From 18d46a82bb624703c822d3eeffb8f03c49acd12d Mon Sep 17 00:00:00 2001 From: Stefan Sayer Date: Tue, 2 Dec 2008 21:18:06 +0000 Subject: [PATCH] removed some more unneeded stuff git-svn-id: http://svn.berlios.de/svnroot/repos/sems/trunk@1153 8eb893ce-cfd4-0310-b710-fb5ebe64c474 --- apps/examples/b2b_connect/b2b_connect.cpp | 71 ++++++++++++----------- apps/examples/b2b_connect/b2b_connect.h | 12 +--- 2 files changed, 38 insertions(+), 45 deletions(-) diff --git a/apps/examples/b2b_connect/b2b_connect.cpp b/apps/examples/b2b_connect/b2b_connect.cpp index dacdd990..f17289cb 100644 --- a/apps/examples/b2b_connect/b2b_connect.cpp +++ b/apps/examples/b2b_connect/b2b_connect.cpp @@ -152,11 +152,35 @@ void b2b_connectDialog::onSessionStart(const AmSipRequest& req) void b2b_connectDialog::onB2ABEvent(B2ABEvent* ev) { + if (ev->event_id == B2ABConnectOtherLegException) { + B2ABConnectOtherLegExceptionEvent* ex_ev = + dynamic_cast(ev); + if (ex_ev && dlg.getStatus() == AmSipDialog::Pending) { + DBG("callee leg creation failed with exception '%d %s'\n", + ex_ev->code, ex_ev->reason.c_str()); + dlg.reply(invite_req, ex_ev->code, ex_ev->reason); + setStopped(); + return; + } + } + + if (ev->event_id == B2ABConnectOtherLegFailed) { + B2ABConnectOtherLegFailedEvent* f_ev = + dynamic_cast(ev); + if (f_ev && dlg.getStatus() == AmSipDialog::Pending) { + DBG("callee leg creation failed with reply '%d %s'\n", + f_ev->code, f_ev->reason.c_str()); + dlg.reply(invite_req, f_ev->code, f_ev->reason); + setStopped(); + return; + } + } if (ev->event_id == B2ABConnectAudio) { // delayed processing of first INVITE request AmSession::onInvite(invite_req); } + AmB2ABCallerSession::onB2ABEvent(ev); } @@ -241,9 +265,8 @@ AmB2ABCalleeSession* b2b_connectDialog::createCalleeSession() } b2b_connectCalleeSession::b2b_connectCalleeSession(const string& other_tag, - const string& user, const string& pwd) - : auth(NULL), - credentials("", user, pwd), // domain (realm) is unused in credentials + const string& user, const string& pwd) + : credentials("", user, pwd), // domain (realm) is unused in credentials AmB2ABCalleeSession(other_tag) { rtp_str.setPlayoutType(ADAPTIVE_PLAYOUT); @@ -251,8 +274,7 @@ b2b_connectCalleeSession::b2b_connectCalleeSession(const string& other_tag, } b2b_connectCalleeSession::~b2b_connectCalleeSession() { - if (auth) - delete auth; + } inline UACAuthCred* b2b_connectCalleeSession::getCredentials() { @@ -260,34 +282,13 @@ inline UACAuthCred* b2b_connectCalleeSession::getCredentials() { } void b2b_connectCalleeSession::onSipReply(const AmSipReply& reply) { - AmB2ABCalleeSession::onSipReply(reply); -} - -void b2b_connectCalleeSession::onSendRequest(const string& method, const string& content_type, - const string& body, string& hdrs, int flags, unsigned int cseq) -{ - AmB2ABCalleeSession::onSendRequest(method, content_type, - body, hdrs, flags, cseq); -} - -void b2b_connectCalleeSession::onB2ABEvent(B2ABEvent* ev) -{ - -// if (ev->event_id == B2ABConnectAudio) { -// // delayed processing of first INVITE request -// AmSession::onInvite(invite_req); -// } - AmB2ABCalleeSession::onB2ABEvent(ev); -} - -void b2b_connectCalleeSession::process(AmEvent* ev) -{ - AmAudioEvent* audio_event = dynamic_cast(ev); - if(audio_event && (audio_event->event_id == AmAudioEvent::noAudio)){ - DBG("connecting audio\n"); - connectSession(); - return; - } - - AmB2ABCalleeSession::process(ev); + int status_before = dlg.getStatus(); + AmB2ABCalleeSession::onSipReply(reply); + int status = dlg.getStatus(); + + if ((status_before == AmSipDialog::Pending)&& + (status == AmSipDialog::Disconnected)) { + DBG("status change Pending -> Disconnected. Stopping session.\n"); + setStopped(); + } } diff --git a/apps/examples/b2b_connect/b2b_connect.h b/apps/examples/b2b_connect/b2b_connect.h index 664569c4..98275887 100644 --- a/apps/examples/b2b_connect/b2b_connect.h +++ b/apps/examples/b2b_connect/b2b_connect.h @@ -89,23 +89,15 @@ class b2b_connectCalleeSession : public AmB2ABCalleeSession, public CredentialHolder { UACAuthCred credentials; - AmSessionEventHandler* auth; AmSipRequest invite_req; protected: + void onSipReply(const AmSipReply& reply); - void onSipReply(const AmSipReply& reply); - void onSendRequest(const string& method, const string& content_type, - const string& body, string& hdrs, int flags, unsigned int cseq); - - public: +public: b2b_connectCalleeSession(const string& other_tag, const string& user, const string& pwd); ~b2b_connectCalleeSession(); - void onB2ABEvent(B2ABEvent* ev); - void process(AmEvent* ev); inline UACAuthCred* getCredentials(); - - void setAuthHandler(AmSessionEventHandler* h) { auth = h; } }; #endif