Thank you both for that help.<br><br>I have gone ahead and successfully implemented the avp_db_query version and I now have a variable $avp(i:1) that contains the correct forwarding uri.<br><br>Now this is really where I show my ignorance.<br>
<br>How go I use $avp(i:1) correctly, considering that I am going to call t_relay()<br><br>if (!t_relay()) <br> { <br> sl_reply_error();<br> };<br><br>Is it simply a case of $ru = $avp(i:1);<br><br>That appears to work but I just want to make sure it is the correct approach.<br>
<br>Thanks again<br><br>pj<br><br><br><br><div class="gmail_quote">On Wed, Feb 24, 2010 at 2:25 PM, Brett Nemeroff <span dir="ltr"><<a href="mailto:brett@nemeroff.com" target="_blank">brett@nemeroff.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Something else I wanted to mention regarding your code here.. There is an obvious race condition if two calls come in at once.. your script writes the query results to a tmp file which could already be written by another call.<div>
<br></div><div>Overall, exec_dset should be avoided IMO. avp_db_query is fast, and easy to implement. I think you'll be happy with the results. The conversion should be simple enough, especially if your shell script really is that simple..</div>
<div><br></div><div>-Brett</div><div><br></div><div><br></div><div><br><div class="gmail_quote"><div>On Wed, Feb 24, 2010 at 12:44 PM, Phillip Jones <span dir="ltr"><<a href="mailto:pjintheusa@gmail.com" target="_blank">pjintheusa@gmail.com</a>></span> wrote:<br>
</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div></div><div>Hi there,<br><br>I am new to opensips - and I am trying to convert a script currently working in SER. I am almost done - but have one last issue that is getting the better of me. This is the script part:<br>
<br>exec_dset('<br>
<br> AQUERY="CALL Routing(\"$$SIP_USER\", \"$$SIP_SRCIP\", \"$$SIP_RURI\", \"$$SIP_ORURI\", False);";<br> AURI=`mysql -Broot -pxxxxxxx -e "$$AQUERY" opensips`;<br>
<br> echo $$AQUERY > /tmp/AQUERY.txt<br> echo $$AURI> /tmp/AURI.txt<br><br> if [ ! -z "$$AURI" ] ; then<br> <br> printf ("$$AURI"); <br>
fi;<br> <br> exit;<br> <br> echo > dev/null<br> <br> ');<br><br>AURI contains "+-----------------------------------+ | DestinationURI | +-----------------------------------+ | sip:121255555666@64.55.55.555:5060 | +-----------------------------------+" which kind of makes sense.<br>
<br>Opensips falls over with error: ERROR:core:parse_uri: bad uri - which also makes sense.<br><br>If I use printf ("sip:121255555666@64.55.55.555:5060"); then every thing works nicely.<br><br>What I am missing here? If this worked in SER - what has changed - a config in MySQL??<br>
<br>Any help would be much appreciated. I think I could use REGEX here to extract the uri, but I not familiar with the syntax in opensips.<br><br><br><br>Thanks<br><font color="#888888"><br><br>pj<br>
</font><br></div></div><div>_______________________________________________<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" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
<br></div></blockquote></div><br></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" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
<br></blockquote></div><br>