bool CallControlManagerImpl::startP2PMode(const std::string& user) { setConnectionState(ConnectionStatusEnum::eRegistering); CSFLogInfoS(logTag, "startP2PMode(" << user << " )"); if(phone != NULL) { setConnectionState(ConnectionStatusEnum::eReady); CSFLogError(logTag, "startP2PMode() failed - already started in p2p mode!"); return false; } softPhone = CC_SIPCCServicePtr(new CC_SIPCCService()); phone = softPhone; phone->init(user, "", "127.0.0.1", "sipdevice"); softPhone->setLoggingMask(sipccLoggingMask); phone->addCCObserver(this); phone->setP2PMode(true); bool bStarted = phone->startService(); if (!bStarted) { setConnectionState(ConnectionStatusEnum::eFailed); } else { setConnectionState(ConnectionStatusEnum::eReady); } return bStarted; }
bool CallControlManagerImpl::registerUser( const std::string& deviceName, const std::string& user, const std::string& password, const std::string& domain ) { setConnectionState(ConnectionStatusEnum::eRegistering); CSFLogInfoS(logTag, "registerUser(" << user << ", " << domain << " )"); if(phone != NULL) { setConnectionState(ConnectionStatusEnum::eReady); CSFLogError(logTag, "registerUser() failed - already connected!"); return false; } softPhone = CC_SIPCCServicePtr(new CC_SIPCCService()); phone = softPhone; phone->init(user, password, domain, deviceName); softPhone->setLoggingMask(sipccLoggingMask); phone->addCCObserver(this); phone->setP2PMode(false); bool bStarted = phone->startService(); if (!bStarted) { setConnectionState(ConnectionStatusEnum::eFailed); } else { setConnectionState(ConnectionStatusEnum::eReady); } return bStarted; }
bool CallControlManagerImpl::startSDPMode() { CSFLogInfo(logTag, "startSDPMode"); if(phone != nullptr) { CSFLogError(logTag, "%s failed - already started in SDP mode!",__FUNCTION__); return false; } softPhone = CC_SIPCCServicePtr(new CC_SIPCCService()); phone = softPhone; phone->init("JSEP", "", "127.0.0.1", "sipdevice"); softPhone->setLoggingMask(sipccLoggingMask); phone->addCCObserver(this); phone->setSDPMode(true); return phone->startService(); }
bool CallControlManagerImpl::registerUser( const std::string& deviceName, const std::string& user, const std::string& password, const std::string& domain ) { setConnectionState(ConnectionStatusEnum::eRegistering); CSFLogInfoS(logTag, "registerUser(" << user << ", " << domain << " )"); if(phone != NULL) { setConnectionState(ConnectionStatusEnum::eReady); CSFLogErrorS(logTag, "registerUser() failed - already connected!"); return false; } // Check preconditions. if(localIpAddress.empty() || localIpAddress == "127.0.0.1") { setConnectionState(ConnectionStatusEnum::eFailed); CSFLogErrorS(logTag, "registerUser() failed - No local IP address set!"); return false; } softPhone = CC_SIPCCServicePtr(new CC_SIPCCService()); phone = softPhone; phone->init(user, password, domain, deviceName); softPhone->setLoggingMask(sipccLoggingMask); softPhone->setLocalAddressAndGateway(localIpAddress, defaultGW); phone->addCCObserver(this); bool bStarted = phone->startService(); if (!bStarted) { setConnectionState(ConnectionStatusEnum::eFailed); } else { setConnectionState(ConnectionStatusEnum::eReady); } return bStarted; }