[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
Mon Aug 30 06:59:46 CDT 2010


branch "master" has been updated
       via  5d497088cfdc89c808f234917bbcc9815fb247d4 (commit)
       via  88cbd3399544c0f3f2801ac5a340276cc6da23c4 (commit)
      from  0b6fc078a74a8cdc36ce3be557f1a088352afd4d (commit)

Summary of changes:
 src/PJSipSessionModule.cpp |   21 ++++++++-------------
 src/SipEndpoint.cpp        |    9 +++++++++
 2 files changed, 17 insertions(+), 13 deletions(-)


- Log -----------------------------------------------------------------
commit 5d497088cfdc89c808f234917bbcc9815fb247d4
Author: Joshua Colp <jcolp at digium.com>
Date:   Mon Aug 30 09:12:02 2010 -0300

    Move handling of session terminating messages to function that handles session termination, and also only allow a single session ending call to occur.

diff --git a/src/PJSipSessionModule.cpp b/src/PJSipSessionModule.cpp
index 00d4694..be5e979 100644
--- a/src/PJSipSessionModule.cpp
+++ b/src/PJSipSessionModule.cpp
@@ -259,13 +259,6 @@ static void handle_invite_response(pjsip_inv_session *inv, pjsip_rx_data *rdata,
 		   (*endpoint)->getSignalCallback()->connected((*endpoint)->getSessionEndpoint()->id);
 		}
 	}
-	else if (respCode >= 400)
-	{
-		//For now treat all failures the same. Call the
-		//caller's signalcallback's terminated()
-		std::cout << "[DEBUG] Got response " << respCode << "on outgoing INVITE" << std::endl;
-		(*endpoint)->getSignalCallback()->busy((*endpoint)->getSessionEndpoint()->id);
-	}
 }
 
 static pj_bool_t sessionOnReceiveResponse(pjsip_rx_data *rdata)
@@ -332,6 +325,11 @@ static void invOnStateChanged(pjsip_inv_session *inv, pjsip_event *event)
       SipEndpointPtr *endpoint = (SipEndpointPtr*)inv->dlg->mod_data[pjsip_ua_instance()->id];
       if ((*endpoint)->getSignalCallback() != 0)
       {
+	 /* Translate the reason for our disconnection into suitable granular calls */
+	 if (inv->cause == 486)
+	 {
+	    (*endpoint)->getSignalCallback()->busy((*endpoint)->getSessionEndpoint()->id);
+	 }
 	 Hydra::Session::V1::ResponseCodePtr response = new Hydra::Session::V1::ResponseCode();
 	 response->isdnCode = 42;
 	 (*endpoint)->getSignalCallback()->terminated((*endpoint)->getSessionEndpoint()->id, response);
diff --git a/src/SipEndpoint.cpp b/src/SipEndpoint.cpp
index 7b03048..9aca790 100644
--- a/src/SipEndpoint.cpp
+++ b/src/SipEndpoint.cpp
@@ -78,6 +78,11 @@ public:
 	}
 	void terminate(const Core::Endpoint::V1::EndpointIdPtr&, const Ice::Current&)
 	{
+	   if (mEndpoint->getSignalCallback() == 0)
+	   {
+	      return;
+	   }
+
 	   pjsip_tx_data *packet;
 
 	   mEndpoint->setSignalCallback(0);
@@ -130,6 +135,8 @@ public:
 	   {
 	      pjsip_inv_send_msg(mEndpoint->getInviteSession(), packet);
 	   }
+
+	   mEndpoint->setSignalCallback(0);
 	}
 	void congestion(const Core::Endpoint::V1::EndpointIdPtr& ep, const Hydra::Session::V1::ResponseCodePtr& response, const Ice::Current&)
 	{
@@ -140,6 +147,8 @@ public:
 	   {
 	      pjsip_inv_send_msg(mEndpoint->getInviteSession(), packet);
 	   }
+
+	   mEndpoint->setSignalCallback(0);
 	}
 	void hold(const Core::Endpoint::V1::EndpointIdPtr& ep, const Ice::Current&)
 	{

commit 88cbd3399544c0f3f2801ac5a340276cc6da23c4
Author: Joshua Colp <jcolp at digium.com>
Date:   Mon Aug 30 08:41:51 2010 -0300

    Do some cleanup and add in call to progress().

diff --git a/src/PJSipSessionModule.cpp b/src/PJSipSessionModule.cpp
index 9faa465..00d4694 100644
--- a/src/PJSipSessionModule.cpp
+++ b/src/PJSipSessionModule.cpp
@@ -241,21 +241,18 @@ static void handle_invite_response(pjsip_inv_session *inv, pjsip_rx_data *rdata,
 	}
 	else if (respCode == 180)
 	{
-		//We'll need to get the caller endpoint and call his
-		//signalcallback's ring()
 		std::cout << "[DEBUG] Got 180 response" << std::endl;
 		(*endpoint)->getSignalCallback()->ring((*endpoint)->getSessionEndpoint()->id);
 	}
 	else if (respCode == 183)
 	{
-		//We'll need to get the caller endpoint and call his
-		//signallcallback's progress()
 		std::cout << "[DEBUG] Got 183 response" << std::endl;
+		Hydra::Session::V1::ResponseCodePtr response = new Hydra::Session::V1::ResponseCode();
+		response->isdnCode = 42;
+		(*endpoint)->getSignalCallback()->progress((*endpoint)->getSessionEndpoint()->id, response);
 	}
 	else if (respCode == 200)
 	{
-		//We'll need to get the caller endpoint and call his
-		//signalcallback's connected()
 		std::cout << "[DEBUG] Got 200 response" << std::endl;
 		if (inv->state != PJSIP_INV_STATE_DISCONNECTED)
 		{

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


-- 
asterisk-scf/integration/sip.git



More information about the asterisk-scf-commits mailing list