Module: sems Branch: master Commit: 56115ed5dd00f7ce9271e97e5933a9745eb31435 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sems/?a=commit;h=56115ed5dd00f7ce9271e97e5933a9745eb31435
Author: Stefan Sayer <[email protected]> Committer: Stefan Sayer <[email protected]> Date: Fri May 13 18:33:46 2011 +0200 b/f: B2BUA: don't refresh for establishing transaction fixes click2dial application. In the B2BUA, usually a refresh is done if the established session description has changed on the other leg (e.g. initiated by SST refresh from the middle). This fix prevents that refresh for the initial transaction, where the re-INVITE to caller is done explicitely. --- apps/click2dial/Click2Dial.cpp | 17 +++++++++++++++++ apps/click2dial/Click2Dial.h | 1 + core/AmB2BSession.cpp | 34 +++++++++++++++++++++++++++------- core/AmB2BSession.h | 1 + 4 files changed, 46 insertions(+), 7 deletions(-) diff --git a/apps/click2dial/Click2Dial.cpp b/apps/click2dial/Click2Dial.cpp index fb06d47..9c8e674 100644 --- a/apps/click2dial/Click2Dial.cpp +++ b/apps/click2dial/Click2Dial.cpp @@ -200,6 +200,9 @@ void C2DCallerDialog::onSessionStart(const AmSipReply& rep) { setReceiving(false); invite_req.body = rep.body; + invite_req.content_type = rep.content_type; + invite_req.cseq = rep.cseq; + est_invite_cseq = rep.cseq; if(wav_file.open(filename,AmAudioFile::Read)) throw string("AnnouncementDialog::onSessionStart: Cannot open file\n"); @@ -209,8 +212,22 @@ void C2DCallerDialog::onSessionStart(const AmSipReply& rep) void C2DCallerDialog::onSessionStart(const AmSipRequest& req) { + ERROR("incoming calls not supported in click2dial app!\n"); + dlg.bye(); + setStopped(); } +void C2DCallerDialog::updateUACTransCSeq(unsigned int old_cseq, unsigned int new_cseq) { + if (old_cseq == invite_req.cseq) { + DBG("updating invite_req.cseq %u -> %u\n", old_cseq, new_cseq); + invite_req.cseq = new_cseq; + } + if (old_cseq == est_invite_cseq) { + DBG("updating est_invite_cseq %u -> %u\n", old_cseq, new_cseq); + est_invite_cseq = new_cseq; + } + +} void C2DCallerDialog::process(AmEvent* event) { diff --git a/apps/click2dial/Click2Dial.h b/apps/click2dial/Click2Dial.h index f6e7303..ceca83e 100644 --- a/apps/click2dial/Click2Dial.h +++ b/apps/click2dial/Click2Dial.h @@ -74,6 +74,7 @@ class C2DCallerDialog: public AmB2BCallerSession, public CredentialHolder void createCalleeSession(); inline UACAuthCred* getCredentials() { return cred.get(); } void onB2BEvent(B2BEvent*); + void updateUACTransCSeq(unsigned int old_cseq, unsigned int new_cseq); }; class C2DCalleeDialog : public AmB2BCalleeSession, public CredentialHolder diff --git a/core/AmB2BSession.cpp b/core/AmB2BSession.cpp index 844ace4..51e81b8 100644 --- a/core/AmB2BSession.cpp +++ b/core/AmB2BSession.cpp @@ -109,6 +109,7 @@ void AmB2BSession::process(AmEvent* event) void AmB2BSession::onB2BEvent(B2BEvent* ev) { + DBG("AmB2BSession::onB2BEvent\n"); switch(ev->event_id){ case B2BSipRequest: @@ -187,13 +188,17 @@ void AmB2BSession::onB2BEvent(B2BEvent* ev) reply_ev->reply.method == SIP_METH_UPDATE)) { if (updateSessionDescription(reply_ev->reply.content_type, reply_ev->reply.body)) { - if (dlg.getUACInvTransPending()) { - DBG("changed session, but UAC INVITE trans pending\n"); - // todo(?): save until trans is finished? - return; + if (reply_ev->reply.cseq != est_invite_cseq) { + if (dlg.getUACInvTransPending()) { + DBG("changed session, but UAC INVITE trans pending\n"); + // todo(?): save until trans is finished? + return; + } + DBG("session description changed - refreshing\n"); + sendEstablishedReInvite(); + } else { + DBG("reply to establishing INVITE request - not refreshing\n"); } - DBG("session description changed - refreshing\n"); - sendEstablishedReInvite(); } } } @@ -881,6 +886,7 @@ void AmB2BCallerSession::onB2BEvent(B2BEvent* ev) if(reply.code < 200){ if ((!sip_relay_only) && sip_relay_early_media_sdp && reply.code>=180 && reply.code<=183 && (!reply.body.empty())) { + DBG("sending re-INVITE to caller with early media SDP\n"); if (reinviteCaller(reply)) { ERROR("re-INVITEing caller for early session failed - " "stopping this and other leg\n"); @@ -893,8 +899,10 @@ void AmB2BCallerSession::onB2BEvent(B2BEvent* ev) } else if(reply.code < 300){ callee_status = Connected; - + DBG("setting callee status to connected\n"); if (!sip_relay_only) { + DBG("received 200 class reply to establishing INVITE: " + "switching to SIP relay only mode, sending re-INVITE to caller\n"); sip_relay_only = true; if (reinviteCaller(reply)) { ERROR("re-INVITEing caller failed - stopping this and other leg\n"); @@ -950,9 +958,21 @@ int AmB2BCallerSession::relayEvent(AmEvent* ev) void AmB2BCallerSession::onSessionStart(const AmSipRequest& req) { invite_req = req; + est_invite_cseq = req.cseq; + AmB2BSession::onSessionStart(req); } +void AmB2BCallerSession::onSessionStart(const AmSipReply& rep) +{ + invite_req.body = rep.body; + invite_req.content_type = rep.content_type; + invite_req.cseq = rep.cseq; + est_invite_cseq = rep.cseq; + + AmB2BSession::onSessionStart(rep); +} + void AmB2BCallerSession::onCancel() { if(dlg.getStatus() == AmSipDialog::Pending) { diff --git a/core/AmB2BSession.h b/core/AmB2BSession.h index 57f5037..5c1af46 100644 --- a/core/AmB2BSession.h +++ b/core/AmB2BSession.h @@ -309,6 +309,7 @@ class AmB2BCallerSession: public AmB2BSession // @see AmSession void onSessionStart(const AmSipRequest& req); + void onSessionStart(const AmSipReply& rep); void onCancel(); // @see AmB2BSession _______________________________________________ Semsdev mailing list [email protected] http://lists.iptel.org/mailman/listinfo/semsdev
