<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div><span>Thank you Ali, for your prompt response. I will read about it to implement it. </span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal; "><span><br></span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal; "><span>Still i am a bit puzzled as why this is not working in such a simple scenario. It worked in the old SER box.</span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal; "><span><br></span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new
roman', 'new york', times, serif; background-color: transparent; font-style: normal; ">Regards,</div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal; "><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal; ">Xavier</div><div><br></div> <div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; "> <div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; "> <div dir="ltr"> <font size="2" face="Arial"> <hr size="1"> <b><span style="font-weight:bold;">De:</span></b> Ali Pey <alipey@gmail.com><br> <b><span style="font-weight: bold;">Para:</span></b> Xavier Herlindo <xherlindo@yahoo.com.mx>; OpenSIPS users mailling list <users@lists.opensips.org> <br> <b><span
style="font-weight: bold;">Enviado:</span></b> Sábado, 6 de octubre, 2012 19:09:40<br> <b><span style="font-weight: bold;">Asunto:</span></b> Re: [OpenSIPS-Users] bash shell variable not kept when run in opensips.cfg<br> </font> </div> <br><div id="yiv1326962164">Hello Xavier,<div><br></div><div>Try the avops module. This is your best option in this scenario:</div><div><br></div><div><a rel="nofollow" target="_blank" href="http://www.opensips.org/html/docs/modules/1.8.x/avpops.html#id292750">http://www.opensips.org/html/docs/modules/1.8.x/avpops.html#id292750</a></div>
<div><br></div><div>Regards,</div><div>Ali Pey</div><div><br><div class="yiv1326962164gmail_quote">On Sat, Oct 6, 2012 at 7:38 PM, Xavier Herlindo <span dir="ltr"><<a rel="nofollow" ymailto="mailto:xherlindo@yahoo.com.mx" target="_blank" href="mailto:xherlindo@yahoo.com.mx">xherlindo@yahoo.com.mx</a>></span> wrote:<br>
<blockquote class="yiv1326962164gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div><div style="font-size: 12pt; font-family: 'times new roman', 'new york', times, serif; "><div style="font-size:12pt;">
Hello all,</div><div style="font-size:12pt;"><br></div><div style="font-style:normal;font-size:16px;background-color:transparent;">
this is my first post, so please bare with me if i commit any protocol error. All comments are welcome. Thanks all in advance for any help i can get.</div><div style="font-style:normal;font-size:16px;background-color:transparent;">
<br></div><div style="font-style:normal;font-size:16px;background-color:transparent;">I am running Opensips 8.1 with a Centos 5.8 install. <span style="background-color:transparent;">I am setting up a redirect server. Only using the slo.so, mi_fifo.so, rr.so (not sure if i really need this one) and exec.so modules.</span></div>
<div style="font-style:normal;font-size:16px;background-color:transparent;"><br></div><div style="font-style:normal;font-size:16px;background-color:transparent;">
I am trying to run a simple bash script that checks if the number in the URI exists in a mysq table and if so, the script rewrites the prefix and ip address to redirect. If not, there is a default address to redirect to.</div>
<div style="font-style:normal;font-size:16px;background-color:transparent;"><br></div><div style="font-style:normal;font-size:16px;background-color:transparent;">
The sh script works fine as i have tested it directly from the shell, running without issues. If i input an URI with an existing number in my mysql table, the script connects to the db, validates it, an the output is the modified URI as expected. <span style="background-color:transparent;">Now if the script is called from within opensips.cfg file, the script is not validating in mysql. The opensips log file show no errors when running the sh file. If i try to set an incorrect connection param string there is no change either, as if the line is ignored.</span></div>
<div style="font-style:normal;font-size:16px;background-color:transparent;"><br></div><div style="font-style:normal;font-size:16px;background-color:transparent;">
This is my unrecognized variable:</div><div style="font-style:normal;font-size:16px;background-color:transparent;"><br></div><div style="background-color:transparent;">
<font face="times new roman, new york, times, serif">exec_query=`mysql -u USER --password=TEST -s -D MY_DB -e "SELECT numB FROM valid_numb WHERE numB = '123';"`</font><br></div><div style="font-style:normal;font-size:16px;background-color:transparent;">
<br></div><div style="font-style:normal;font-size:16px;background-color:transparent;"> If i echo the value for exec_query it is empty when running
within opensips.cfg </div><div style="font-style:normal;font-size:16px;background-color:transparent;">Running in the bash prompt the value of exec_query is set correctly.<br>
</div><div style="font-style:normal;font-size:16px;background-color:transparent;"><br></div><div style="font-style:normal;font-size:16px;background-color:transparent;">
This same shell script was tested in an old SER box without not issues, so i think it is something out of the script directly related to opensips configuration. </div><div style="font-style:normal;font-size:16px;background-color:transparent;">
<br></div><div style="font-style:normal;font-size:16px;background-color:transparent;">Do you know what may be the problem?</div><div style="font-style:normal;font-size:16px;background-color:transparent;">
<br></div><div style="font-style:normal;font-size:16px;background-color:transparent;"><span style="background-color:transparent;">Regards,</span><br></div>
<div style="font-style:normal;font-size:16px;background-color:transparent;"><br></div><div style="font-style:normal;font-size:16px;background-color:transparent;">
Xavier</div></div></div><br>_______________________________________________<br>
Users mailing list<br>
<a rel="nofollow" ymailto="mailto:Users@lists.opensips.org" target="_blank" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a><br>
<a rel="nofollow" target="_blank" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
<br></blockquote></div><br></div>
</div><br><br> </div> </div> </div></body></html>