⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sipdialogconfvoip.cxx

📁 MiniSip Client with DomainKeys Authentication, Sip, Audio communications, Echo Cancel
💻 CXX
📖 第 1 页 / 共 5 页
字号:
{	confId=confid;	numConnected= conflist->size();	type="join";		//cerr << "CONFDIALOG: Creating SipDialogConfVoip's receivedList" << endl;		//this is the list you get/send as advice of who is in the conference. It will go to the GUI to be displayed to	//the user to make a decision to join or not.	//adviceList = new minilist<ConfMember>(*list);	adviceList=conflist;		//CommandString cmdstr("", "myuri", getDialogConfig()->inherited.sipIdentity->getSipUri());								//getDialogContainer()->getCallback()->sipcb_handleCommand(cmdstr);		//getDialogContainer()->getCallback()->sipcb_handleConfCommand( cmdstr );	/*	for(int t=0;t<10;t++)	{		if(t<=numConnected)			connectedList[t]=list[t];		else			connectedList[t]="";	}	*/		//cerr << "CONFDIALOG: "+ ((*list)[0]).uri << endl;	//cerr << "CONFDIALOG: "+ ((*list)[1]).uri << endl;	//cerr << "CONFDIALOG: "+itoa(numConnected)<< endl;		if (cid=="")		dialogState.callId = itoa(rand())+"@"+getDialogConfig()->inherited->externalContactIP;	else		dialogState.callId = cid;		dialogState.localTag = itoa(rand());		/* We will fill that later, once we know if that succeeded */	logEntry = NULL;	setUpStateMachine();}#ifdef IPSEC_SUPPORTSipDialogConfVoip::SipDialogConfVoip(MRef<ConfMessageRouter*> confCb, MRef<SipStack*> stack, MRef<SipDialogConfig*> callconfig, MRef<SipSoftPhoneConfiguration*> pconf, MRef<Session *> mediaSession, string confid, string cid, MRef<MsipIpsecAPI *> ipsecSession) :                 SipDialog(stack,callconfig),		confCallback(confCb),                lastInvite(NULL), 		phoneconf(pconf),		mediaSession(mediaSession), ipsecSession(ipsecSession)#elseSipDialogConfVoip::SipDialogConfVoip(MRef<ConfMessageRouter*> confCb, MRef<SipStack*> stack, MRef<SipDialogConfig*> callconfig, MRef<SipSoftPhoneConfiguration*> pconf, MRef<Session *> mediaSession, string confid, string cid) :                 SipDialog(stack,callconfig),		confCallback(confCb),                lastInvite(NULL), 		phoneconf(pconf),		mediaSession(mediaSession)#endif{	confId=confid;	//cerr<<"SDCVididididididididididdididi "+confId<<endl;	//cerr << "CONFDIALOG: received"<< endl;	type="connect";	if (cid=="")		dialogState.callId = itoa(rand())+"@"+getDialogConfig()->inherited->externalContactIP;	else		dialogState.callId = cid;		dialogState.localTag = itoa(rand());		/* We will fill that later, once we know if that succeeded */	logEntry = NULL;	setUpStateMachine();}SipDialogConfVoip::~SipDialogConfVoip(){	}/*void SipDialogVoip::handleSdp(MRef<SdpPacket*> sdp){}*/void SipDialogConfVoip::sendInvite(const string &branch){	//	mdbg << "ERROR: SipDialogVoip::sendInvite() UNIMPLEMENTED"<< end;		MRef<SipRequest*> inv;	string keyAgreementMessage;	//inv= MRef<SipInvite*>(new 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 );	if(type=="join"){		//cerr << "SDCV: modifyjoininvite"<< endl;		modifyConfJoinInvite(inv);}	else		modifyConfConnectInvite(inv);	//if(inv->is_ConfJoin())		//cerr << "SDCV: confjoin was set!!"<< endl;//	mdbg << "SipDialogVoip::sendInvite(): sending INVITE to transaction"<<end;//	ts.save( INVITE_END );        MRef<SipMessage*> pktr(*inv);        SipSMCommand scmd(                pktr,                 SipSMCommand::dialog_layer,                 SipSMCommand::transaction_layer                );	//	scmd.setDispatched(true); //What was I thinking about here?? --EE	//	handleCommand(scmd);	//cerr<<"SDCV: "+scmd.getCommandString().getString()<<endl;	dispatcher->enqueueCommand(scmd, HIGH_PRIO_QUEUE/*, PRIO_LAST_IN_QUEUE*/);	setLastInvite(inv);	//inv->checkAcceptContact();}void SipDialogConfVoip::sendAuthInvite(const string &branch){	//	merr << "ERROR: SipDialogVoip::sendAuthInvite() UNIMPLEMENTED"<< end;//	string call_id = getDialogConfig().callId;	//SipInvite * inv;	MRef<SipRequest*> inv;	string keyAgreementMessage;	//inv= new SipInvite(	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);	if(type=="join")		modifyConfJoinInvite(inv);	else		modifyConfConnectInvite(inv);	//      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//-------------------------------------------------------------------------------------------------------------////	/* 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);}//#ifdef NEVERDEFINED_ERSADFSvoid SipDialogConfVoip::sendAck(const string &branch){/*	//	mdbg << "ERROR: SipDialogVoip::sendAck() UNIMPLEMENTED" << end;		massert( !lastResponse.isNull());		SipAck *ack = new SipAck(			branch, 			*lastResponse,			dialogState.remoteUri,			//getDialogConfig().inherited.sipIdentity->getSipProxy()->sipProxyIpAddr->getString());			getDialogConfig()->inherited.sipIdentity->sipDomain);	//TODO:	//	ack.add_header( new SipHeaderRoute(getDialog()->getRouteSet() ) );//	mdbg << "SipDialogVoip:sendAck(): sending ACK directly to remote" << end;	//	if(socket == NULL){	// No StreamSocket, create one or use UDP//	Socket *sock=NULL;	MRef<SdpPacket *> sdp;		ack->setContent( *sdp );//-------------------------------------------------------------------------------------------------------------//			modifyConfAck(ack);	MRef<SipMessage*> pref(*ack);        SipSMCommand cmd( pref, SipSMCommand::dialog_layer, SipSMCommand::transaction_layer);//	handleCommand(cmd);	dispatcher->enqueueCommand(cmd, HIGH_PRIO_QUEUE, PRIO_LAST_IN_QUEUE);			//	}*/	/*	if(dynamic_cast<StreamSocket *>(socket) != NULL){	// A StreamSocket exists, try to use it	mdbg << "Sending packet using existing StreamSocket"<<end;	getDialog()->getDialogConfig().sipTransport->sendMessage(pack,(StreamSocket *)socket);	return;	}	 */	 	//MRef<SipAck *> ack = new SipAck(	MRef<SipRequest*> ack = SipRequest::createSipMessageAck(		branch, 		*lastResponse,		dialogState.remoteUri		);//      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("getMikeyIpsecAnswer");		mikey = ipsecSession->getMikeyIpsecAnswer();		ts.save("getMikeyIpsecAnswer");		if (!mikey){			merr << "Mikey was NULL in sendInviteOk" << end;			merr << "Still some errors with IPSEC" << end;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -