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

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Wed May 25 14:54:57 CDT 2011


branch "master" has been updated
       via  c81b0fc11568a4b86ab67f8fc9de678f1692c2b8 (commit)
      from  b78b8a44294837357cece3e68fbafb00b2344c20 (commit)

Summary of changes:
 src/PJSipSessionModule.cpp |   23 ++++++++++++++++++++---
 1 files changed, 20 insertions(+), 3 deletions(-)


- Log -----------------------------------------------------------------
commit c81b0fc11568a4b86ab67f8fc9de678f1692c2b8
Author: Joshua Colp <jcolp at digium.com>
Date:   Wed May 25 16:45:03 2011 -0300

    If we do not have compatible SDP or if we are informed an address we received for RTP is invalid then end the session since it is a broken call.

diff --git a/src/PJSipSessionModule.cpp b/src/PJSipSessionModule.cpp
index ae6ba8f..5cb8e64 100644
--- a/src/PJSipSessionModule.cpp
+++ b/src/PJSipSessionModule.cpp
@@ -1324,8 +1324,12 @@ protected:
         pj_status_t status;
         if ((status = pjmedia_sdp_neg_get_active_remote(mInv->neg, &remote_sdp)) != PJ_SUCCESS)
         {
-            // TODO: What happens if we can't get negotiated SDP?
-            return Complete;
+	    pjsip_tx_data *packet;
+	    if (pjsip_inv_end_session(mInv, 488, NULL, &packet) == PJ_SUCCESS)
+	    {
+		pjsip_inv_send_msg(mInv, packet);
+	    }
+	    return Complete;
         }
 
         const pjmedia_sdp_conn *remote_conn = remote_sdp->media[0]->conn ? remote_sdp->media[0]->conn : remote_sdp->conn;
@@ -1333,7 +1337,20 @@ protected:
         PJSipSessionModInfo *session_mod_info = (PJSipSessionModInfo*)mInv->mod_data[mModuleId];
         SipSessionPtr session = session_mod_info->getSessionPtr();
         std::string destination(pj_strbuf(&remote_conn->addr), pj_strlen(&remote_conn->addr));
-        session->setRemoteDetails(destination, remote_sdp->media[0]->desc.port);
+
+	try
+	{
+	    session->setRemoteDetails(destination, remote_sdp->media[0]->desc.port);
+	}
+	catch (const AsteriskSCF::Media::RTP::V1::InvalidAddress&)
+	{
+	    pjsip_tx_data *packet;
+            if (pjsip_inv_end_session(mInv, 488, NULL, &packet) == PJ_SUCCESS)
+            {
+                pjsip_inv_send_msg(mInv, packet);
+            }
+            return Complete;
+	}
 
         // Each stream has its own set of formats, so go to that granularity
         for (unsigned int stream = 0; stream < remote_sdp->media_count; stream++)

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


-- 
asterisk-scf/release/sip.git



More information about the asterisk-scf-commits mailing list