[OpenSIPS-Users] Using AVP_DB_Querry

Podrigal, Aron aronp at guaranteedplus.com
Wed Oct 7 11:48:49 CEST 2015


Oh, actually, I see now. Change your query to

avp_db_query("select PBX from pbx where CustomerContext like '%" + $tu +
"%' ", "$avp(PBX)");

In addition to that, you may consider using $tu{s.escape_common} to avoid
sql injections.
On Oct 7, 2015 4:38 AM, "Podrigal, Aron" <aronp at guaranteedplus.com> wrote:

> The syntax looks ok. Can you confirm that avp_db_query actually returned a
> value. Also what is the value stored in the avp(PBX) maybe you got NULL.
> On Oct 6, 2015 4:41 PM, "Travis Manson-Drake" <travism at simplybits.com>
> wrote:
>
>> Hello Everyone,
>>
>>
>>
>> Hope you’re all doing well,
>>
>>
>>
>> As per the awesome suggestion of one of the users on this mailing list I
>> have tryied using the AVP_DB_Querry function
>>
>>
>>
>> However it doesn’t look like I have it right or understand how to fully
>> use it.
>>
>>
>>
>> Heres what I currently have in my routing logic:
>>
>>
>>
>> if (has_totag())
>>
>>
>>
>>                 {
>>
>>
>>
>>                 #here we check the Database to see which PBX our UAC
>> belongs to, once Opensips get this info we store its value as a $avp
>> variable it can later refrence in the routing logic
>>
>>                 avp_db_query("select PBX from pbx where CustomerContext
>> like '%$tu%'", "$avp(PBX)");
>>
>>
>> avp_pushto("$ru","$avp(PBX)");
>>
>>
>>
>>
>>                                 if (loose_route())
>>
>>                                 {
>>
>>                                                 if (is_method("BYE"))
>>
>>                                                 {
>>
>>                                                 setflag(ACC_DO);
>>
>>                                                 setflag(ACC_FAILED);
>>
>>                                                 }
>>
>>
>>
>> With that being programmed, shouldn’t the $avp(PBX) be pushed to the
>> request URI or the sip packet?
>>
>>
>>
>> What I’m seeing is essentially nothing happening.
>>
>>
>>
>> Can anyone give me any idea as to where I went wrong or what I may not be
>> getting?
>>
>>
>>
>> Any input is greatly appreciated! Thank you in advanced!
>>
>>
>>
>> *Travis Manson-Drake*
>>
>> *Voice Systems Analyst L1*
>>
>> *Simply Bits, LLC*
>>
>> *Now You’re Thinkin’ Smart!*
>>
>> 5225 N. Sabino Canyon Road
>> Tucson, AZ 85750
>>
>> *Phone:* 520-545-0311
>>
>> *Fax:* 520-545-7252
>>
>> *Support Hotline*: 5205450333
>>
>> www.simplybits.com
>>
>>
>>
>> _______________________________________________
>> 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/20151007/6efb769a/attachment-0001.htm>


More information about the Users mailing list