[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 Oct 22 11:49:41 CDT 2010


branch "master" has been updated
       via  29418c23644d5ae95447e0c4b61b4c7cb5e2c829 (commit)
      from  34452fb36f2ccbec233a2508694db21aedc2dcb1 (commit)

Summary of changes:
 src/PJSipSessionModule.cpp |   43 +++++++++++++++++++++++++++++++------------
 1 files changed, 31 insertions(+), 12 deletions(-)


- Log -----------------------------------------------------------------
commit 29418c23644d5ae95447e0c4b61b4c7cb5e2c829
Author: Ken Hunt <ken.hunt at digium.com>
Date:   Fri Oct 22 11:48:12 2010 -0500

    Added additional logging to handleRefer().

diff --git a/src/PJSipSessionModule.cpp b/src/PJSipSessionModule.cpp
index a110229..6549ad7 100644
--- a/src/PJSipSessionModule.cpp
+++ b/src/PJSipSessionModule.cpp
@@ -451,6 +451,7 @@ void PJSipSessionModule::handleRefer(pjsip_inv_session *inv, pjsip_rx_data *rdat
    if (!refer_to)
    {
       // Uh... so they didn't tell us where to REFER this to... yeah no
+      lg(Debug) << "handleRefer() sending 400 due to no refer_to. ";
       pjsip_dlg_respond(inv->dlg, rdata, 400, NULL, NULL, NULL);
       return;
    }
@@ -466,6 +467,7 @@ void PJSipSessionModule::handleRefer(pjsip_inv_session *inv, pjsip_rx_data *rdat
    if (!PJSIP_URI_SCHEME_IS_SIP(target_uri) && !PJSIP_URI_SCHEME_IS_SIPS(target_uri))
    {
       // TODO: Place proper response code in here
+      lg(Debug) << "handleRefer() sending 400 due to non-SIP URI. ";
       pjsip_dlg_respond(inv->dlg, rdata, 400, NULL, NULL, NULL);
       return;
    }
@@ -502,6 +504,7 @@ void PJSipSessionModule::handleRefer(pjsip_inv_session *inv, pjsip_rx_data *rdat
 
 	 if (from_tag_pos == std::string::npos || to_tag_pos == std::string::npos)
 	 {
+        lg(Debug) << "handleRefer() sending 400 due to From or To missing. ";
 	    pjsip_dlg_respond(inv->dlg, rdata, 400, NULL, NULL, NULL);
 	    return;
 	 }
@@ -519,6 +522,7 @@ void PJSipSessionModule::handleRefer(pjsip_inv_session *inv, pjsip_rx_data *rdat
 
       if (!other_dlg)
       {
+      lg(Debug) << "handleRefer() sending PJSIP_SC_CALL_TSX_DOES_NOT_EXIST due to no other_dlg. ";
 	 pjsip_dlg_respond(inv->dlg, rdata, PJSIP_SC_CALL_TSX_DOES_NOT_EXIST, NULL, NULL, NULL);
 	 return;
       }
@@ -527,6 +531,7 @@ void PJSipSessionModule::handleRefer(pjsip_inv_session *inv, pjsip_rx_data *rdat
 
       if (!other_inv)
       {
+      lg(Debug) << "handleRefer() sending PJSIP_SC_CALL_TSX_DOES_NOT_EXIST due to no other_inv. ";
 	 pjsip_dlg_respond(inv->dlg, rdata, PJSIP_SC_CALL_TSX_DOES_NOT_EXIST, NULL, NULL, NULL);
 	 pjsip_dlg_dec_lock(other_dlg);
 	 return;
@@ -534,6 +539,8 @@ void PJSipSessionModule::handleRefer(pjsip_inv_session *inv, pjsip_rx_data *rdat
 
       if (other_inv->state >= PJSIP_INV_STATE_DISCONNECTED)
       {
+      lg(Debug) << "handleRefer() sending PJSIP_SC_DECLINE due to state > PJSIP_INV_STATE_DISCONNECTED. ";
+
 	 pjsip_dlg_respond(inv->dlg, rdata, PJSIP_SC_DECLINE, NULL, NULL, NULL);
 	 pjsip_dlg_dec_lock(other_dlg);
 	 return;
@@ -541,6 +548,8 @@ void PJSipSessionModule::handleRefer(pjsip_inv_session *inv, pjsip_rx_data *rdat
 
       if (other_inv->state <= PJSIP_INV_STATE_EARLY && other_inv->role != PJSIP_ROLE_UAC)
       {
+      lg(Debug) << "handleRefer() sending PJSIP_SC_CALL_TSX_DOES_NOT_EXIST due to other_inv->state < PJSIP_INV_STATE_EARLY and role not UAC. ";
+
 	 pjsip_dlg_respond(inv->dlg, rdata, PJSIP_SC_CALL_TSX_DOES_NOT_EXIST, NULL, NULL, NULL);
 	 pjsip_dlg_dec_lock(other_dlg);
 	 return;
@@ -554,14 +563,17 @@ void PJSipSessionModule::handleRefer(pjsip_inv_session *inv, pjsip_rx_data *rdat
 
       try
       {
-	 mSessionRouter->connectBridgedSessions(session->getSessionProxy(), other_session->getSessionProxy());
-	 pjsip_dlg_respond(inv->dlg, rdata, 200, NULL, NULL, NULL);
-	 Ice::Current current;
-	 session->stop(new ResponseCode(16), current);
+      lg(Debug) << "handleRefer() calling router connectBridgedSessions(). " << std::endl;
+	  mSessionRouter->connectBridgedSessions(session->getSessionProxy(), other_session->getSessionProxy());
+ 	  pjsip_dlg_respond(inv->dlg, rdata, 200, NULL, NULL, NULL);
+ 	  Ice::Current current;
+      lg(Debug) << "handleRefer() calling session->stop(). " << std::endl;
+	  session->stop(new ResponseCode(16), current);
       }
-      catch (...)
+      catch (const std::exception& e)
       {
-	 pjsip_dlg_respond(inv->dlg, rdata, 400, NULL, NULL, NULL);
+         lg(Debug) << "handleRefer() sending 400 due to exception:  " << e.what() << std::endl;
+	     pjsip_dlg_respond(inv->dlg, rdata, 400, NULL, NULL, NULL);
       }
       pjsip_dlg_dec_lock(other_dlg);
    }
@@ -574,20 +586,27 @@ void PJSipSessionModule::handleRefer(pjsip_inv_session *inv, pjsip_rx_data *rdat
       {
 	 PJSipSessionModInfo *session_mod_info = (PJSipSessionModInfo*)inv->mod_data[mModule.id];
 	 SipSessionPtr session = session_mod_info->getSessionPtr();
+
+      lg(Debug) << "handleRefer() calling router connectBridgedSessionsWithDestination(). " << std::endl;
 	 mSessionRouter->connectBridgedSessionsWithDestination(session->getSessionProxy(), target);
 	 pjsip_dlg_respond(inv->dlg, rdata, 200, NULL, NULL, NULL);
 	 Ice::Current current;
+
+      lg(Debug) << "handleRefer() calling session->stop(). " << std::endl;
 	 session->stop(new ResponseCode(16), current);
       }
-      catch (AsteriskSCF::Core::Routing::V1::DestinationNotFoundException&)
+      catch (const AsteriskSCF::Core::Routing::V1::DestinationNotFoundException&)
       {
-	 pjsip_dlg_respond(inv->dlg, rdata, 404, NULL, NULL, NULL);
-	 return;
+      lg(Debug) << "handleRefer() sending 404 due to destination not found for target:  " << target << std::endl;
+
+	  pjsip_dlg_respond(inv->dlg, rdata, 404, NULL, NULL, NULL);
+	  return;
       }
-      catch (...)
+      catch (const std::exception& e)
       {
-	 pjsip_dlg_respond(inv->dlg, rdata, 400, NULL, NULL, NULL);
-	 return;
+      lg(Debug) << "handleRefer() sending 400 due to exception:  " << e.what() << std::endl;
+	  pjsip_dlg_respond(inv->dlg, rdata, 400, NULL, NULL, NULL);
+	  return;
       }
    }
 }

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


-- 
asterisk-scf/integration/sip.git



More information about the asterisk-scf-commits mailing list