Module: sems Branch: master Commit: 653648dae2641a7f859d9780aa684d0d3509f411 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sems/?a=commit;h=653648dae2641a7f859d9780aa684d0d3509f411
Author: Stefan Sayer <[email protected]> Committer: Stefan Sayer <[email protected]> Date: Wed Sep 21 16:40:30 2011 +0200 sbc: support for set/reset call timer while call is running --- apps/sbc/SBC.cpp | 15 +++++++++++++++ core/ampi/SBCCallControlAPI.h | 18 ++++++++++++++++++ 2 files changed, 33 insertions(+), 0 deletions(-) diff --git a/apps/sbc/SBC.cpp b/apps/sbc/SBC.cpp index ceac266..e142d22 100644 --- a/apps/sbc/SBC.cpp +++ b/apps/sbc/SBC.cpp @@ -944,6 +944,20 @@ void SBCDialog::process(AmEvent* ev) } } + SBCCallTimerEvent* ct_event; + if (ev->event_id == SBCCallTimerEvent_ID && + (ct_event = dynamic_cast<SBCCallTimerEvent*>(ev)) != NULL) { + switch (ct_event->timer_action) { + case SBCCallTimerEvent::Remove: removeTimer(ct_event->timer_id); return; + case SBCCallTimerEvent::Set: setTimer(ct_event->timer_id, ct_event->timeout); return; + case SBCCallTimerEvent::Reset: + removeTimer(ct_event->timer_id); + setTimer(ct_event->timer_id, ct_event->timeout); + return; + default: ERROR("unknown timer_action in sbc call timer event\n"); + } + } + AmB2BCallerSession::process(ev); } @@ -1257,6 +1271,7 @@ bool SBCDialog::CCStart(const AmSipRequest& req) { di_args.push(cc_timer_id); // current timer ID (*cc_mod)->invoke("start", di_args, ret); + // evaluate ret for (size_t i=0;i<ret.size();i++) { if (!isArgArray(ret[i]) || !ret[i].size()) diff --git a/core/ampi/SBCCallControlAPI.h b/core/ampi/SBCCallControlAPI.h index 0f7599f..97c2e62 100644 --- a/core/ampi/SBCCallControlAPI.h +++ b/core/ampi/SBCCallControlAPI.h @@ -16,4 +16,22 @@ // set timer #define SBC_CC_TIMER_TIMEOUT 1 +/** post an SBCCallTimerEvent to an SBC call in order to set or reset call timer */ +#define SBCCallTimerEvent_ID -563 +struct SBCCallTimerEvent : public AmEvent { + enum TimerAction { + Remove = 0, + Set, + Reset + }; + + TimerAction timer_action; + int timeout; + int timer_id; + + SBCCallTimerEvent(TimerAction timer_action, int timer_id, int timeout = 0) + : AmEvent(SBCCallTimerEvent_ID), + timer_id(timer_id), timer_action(timer_action), timeout(timeout) { } +}; + #endif _______________________________________________ Semsdev mailing list [email protected] http://lists.iptel.org/mailman/listinfo/semsdev
