<div dir="ltr">Nikhitha,<div><br></div><div>I doubt that the poor response time is caused by the script itself. For example, from the shell, time your script using "time <script.sh>". You will probably get a time around 10ms. This should not be a concern, and would be difficult to improve.</div>
<div>The problem most likely is the choice of using 'system'. A system() call is an expensive choice in terms of performance. There is a lot of overhead going on in the operating system in the process.</div><div>
You can perform a few quick tests to see where your issue lies: Use the freeswitch logs to see what the total time of the system call is, and then use the "time <script.sh>" to see what the time is from the shell. I think you will find that the issue is "system" and not the script itself.</div>
<div><br></div><div>Is the performance unacceptable because a live caller experiences an unacceptable pause? If so, can you run the system command prior to the start of the script? There are other approaches to solve your problem, but they increase in complexity.</div>
<div><br></div><div>Ian.<br><br><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, May 9, 2014 at 3:24 AM, Nikhitha T <span dir="ltr"><<a href="mailto:nikhitha.voxta@gmail.com" target="_blank">nikhitha.voxta@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>Ian <br><br></div>Thank you for the reply that worked for me and I have one more doubt.<br><br>
</div>While executing a shell script from the dial plan it is consuming much time to execute that script.How can i overcome this problem in reducing execution time of shell script when used in dial plan.<br>
</div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, May 8, 2014 at 7:35 PM, Ian McMaster <span dir="ltr"><<a href="mailto:ian.mcmaster@gmail.com" target="_blank">ian.mcmaster@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Nikhitha,<div><br></div><div>You are using 'sed' to print the first line (head -1), which will include a line return.</div>
<div><br></div><div>This will work:</div><div>Create a shell script "getplayfile.sh" and in your dialplan use:</div>
<div><b style="font-family:arial,sans-serif;font-size:13px"> data="RESULT=${system getplayfile.sh}"</b><br></div><div><b style="font-family:arial,sans-serif;font-size:13px"><br></b></div><div><font face="arial, sans-serif">The shell script can use tr to strip out the end of line as follows:</font></div>
<div><font face="arial, sans-serif">sed -n 1p /nfs/th/play/${uuid} | tr "\n" "\0"</font></div></div><div class="gmail_extra"><br><br><div class="gmail_quote"><div><div>On Thu, May 8, 2014 at 6:55 AM, Nikhitha T <span dir="ltr"><<a href="mailto:nikhitha.voxta@gmail.com" target="_blank">nikhitha.voxta@gmail.com</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div dir="ltr">In freeswitch as I am setting the variable like this <br><br><b><action application="set" data="RESULT=${system sed -n 1p /nfs/th/play/${uuid}}" inline="true"/></b><br>
<br>
Here i am trying to assign the wav file path to the variable,but here the problem is it is getting assigned as <br><b><br>2014-05-08 13:34:56.659049 [DEBUG] mod_dptools.c:1402 sofia/internal/<a href="mailto:1002@192.168.0.106" target="_blank">1002@192.168.0.106</a> SET [RESULT]=[/usr/local/freeswitch/sounds/en/us/callie/directory/8000/dir-for_prev.wav<br>
<br>]</b><br><br>The variable RESULT is not being set properly,The closing square bracket is coming to the new line as it should be in the same line immediately after the path.So while playing the wav file it is showing the error as<br>
<br><b>2014-05-08 13:34:56.679046 [ERR] switch_core_file.c:150 Invalid file format [wav<br><br>] for [/usr/local/freeswitch/sounds/en/us/callie/directory/8000/dir-for_prev.wav<br><br>]!<br></b><br><p>Can anyone help me in solving this issue.Thanks in advance</p>
<span><font color="#888888">
<br><br clear="all"><br>-- <br>Thanks & Regards<br>---------------------------------<br>Nikhitha<br>
</font></span></div>
<br></div></div>_________________________________________________________________________<br>
Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org" target="_blank">consulting@freeswitch.org</a><br>
<a href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a><br>
<br>
FreeSWITCH-powered IP PBX: The CudaTel Communication Server<br>
<a href="http://www.cudatel.com" target="_blank">http://www.cudatel.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<a href="http://wiki.freeswitch.org" target="_blank">http://wiki.freeswitch.org</a><br>
<a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><br></div>
<br>_________________________________________________________________________<br>
Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org" target="_blank">consulting@freeswitch.org</a><br>
<a href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a><br>
<br>
FreeSWITCH-powered IP PBX: The CudaTel Communication Server<br>
<a href="http://www.cudatel.com" target="_blank">http://www.cudatel.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<a href="http://wiki.freeswitch.org" target="_blank">http://wiki.freeswitch.org</a><br>
<a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>Thanks & Regards<br>---------------------------------<br>Nikhitha<br>
</div>
</div></div><br>_________________________________________________________________________<br>
Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</a><br>
<a href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a><br>
<br>
FreeSWITCH-powered IP PBX: The CudaTel Communication Server<br>
<a href="http://www.cudatel.com" target="_blank">http://www.cudatel.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<a href="http://wiki.freeswitch.org" target="_blank">http://wiki.freeswitch.org</a><br>
<a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><br></div>