[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 08:17:41 CDT 2010


branch "master" has been updated
       via  3c4f6511d6e66e5b014e351b3fe8654e35b6bb92 (commit)
      from  5d497088cfdc89c808f234917bbcc9815fb247d4 (commit)

Summary of changes:
 src/PJSipSessionModule.cpp |   13 ++++++++++++-
 src/SipEndpoint.cpp        |   12 +++++++++---
 src/SipEndpoint.h          |    2 ++
 3 files changed, 23 insertions(+), 4 deletions(-)


- Log -----------------------------------------------------------------
commit 3c4f6511d6e66e5b014e351b3fe8654e35b6bb92
Author: Joshua Colp <jcolp at digium.com>
Date:   Mon Aug 30 10:27:10 2010 -0300

    Add preliminary negotiated SDP usage. Right now the IP address/port is read and sent to the RTP session.

diff --git a/src/PJSipSessionModule.cpp b/src/PJSipSessionModule.cpp
index be5e979..896b958 100644
--- a/src/PJSipSessionModule.cpp
+++ b/src/PJSipSessionModule.cpp
@@ -365,7 +365,18 @@ static void invOnCreateOffer(pjsip_inv_session *inv, pjmedia_sdp_session **p_off
 
 static void invOnMediaUpdate(pjsip_inv_session *inv, pj_status_t status)
 {
-	//stub
+   if (status != PJ_SUCCESS)
+   {
+      // We have nothing, zip, nada, kablamo, in common.
+      return;
+   }
+
+   const pjmedia_sdp_session *remote_sdp;
+   status = pjmedia_sdp_neg_get_active_remote(inv->neg, &remote_sdp);
+   const pjmedia_sdp_conn *remote_conn = remote_sdp->media[0]->conn ? remote_sdp->media[0]->conn : remote_sdp->conn;
+
+   SipEndpointPtr *endpoint = (SipEndpointPtr*)inv->dlg->mod_data[pjsip_ua_instance()->id];
+   (*endpoint)->setRemoteDetails(pj_strbuf(&remote_conn->addr), remote_sdp->media[0]->desc.port);
 }
 //Comment this out for now so pjsip will send the ACK for us.
 //static void invOnSendAck(pjsip_inv_session *inv, pjsip_rx_data *rdata)
diff --git a/src/SipEndpoint.cpp b/src/SipEndpoint.cpp
index 9aca790..ea1c378 100644
--- a/src/SipEndpoint.cpp
+++ b/src/SipEndpoint.cpp
@@ -356,9 +356,6 @@ void SipEndpoint::requestRTPSessions(Hydra::Media::V1::FormatSeq& formats)
    // Create a local copy of the sinks, this won't get changed by the RTP session so it's all good
    mSinks = session->getSinks();
 
-   Hydra::Media::RTP::V1::StreamSinkRTPPrx sink = Hydra::Media::RTP::V1::StreamSinkRTPPrx::uncheckedCast(mSinks.front());
-   sink->setRemoteDetails("127.0.0.1", 4580);
-
    // For testing push a static payload mapping for ULAW into the RTP session
    Hydra::Media::RTP::V1::PayloadMap payloads;
    Hydra::Media::V1::AudioFormatPtr format = new Hydra::Media::V1::AudioFormat();
@@ -372,5 +369,14 @@ void SipEndpoint::requestRTPSessions(Hydra::Media::V1::FormatSeq& formats)
    session->associatePayloads(payloads);
 }
 
+/**
+ * Internal function called to set the remote details for RTP.
+ */
+void SipEndpoint::setRemoteDetails(std::string destination, int port)
+{
+   Hydra::Media::RTP::V1::StreamSinkRTPPrx sink = Hydra::Media::RTP::V1::StreamSinkRTPPrx::uncheckedCast(mSinks.front());
+   sink->setRemoteDetails(destination, port);
+}
+
 }; // end SipChannelService
 }; // end Hydra
diff --git a/src/SipEndpoint.h b/src/SipEndpoint.h
index 3ea1025..9c59ab8 100644
--- a/src/SipEndpoint.h
+++ b/src/SipEndpoint.h
@@ -34,6 +34,8 @@ public:
 
    pjmedia_sdp_session *createSDPOffer();
 
+   void setRemoteDetails(std::string destination, int port);
+
    /**
     * Internal function which sets the PJsip dialog.
     */

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


-- 
asterisk-scf/integration/sip.git



More information about the asterisk-scf-commits mailing list