Browse Source

pass call-id to update table for better logging

4.1
lazedo 9 years ago
committed by GitHub
parent
commit
cbd5635836
1 changed files with 14 additions and 6 deletions
  1. +14
    -6
      kamailio/presence_notify_sync-role.cfg

+ 14
- 6
kamailio/presence_notify_sync-role.cfg View File

@ -92,8 +92,8 @@ event_route[presence:notify-reply]
} }
if(@cfg_get.kazoo.presence_notify_log_to_table == 1) { if(@cfg_get.kazoo.presence_notify_log_to_table == 1) {
$var(Query) = $_s(REPLACE active_watchers_log SET sent_msg="$(mb{s.escape.common}{s.replace,\','}{s.replace,$$,})", received_msg="$(notify_reply($mb){s.escape.common}{s.replace,\','}{s.replace,$$,})", time=$TS, result=$notify_reply($rs), user_agent="$(subs(user_agent){s.escape.common}{s.replace,\','}{s.replace,$$,})", callid="$subs(callid)", to_user="$subs(to_user)", to_domain="$subs(to_domain)" where presentity_uri="$subs(uri)" watcher_username="$subs(watcher_username)" and watcher_domain="$subs(watcher_domain)" event="$subs(event)");
mq_add("presence_last_notity", "$subs(watcher_username)@$subs(watcher_domain)", "$var(Query)");
$var(Query) = $_s(REPLACE active_watchers_log SET sent_msg="$(mb{s.escape.common}{s.replace,\','}{s.replace,$$,})", received_msg="$(notify_reply($mb){s.escape.common}{s.replace,\','}{s.replace,$$,})", time=$TS, result=$notify_reply($rs), user_agent="$(subs(user_agent){s.escape.common}{s.replace,\','}{s.replace,$$,})", callid="$subs(callid)", to_user="$subs(to_user)", to_domain="$subs(to_domain)" where presentity_uri="$subs(uri)" and watcher_username="$subs(watcher_username)" and watcher_domain="$subs(watcher_domain)" and event="$subs(event)");
mq_add("presence_last_notity", "$subs(callid)", "$var(Query)");
} }
} }
@ -102,13 +102,21 @@ route[PRESENCE_LOG_TIMER_ROUTE]
{ {
$var(runloop) = 1; $var(runloop) = 1;
while(mq_fetch("presence_last_notity") == 1 && $var(runloop) < MAX_WHILE_LOOPS) { while(mq_fetch("presence_last_notity") == 1 && $var(runloop) < MAX_WHILE_LOOPS) {
# xlog("L_INFO", "Query : $mqv(presence_last_notity)");
if (sql_query("cb", "$mqv(presence_last_notity)") != 1) {
xlog("L_ERROR", "$ci|log|error updating active_watchers_log\n");
$var(ci) = $mqk(presence_last_notity);
xlog("L_DEBUG", "Query : $mqv(presence_last_notity)");
$var(sqlres) = sql_query("cb", "$mqv(presence_last_notity)");
xlog("L_DEBUG", "Query result : $var(sqlres)");
if($var(sqlres) < 0) {
xlog("L_ERROR", "$var(ci)|log|error updating active_watchers_log\n");
} else {
$var(nrows) = $sqlrows(cb);
xlog("L_DEBUG", "$var(ci)|log|end UPDATED $var(nrows)\n");
if($var(nrows) == 0) {
xlog("L_ERROR", "$var(ci)|log|error no rows affected when updating active_watchers_log\n");
}
} }
$var(runloop) = $var(runloop) + 1; $var(runloop) = $var(runloop) + 1;
} }
} }
route[PRESENCE_NOTIFY_AMQP] route[PRESENCE_NOTIFY_AMQP]


Loading…
Cancel
Save