Hello,

The $si is the source ip of the sip packet. Bu in a rtimer route there is
no packet received from the network.

So your config is not going to work for what you want to do.

You can try to use mqueue to push sql queries from sip worker to rtimer as
you need to write something to database.

Cheers,
Daniel

On Wednesday, September 3, 2014, aft <aft...@gmail.com> wrote:

> I'm trying to configure HOMER sip capture server to do some accounting
> of the cases when "503 Service Unavailable" message arrives from
> capture agents.
>
> I've implemented the following to record the source IPs from which 503
> message originates.
>
>
>
>
> onreply_route {
> ......................
> ......................
> ......................
>
>  else if(status == "503") {
>                 if($sht(a=>alarm::503) == $null) {
>                         $sht(a=>alarm::503) = 0;
>                         $sht(a=>alarm::$si::503) = 0;
>                 }
>                 xlog("Got 503");
>                 xlog("($sht(a=>alarm::$si::503))");
>                 $sht(a=>alarm::$si::503) = $sht(a=>alarm::$si::503) + 1;
>         }
> ...................
> ...................
> ...................
>
> The following route supposed run periodically to update the databases.
>
> }
>
> route[TIMER_STATS] {
>
> .....................
> .....................
>
>  xlog("($sht(a=>alarm::$si::503))");
>     if($sht(a=>alarm::$si::503) > 0) {
>         sql_query("cb", "INSERT INTO alarm_data (create_date, type,
> total, description, source_ip) VALUES(NOW(), 'Too Many 503',
> $sht(a=>alarm::$si::503), 'service unavailable', $si)");
>     xlog("adding stuff to db");
>     }
>     $sht(a=>alarm::503) = 0;
>     $sht(a=>alarm::$si::503) = 0;
>
>
> }
>
>
> But the xlog("adding stuff to db") never executed. But in the first
> block of code, the log message to print the value
> $sht(a=>alarm::$si::503), which is shown to be non zero.
>
> Don't understand why its not working.
> --
> -Cheers
> -Arif
>
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users@lists.sip-router.org <javascript:;>
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>


-- 
Daniel-Constantin Mierla - http://www.asipto.com
http://twitter.com/#!/miconda - http://www.linkedin.com/in/micond
<http://www.linkedin.com/in/miconda>
_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

Reply via email to