<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EstiloDeEmail17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=EN-US link=blue vlink=purple>
<div class=Section1>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Hi, <o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>It seems to me that you are simply running a call procedure in
the database and sending the query and uri to a txt file. You may call the
stored procedure in the database using avp_db_query, check the syntax in the
documentation. Instead of using echo, you may use xlog to send these queries to
a log file instead of simply overwrite AQUERY.txt and AURI.txt. Native commands
are faster than calling an external shell and are more reliable. <o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>$$SIP_USER - $rU<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>$$SIP_SRCIP - $si<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>$$SIP_RURI - $ru<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>$$SIP_ORURI - $tu – original ruri (my best guess)<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>If !(avp_db_query(“call routing(‘$rU, $si, $ru, $tu,
False’))) {<o:p></o:p></span></p>
<p class=MsoNormal><span lang=PT-BR style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'> xlog(“query failed, $rU, $si, $ru, $tu,
False”);<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>}<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>I have already used avp_db_query to call a stored procedure so works
and is much faster then exec_dset. <o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'> <o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>I hope it helps, <o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Flavio E. Goncalves<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'>
<p class=MsoNormal><b><span lang=PT-BR style='font-size:10.0pt;font-family:
"Tahoma","sans-serif"'>De:</span></b><span lang=PT-BR style='font-size:10.0pt;
font-family:"Tahoma","sans-serif"'> users-bounces@lists.opensips.org
[mailto:users-bounces@lists.opensips.org] <b>Em nome de </b>Phillip Jones<br>
<b>Enviada em:</b> Wednesday, February 24, 2010 3:44 PM<br>
<b>Para:</b> Users@lists.opensips.org<br>
<b>Assunto:</b> [OpenSIPS-Users] exec_dset / mySQL / SER<o:p></o:p></span></p>
</div>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>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>
<br>
<br>
pj<o:p></o:p></p>
</div>
</body>
</html>