diff --git a/core/AmSession.cpp b/core/AmSession.cpp index 3bcf5826..dfbc1def 100644 --- a/core/AmSession.cpp +++ b/core/AmSession.cpp @@ -804,6 +804,17 @@ void AmSession::onInvite2xx(const AmSipReply& reply) 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) diff --git a/core/AmSession.h b/core/AmSession.h index 7463f1eb..f143185d 100644 --- a/core/AmSession.h +++ b/core/AmSession.h @@ -467,6 +467,11 @@ public: /** 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 diff --git a/core/AmSipDialog.cpp b/core/AmSipDialog.cpp index acb79a7b..c7070ee1 100644 --- a/core/AmSipDialog.cpp +++ b/core/AmSipDialog.cpp @@ -300,13 +300,13 @@ void AmSipDialog::uasTimeout(AmSipTimeoutEvent* to_ev) 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: diff --git a/core/AmSipDialog.h b/core/AmSipDialog.h index 16ef5f75..f4c29900 100644 --- a/core/AmSipDialog.h +++ b/core/AmSipDialog.h @@ -96,6 +96,12 @@ class AmSipDialogEventHandler /** 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() {}; }; diff --git a/core/AmSipEvent.h b/core/AmSipEvent.h index 7da2c9a2..8b2ec4d3 100644 --- a/core/AmSipEvent.h +++ b/core/AmSipEvent.h @@ -62,10 +62,9 @@ class AmSipTimeoutEvent: public AmSipEvent 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) {} diff --git a/core/SipCtrlInterface.cpp b/core/SipCtrlInterface.cpp index f7f3e27a..9136f1d5 100644 --- a/core/SipCtrlInterface.cpp +++ b/core/SipCtrlInterface.cpp @@ -493,6 +493,8 @@ void SipCtrlInterface::timer_expired(sip_trans* trans, sip_timer_type tt) 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 @@ void SipCtrlInterface::timer_expired(sip_trans* trans, sip_timer_type tt) ERROR("timer H expired / transaction in undefined state\n"); return; } + break; + default: return; } @@ -527,7 +531,7 @@ void SipCtrlInterface::timer_expired(sip_trans* trans, sip_timer_type tt) } 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& routes, string& route_field)