Module: sems
Branch: master
Commit: 11efdbbd43dcd281a3d011374f106117ae80c8bc
URL:    
http://git.sip-router.org/cgi-bin/gitweb.cgi/sems/?a=commit;h=11efdbbd43dcd281a3d011374f106117ae80c8bc

Author: Stefan Sayer <[email protected]>
Committer: Stefan Sayer <[email protected]>
Date:   Tue Sep 27 18:26:02 2011 +0200

sbc: fix generating timestamps for call control

---

 apps/sbc/SBC.cpp |   17 ++++++++++-------
 1 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/apps/sbc/SBC.cpp b/apps/sbc/SBC.cpp
index e435c12..9e2ffe4 100644
--- a/apps/sbc/SBC.cpp
+++ b/apps/sbc/SBC.cpp
@@ -567,6 +567,12 @@ void SBCDialog::onInvite(const AmSipRequest& req)
 
   string app_param = getHeader(req.hdrs, PARAM_HDR, true);
 
+  // prepaid
+  if (call_profile.cc_interfaces.size() ||
+      call_profile.prepaid_enabled || call_profile.cdr_enabled) {
+    gettimeofday(&prepaid_starttime, NULL);
+  }
+
   // process call control
   if (call_profile.cc_interfaces.size()) {
     for (vector<CCInterface>::iterator 
cc_it=call_profile.cc_interfaces.begin();
@@ -797,11 +803,6 @@ void SBCDialog::onInvite(const AmSipRequest& req)
     }
   }
 
-  // prepaid
-  if (call_profile.prepaid_enabled || call_profile.cdr_enabled) {
-    gettimeofday(&prepaid_starttime, NULL);
-  }
-
   if (call_profile.prepaid_enabled) {
     call_profile.prepaid_accmodule =
       replaceParameters(call_profile.prepaid_accmodule, "prepaid_accmodule", 
REPLACE_VALS);
@@ -1108,7 +1109,8 @@ void SBCDialog::onCallConnected(const AmSipReply& reply) {
   if (!startCallTimer())
     return;
 
-  if (call_profile.prepaid_enabled || call_profile.cdr_enabled) {
+  if (call_profile.cc_interfaces.size() ||
+      call_profile.prepaid_enabled || call_profile.cdr_enabled) {
     gettimeofday(&prepaid_acc_start, NULL);
   }
 
@@ -1119,7 +1121,8 @@ void SBCDialog::onCallConnected(const AmSipReply& reply) {
 }
 
 void SBCDialog::onCallStopped() {
-  if (call_profile.prepaid_enabled || call_profile.cdr_enabled) {
+  if (call_profile.cc_interfaces.size() ||
+      call_profile.prepaid_enabled || call_profile.cdr_enabled) {
     gettimeofday(&prepaid_acc_end, NULL);
   }
 

_______________________________________________
Semsdev mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/semsdev

Reply via email to