<span class="ik"></span>AsteriskGuide & Brett - thanks for help - I now have a working system :)<br><br>John! How are you? Yes - your code barley ran 3 years with zero problems before I had to jump in and fix it!<br><br>
Seriously - new datacenter so thought time to swap out SER.<br><br>I will ping you offline for an update.<br><br>Thanks again guys.<br><br><div class="gmail_quote">On Wed, Feb 24, 2010 at 4:18 PM, AsteriskGuide <span dir="ltr"><<a href="mailto:flavio@asteriskguide.com">flavio@asteriskguide.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;">
<div link="blue" vlink="purple" lang="EN-US">
<div>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">As simple as possible is usually the best way. </span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">$ru=avp(i:1); </span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">Is ok. </span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">Flavio E. Goncalves</span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span></p>
<div style="border-style: solid none none; border-color: rgb(181, 196, 223) -moz-use-text-color -moz-use-text-color; border-width: 1pt medium medium; padding: 3pt 0in 0in;">
<p class="MsoNormal"><b><span style="font-size: 10pt;" lang="PT-BR">De:</span></b><span style="font-size: 10pt;" lang="PT-BR"> <a href="mailto:users-bounces@lists.opensips.org" target="_blank">users-bounces@lists.opensips.org</a>
[mailto:<a href="mailto:users-bounces@lists.opensips.org" target="_blank">users-bounces@lists.opensips.org</a>] <b>Em nome de </b>Phillip Jones<br>
<b>Enviada em:</b> Wednesday, February 24, 2010 5:49 PM<br>
<b>Para:</b> OpenSIPS users mailling list<br>
<b>Assunto:</b> Re: [OpenSIPS-Users] exec_dset / mySQL / SER</span></p>
</div><div><div></div><div class="h5">
<p class="MsoNormal"> </p>
<p class="MsoNormal" style="margin-bottom: 12pt;">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>
</p>
<div>
<p class="MsoNormal">On Wed, Feb 24, 2010 at 2:25 PM, Brett Nemeroff <<a href="mailto:brett@nemeroff.com" target="_blank">brett@nemeroff.com</a>>
wrote:</p>
<p class="MsoNormal">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.</p>
<div>
<p class="MsoNormal"> </p>
</div>
<div>
<p class="MsoNormal">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..</p>
</div>
<div>
<p class="MsoNormal"> </p>
</div>
<div>
<p class="MsoNormal">-Brett</p>
</div>
<div>
<p class="MsoNormal"> </p>
</div>
<div>
<p class="MsoNormal"> </p>
</div>
<div>
<p class="MsoNormal"> </p>
<div>
<div>
<p class="MsoNormal">On Wed, Feb 24, 2010 at 12:44 PM, Phillip Jones <<a href="mailto:pjintheusa@gmail.com" target="_blank">pjintheusa@gmail.com</a>>
wrote:</p>
</div>
<blockquote style="border-style: none none none solid; border-color: -moz-use-text-color -moz-use-text-color -moz-use-text-color rgb(204, 204, 204); border-width: medium medium medium 1pt; padding: 0in 0in 0in 6pt; margin-left: 4.8pt; margin-right: 0in;">
<div>
<div>
<p class="MsoNormal" style="margin-bottom: 12pt;">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>
<span style="color: rgb(136, 136, 136);"><br>
<br>
pj</span></p>
</div>
</div>
<div>
<p class="MsoNormal" style="margin-bottom: 12pt;">_______________________________________________<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></p>
</div>
</blockquote>
</div>
<p class="MsoNormal"> </p>
</div>
<p class="MsoNormal" style="margin-bottom: 12pt;"><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></p>
</div>
<p class="MsoNormal"> </p>
</div></div></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" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
<br></blockquote></div><br>