Module: sems
Branch: rco/t38_relay
Commit: 8ec1e788f5b20e08c89d9340f95353e9f818dade
URL:    
http://git.sip-router.org/cgi-bin/gitweb.cgi/sems/?a=commit;h=8ec1e788f5b20e08c89d9340f95353e9f818dade

Author: Raphael Coeffic <[email protected]>
Committer: Raphael Coeffic <[email protected]>
Date:   Mon Nov 26 13:07:10 2012 +0100

SimpleRelayController now enables everything but telephone-event (uses invert())

---

 core/AmB2BMedia.cpp |   21 +++++++++++++++++----
 1 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/core/AmB2BMedia.cpp b/core/AmB2BMedia.cpp
index 6a9d21c..59d0618 100644
--- a/core/AmB2BMedia.cpp
+++ b/core/AmB2BMedia.cpp
@@ -25,19 +25,32 @@ static SimpleRelayController simple_relay_ctrl;
 
 void SimpleRelayController::computeRelayMask(const SdpMedia &m, bool &enable, 
PayloadMask &mask)
 {
+  int te_pl = -1;
   enable = false;
 
-  // walk through the media line and add all payload IDs to the bit mask
+  // walk through the media lines and find the telephone-event payload
   for (std::vector<SdpPayload>::const_iterator i = m.payloads.begin();
       i != m.payloads.end(); ++i)
   {
     // do not mark telephone-event payload for relay
-    if(strcasecmp("telephone-event",i->encoding_name.c_str()) != 0){
-      mask.set(i->payload_type);
+    if(!strcasecmp("telephone-event",i->encoding_name.c_str())){
+      te_pl = i->payload_type;
+    }
+    else {
       enable = true;
-      TRACE("marking payload %d for relay\n", i->payload_type);
     }
   }
+
+  if(!enable)
+    return;
+
+  if(te_pl > 0) { 
+    TRACE("unmarking telephone-event payload %d for relay\n", te_pl);
+    mask.set(te_pl);
+  }
+
+  TRACE("marking all other payloads for relay\n");
+  mask.invert();
 }
 
 
//////////////////////////////////////////////////////////////////////////////////

_______________________________________________
Semsdev mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/semsdev

Reply via email to