Module: sems Branch: master Commit: 8f38cfd44ed4c58e412048c619b6b31c3d5291b1 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sems/?a=commit;h=8f38cfd44ed4c58e412048c619b6b31c3d5291b1
Author: Stefan Sayer <[email protected]> Committer: Stefan Sayer <[email protected]> Date: Thu Sep 29 14:31:18 2011 +0200 sbc: removed obsolete call_timer sbc profile option replaced with call_timer call control module --- apps/sbc/SBC.cpp | 39 +++++++-------------------------------- apps/sbc/SBC.h | 2 -- apps/sbc/SBCCallProfile.cpp | 15 +-------------- apps/sbc/SBCCallProfile.h | 4 ---- 4 files changed, 8 insertions(+), 52 deletions(-) diff --git a/apps/sbc/SBC.cpp b/apps/sbc/SBC.cpp index 9cb1265..641b1f2 100644 --- a/apps/sbc/SBC.cpp +++ b/apps/sbc/SBC.cpp @@ -782,27 +782,13 @@ void SBCDialog::onInvite(const AmSipRequest& req) } // get timer - if (call_profile.call_timer_enabled || call_profile.prepaid_enabled) { + if (call_profile.prepaid_enabled) { if (!timersSupported()) { ERROR("load session_timer module for call timers\n"); throw AmSession::Exception(500, SIP_REPLY_SERVER_INTERNAL_ERROR); } } - if (call_profile.call_timer_enabled) { - call_profile.call_timer = - replaceParameters(call_profile.call_timer, "call_timer", REPLACE_VALS); - if (str2i(call_profile.call_timer, call_timer)) { - ERROR("invalid call_timer value '%s'\n", call_profile.call_timer.c_str()); - throw AmSession::Exception(500, SIP_REPLY_SERVER_INTERNAL_ERROR); - } - - if (!call_timer) { - // time=0 - throw AmSession::Exception(503, "Service Unavailable"); - } - } - if (call_profile.prepaid_enabled) { call_profile.prepaid_accmodule = replaceParameters(call_profile.prepaid_accmodule, "prepaid_accmodule", REPLACE_VALS); @@ -931,13 +917,7 @@ void SBCDialog::process(AmEvent* ev) AmPluginEvent* plugin_event = dynamic_cast<AmPluginEvent*>(ev); if(plugin_event && plugin_event->name == "timer_timeout") { int timer_id = plugin_event->data.get(0).asInt(); - if (timer_id == SBC_TIMER_ID_CALL_TIMER && - getCalleeStatus() == Connected) { - DBG("SBC: %us call timer hit - ending call\n", call_timer); - stopCall(); - ev->processed = true; - return; - } else if (timer_id == SBC_TIMER_ID_PREPAID_TIMEOUT) { + if (timer_id == SBC_TIMER_ID_PREPAID_TIMEOUT) { DBG("timer timeout, no more credit\n"); stopCall(); ev->processed = true; @@ -1185,18 +1165,12 @@ void SBCDialog::stopCall() { /** @return whether successful */ bool SBCDialog::startCallTimer() { - if ((call_profile.call_timer_enabled || call_profile.prepaid_enabled) && - (!AmSession::timersSupported())) { + if (call_profile.prepaid_enabled && (!AmSession::timersSupported())) { ERROR("internal implementation error: timers not supported\n"); stopCall(); return false; } - if (call_profile.call_timer_enabled) { - DBG("SBC: starting call timer of %u seconds\n", call_timer); - setTimer(SBC_TIMER_ID_CALL_TIMER, call_timer); - } - for (vector<pair<int, unsigned int> >::iterator it= call_timers.begin(); it != call_timers.end(); it++) { DBG("SBC: starting call timer %i of %u seconds\n", it->first, it->second); @@ -1207,9 +1181,10 @@ bool SBCDialog::startCallTimer() { } void SBCDialog::stopCallTimer() { - if (call_profile.call_timer_enabled) { - DBG("SBC: removing call timer\n"); - removeTimer(SBC_TIMER_ID_CALL_TIMER); + for (vector<pair<int, unsigned int> >::iterator it= + call_timers.begin(); it != call_timers.end(); it++) { + DBG("SBC: removing call timer %i\n", it->first); + removeTimer(it->first); } } diff --git a/apps/sbc/SBC.h b/apps/sbc/SBC.h index c84d699..7b2d861 100644 --- a/apps/sbc/SBC.h +++ b/apps/sbc/SBC.h @@ -41,7 +41,6 @@ using std::string; #define SBC_TIMER_ID_CALL_TIMERS_START 10 #define SBC_TIMER_ID_CALL_TIMERS_END 99 -#define SBC_TIMER_ID_CALL_TIMER 1 #define SBC_TIMER_ID_PREPAID_TIMEOUT 2 @@ -108,7 +107,6 @@ class SBCDialog : public AmB2BCallerSession, public CredentialHolder string to; string callid; - unsigned int call_timer; vector<pair<int, unsigned int> > call_timers; int outbound_interface; diff --git a/apps/sbc/SBCCallProfile.cpp b/apps/sbc/SBCCallProfile.cpp index dae9fc6..085c60e 100644 --- a/apps/sbc/SBCCallProfile.cpp +++ b/apps/sbc/SBCCallProfile.cpp @@ -157,9 +157,6 @@ bool SBCCallProfile::readFromConfiguration(const string& name, auth_aleg_credentials.user = cfg.getParameter("auth_aleg_user"); auth_aleg_credentials.pwd = cfg.getParameter("auth_aleg_pwd"); - call_timer_enabled = cfg.getParameter("enable_call_timer", "no") == "yes"; - call_timer = cfg.getParameter("call_timer"); - prepaid_enabled = cfg.getParameter("enable_prepaid", "no") == "yes"; prepaid_accmodule = cfg.getParameter("prepaid_accmodule"); prepaid_uuid = cfg.getParameter("prepaid_uuid"); @@ -380,10 +377,7 @@ bool SBCCallProfile::readFromConfiguration(const string& name, INFO("SBC: SIP auth %sabled\n", auth_enabled?"en":"dis"); INFO("SBC: SIP auth for A leg %sabled\n", auth_aleg_enabled?"en":"dis"); - INFO("SBC: call timer %sabled\n", call_timer_enabled?"en":"dis"); - if (call_timer_enabled) { - INFO("SBC: %s seconds\n", call_timer.c_str()); - } + INFO("SBC: prepaid %sabled\n", prepaid_enabled?"en":"dis"); if (prepaid_enabled) { INFO("SBC: acc_module = '%s'\n", prepaid_accmodule.c_str()); @@ -455,7 +449,6 @@ bool SBCCallProfile::operator==(const SBCCallProfile& rhs) const { sst_aleg_enabled == rhs.sst_aleg_enabled && auth_enabled == rhs.auth_enabled && auth_aleg_enabled == rhs.auth_aleg_enabled && - call_timer_enabled == rhs.call_timer_enabled && prepaid_enabled == rhs.prepaid_enabled && reply_translations == rhs.reply_translations && append_headers == rhs.append_headers && @@ -479,10 +472,6 @@ bool SBCCallProfile::operator==(const SBCCallProfile& rhs) const { auth_aleg_credentials.user == rhs.auth_aleg_credentials.user && auth_aleg_credentials.pwd == rhs.auth_aleg_credentials.pwd; } - if (call_timer_enabled) { - res = res && - call_timer == rhs.call_timer; - } if (prepaid_enabled) { res = res && prepaid_accmodule == rhs.prepaid_accmodule && @@ -529,8 +518,6 @@ string SBCCallProfile::print() const { res += "auth_aleg_enabled: " + string(auth_aleg_enabled?"true":"false") + "\n"; res += "auth_aleg_user: " + auth_aleg_credentials.user+"\n"; res += "auth_aleg_pwd: " + auth_aleg_credentials.pwd+"\n"; - res += "call_timer_enabled: " + string(call_timer_enabled?"true":"false") + "\n"; - res += "call_timer: " + call_timer + "\n"; res += "prepaid_enabled: " + string(prepaid_enabled?"true":"false") + "\n"; res += "prepaid_accmodule: " + prepaid_accmodule + "\n"; res += "prepaid_uuid: " + prepaid_uuid + "\n"; diff --git a/apps/sbc/SBCCallProfile.h b/apps/sbc/SBCCallProfile.h index b9ed2b4..ae91977 100644 --- a/apps/sbc/SBCCallProfile.h +++ b/apps/sbc/SBCCallProfile.h @@ -91,9 +91,6 @@ struct SBCCallProfile bool auth_aleg_enabled; UACAuthCred auth_aleg_credentials; - bool call_timer_enabled; - string call_timer; - bool prepaid_enabled; string prepaid_accmodule; string prepaid_uuid; @@ -127,7 +124,6 @@ struct SBCCallProfile sdpfilter_enabled(false), sdpfilter(Transparent), auth_enabled(false), - call_timer_enabled(false), prepaid_enabled(false), rtprelay_enabled(false) _______________________________________________ Semsdev mailing list [email protected] http://lists.iptel.org/mailman/listinfo/semsdev
