<p dir="ltr">Oh, actually, I see now. Change your query to</p>
<p dir="ltr">avp_db_query("select PBX from pbx where CustomerContext like '%" + $tu + "%' ", "$avp(PBX)");</p>
<p dir="ltr">In addition to that, you may consider using $tu{s.escape_common} to avoid sql injections.</p>
<div class="gmail_quote">On Oct 7, 2015 4:38 AM, "Podrigal, Aron" <<a href="mailto:aronp@guaranteedplus.com">aronp@guaranteedplus.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr">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.</p>
<div class="gmail_quote">On Oct 6, 2015 4:41 PM, "Travis Manson-Drake" <<a href="mailto:travism@simplybits.com" target="_blank">travism@simplybits.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="EN-US" link="#0563C1" vlink="#954F72">
<div>
<p class="MsoNormal">Hello Everyone,<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Hope you’re all doing well,<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">As per the awesome suggestion of one of the users on this mailing list I have tryied using the AVP_DB_Querry function<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">However it doesn’t look like I have it right or understand how to fully use it.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Heres what I currently have in my routing logic:<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">if (has_totag())<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"> {<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal"> #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<u></u><u></u></p>
<p class="MsoNormal"> avp_db_query("select PBX from pbx where CustomerContext like '%$tu%'", "$avp(PBX)");<u></u><u></u></p>
<p class="MsoNormal"> avp_pushto("$ru","$avp(PBX)");
<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal"> if (loose_route())<u></u><u></u></p>
<p class="MsoNormal"> {<u></u><u></u></p>
<p class="MsoNormal"> if (is_method("BYE"))<u></u><u></u></p>
<p class="MsoNormal"> {<u></u><u></u></p>
<p class="MsoNormal"> setflag(ACC_DO);<u></u><u></u></p>
<p class="MsoNormal"> setflag(ACC_FAILED);<u></u><u></u></p>
<p class="MsoNormal"> }<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">With that being programmed, shouldn’t the $avp(PBX) be pushed to the request URI or the sip packet?
<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">What I’m seeing is essentially nothing happening. <u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Can anyone give me any idea as to where I went wrong or what I may not be getting?<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Any input is greatly appreciated! Thank you in advanced!<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal" style="line-height:115%"><b><span style="font-size:10.0pt;line-height:115%;font-family:"Arial",sans-serif;color:navy">Travis Manson-Drake<u></u><u></u></span></b></p>
<p class="MsoNormal" style="line-height:115%"><b><span style="font-size:10.0pt;line-height:115%;font-family:"Arial",sans-serif;color:navy">Voice Systems Analyst L1<u></u><u></u></span></b></p>
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Arial",sans-serif;color:navy">Simply Bits, LLC</span></b><span style="font-size:12.0pt;font-family:"Arial",sans-serif;color:navy"><u></u><u></u></span></p>
<p class="MsoNormal"><b><i><span style="font-size:8.0pt;font-family:"Arial",sans-serif;color:#ffc000">Now You’re Thinkin’ Smart!</span></i></b><span style="font-family:"Arial",sans-serif;color:navy"><u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:115%"><span style="font-size:8.0pt;line-height:115%;font-family:"Arial",sans-serif;color:navy">5225 N. Sabino Canyon Road
<br>
Tucson, AZ 85750<u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:115%"><b><span style="font-size:8.0pt;line-height:115%;font-family:"Arial",sans-serif;color:navy">Phone:</span></b><span style="font-size:8.0pt;line-height:115%;font-family:"Arial",sans-serif;color:navy">
</span><span style="font-size:8.0pt;line-height:115%;font-family:"Arial",sans-serif;color:#002060"><a href="tel:520-545-0311" value="+15205450311" target="_blank">520-545-0311</a></span><span style="font-size:8.0pt;line-height:115%;font-family:"Arial",sans-serif;color:navy"><u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:115%"><b><span style="font-size:8.0pt;line-height:115%;font-family:"Arial",sans-serif;color:navy">Fax:</span></b><span style="font-size:8.0pt;line-height:115%;font-family:"Arial",sans-serif;color:navy">
</span><span style="font-size:8.0pt;line-height:115%;font-family:"Arial",sans-serif;color:#002060"><a href="tel:520-545-7252" value="+15205457252" target="_blank">520-545-7252</a><u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:115%"><b><span style="font-size:8.0pt;line-height:115%;font-family:"Arial",sans-serif;color:navy">Support Hotline</span></b><span style="font-size:8.0pt;line-height:115%;font-family:"Arial",sans-serif;color:navy">:
</span><span style="font-size:8.0pt;line-height:115%;font-family:"Arial",sans-serif;color:#002060"><a href="tel:5205450333" value="+15205450333" target="_blank">5205450333</a></span><span style="font-size:8.0pt;line-height:115%;font-family:"Arial",sans-serif;color:navy"><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:#1f497d"><a href="http://www.simplybits.com/" title="http://www.simplybits.com/" target="_blank"><span style="font-size:8.0pt;font-family:"Times New Roman",serif;color:#0563c1">www.simplybits.com</span></a><u></u><u></u></span></p>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div>
<br>_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
<br></blockquote></div>
</blockquote></div>