<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, &quot;Travis Manson-Drake&quot; &lt;<a href="mailto:travism@simplybits.com">travism@simplybits.com</a>&gt; 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(&quot;select PBX from pbx where CustomerContext like &#39;%$tu%&#39;&quot;, &quot;$avp(PBX)&quot;);<u></u><u></u></p>
<p class="MsoNormal">                avp_pushto(&quot;$ru&quot;,&quot;$avp(PBX)&quot;);                                                             
<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(&quot;BYE&quot;))<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:&quot;Arial&quot;,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:&quot;Arial&quot;,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:&quot;Arial&quot;,sans-serif;color:navy">Simply Bits, LLC</span></b><span style="font-size:12.0pt;font-family:&quot;Arial&quot;,sans-serif;color:navy"><u></u><u></u></span></p>
<p class="MsoNormal"><b><i><span style="font-size:8.0pt;font-family:&quot;Arial&quot;,sans-serif;color:#ffc000">Now You’re Thinkin’ Smart!</span></i></b><span style="font-family:&quot;Arial&quot;,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:&quot;Arial&quot;,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:&quot;Arial&quot;,sans-serif;color:navy">Phone:</span></b><span style="font-size:8.0pt;line-height:115%;font-family:&quot;Arial&quot;,sans-serif;color:navy">
</span><span style="font-size:8.0pt;line-height:115%;font-family:&quot;Arial&quot;,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:&quot;Arial&quot;,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:&quot;Arial&quot;,sans-serif;color:navy">Fax:</span></b><span style="font-size:8.0pt;line-height:115%;font-family:&quot;Arial&quot;,sans-serif;color:navy">
</span><span style="font-size:8.0pt;line-height:115%;font-family:&quot;Arial&quot;,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:&quot;Arial&quot;,sans-serif;color:navy">Support Hotline</span></b><span style="font-size:8.0pt;line-height:115%;font-family:&quot;Arial&quot;,sans-serif;color:navy">:
</span><span style="font-size:8.0pt;line-height:115%;font-family:&quot;Arial&quot;,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:&quot;Arial&quot;,sans-serif;color:navy"><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:&quot;Arial&quot;,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:&quot;Times New Roman&quot;,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">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>