Hello,<div><br></div><div>The $si is the source ip of the sip packet. Bu in a rtimer route there is no packet received from the network.</div><div><br></div><div>So your config is not going to work for what you want to do.</div>
<div><br></div><div>You can try to use mqueue to push sql queries from sip worker to rtimer as you need to write something to database.</div><div><br></div><div>Cheers,</div><div>Daniel<span></span><br><br>On Wednesday, September 3, 2014, aft <<a href="mailto:aftnix@gmail.com">aftnix@gmail.com</a>> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I'm trying to configure HOMER sip capture server to do some accounting<br>
of the cases when "503 Service Unavailable" message arrives from<br>
capture agents.<br>
<br>
I've implemented the following to record the source IPs from which 503<br>
message originates.<br>
<br>
<br>
<br>
<br>
onreply_route {<br>
......................<br>
......................<br>
......................<br>
<br>
 else if(status == "503") {<br>
                if($sht(a=>alarm::503) == $null) {<br>
                        $sht(a=>alarm::503) = 0;<br>
                        $sht(a=>alarm::$si::503) = 0;<br>
                }<br>
                xlog("Got 503");<br>
                xlog("($sht(a=>alarm::$si::503))");<br>
                $sht(a=>alarm::$si::503) = $sht(a=>alarm::$si::503) + 1;<br>
        }<br>
...................<br>
...................<br>
...................<br>
<br>
The following route supposed run periodically to update the databases.<br>
<br>
}<br>
<br>
route[TIMER_STATS] {<br>
<br>
.....................<br>
.....................<br>
<br>
 xlog("($sht(a=>alarm::$si::503))");<br>
    if($sht(a=>alarm::$si::503) > 0) {<br>
        sql_query("cb", "INSERT INTO alarm_data (create_date, type,<br>
total, description, source_ip) VALUES(NOW(), 'Too Many 503',<br>
$sht(a=>alarm::$si::503), 'service unavailable', $si)");<br>
    xlog("adding stuff to db");<br>
    }<br>
    $sht(a=>alarm::503) = 0;<br>
    $sht(a=>alarm::$si::503) = 0;<br>
<br>
<br>
}<br>
<br>
<br>
But the xlog("adding stuff to db") never executed. But in the first<br>
block of code, the log message to print the value<br>
$sht(a=>alarm::$si::503), which is shown to be non zero.<br>
<br>
Don't understand why its not working.<br>
--<br>
-Cheers<br>
-Arif<br>
<br>
_______________________________________________<br>
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list<br>
<a href="javascript:;" onclick="_e(event, 'cvml', 'sr-users@lists.sip-router.org')">sr-users@lists.sip-router.org</a><br>
<a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><br>
</blockquote></div><br><br>-- <br><div dir="ltr"><div>Daniel-Constantin Mierla - <a href="http://www.asipto.com" target="_blank">http://www.asipto.com</a></div><div><a href="http://twitter.com/#!/miconda" target="_blank">http://twitter.com/#!/miconda</a> - <a href="http://www.linkedin.com/in/miconda" target="_blank">http://www.linkedin.com/in/micond</a></div>
</div><br>