87 ErrLog(<<
"AccountingCollector::doRegistrationAccounting: missing proper callId header: " << msg);
91 regEvent[
"EventId"] = Number(regevent);
95 regEvent[
"EventName"] = String(
"Registration Added");
98 regEvent[
"EventName"] = String(
"Registration Refreshed");
101 regEvent[
"EventName"] = String(
"Registration Removed");
104 regEvent[
"EventName"] = String(
"Registration Removed All");
107 regEvent[
"Datetime"] = String(
Data::from(datetime).c_str());
108 regEvent[
"CallId"] = String(msg.
header(
h_CallId).value().c_str());
111 if(!msg.
header(h_To).displayName().empty())
113 regEvent[
"User"][
"DisplayName"] = String(msg.
header(h_To).displayName().c_str());
121 if(!msg.
header(h_From).displayName().empty())
123 regEvent[
"From"][
"DisplayName"] = String(msg.
header(h_From).displayName().c_str());
128 if(msg.
exists(h_Contacts) && !msg.
header(h_Contacts).empty())
131 NameAddrs::const_iterator contactIt = msg.
header(h_Contacts).begin();
132 for(; contactIt != msg.
header(h_Contacts).end(); contactIt++)
134 if(contactIt->isWellFormed())
139 if(!arrayContacts.Empty())
141 regEvent[
"Contacts"] = arrayContacts;
146 regEvent[
"Expires"] = Number(msg.
header(h_Expires).value());
148 if(mRegistrationAccountingAddViaHeaders &&
152 Vias::const_iterator viaIt = msg.
header(h_Vias).begin();
153 for(; viaIt != msg.
header(h_Vias).end(); viaIt++)
155 if(viaIt->isWellFormed())
160 if(!arrayVias.Empty())
162 regEvent[
"Vias"] = arrayVias;
169 regEvent[
"ClientPublicAddress"][
"IP"] = String(
Tuple::inet_ntop(publicAddress).c_str());
170 regEvent[
"ClientPublicAddress"][
"Port"] = Number(publicAddress.
getPort());
172 if(mRegistrationAccountingAddRoutingHeaders &&
176 NameAddrs::const_iterator routeIt = msg.
header(h_Routes).begin();
177 for(; routeIt != msg.
header(h_Routes).end(); routeIt++)
179 if(routeIt->isWellFormed())
184 if(!arrayRoutes.Empty())
186 regEvent[
"Routes"] = arrayRoutes;
189 if(mRegistrationAccountingAddRoutingHeaders &&
193 NameAddrs::const_iterator pathIt = msg.
header(h_Paths).begin();
194 for(; pathIt != msg.
header(h_Paths).end(); pathIt++)
196 if(pathIt->isWellFormed())
201 if(!arrayPaths.Empty())
203 regEvent[
"Paths"] = arrayPaths;
208 regEvent[
"UserAgent"] = String(msg.
header(h_UserAgent).value().c_str());
210 pushEventObjectToQueue(regEvent, RegistrationEventType);
219 if(msg.
method() == INVITE && !msg.
header(h_To).exists(p_tag))
228 ErrLog(<<
"AccountingCollector::doSessionAccounting: missing proper callId header: " << msg);
233 sessionEvent[
"EventName"] = String(
"Session Created");
234 sessionEvent[
"Datetime"] = String(
Data::from(datetime).c_str());
235 sessionEvent[
"CallId"] = String(msg.
header(
h_CallId).value().c_str());
239 if(!msg.
header(h_To).displayName().empty())
241 sessionEvent[
"To"][
"DisplayName"] = String(msg.
header(h_To).displayName().c_str());
247 if(!msg.
header(h_From).displayName().empty())
249 sessionEvent[
"From"][
"DisplayName"] = String(msg.
header(h_From).displayName().c_str());
257 if(mSessionAccountingAddViaHeaders &&
261 Vias::const_iterator viaIt = msg.
header(h_Vias).begin();
262 for(; viaIt != msg.
header(h_Vias).end(); viaIt++)
264 if(viaIt->isWellFormed())
269 if(!arrayVias.Empty())
271 sessionEvent[
"Vias"] = arrayVias;
278 sessionEvent[
"ClientPublicAddress"][
"IP"] = String(
Tuple::inet_ntop(publicAddress).c_str());
279 sessionEvent[
"ClientPublicAddress"][
"Port"] = Number(publicAddress.
getPort());
281 if(mSessionAccountingAddRoutingHeaders &&
285 NameAddrs::const_iterator routeIt = msg.
header(h_Routes).begin();
286 for(; routeIt != msg.
header(h_Routes).end(); routeIt++)
288 if(routeIt->isWellFormed())
293 if(!arrayRoutes.Empty())
295 sessionEvent[
"Routes"] = arrayRoutes;
298 if(mSessionAccountingAddRoutingHeaders &&
299 msg.
exists(h_RecordRoutes) && !msg.
header(h_RecordRoutes).empty())
301 Array arrayRecordRoutes;
302 NameAddrs::const_iterator recordRouteIt = msg.
header(h_RecordRoutes).begin();
303 for(; recordRouteIt != msg.
header(h_RecordRoutes).end(); recordRouteIt++)
305 if(recordRouteIt->isWellFormed())
310 if(!arrayRecordRoutes.Empty())
312 sessionEvent[
"RecordRoutes"] = arrayRecordRoutes;
317 sessionEvent[
"UserAgent"] = String(msg.
header(h_UserAgent).value().c_str());
320 pushEventObjectToQueue(sessionEvent, SessionEventType);
328 ErrLog(<<
"AccountingCollector::doSessionAccounting: missing proper callId header: " << msg);
333 sessionEvent[
"EventName"] = String(
"Session Routed");
334 sessionEvent[
"Datetime"] = String(
Data::from(datetime).c_str());
335 sessionEvent[
"CallId"] = String(msg.
header(
h_CallId).value().c_str());
337 if(mSessionAccountingAddRoutingHeaders &&
341 NameAddrs::const_iterator routeIt = msg.
header(h_Routes).begin();
342 for(; routeIt != msg.
header(h_Routes).end(); routeIt++)
344 if(routeIt->isWellFormed())
349 if(!arrayRoutes.Empty())
351 sessionEvent[
"Routes"] = arrayRoutes;
354 pushEventObjectToQueue(sessionEvent, SessionEventType);
357 else if(msg.
method() == BYE && received)
363 ErrLog(<<
"AccountingCollector::doSessionAccounting: missing proper callId header: " << msg);
368 sessionEvent[
"EventName"] = String(
"Session Ended");
369 sessionEvent[
"Datetime"] = String(
Data::from(datetime).c_str());
370 sessionEvent[
"CallId"] = String(msg.
header(
h_CallId).value().c_str());
373 if(!msg.
header(h_From).displayName().empty())
375 sessionEvent[
"From"][
"DisplayName"] = String(msg.
header(h_From).displayName().c_str());
382 sessionEvent[
"Reason"][
"Value"] = String(msg.
header(h_Reasons).front().value().c_str());
383 if(msg.
header(h_Reasons).front().exists(p_cause))
385 sessionEvent[
"Reason"][
"Cause"] = Number(msg.
header(h_Reasons).front().param(p_cause));
387 if(msg.
header(h_Reasons).front().exists(p_text) && !msg.
header(h_Reasons).front().param(p_text).empty())
389 sessionEvent[
"Reason"][
"Text"] = String(msg.
header(h_Reasons).front().param(p_text).c_str());
392 pushEventObjectToQueue(sessionEvent, SessionEventType);
394 else if(msg.
method() == CANCEL && received)
400 ErrLog(<<
"AccountingCollector::doSessionAccounting: missing proper callId header: " << msg);
405 sessionEvent[
"EventName"] = String(
"Session Cancelled");
406 sessionEvent[
"Datetime"] = String(
Data::from(datetime).c_str());
407 sessionEvent[
"CallId"] = String(msg.
header(
h_CallId).value().c_str());
411 sessionEvent[
"Reason"][
"Value"] = String(msg.
header(h_Reasons).front().value().c_str());
412 if(msg.
header(h_Reasons).front().exists(p_cause))
414 sessionEvent[
"Reason"][
"Cause"] = Number(msg.
header(h_Reasons).front().param(p_cause));
416 if(msg.
header(h_Reasons).front().exists(p_text) && !msg.
header(h_Reasons).front().param(p_text).empty())
418 sessionEvent[
"Reason"][
"Text"] = String(msg.
header(h_Reasons).front().param(p_text).c_str());
421 pushEventObjectToQueue(sessionEvent, SessionEventType);
423 else if(msg.
method() == REFER && received && msg.
header(h_To).exists(p_tag))
430 ErrLog(<<
"AccountingCollector::doSessionAccounting: missing proper callId header: " << msg);
435 sessionEvent[
"EventName"] = String(
"Session Redirected");
436 sessionEvent[
"Datetime"] = String(
Data::from(datetime).c_str());
437 sessionEvent[
"CallId"] = String(msg.
header(
h_CallId).value().c_str());
440 if(!msg.
header(h_From).displayName().empty())
442 sessionEvent[
"ReferredBy"][
"DisplayName"] = String(msg.
header(h_From).displayName().c_str());
450 pushEventObjectToQueue(sessionEvent, SessionEventType);
456 if(!received && msg.
method() == INVITE)
465 ErrLog(<<
"AccountingCollector::doSessionAccounting: missing proper callId header: " << msg);
470 sessionEvent[
"EventName"] = String(
"Session Established");
471 sessionEvent[
"Datetime"] = String(
Data::from(datetime).c_str());
472 sessionEvent[
"CallId"] = String(msg.
header(
h_CallId).value().c_str());
477 if(mSessionAccountingAddRoutingHeaders &&
478 msg.
exists(h_RecordRoutes) && !msg.
header(h_RecordRoutes).empty())
480 Array arrayRecordRoutes;
481 NameAddrs::const_iterator recordRouteIt = msg.
header(h_RecordRoutes).begin();
482 for(; recordRouteIt != msg.
header(h_RecordRoutes).end(); recordRouteIt++)
484 if(recordRouteIt->isWellFormed())
489 if(!arrayRecordRoutes.Empty())
491 sessionEvent[
"RecordRoutes"] = arrayRecordRoutes;
496 sessionEvent[
"UserAgent"] = String(msg.
header(h_UserAgent).value().c_str());
499 pushEventObjectToQueue(sessionEvent, SessionEventType);
509 ErrLog(<<
"AccountingCollector::doSessionAccounting: missing proper callId header: " << msg);
514 sessionEvent[
"EventName"] = String(
"Session Redirected");
515 sessionEvent[
"Datetime"] = String(
Data::from(datetime).c_str());
516 sessionEvent[
"CallId"] = String(msg.
header(
h_CallId).value().c_str());
517 if(msg.
exists(h_Contacts) && !msg.
header(h_Contacts).empty())
520 NameAddrs::const_iterator contactIt = msg.
header(h_Contacts).begin();
521 for(; contactIt != msg.
header(h_Contacts).end(); contactIt++)
523 if(contactIt->isWellFormed())
528 if(!arrayContacts.Empty())
530 sessionEvent[
"TargetUris"] = arrayContacts;
535 sessionEvent[
"UserAgent"] = String(msg.
header(h_UserAgent).value().c_str());
537 pushEventObjectToQueue(sessionEvent, SessionEventType);
548 ErrLog(<<
"AccountingCollector::doSessionAccounting: missing proper callId header: " << msg);
552 sessionEvent[
"EventName"] = String(
"Session Error");
553 sessionEvent[
"Datetime"] = String(
Data::from(datetime).c_str());
554 sessionEvent[
"CallId"] = String(msg.
header(
h_CallId).value().c_str());
563 sessionEvent[
"Warning"][
"Code"] = Number(msg.
header(h_Warnings).front().code());
564 if(!msg.
header(h_Warnings).front().text().empty())
566 sessionEvent[
"Warning"][
"Text"] = String(msg.
header(h_Warnings).front().text().c_str());
573 sessionEvent[
"Reason"][
"Value"] = String(msg.
header(h_Reasons).front().value().c_str());
574 if(msg.
header(h_Reasons).front().exists(p_cause))
576 sessionEvent[
"Reason"][
"Cause"] = Number(msg.
header(h_Reasons).front().param(p_cause));
578 if(msg.
header(h_Reasons).front().exists(p_text) && !msg.
header(h_Reasons).front().param(p_text).empty())
580 sessionEvent[
"Reason"][
"Text"] = String(msg.
header(h_Reasons).front().param(p_text).c_str());
585 sessionEvent[
"UserAgent"] = String(msg.
header(h_UserAgent).value().c_str());
587 pushEventObjectToQueue(sessionEvent, SessionEventType);