[OpenSIPS-Users] Boolean values from DB and avp

Patrick Wakano pwakano at gmail.com
Mon Feb 23 18:41:40 CET 2015


Thanks Vlad!

As an last annoying comment, I think it would be nice to apply this kind of
boolean lexer to the DB queries too!

On Mon, Feb 23, 2015 at 12:15 PM, Vlad Paiu <vladpaiu at opensips.org> wrote:

>  Hello,
>
> From the OpenSIPS lexer :
>
> YES                     "yes"|"true"|"on"|"enable"
> NO                      "no"|"false"|"off"|"disable"
>
> All of them are equivalent, and are correspondent to integer 1 and
> respectively integer 0.
>
> Best Regards,
>
> Vlad Paiu
> OpenSIPS Developerhttp://www.opensips-solutions.com
>
> On 23.02.2015 17:09, Patrick Wakano wrote:
>
> Thank you very much for the answer Vlad!
>
>  This raises me another question. I've been using boolean values with avp
> and found no problem so far. For instance, I set $avp(test) = true, and
> then use it in an "if" clause and everything works fine! But I'm really not
> sure if this is correct, and the docs are a little fuzzy regarding avp and
> boolean values. So can you clarify me what is the real support of boolean
> types in Opensips?
>
>  Regards,
> Patrick
>
>
> On Mon, Feb 23, 2015 at 11:58 AM, Vlad Paiu <vladpaiu at opensips.org> wrote:
>
>>  Hello,
>>
>> In OpenSIPS, AVPs can have either integer or string values.
>> For boolean values in Postgres, the module internally stores them as
>> strings, so you will either get 't' or 'f' in your script - so yes, it's an
>> OpenSIPS restriction in some ways.
>>
>> Best Regards,
>>
>> Vlad Paiu
>> OpenSIPS Developerhttp://www.opensips-solutions.com
>>
>>  On 23.02.2015 16:36, Patrick Wakano wrote:
>>
>>  Hello list,
>>
>>  I've been using Opensips 11.3.1 with a Postgres DB 9.1 and noticed that
>> if I perform an avp_db_query call to retrieve any boolean value from DB,
>> the result gives me an avp with a string and not the boolean value. For
>> instance if I have any false value in my DB, my avp_db_query gives me an
>> avp with the string value "f" and not the boolean value false.
>> Is this behaviour due to some misconfiguration in my DB or Opensips, or
>> is it an Opensips restriction? The docs shows "The value type of the AVP
>> (string or integer) will be derived from the type of the columns." but have
>> no mention to boolean...
>>
>>  Thanks,
>>
>>  Patrick
>>
>>
>>  _______________________________________________
>> Users mailing listUsers at lists.opensips.orghttp://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>
>>
>>
>> _______________________________________________
>> Users mailing list
>> Users at lists.opensips.org
>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>
>>
>
>
> _______________________________________________
> Users mailing listUsers at lists.opensips.orghttp://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20150223/c500eb80/attachment-0001.htm>


More information about the Users mailing list