Hi Stefan,

Please find attached the patch that will allow a B2B application to toggle the relay of early media SDPs.

Use set_sip_relay_early_media_sdp(true) to enable the relay. (see example in Click2Dial.cpp) Default behavior is off...

Since I'm using rel_1.1.0_rc1 (from tags) I created a patch against that. That's the patch I've tested and proven to work. For your convenience I've also created a patch against trunk, but I didn't test that.

Best regards,

Tom van der Geer

-------- Originele bericht --------
Onderwerp: Re: [Sems] click2dial with early media
Van: Stefan Sayer <[email protected]>
Aan: Tom van der Geer <[email protected]>
CC: [email protected]
Datum: 8-4-2009 12:24
Hi Tom,

Tom van der Geer wrote:
Hi Stefan,

Excellent! That works!
nice :)

[...]
If you want I can create a patch for the AmB2BSession.cpp/.h. Or do you
That would be great. Preferably in such a way that the application can
choose whether to relay early media SDP or not.

Thanks
Stefan



Index: AmB2BSession.cpp
===================================================================
--- AmB2BSession.cpp    (revision 1354)
+++ AmB2BSession.cpp    (working copy)
@@ -237,7 +237,8 @@
 
 AmB2BCallerSession::AmB2BCallerSession()
   : AmB2BSession(),
-    callee_status(None)
+    callee_status(None),
+    sip_relay_early_media_sdp(false)
 {
 }
 
@@ -245,6 +246,11 @@
 {
 }
 
+void AmB2BCallerSession::set_sip_relay_early_media_sdp(bool r)
+{
+  sip_relay_early_media_sdp = r; 
+}
+
 void AmB2BCallerSession::terminateLeg()
 {
   AmB2BSession::terminateLeg();
@@ -359,6 +365,15 @@
   return dlg.sendRequest("INVITE",content_type,callee_reply.body, "", 
SIP_FLAGS_VERBATIM);
 }
 
+bool AmB2BCallerSession::onOtherReply(const AmSipReply& reply)
+{
+  if(reply.code == 183 && sip_relay_early_media_sdp){
+    reinviteCaller(reply);
+    return true;
+  }
+  return AmB2BSession::onOtherReply(reply);
+}
+
 void AmB2BCallerSession::createCalleeSession()
 {
   AmB2BCalleeSession* callee_session = newCalleeSession();
Index: AmB2BSession.h
===================================================================
--- AmB2BSession.h      (revision 1354)
+++ AmB2BSession.h      (working copy)
@@ -191,6 +191,13 @@
   virtual void createCalleeSession();
   void relayEvent(AmEvent* ev);
 
+  virtual bool onOtherReply(const AmSipReply& reply);
+  /** Tell if the session should
+   *  relay early media SDPs to
+   *  caller leg
+   */
+  bool sip_relay_early_media_sdp;
+  
  public:
   AmB2BCallerSession();
   virtual ~AmB2BCallerSession();
@@ -215,6 +222,7 @@
 
   AmSipRequest* getInviteReq() { return &invite_req; }
 
+  void set_sip_relay_early_media_sdp(bool r);
 };
 
 /** \brief Callee leg of a B2B session */
Index: AmB2BSession.cpp
===================================================================
--- AmB2BSession.cpp    (revision 1354)
+++ AmB2BSession.cpp    (working copy)
@@ -236,7 +236,8 @@
 
 AmB2BCallerSession::AmB2BCallerSession()
   : AmB2BSession(),
-    callee_status(None)
+    callee_status(None),
+    sip_relay_early_media_sdp(false)
 {
 }
 
@@ -244,6 +245,11 @@
 {
 }
 
+void AmB2BCallerSession::set_sip_relay_early_media_sdp(bool r)
+{
+  sip_relay_early_media_sdp = r; 
+}
+
 void AmB2BCallerSession::terminateLeg()
 {
   AmB2BSession::terminateLeg();
@@ -362,6 +368,15 @@
   return dlg.sendRequest("INVITE",content_type,callee_reply.body, "", 
SIP_FLAGS_VERBATIM);
 }
 
+bool AmB2BCallerSession::onOtherReply(const AmSipReply& reply)
+{
+  if(reply.code == 183 && sip_relay_early_media_sdp){
+    reinviteCaller(reply);
+    return true;
+  }
+  return AmB2BSession::onOtherReply(reply);
+}
+
 void AmB2BCallerSession::createCalleeSession() {
   AmB2BCalleeSession* callee_session = newCalleeSession();  
   if (NULL == callee_session) 
Index: AmB2BSession.h
===================================================================
--- AmB2BSession.h      (revision 1354)
+++ AmB2BSession.h      (working copy)
@@ -191,6 +191,13 @@
   virtual void createCalleeSession();
   void relayEvent(AmEvent* ev);
 
+  virtual bool onOtherReply(const AmSipReply& reply);
+  /** Tell if the session should
+   *  relay early media SDPs to
+   *  caller leg
+   */
+  bool sip_relay_early_media_sdp;
+  
  public:
   AmB2BCallerSession();
   virtual ~AmB2BCallerSession();
@@ -215,6 +222,7 @@
 
   AmSipRequest* getInviteReq() { return &invite_req; }
 
+  void set_sip_relay_early_media_sdp(bool r);
 };
 
 /** \brief Callee leg of a B2B session */
Index: Click2Dial.cpp
===================================================================
--- Click2Dial.cpp      (revision 1354)
+++ Click2Dial.cpp      (working copy)
@@ -189,6 +189,7 @@
 AmB2BCallerSession()
 {
   set_sip_relay_only(false);
+  set_sip_relay_early_media_sdp(true);
 }
 
 
_______________________________________________
Sems mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/sems

Reply via email to