📄 sipdialogvoipclient.cxx
字号:
(bool (StateMachine<SipSMCommand,string>::*)(const SipSMCommand&)) &SipDialogVoipClient::a2010_callingauth_callingauth_1xx, s_callingauth, s_callingauth); new StateTransition<SipSMCommand,string>(this, "transition_callingauth_incall_2xx", (bool (StateMachine<SipSMCommand,string>::*)(const SipSMCommand&)) &SipDialogVoipClient::a2011_callingauth_incall_2xx, s_callingauth, s_incall); new StateTransition<SipSMCommand,string>(this, "transition_callingauth_termwait_2xx", (bool (StateMachine<SipSMCommand,string>::*)(const SipSMCommand&)) &SipDialogVoipClient::a2012_calling_termwait_2xx, s_callingauth, s_termwait); new StateTransition<SipSMCommand,string>(this, "transition_callingauth_termwait_resp36", (bool (StateMachine<SipSMCommand,string>::*)(const SipSMCommand&)) &SipDialogVoipClient::a2007_callingnoauth_termwait_36, s_callingauth, s_termwait); new StateTransition<SipSMCommand,string>(this, "transition_callingnoauth_termwait_transporterror", (bool (StateMachine<SipSMCommand,string>::*)(const SipSMCommand&)) &SipDialogVoipClient::a2013_callingnoauth_termwait_transporterror, s_callingnoauth, s_termwait); new StateTransition<SipSMCommand,string>(this, "transition_callingauth_termwait_cancel", (bool (StateMachine<SipSMCommand,string>::*)(const SipSMCommand&)) &SipDialogVoipClient::a2014_callingauth_termwait_cancel, s_callingauth, s_termwait); setCurrentState(s_start);}#ifdef IPSEC_SUPPORTSipDialogVoipClient::SipDialogVoipClient(MRef<SipStack*> stack, MRef<SipDialogConfig*> callconfig, MRef<SipSoftPhoneConfiguration*> pconf, MRef<Session *> mediaSession, string cid, MRef<MsipIpsecAPI *> ipsecSession) : SipDialogVoip(stack,callconfig,pconf,mediaSession,cid,ipsecSession), ipsecSession(ipsecSession)#elseSipDialogVoipClient::SipDialogVoipClient(MRef<SipStack*> stack, MRef<SipDialogConfig*> callconfig, MRef<SipSoftPhoneConfiguration*> pconf, MRef<Session *> mediaSession, string cid) : SipDialogVoip(stack, callconfig, pconf, mediaSession, cid) #endif{ setUpStateMachine();}SipDialogVoipClient::~SipDialogVoipClient(){ }void SipDialogVoipClient::sendInvite(const string &branch){ // mdbg << "ERROR: SipDialogVoipClient::sendInvite() UNIMPLEMENTED"<< end; MRef<SipRequest*> inv; string keyAgreementMessage; //inv= MRef<SipInvite*>( inv = SipRequest::createSipMessageInvite( branch, dialogState.callId, dialogState.remoteUri, getDialogConfig()->inherited->sipIdentity->sipDomain, //TODO: Change API - not sure if proxy or domain getDialogConfig()->inherited->sipIdentity->getSipProxy()->sipProxyPort, getDialogConfig()->inherited->externalContactIP, getDialogConfig()->inherited->getLocalSipPort(phoneconf->useSTUN), getDialogConfig()->inherited->sipIdentity->getSipUri(), dialogState.seqNo, getDialogConfig()->inherited->getTransport(), sipStack ) ; /* Get the session description from the Session */ //There might be so that there are no SDP. Check! MRef<SdpPacket *> sdp; if (mediaSession){#ifdef ENABLE_TS ts.save("getSdpOffer");#endif sdp = mediaSession->getSdpOffer();#ifdef ENABLE_TS ts.save("getSdpOffer");#endif if( !sdp ){ // FIXME: this most probably means that the // creation of the MIKEY message failed, it // should not happen merr << "Sdp was NULL in sendInvite" << end; return; } } /* Add the latter to the INVITE message */ // If it exists //-------------------------------------------------------------------------------------------------------------//#ifdef IPSEC_SUPPORT // Create a MIKEY message for IPSEC if stated in the config file. MRef<SipMimeContent*> mikey; if (getIpsecSession()->required()){ ts.save("getMikeyIpsecOffer"); mikey = ipsecSession->getMikeyIpsecOffer(); ts.save("getMikeyIpsecOffer"); if (!mikey){ merr << "Mikey was NULL" << end; merr << "Still some errors with IPSEC" << end; //return; } } else mikey = NULL; MRef<SipMimeContent*> multi; if (mikey && mediaSession){ multi = new SipMimeContent("multipart/mixed"); multi->addPart(*mikey); multi->addPart(*sdp); inv->setContent( *multi); } if (mikey && !mediaSession) inv->setContent( *mikey); if (!mikey && mediaSession) inv->setContent( *sdp );#else inv->setContent( *sdp );#endif//-------------------------------------------------------------------------------------------------------------// inv->getHeaderValueFrom()->setParameter("tag",dialogState.localTag );// mdbg << "SipDialogVoipClient::sendInvite(): sending INVITE to transaction"<<end;// ts.save( INVITE_END ); MRef<SipMessage*> pktr(*inv); SipSMCommand scmd( pktr, SipSMCommand::dialog_layer, SipSMCommand::transaction_layer ); dispatcher->enqueueCommand(scmd, HIGH_PRIO_QUEUE/*, PRIO_LAST_IN_QUEUE*/); setLastInvite(inv);}void SipDialogVoipClient::sendPrack(MRef<SipResponse*> rel100resp){ MRef<SipRequest*> prack = SipRequest::createSipMessageAck( "", *rel100resp, dialogState.remoteUri, true ) ; SipSMCommand scmd( *prack, SipSMCommand::dialog_layer, SipSMCommand::transaction_layer ); dispatcher->enqueueCommand(scmd, HIGH_PRIO_QUEUE);}void SipDialogVoipClient::sendAuthInvite(const string &branch){ // merr << "ERROR: SipDialogVoipClient::sendAuthInvite() UNIMPLEMENTED"<< end; MRef<SipRequest*> inv; string keyAgreementMessage; //merr << "SipDialogVoip::sendAuthInv : dialogstate.remoteUri=" << dialogState.remoteUri << end; inv = SipRequest::createSipMessageInvite( branch, dialogState.callId, dialogState.remoteUri, getDialogConfig()->inherited->sipIdentity->sipDomain, getDialogConfig()->inherited->sipIdentity->getSipProxy()->sipProxyPort, getDialogConfig()->inherited->externalContactIP, getDialogConfig()->inherited->getLocalSipPort(phoneconf->useSTUN), getDialogConfig()->inherited->sipIdentity->getSipUri(), dialogState.seqNo, getDialogConfig()->inherited->sipIdentity->getSipProxy()->sipProxyUsername, nonce, realm, getDialogConfig()->inherited->sipIdentity->getSipProxy()->sipProxyPassword, getDialogConfig()->inherited->getTransport(), sipStack); inv->getHeaderValueFrom()->setParameter("tag",dialogState.localTag); //There might be so that there are no SDP. Check! MRef<SdpPacket *> sdp; if (mediaSession){#ifdef ENABLE_TS ts.save("getSdpOffer");#endif sdp = mediaSession->getSdpOffer();#ifdef ENABLE_TS ts.save("getSdpOffer");#endif if( !sdp ){ // FIXME: this most probably means that the // creation of the MIKEY message failed, it // should not happen merr << "Sdp was NULL in sendAuthInvite" << end; return; } } /* Add the latter to the INVITE message */ // If it exists //-------------------------------------------------------------------------------------------------------------//#ifdef IPSEC_SUPPORT // Create a MIKEY message for IPSEC if stated in the config file. MRef<SipMimeContent*> mikey; if (getIpsecSession()->required()){ ts.save("getMikeyIpsecOffer"); mikey = ipsecSession->getMikeyIpsecOffer(); ts.save("getMikeyIpsecOffer"); if (!mikey){ merr << "Mikey was NULL" << end; merr << "Still some errors with IPSEC" << end; //return; } } else mikey = NULL; MRef<SipMimeContent*> multi; if (mikey && mediaSession){ multi = new SipMimeContent("multipart/mixed"); multi->addPart(*mikey); multi->addPart(*sdp); inv->setContent( *multi); } if (mikey && !mediaSession) inv->setContent( *mikey); if (!mikey && mediaSession) inv->setContent( *sdp );#else inv->setContent( *sdp );#endif//-------------------------------------------------------------------------------------------------------------// // /* Get the session description from the Session */ // MRef<SdpPacket *> sdp = mediaSession->getSdpOffer(); // // /* Add the latter to the INVITE message */ // inv->setContent( *sdp ); MRef<SipMessage*> pref(*inv); SipSMCommand cmd(pref, SipSMCommand::dialog_layer, SipSMCommand::transaction_layer); dispatcher->enqueueCommand(cmd, HIGH_PRIO_QUEUE/*, PRIO_LAST_IN_QUEUE*/); setLastInvite(inv);}void SipDialogVoipClient::sendInviteOk(const string &branch){ MRef<SipResponse*> ok= new SipResponse(branch, 200,"OK", MRef<SipMessage*>(*getLastInvite())); ok->getHeaderValueTo()->setParameter("tag",dialogState.localTag); MRef<SipHeaderValue *> contact = new SipHeaderValueContact( getDialogConfig()->inherited->sipIdentity->getSipUri(), getDialogConfig()->inherited->externalContactIP, getDialogConfig()->inherited->getLocalSipPort(phoneconf->useSTUN), "", getDialogConfig()->inherited->getTransport(), -1); //set expires to -1, we do not use it (only in register) ok->addHeader( new SipHeader(*contact) ); //There might be so that there are no SDP. Check! MRef<SdpPacket *> sdp; if (mediaSession){#ifdef ENABLE_TS ts.save("getSdpAnswer");#endif sdp = mediaSession->getSdpAnswer();#ifdef ENABLE_TS ts.save("getSdpAnswer");#endif if( !sdp ){ // FIXME: this most probably means that the // creation of the MIKEY message failed, it // should not happen merr << "Sdp was NULL in sendInviteOk" << end; return; } } /* Add the latter to the INVITE message */ // If it exists //-------------------------------------------------------------------------------------------------------------//#ifdef IPSEC_SUPPORT // Create a MIKEY message for IPSEC if stated in the config file. MRef<SipMimeContent*> mikey; if (getIpsecSession()->required()){ ts.save("getMikeyIpsecAnswer"); mikey = ipsecSession->getMikeyIpsecAnswer(); ts.save("getMikeyIpsecAnswer"); if (!mikey){ merr << "Mikey was NULL in sendInviteOk" << end; merr << "Still some errors with IPSEC" << end; //return; } } else mikey = NULL; MRef<SipMimeContent*> multi; if (mikey && mediaSession){ multi = new SipMimeContent("multipart/mixed"); multi->addPart(*mikey); multi->addPart(*sdp); ok->setContent( *multi); } if (mikey && !mediaSession) ok->setContent( *mikey); if (!mikey && mediaSession) ok->setContent( *sdp );#else ok->setContent( *sdp );#endif//-------------------------------------------------------------------------------------------------------------//// /* Get the SDP Answer from the MediaSession */// MRef<SdpPacket *> sdpAnswer = mediaSession->getSdpAnswer();//// if( sdpAnswer ){// ok->setContent( *sdpAnswer );// }// /* if sdp is NULL, the offer was refused, send 606 */// // FIXME// else return; MRef<SipMessage*> pref(*ok); SipSMCommand cmd( pref, SipSMCommand::dialog_layer, SipSMCommand::transaction_layer); dispatcher->enqueueCommand(cmd, HIGH_PRIO_QUEUE/*, PRIO_LAST_IN_QUEUE*/);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -