Author: sayer
Date: 2008-12-02 22:18:06 +0100 (Tue, 02 Dec 2008)
New Revision: 1153
Modified:
trunk/apps/examples/b2b_connect/b2b_connect.cpp
trunk/apps/examples/b2b_connect/b2b_connect.h
Log:
removed some more unneeded stuff
Modified: trunk/apps/examples/b2b_connect/b2b_connect.cpp
===================================================================
--- trunk/apps/examples/b2b_connect/b2b_connect.cpp 2008-12-02 20:58:18 UTC
(rev 1152)
+++ trunk/apps/examples/b2b_connect/b2b_connect.cpp 2008-12-02 21:18:06 UTC
(rev 1153)
@@ -152,11 +152,35 @@
void b2b_connectDialog::onB2ABEvent(B2ABEvent* ev)
{
+ if (ev->event_id == B2ABConnectOtherLegException) {
+ B2ABConnectOtherLegExceptionEvent* ex_ev =
+ dynamic_cast<B2ABConnectOtherLegExceptionEvent*>(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<B2ABConnectOtherLegFailedEvent*>(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 @@
}
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() {
- if (auth)
- delete auth;
+
}
inline UACAuthCred* b2b_connectCalleeSession::getCredentials() {
@@ -260,34 +282,13 @@
}
void b2b_connectCalleeSession::onSipReply(const AmSipReply& reply) {
- AmB2ABCalleeSession::onSipReply(reply);
+ 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();
+ }
}
-
-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<AmAudioEvent*>(ev);
- if(audio_event && (audio_event->event_id == AmAudioEvent::noAudio)){
- DBG("connecting audio\n");
- connectSession();
- return;
- }
-
- AmB2ABCalleeSession::process(ev);
-}
Modified: trunk/apps/examples/b2b_connect/b2b_connect.h
===================================================================
--- trunk/apps/examples/b2b_connect/b2b_connect.h 2008-12-02 20:58:18 UTC
(rev 1152)
+++ trunk/apps/examples/b2b_connect/b2b_connect.h 2008-12-02 21:18:06 UTC
(rev 1153)
@@ -89,23 +89,15 @@
: 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
_______________________________________________
Semsdev mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/semsdev