source: qutecom-coip/libs/coipmanager/plugins/callsessionmanager/sipwrapper/iaxclient/IAXClientCallSessionManager.cpp

tip
Last change on this file was 125:d648f4cb122f, checked in by laurent, 3 years ago

wengo => qutecom

File size: 2.3 KB
Line 
1/*
2 * QuteCom, a voice over Internet phone
3 * Copyright (C) 2010 Mbdsys
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18 */
19
20#include "IAXClientCallSessionManager.h"
21
22#include "IAXClientCallSession.h"
23
24#include <IAXClientFactory.h>
25#include <sipwrapper/SipWrapper.h>
26
27#include <util/Logger.h>
28
29IAXClientCallSessionManager::IAXClientCallSessionManager(CoIpManager & coIpManager)
30        : ICallSessionManagerPlugin(coIpManager) {
31
32        _supportedAccountType.push_back(EnumAccountType::AccountTypeIAX);
33
34        //Get IAXClientWrapper instance
35        IAXClientFactory iaxFactory;
36        _iaxClientWrapper = iaxFactory.createSipWrapper();
37
38        //Bind to get incoming call event
39        _iaxClientWrapper->phoneCallStateChangedEvent.connect(this,
40                boost::bind(&IAXClientCallSessionManager::phoneCallStateChangedEventHandler, this, _1, _2, _3, _4), NULL);
41}
42
43IAXClientCallSessionManager::~IAXClientCallSessionManager() {
44}
45
46ICallSessionPlugin * IAXClientCallSessionManager::createICallSessionPlugin() {
47        return new IAXClientCallSession(_coIpManager, _iaxClientWrapper);
48}
49
50void IAXClientCallSessionManager::phoneCallStateChangedEventHandler(SipWrapper * sender, int callId,
51        EnumPhoneCallState::PhoneCallState state, const std::string & from) {
52
53        if (sender != _iaxClientWrapper) {
54                LOG_ERROR("phoneCallStateChangedEvent not coming from our wrapper");
55                return;
56        }
57
58        if (state != EnumPhoneCallState::PhoneCallStateIncoming) {
59                LOG_ERROR("this is not an incoming phone call");
60                return;
61        }
62
63        LOG_DEBUG("incoming phone call, create a CallSession");
64
65        IAXClientCallSession * session = new IAXClientCallSession(_coIpManager, _iaxClientWrapper, callId, state, from);
66        newICallSessionPluginCreatedEvent(this, session);
67}
Note: See TracBrowser for help on using the repository browser.