From c0f8e76d2d4a343dc375a78f94d696badc267f5b Mon Sep 17 00:00:00 2001 From: Stefan Sayer Date: Wed, 6 May 2009 12:53:00 +0000 Subject: [PATCH] optionally relay early media (180 .. 183) into caller leg of B2B sessions. note this effects only applications where call is accepted before creating second call leg, i.e. it does not affect call_timer/auth_b2b. based on a patch by Tom van der Geer git-svn-id: http://svn.berlios.de/svnroot/repos/sems/trunk@1362 8eb893ce-cfd4-0310-b710-fb5ebe64c474 --- core/AmB2BSession.cpp | 11 ++++++++++- core/AmB2BSession.h | 7 +++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/core/AmB2BSession.cpp b/core/AmB2BSession.cpp index b36daf60..a2e647fb 100644 --- a/core/AmB2BSession.cpp +++ b/core/AmB2BSession.cpp @@ -236,7 +236,7 @@ void AmB2BSession::relaySip(const AmSipRequest& orig, const AmSipReply& reply) AmB2BCallerSession::AmB2BCallerSession() : AmB2BSession(), - callee_status(None) + callee_status(None), sip_relay_early_media_sdp(false) { } @@ -244,6 +244,11 @@ AmB2BCallerSession::~AmB2BCallerSession() { } +void AmB2BCallerSession::set_sip_relay_early_media_sdp(bool r) +{ + sip_relay_early_media_sdp = r; +} + void AmB2BCallerSession::terminateLeg() { AmB2BSession::terminateLeg(); @@ -275,6 +280,10 @@ void AmB2BCallerSession::onB2BEvent(B2BEvent* ev) case Ringing: if(reply.code < 200){ + if ((!sip_relay_only) && sip_relay_early_media_sdp && + reply.code>=180 && reply.code<=183 && (!reply.body.empty())) { + reinviteCaller(reply); + } callee_status = Ringing; } diff --git a/core/AmB2BSession.h b/core/AmB2BSession.h index eb7b2894..3375e7ea 100644 --- a/core/AmB2BSession.h +++ b/core/AmB2BSession.h @@ -191,6 +191,12 @@ class AmB2BCallerSession: public AmB2BSession virtual void createCalleeSession(); void relayEvent(AmEvent* ev); + /** Tell if the session should + * relay early media SDPs to + * caller leg + */ + bool sip_relay_early_media_sdp; + public: AmB2BCallerSession(); virtual ~AmB2BCallerSession(); @@ -215,6 +221,7 @@ class AmB2BCallerSession: public AmB2BSession AmSipRequest* getInviteReq() { return &invite_req; } + void set_sip_relay_early_media_sdp(bool r); }; /** \brief Callee leg of a B2B session */