Author: rco
Date: 2010-05-03 17:36:33 +0200 (Mon, 03 May 2010)
New Revision: 1893
Modified:
trunk/core/AmSession.cpp
trunk/core/AmSession.h
trunk/core/AmSipDialog.cpp
trunk/core/AmSipDialog.h
trunk/core/AmSipEvent.h
trunk/core/SipCtrlInterface.cpp
Log:
- sessions are now terminated if no 200-ACK is received until timer H expires.
- an event handler has been added to notify the app about missing non-200 ACK.
Modified: trunk/core/AmSession.cpp
===================================================================
--- trunk/core/AmSession.cpp 2010-05-03 07:25:22 UTC (rev 1892)
+++ trunk/core/AmSession.cpp 2010-05-03 15:36:33 UTC (rev 1893)
@@ -804,6 +804,17 @@
if(t) dlg.send_200_ack(*t);
}
+void AmSession::onNo2xxACK(unsigned int cseq)
+{
+ dlg.bye();
+ setStopped();
+}
+
+void AmSession::onNoErrorACK(unsigned int cseq)
+{
+ setStopped();
+}
+
void AmSession::onAudioEvent(AmAudioEvent* audio_ev)
{
if (audio_ev->event_id == AmAudioEvent::cleared)
Modified: trunk/core/AmSession.h
===================================================================
--- trunk/core/AmSession.h 2010-05-03 07:25:22 UTC (rev 1892)
+++ trunk/core/AmSession.h 2010-05-03 15:36:33 UTC (rev 1893)
@@ -467,6 +467,11 @@
/** 2xx reply has been received for an INVITE transaction */
virtual void onInvite2xx(const AmSipReply& reply);
+
+ /** missing 2xx-ACK */
+ virtual void onNo2xxACK(unsigned int cseq);
+ /** missing non-2xx-ACK */
+ virtual void onNoErrorACK(unsigned int cseq);
/**
* Entry point for Audio events
Modified: trunk/core/AmSipDialog.cpp
===================================================================
--- trunk/core/AmSipDialog.cpp 2010-05-03 07:25:22 UTC (rev 1892)
+++ trunk/core/AmSipDialog.cpp 2010-05-03 15:36:33 UTC (rev 1893)
@@ -300,13 +300,13 @@
switch(to_ev->type){
case AmSipTimeoutEvent::no2xxACK:
- //TODO
- DBG("Timeout: missing 2xx-ACK received\n");
+ DBG("Timeout: missing 2xx-ACK\n");
+ if(hdl) hdl->onNo2xxACK(to_ev->cseq);
break;
case AmSipTimeoutEvent::noErrorACK:
- //TODO
DBG("Timeout: missing non-2xx-ACK\n");
+ if(hdl) hdl->onNoErrorACK(to_ev->cseq);
break;
case AmSipTimeoutEvent::noPRACK:
Modified: trunk/core/AmSipDialog.h
===================================================================
--- trunk/core/AmSipDialog.h 2010-05-03 07:25:22 UTC (rev 1892)
+++ trunk/core/AmSipDialog.h 2010-05-03 15:36:33 UTC (rev 1893)
@@ -96,6 +96,12 @@
/** Hook called when a local INVITE request has been replied with 2xx */
virtual void onInvite2xx(const AmSipReply& reply)=0;
+ /** Hook called when a UAS INVITE transaction did not receive a 2xx-ACK */
+ virtual void onNo2xxACK(unsigned int cseq)=0;
+
+ /** Hook called when a UAS INVITE transaction did not receive a non-2xx-ACK
*/
+ virtual void onNoErrorACK(unsigned int cseq)=0;
+
virtual ~AmSipDialogEventHandler() {};
};
Modified: trunk/core/AmSipEvent.h
===================================================================
--- trunk/core/AmSipEvent.h 2010-05-03 07:25:22 UTC (rev 1892)
+++ trunk/core/AmSipEvent.h 2010-05-03 15:36:33 UTC (rev 1893)
@@ -62,10 +62,9 @@
EvType type;
- unsigned int cseq_num;
- string cseq_method;
+ unsigned int cseq;
- AmSipTimeoutEvent(EvType t, unsigned int cseq_num, const string& cseq_method)
+ AmSipTimeoutEvent(EvType t, unsigned int cseq_num)
: AmSipEvent(), type(t)
{}
Modified: trunk/core/SipCtrlInterface.cpp
===================================================================
--- trunk/core/SipCtrlInterface.cpp 2010-05-03 07:25:22 UTC (rev 1892)
+++ trunk/core/SipCtrlInterface.cpp 2010-05-03 15:36:33 UTC (rev 1893)
@@ -493,6 +493,8 @@
AmSipTimeoutEvent::EvType ev = AmSipTimeoutEvent::_noEv;
+ DBG("tt=%i;state=%i\n",tt,trans->state);
+
//TODO: send an event to the SIP Dialog
switch(tt){
@@ -511,6 +513,8 @@
ERROR("timer H expired / transaction in undefined state\n");
return;
}
+ break;
+
default:
return;
}
@@ -527,7 +531,7 @@
}
AmEventDispatcher::instance()->post(c2stlstr(trans->to_tag),
- new AmSipTimeoutEvent(ev, cseq->num,
c2stlstr(cseq->method_str)));
+ new AmSipTimeoutEvent(ev, cseq->num));
}
void SipCtrlInterface::prepare_routes_uac(const list<sip_header*>& routes,
string& route_field)
_______________________________________________
Semsdev mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/semsdev