[asterisk-scf-commits] asterisk-scf/integration/sip.git branch "master" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Fri Sep 24 13:15:11 CDT 2010


branch "master" has been updated
       via  930d1be64f35173f51c39dac97b0b093da85e7cd (commit)
      from  6a9f1180087a2e81a455faf0fd06b9524d9fe10e (commit)

Summary of changes:
 src/PJSipSessionModule.cpp |   24 ++++++++++++------------
 src/SipSession.cpp         |    2 +-
 2 files changed, 13 insertions(+), 13 deletions(-)


- Log -----------------------------------------------------------------
commit 930d1be64f35173f51c39dac97b0b093da85e7cd
Author: Joshua Colp <jcolp at digium.com>
Date:   Fri Sep 24 15:18:20 2010 -0300

    Don't squash internal pjsip stuff by using the UA's module ID to store stuff, instead use our own.

diff --git a/src/PJSipSessionModule.cpp b/src/PJSipSessionModule.cpp
index c6a78a0..40b85bd 100644
--- a/src/PJSipSessionModule.cpp
+++ b/src/PJSipSessionModule.cpp
@@ -290,13 +290,13 @@ static void handle_new_invite(pjsip_rx_data *rdata)
 	//handle the request. For now, just plunge forward.
 	
 	pjsip_dialog *dlg;
-	pjsip_module *module = pjsip_ua_instance();
+	pjsip_module *module = SipChannelServiceDataModel::getInstance().getPJSipManager()->getSessionModule();
 
 	//XXX The NULL parameter should be replaced with
 	//An appropriate Contact header. Leaving it NULL makes
 	//PJSIP create the contact header for responses based
 	//on the To header of the incoming Invite.
-	if (pjsip_dlg_create_uas(module, rdata, NULL, &dlg) != PJ_SUCCESS)
+	if (pjsip_dlg_create_uas(pjsip_ua_instance(), rdata, NULL, &dlg) != PJ_SUCCESS)
 	{
 		std::cerr << "[WARNING] Unable to create UAS dialog on incoming INVITE" << std::endl;
 		return;
@@ -422,7 +422,7 @@ static pj_bool_t sessionOnReceiveRequest(pjsip_rx_data *rdata)
 static void handle_invite_response(pjsip_inv_session *inv, pjsip_rx_data *rdata, pjsip_dialog *dlg)
 {
 	int respCode = rdata->msg_info.msg->line.status.code;
-	PJSipSessionModInfo *session_mod_info = (PJSipSessionModInfo*)inv->mod_data[pjsip_ua_instance()->id];
+	PJSipSessionModInfo *session_mod_info = (PJSipSessionModInfo*)inv->mod_data[SipChannelServiceDataModel::getInstance().getPJSipManager()->getSessionModule()->id];
 	SipSessionPtr session = session_mod_info->getSessionPtr();
 	//Commented because they are currently unused. They
 	//will be once the individual cases are mapped out.
@@ -491,7 +491,7 @@ static void invOnStateChanged(pjsip_inv_session *inv, pjsip_event *event)
    }
    if (inv->state == PJSIP_INV_STATE_DISCONNECTED)
    {
-      PJSipSessionModInfo *session_mod_info = (PJSipSessionModInfo*)inv->mod_data[pjsip_ua_instance()->id];
+      PJSipSessionModInfo *session_mod_info = (PJSipSessionModInfo*)inv->mod_data[SipChannelServiceDataModel::getInstance().getPJSipManager()->getSessionModule()->id];
       if (session_mod_info == 0)
       {
 	 return;
@@ -520,13 +520,13 @@ static void invOnStateChanged(pjsip_inv_session *inv, pjsip_event *event)
       }
 	  session_mod_info->mNeedsRemoval = true;
 	  pjsip_dialog *dlg = inv->dlg;
-	  PJSipDialogModInfo *dlg_mod_info = (PJSipDialogModInfo*) dlg->mod_data[pjsip_ua_instance()->id];
+	  PJSipDialogModInfo *dlg_mod_info = (PJSipDialogModInfo*) dlg->mod_data[SipChannelServiceDataModel::getInstance().getPJSipManager()->getSessionModule()->id];
 	  dlg_mod_info->mNeedsRemoval = true;
 	  replicateState(dlg_mod_info, NULL, session_mod_info);
       delete session_mod_info;
 	  delete dlg_mod_info;
-	  dlg->mod_data[pjsip_ua_instance()->id] = 0;
-      inv->mod_data[pjsip_ua_instance()->id] = 0;
+	  dlg->mod_data[SipChannelServiceDataModel::getInstance().getPJSipManager()->getSessionModule()->id] = 0;
+	  inv->mod_data[SipChannelServiceDataModel::getInstance().getPJSipManager()->getSessionModule()->id] = 0;
    }
    if (event->type == PJSIP_EVENT_RX_MSG && inv->state == PJSIP_INV_STATE_CONFIRMED)
    {
@@ -548,9 +548,9 @@ static void invOnStateChanged(pjsip_inv_session *inv, pjsip_event *event)
 	  //information there.
 	  PJSipDialogModInfo *dlg_mod_info = new PJSipDialogModInfo(inv->dlg);
 	  PJSipTransactionModInfo *tsx_mod_info = new PJSipTransactionModInfo(inv->invite_tsx);
-	  PJSipSessionModInfo *session_mod_info = static_cast<PJSipSessionModInfo *>(inv->mod_data[pjsip_ua_instance()->id]);
-	  inv->invite_tsx->mod_data[pjsip_ua_instance()->id] = (void *) tsx_mod_info;
-	  inv->dlg->mod_data[pjsip_ua_instance()->id] = (void *) dlg_mod_info;
+	  PJSipSessionModInfo *session_mod_info = static_cast<PJSipSessionModInfo *>(inv->mod_data[SipChannelServiceDataModel::getInstance().getPJSipManager()->getSessionModule()->id]);
+	  inv->invite_tsx->mod_data[SipChannelServiceDataModel::getInstance().getPJSipManager()->getSessionModule()->id] = (void *) tsx_mod_info;
+	  inv->dlg->mod_data[SipChannelServiceDataModel::getInstance().getPJSipManager()->getSessionModule()->id] = (void *) dlg_mod_info;
 	  replicateState(dlg_mod_info, tsx_mod_info, session_mod_info);
    }
 }
@@ -579,7 +579,7 @@ static void invOnTransactionStateChanged(pjsip_inv_session *inv, pjsip_transacti
 	//proper state replication in the invOnStateChanged function. This can be
 	//done simply by calling this function from there.
 
-	pjsip_module *module = pjsip_ua_instance();
+   pjsip_module *module = SipChannelServiceDataModel::getInstance().getPJSipManager()->getSessionModule();
 	PJSipTransactionModInfo *tsx_mod_info = static_cast<PJSipTransactionModInfo *> (tsx->mod_data[module->id]);
 	if (tsx->state != PJSIP_TSX_STATE_DESTROYED)
 	{
@@ -633,7 +633,7 @@ static void invOnMediaUpdate(pjsip_inv_session *inv, pj_status_t status)
 
    const pjmedia_sdp_conn *remote_conn = remote_sdp->media[0]->conn ? remote_sdp->media[0]->conn : remote_sdp->conn;
 
-   PJSipSessionModInfo *session_mod_info = (PJSipSessionModInfo*)inv->mod_data[pjsip_ua_instance()->id];
+   PJSipSessionModInfo *session_mod_info = (PJSipSessionModInfo*)inv->mod_data[SipChannelServiceDataModel::getInstance().getPJSipManager()->getSessionModule()->id];
    SipSessionPtr session = session_mod_info->getSessionPtr();
    session->setRemoteDetails(pj_strbuf(&remote_conn->addr), remote_sdp->media[0]->desc.port);
 
diff --git a/src/SipSession.cpp b/src/SipSession.cpp
index 3ce7037..a19dc92 100644
--- a/src/SipSession.cpp
+++ b/src/SipSession.cpp
@@ -352,7 +352,7 @@ void SipSession::start(const Ice::Current&)
    PJSipSessionModInfo *session_mod_info = new PJSipSessionModInfo(inviteSession);
    SipSessionPtr session = new SipSession(*this);
    session_mod_info->setSessionPtr(session);
-   inviteSession->mod_data[pjsip_ua_instance()->id] = (void*)session_mod_info;
+   inviteSession->mod_data[SipChannelServiceDataModel::getInstance().getPJSipManager()->getSessionModule()->id] = (void*)session_mod_info;
 
    // Create the actual INVITE packet
    pjsip_tx_data *packet;

-----------------------------------------------------------------------


-- 
asterisk-scf/integration/sip.git



More information about the asterisk-scf-commits mailing list