Browse code

sbc: fix call-attempt event when generated after call-control refuse-action.

Raphael Coeffic authored on 31/05/2013 11:21:37
Showing 3 changed files
... ...
@@ -1002,7 +1002,8 @@ bool SBCCallLeg::CCStart(const AmSipRequest& req) {
1002 1002
 
1003 1003
     if(exception_occured) {
1004 1004
       SBCEventLog::instance()->
1005
-	logCallStart(dlg, 500, SIP_REPLY_SERVER_INTERNAL_ERROR);
1005
+	logCallStart(req, getLocalTag(), dlg->getRemoteUA(), "",
1006
+		     500, SIP_REPLY_SERVER_INTERNAL_ERROR);
1006 1007
       AmBasicSipDialog::reply_error(req, 500, SIP_REPLY_SERVER_INTERNAL_ERROR);
1007 1008
 
1008 1009
       // call 'end' of call control modules up to here
... ...
@@ -1064,7 +1065,7 @@ bool SBCCallLeg::CCStart(const AmSipRequest& req) {
1064 1065
 	      cc_if.cc_name.c_str(), headers.c_str());
1065 1066
 
1066 1067
 	  SBCEventLog::instance()->
1067
-	    logCallStart(dlg,
1068
+	    logCallStart(req, getLocalTag(), dlg->getRemoteUA(), "",
1068 1069
 			 ret[i][SBC_CC_REFUSE_CODE].asInt(),
1069 1070
 			 ret[i][SBC_CC_REFUSE_REASON].asCStr());
1070 1071
 
... ...
@@ -1254,7 +1255,8 @@ void SBCCallLeg::logCallStart(const AmSipReply& reply)
1254 1255
 					  (int)reply.code,reply.reason);
1255 1256
   }
1256 1257
   else {
1257
-    SBCEventLog::instance()->logCallStart(dlg,(int)reply.code,reply.reason);
1258
+    ERROR("could not log call-start/call-attempt (ci='%s';lt='%s')",
1259
+	  getCallID().c_str(),getLocalTag().c_str());
1258 1260
   }
1259 1261
 }
1260 1262
 
... ...
@@ -94,33 +94,7 @@ void _SBCEventLog::logCallStart(const AmSipRequest& req,
94 94
 	   start_event);
95 95
 }
96 96
 
97
-void _SBCEventLog::logCallStart(const AmBasicSipDialog* dlg, int code, 
98
-				const string& reason)
99
-{
100
-  size_t end;
101
-  AmArg start_event;
102
-  AmUriParser uri_parser;
103
-
104
-  if(uri_parser.parse_contact(dlg->getLocalParty(),0,end))
105
-    start_event["to"] = uri_parser.uri_str();
106
-  else start_event["to"] = dlg->getLocalParty();
107
-
108
-  start_event["from-ua"] = dlg->getRemoteUA();
109 97
   
110
-  if(uri_parser.parse_contact(dlg->getRemoteParty(),0,end))
111
-    start_event["from"] = uri_parser.uri_str();
112
-  else start_event["from"] = dlg->getRemoteParty();
113
-
114
-  start_event["r-uri"]    = dlg->getLocalUri();
115
-  start_event["call-id"]  = dlg->getCallid();
116
-  start_event["res-code"] = (int)code;
117
-  start_event["reason"]   = reason;
118
-  DBG("from-ua: '%s'",dlg->getRemoteUA().c_str());
119
-
120
-  logEvent(dlg->getLocalTag(),
121
-	   code >= 200 && code < 300 ? "call-start" : "call-attempt",
122
-	   start_event);
123
-}
124 98
 
125 99
 void _SBCEventLog::logCallEnd(const AmSipRequest& req,
126 100
 			      const string& local_tag,
... ...
@@ -36,8 +36,6 @@ public:
36 36
 		    const string& from_remote_ua, const string& to_remote_ua,
37 37
 		    int code, const string& reason);
38 38
 
39
-  void logCallStart(const AmBasicSipDialog* dlg, int code, 
40
-		    const string& reason);
41 39
 
42 40
   void logCallEnd(const AmSipRequest& req,
43 41
 		  const string& local_tag,