[Users] The usrloc table, Oracle, and Asterisk

Daniel-Constantin Mierla daniel at voice-system.ro
Fri Dec 15 17:37:15 CET 2006


Hello,

could you rint the value of the Expires header and see what you get? Try:

xlog("Expires header is [$hdr(expires)]\n");

Cheers,
Daniel



On 12/15/06 18:29, Juan Carlos Castro y Castro wrote:
> Jerome Martin escreveu:
>> On Fri, 2006-12-15 at 12:07 -0200, Juan Carlos Castro y Castro wrote:
>>  
>>> OK, now I'm trying to do something along the lines of:
>>>
>>> if ("$hdr(expires)" > 3600) {
>>>         avp_db_query("UPDATE sip_conf SET ipaddr='$si', port='$sp', 
>>> regseconds=$Ts+$hdr(expires), useragent='$ua' WHERE name='$au'");
>>> } else {
>>>         avp_db_query("UPDATE sip_conf SET ipaddr='$si', port='$sp', 
>>> regseconds=$Ts+3600, useragent='$ua' WHERE name='$au'");
>>> };
>>>
>>> But I get a syntax error at the "if". How can I do such a comparison?
>>>     
>>
>> Take a look at avpcheck() :
>>
>> http://www.openser.org/docs/modules/1.1.x/avpops.html#AEN38
>
> OK, now I'm doing the following, but the "if" always yields false 
> regardless of the passed Expires value. At first I thought the problem 
> was interpreting values as strings, but in that case it would yield 
> true for an Expires of zero. It doesn't. Could it be some flags 
> problem? Using "/g" at the end does no good.
>
> if (avp_check("$hdr(expires)","lt/3600")) {
>        avp_db_query("UPDATE sip_conf SET ipaddr='$si', port='$sp', 
> regseconds=$Ts+$hdr(expires), useragent='$ua' WHERE name='$au'");
> } else {
>        avp_db_query("UPDATE sip_conf SET ipaddr='$si', port='$sp', 
> regseconds=$Ts+3600, useragent='$ua' WHERE name='$au'");
> };
>
> I also tried writing the value to an AVP beforehand. Still always false:
>
> avp_write("$hdr(expires)","$avp(i:777)");
> if (avp_check("$avp(i:777)","lt/3600/g")) {
>        avp_db_query("UPDATE sip_conf SET ipaddr='$si', port='$sp', 
> regseconds=$Ts+$hdr(expires), useragent='$ua' WHERE name='$au'");
> } else {
>        avp_db_query("UPDATE sip_conf SET ipaddr='$si', port='$sp', 
> regseconds=$Ts+3600, useragent='$ua' WHERE name='$au'");
> };
>
>
> _______________________________________________
> Users mailing list
> Users at openser.org
> http://openser.org/cgi-bin/mailman/listinfo/users
>




More information about the sr-users mailing list