Set command is not working with the variable value in freeswitch
In freeswitch as I am setting the variable like this *<action application="set" data="RESULT=${system sed -n 1p /nfs/th/play/${uuid}}" inline="true"/>* Here i am trying to assign the wav file path to the variable,but here the problem is it is getting assigned as *2014-05-08 13:34:56.659049 [DEBUG] mod_dptools.c:1402 sofia/internal/1002@192.168.0.106 <1002@192.168.0.106> SET [RESULT]=[/usr/local/freeswitch/sounds/en/us/callie/directory/8000/dir-for_prev.wav]* 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 *2014-05-08 13:34:56.679046 [ERR] switch_core_file.c:150 Invalid file format [wav] for [/usr/local/freeswitch/sounds/en/us/callie/directory/8000/dir-for_prev.wav]!* Can anyone help me in solving this issue.Thanks in advance -- Thanks & Regards --------------------------------- Nikhitha
Nikhitha, You are using 'sed' to print the first line (head -1), which will include a line return. This will work: Create a shell script "getplayfile.sh" and in your dialplan use: * data="RESULT=${system getplayfile.sh}"* The shell script can use tr to strip out the end of line as follows: sed -n 1p /nfs/th/play/${uuid} | tr "\n" "\0" On Thu, May 8, 2014 at 6:55 AM, Nikhitha T <nikhitha.voxta@gmail.com> wrote:
In freeswitch as I am setting the variable like this
*<action application="set" data="RESULT=${system sed -n 1p /nfs/th/play/${uuid}}" inline="true"/>*
Here i am trying to assign the wav file path to the variable,but here the problem is it is getting assigned as
*2014-05-08 13:34:56.659049 [DEBUG] mod_dptools.c:1402 sofia/internal/1002@192.168.0.106 <1002@192.168.0.106> SET [RESULT]=[/usr/local/freeswitch/sounds/en/us/callie/directory/8000/dir-for_prev.wav ]*
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
*2014-05-08 13:34:56.679046 [ERR] switch_core_file.c:150 Invalid file format [wav] for [/usr/local/freeswitch/sounds/en/us/callie/directory/8000/dir-for_prev.wav]!*
Can anyone help me in solving this issue.Thanks in advance
-- Thanks & Regards --------------------------------- Nikhitha
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
OK, I might be missing something, but why not just use: <action application="set" data="RESULT=/nfs/th/play/${uuid}" inline="true"/> It produced this in my test: [RESULT]=[/nfs/th/play/f44e2a8e-274d-4d71-807c-c02e62e85efc] Sean From: freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] On Behalf Of Ian McMaster Sent: Thursday, May 08, 2014 10:06 AM To: FreeSWITCH Users Help Subject: Re: [Freeswitch-users] Set command is not working with the variable value in freeswitch Nikhitha, You are using 'sed' to print the first line (head -1), which will include a line return. This will work: Create a shell script "getplayfile.sh" and in your dialplan use: data="RESULT=${system getplayfile.sh}" The shell script can use tr to strip out the end of line as follows: sed -n 1p /nfs/th/play/${uuid} | tr "\n" "\0" On Thu, May 8, 2014 at 6:55 AM, Nikhitha T <nikhitha.voxta@gmail.com<mailto:nikhitha.voxta@gmail.com>> wrote: In freeswitch as I am setting the variable like this <action application="set" data="RESULT=${system sed -n 1p /nfs/th/play/${uuid}}" inline="true"/> Here i am trying to assign the wav file path to the variable,but here the problem is it is getting assigned as 2014-05-08 13:34:56.659049 [DEBUG] mod_dptools.c:1402 sofia/internal/1002@192.168.0.106<mailto:1002@192.168.0.106> SET [RESULT]=[/usr/local/freeswitch/sounds/en/us/callie/directory/8000/dir-for_prev.wav ] 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 2014-05-08 13:34:56.679046 [ERR] switch_core_file.c:150 Invalid file format [wav ] for [/usr/local/freeswitch/sounds/en/us/callie/directory/8000/dir-for_prev.wav ]! Can anyone help me in solving this issue.Thanks in advance -- Thanks & Regards --------------------------------- Nikhitha _________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org<mailto:consulting@freeswitch.org> http://www.freeswitchsolutions.com FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org<mailto:FreeSWITCH-users@lists.freeswitch.org> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
My assumption, because of the use of 'sed', is that the name of the wav file is in the contents of the file /nfs/th/play/${uuid}. So the playfile must be extracted from the file. There are many ways to do this, but a simple way is sed (or head, cat, etc). This could be something like a TTS utility creating a dynamic voice file, and the name of the file gets put into a unique file on the nfs mount. Ian. On Thu, May 8, 2014 at 4:00 PM, Sean Devoy <sdevoy@bizfocused.com> wrote:
OK, I might be missing something, but why not just use:
<action application="set" data="RESULT=/nfs/th/play/${uuid}" inline="true" />
It produced this in my test:
[RESULT]=[/nfs/th/play/f44e2a8e-274d-4d71-807c-c02e62e85efc]
Sean
*From:* freeswitch-users-bounces@lists.freeswitch.org [mailto: freeswitch-users-bounces@lists.freeswitch.org] *On Behalf Of *Ian McMaster *Sent:* Thursday, May 08, 2014 10:06 AM *To:* FreeSWITCH Users Help *Subject:* Re: [Freeswitch-users] Set command is not working with the variable value in freeswitch
Nikhitha,
You are using 'sed' to print the first line (head -1), which will include a line return.
This will work:
Create a shell script "getplayfile.sh" and in your dialplan use:
* data="RESULT=${system getplayfile.sh}"*
The shell script can use tr to strip out the end of line as follows:
sed -n 1p /nfs/th/play/${uuid} | tr "\n" "\0"
On Thu, May 8, 2014 at 6:55 AM, Nikhitha T <nikhitha.voxta@gmail.com> wrote:
In freeswitch as I am setting the variable like this
*<action application="set" data="RESULT=${system sed -n 1p /nfs/th/play/${uuid}}" inline="true"/>*
Here i am trying to assign the wav file path to the variable,but here the problem is it is getting assigned as
* 2014-05-08 13:34:56.659049 [DEBUG] mod_dptools.c:1402 sofia/internal/1002@192.168.0.106 <1002@192.168.0.106> SET [RESULT]=[/usr/local/freeswitch/sounds/en/us/callie/directory/8000/dir-for_prev.wav ]*
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
*2014-05-08 13:34:56.679046 [ERR] switch_core_file.c:150 Invalid file format [wav ] for [/usr/local/freeswitch/sounds/en/us/callie/directory/8000/dir-for_prev.wav ]!*
Can anyone help me in solving this issue.Thanks in advance
-- Thanks & Regards --------------------------------- Nikhitha
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
Oh, you are most probably correct. That explains a lot to me. In my own case, that is close to the name of my recording files directly, so I ran the wrong direction (as usual). From: freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] On Behalf Of Ian McMaster Sent: Thursday, May 08, 2014 5:30 PM To: FreeSWITCH Users Help Subject: Re: [Freeswitch-users] Set command is not working with the variable value in freeswitch My assumption, because of the use of 'sed', is that the name of the wav file is in the contents of the file /nfs/th/play/${uuid}. So the playfile must be extracted from the file. There are many ways to do this, but a simple way is sed (or head, cat, etc). This could be something like a TTS utility creating a dynamic voice file, and the name of the file gets put into a unique file on the nfs mount. Ian. On Thu, May 8, 2014 at 4:00 PM, Sean Devoy <sdevoy@bizfocused.com<mailto:sdevoy@bizfocused.com>> wrote: OK, I might be missing something, but why not just use: <action application="set" data="RESULT=/nfs/th/play/${uuid}" inline="true"/> It produced this in my test: [RESULT]=[/nfs/th/play/f44e2a8e-274d-4d71-807c-c02e62e85efc] Sean From: freeswitch-users-bounces@lists.freeswitch.org<mailto:freeswitch-users-bounces@lists.freeswitch.org> [mailto:freeswitch-users-bounces@lists.freeswitch.org<mailto:freeswitch-users-bounces@lists.freeswitch.org>] On Behalf Of Ian McMaster Sent: Thursday, May 08, 2014 10:06 AM To: FreeSWITCH Users Help Subject: Re: [Freeswitch-users] Set command is not working with the variable value in freeswitch Nikhitha, You are using 'sed' to print the first line (head -1), which will include a line return. This will work: Create a shell script "getplayfile.sh" and in your dialplan use: data="RESULT=${system getplayfile.sh}" The shell script can use tr to strip out the end of line as follows: sed -n 1p /nfs/th/play/${uuid} | tr "\n" "\0" On Thu, May 8, 2014 at 6:55 AM, Nikhitha T <nikhitha.voxta@gmail.com<mailto:nikhitha.voxta@gmail.com>> wrote: In freeswitch as I am setting the variable like this <action application="set" data="RESULT=${system sed -n 1p /nfs/th/play/${uuid}}" inline="true"/> Here i am trying to assign the wav file path to the variable,but here the problem is it is getting assigned as 2014-05-08 13:34:56.659049 [DEBUG] mod_dptools.c:1402 sofia/internal/1002@192.168.0.106<mailto:1002@192.168.0.106> SET [RESULT]=[/usr/local/freeswitch/sounds/en/us/callie/directory/8000/dir-for_prev.wav ] 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 2014-05-08 13:34:56.679046 [ERR] switch_core_file.c:150 Invalid file format [wav ] for [/usr/local/freeswitch/sounds/en/us/callie/directory/8000/dir-for_prev.wav ]! Can anyone help me in solving this issue.Thanks in advance -- Thanks & Regards --------------------------------- Nikhitha _________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org<mailto:consulting@freeswitch.org> http://www.freeswitchsolutions.com FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org<mailto:FreeSWITCH-users@lists.freeswitch.org> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org _________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org<mailto:consulting@freeswitch.org> http://www.freeswitchsolutions.com FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org<mailto:FreeSWITCH-users@lists.freeswitch.org> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
Sean, I may not use this <action application="set" data="RESULT=/nfs/th/play/${uuid}" inline="true"/> Here the text file path is being stored in the variable.But what i want is to retrieve the first line of that text file that is the reason i am using sed command On Fri, May 9, 2014 at 1:30 AM, Sean Devoy <sdevoy@bizfocused.com> wrote:
OK, I might be missing something, but why not just use:
<action application="set" data="RESULT=/nfs/th/play/${uuid}" inline="true" />
It produced this in my test:
[RESULT]=[/nfs/th/play/f44e2a8e-274d-4d71-807c-c02e62e85efc]
Sean
*From:* freeswitch-users-bounces@lists.freeswitch.org [mailto: freeswitch-users-bounces@lists.freeswitch.org] *On Behalf Of *Ian McMaster *Sent:* Thursday, May 08, 2014 10:06 AM *To:* FreeSWITCH Users Help *Subject:* Re: [Freeswitch-users] Set command is not working with the variable value in freeswitch
Nikhitha,
You are using 'sed' to print the first line (head -1), which will include a line return.
This will work:
Create a shell script "getplayfile.sh" and in your dialplan use:
* data="RESULT=${system getplayfile.sh}"*
The shell script can use tr to strip out the end of line as follows:
sed -n 1p /nfs/th/play/${uuid} | tr "\n" "\0"
On Thu, May 8, 2014 at 6:55 AM, Nikhitha T <nikhitha.voxta@gmail.com> wrote:
In freeswitch as I am setting the variable like this
*<action application="set" data="RESULT=${system sed -n 1p /nfs/th/play/${uuid}}" inline="true"/>*
Here i am trying to assign the wav file path to the variable,but here the problem is it is getting assigned as
* 2014-05-08 13:34:56.659049 [DEBUG] mod_dptools.c:1402 sofia/internal/1002@192.168.0.106 <1002@192.168.0.106> SET [RESULT]=[/usr/local/freeswitch/sounds/en/us/callie/directory/8000/dir-for_prev.wav ]*
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
*2014-05-08 13:34:56.679046 [ERR] switch_core_file.c:150 Invalid file format [wav ] for [/usr/local/freeswitch/sounds/en/us/callie/directory/8000/dir-for_prev.wav ]!*
Can anyone help me in solving this issue.Thanks in advance
-- Thanks & Regards --------------------------------- Nikhitha
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- Thanks & Regards --------------------------------- Nikhitha
Ian Thank you for the reply that worked for me and I have one more doubt. 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. On Thu, May 8, 2014 at 7:35 PM, Ian McMaster <ian.mcmaster@gmail.com> wrote:
Nikhitha,
You are using 'sed' to print the first line (head -1), which will include a line return.
This will work: Create a shell script "getplayfile.sh" and in your dialplan use: * data="RESULT=${system getplayfile.sh}"*
The shell script can use tr to strip out the end of line as follows: sed -n 1p /nfs/th/play/${uuid} | tr "\n" "\0"
On Thu, May 8, 2014 at 6:55 AM, Nikhitha T <nikhitha.voxta@gmail.com>wrote:
In freeswitch as I am setting the variable like this
*<action application="set" data="RESULT=${system sed -n 1p /nfs/th/play/${uuid}}" inline="true"/>*
Here i am trying to assign the wav file path to the variable,but here the problem is it is getting assigned as
*2014-05-08 13:34:56.659049 [DEBUG] mod_dptools.c:1402 sofia/internal/1002@192.168.0.106 <1002@192.168.0.106> SET [RESULT]=[/usr/local/freeswitch/sounds/en/us/callie/directory/8000/dir-for_prev.wav ]*
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
*2014-05-08 13:34:56.679046 [ERR] switch_core_file.c:150 Invalid file format [wav] for [/usr/local/freeswitch/sounds/en/us/callie/directory/8000/dir-for_prev.wav]!*
Can anyone help me in solving this issue.Thanks in advance
-- Thanks & Regards --------------------------------- Nikhitha
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- Thanks & Regards --------------------------------- Nikhitha
Nikhitha, 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. 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. 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. 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. Ian. On Fri, May 9, 2014 at 3:24 AM, Nikhitha T <nikhitha.voxta@gmail.com> wrote:
Ian
Thank you for the reply that worked for me and I have one more doubt.
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.
On Thu, May 8, 2014 at 7:35 PM, Ian McMaster <ian.mcmaster@gmail.com>wrote:
Nikhitha,
You are using 'sed' to print the first line (head -1), which will include a line return.
This will work: Create a shell script "getplayfile.sh" and in your dialplan use: * data="RESULT=${system getplayfile.sh}"*
The shell script can use tr to strip out the end of line as follows: sed -n 1p /nfs/th/play/${uuid} | tr "\n" "\0"
On Thu, May 8, 2014 at 6:55 AM, Nikhitha T <nikhitha.voxta@gmail.com>wrote:
In freeswitch as I am setting the variable like this
*<action application="set" data="RESULT=${system sed -n 1p /nfs/th/play/${uuid}}" inline="true"/>*
Here i am trying to assign the wav file path to the variable,but here the problem is it is getting assigned as
*2014-05-08 13:34:56.659049 [DEBUG] mod_dptools.c:1402 sofia/internal/1002@192.168.0.106 <1002@192.168.0.106> SET [RESULT]=[/usr/local/freeswitch/sounds/en/us/callie/directory/8000/dir-for_prev.wav ]*
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
*2014-05-08 13:34:56.679046 [ERR] switch_core_file.c:150 Invalid file format [wav] for [/usr/local/freeswitch/sounds/en/us/callie/directory/8000/dir-for_prev.wav]!*
Can anyone help me in solving this issue.Thanks in advance
-- Thanks & Regards --------------------------------- Nikhitha
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- Thanks & Regards --------------------------------- Nikhitha
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
Ian As you told here the performances are unacceptable , I dont want the live caller to experience such issues.So how to overcome this issue and can you tell me what are the other approaches that solve the problem by increasing and not by increasing the complexity. On Fri, May 9, 2014 at 5:16 PM, Ian McMaster <ian.mcmaster@gmail.com> wrote:
Nikhitha,
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. 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. 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.
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.
Ian.
On Fri, May 9, 2014 at 3:24 AM, Nikhitha T <nikhitha.voxta@gmail.com>wrote:
Ian
Thank you for the reply that worked for me and I have one more doubt.
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.
On Thu, May 8, 2014 at 7:35 PM, Ian McMaster <ian.mcmaster@gmail.com>wrote:
Nikhitha,
You are using 'sed' to print the first line (head -1), which will include a line return.
This will work: Create a shell script "getplayfile.sh" and in your dialplan use: * data="RESULT=${system getplayfile.sh}"*
The shell script can use tr to strip out the end of line as follows: sed -n 1p /nfs/th/play/${uuid} | tr "\n" "\0"
On Thu, May 8, 2014 at 6:55 AM, Nikhitha T <nikhitha.voxta@gmail.com>wrote:
In freeswitch as I am setting the variable like this
*<action application="set" data="RESULT=${system sed -n 1p /nfs/th/play/${uuid}}" inline="true"/>*
Here i am trying to assign the wav file path to the variable,but here the problem is it is getting assigned as
*2014-05-08 13:34:56.659049 [DEBUG] mod_dptools.c:1402 sofia/internal/1002@192.168.0.106 <1002@192.168.0.106> SET [RESULT]=[/usr/local/freeswitch/sounds/en/us/callie/directory/8000/dir-for_prev.wav ]*
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
*2014-05-08 13:34:56.679046 [ERR] switch_core_file.c:150 Invalid file format [wav] for [/usr/local/freeswitch/sounds/en/us/callie/directory/8000/dir-for_prev.wav]!*
Can anyone help me in solving this issue.Thanks in advance
-- Thanks & Regards --------------------------------- Nikhitha
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE: http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- Thanks & Regards --------------------------------- Nikhitha
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- Thanks & Regards --------------------------------- Nikhitha
Hello Nikhitha, I have a similar scenario and I'm using mod_python. It's a bit more complicated, but it is very fast and reliable. If you have that module, you can use the following as a solution: 1) Create a file getplayfile.py with the following contents: *-- Copy below --* import freeswitch def handler(session, args): pass def fsapi(session, stream, env, args): with open("/tmp/%s" % args, "r") as f: stream.write(f.readline().rstrip('\n')) *-- End copy --* 2) Place that file somewhere in the python path, for centos 6.5 that's /usr/lib/python2.6/site-packages, 64bit systems use /usr/lib64/python2.6/site-packages 3) Modify your dialplan: <action application="set" data="RESULT=${python(getplayfile ${uuid})}"/> /P.S. I'm pretty sure the same can be done with mod_lua or mod_perl, but I'm not using them so I can't provide a solution./ Kind regards, -- Iskren Hadzhinedev Ian As you told here the performances are unacceptable , I dont want the live caller to experience such issues.So how to overcome this issue and can you tell me what are the other approaches that solve the problem by increasing and not by increasing the complexity. On Fri, May 9, 2014 at 5:16 PM, Ian McMaster <ian.mcmaster@gmail.com[1]> wrote: Nikhitha, 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. 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. 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. 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. Ian. On Fri, May 9, 2014 at 3:24 AM, Nikhitha T <nikhitha.voxta@gmail.com[2]> wrote: Ian Thank you for the reply that worked for me and I have one more doubt. 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. On Thu, May 8, 2014 at 7:35 PM, Ian McMaster <ian.mcmaster@gmail.com[1]> wrote: Nikhitha, You are using 'sed' to print the first line (head -1), which will include a line return. This will work: Create a shell script "getplayfile.sh" and in your dialplan use: * data="RESULT=${system getplayfile.sh}"* The shell script can use tr to strip out the end of line as follows: sed -n 1p /nfs/th/play/${uuid} | tr "\n" "\0" On Thu, May 8, 2014 at 6:55 AM, Nikhitha T <nikhitha.voxta@gmail.com[2]> wrote: In freeswitch as I am setting the variable like this *<action application="set" data="RESULT=${system sed -n 1p /nfs/th/play/${uuid}}" inline="true"/>* *1002@192.168.0.106[3] SET [RESULT]=[/usr/local/freeswitch/sounds/en/us/callie/directory/8000/dir-for_prev.wav ]* *2014-05-08 13:34:56.679046 [ERR] switch_core_file.c:150 Invalid file format [wav ] for [/usr/local/freeswitch/sounds/en/us/callie/directory/8000/dir-for_prev.wav ]! * Can anyone help me in solving this issue.Thanks in advance _________________________________________________________________________Professional FreeSWITCH Consulting Services: consulting@freeswitch.org[4] http://www.freeswitchsolutions.com[5] http://www.cudatel.com[6] http://www.freeswitch.org[7] http://wiki.freeswitch.org[8] http://www.cluecon.com[9] FreeSWITCH-users@lists.freeswitch.org[10] http://lists.freeswitch.org/mailman/listinfo/freeswitch-users[11] http://lists.freeswitch.org/mailman/options/freeswitch-users[12] http://www.freeswitch.org[7] consulting@freeswitch.org[4] http://www.freeswitchsolutions.com[5] http://www.cudatel.com[6] http://www.freeswitch.org[7] http://wiki.freeswitch.org[8] http://www.cluecon.com[9] FreeSWITCH-users@lists.freeswitch.org[10] http://lists.freeswitch.org/mailman/listinfo/freeswitch-users[11] http://lists.freeswitch.org/mailman/options/freeswitch-users[12] http://www.freeswitch.org[7] consulting@freeswitch.org[4] http://www.freeswitchsolutions.com[5] http://www.cudatel.com[6] http://www.freeswitch.org[7] http://wiki.freeswitch.org[8] http://www.cluecon.com[9] FreeSWITCH-users@lists.freeswitch.org[10] http://lists.freeswitch.org/mailman/listinfo/freeswitch-users[11] http://lists.freeswitch.org/mailman/options/freeswitch-users[12] http://www.freeswitch.org[7] consulting@freeswitch.org[4] http://www.freeswitchsolutions.com[5] http://www.cudatel.com[6] http://www.freeswitch.org[7] http://wiki.freeswitch.org[8] http://www.cluecon.com[9] FreeSWITCH-users@lists.freeswitch.org[10] http://lists.freeswitch.org/mailman/listinfo/freeswitch-users[11] http://lists.freeswitch.org/mailman/options/freeswitch-users[12] http://www.freeswitch.org[7] -------- [1] mailto:ian.mcmaster@gmail.com [2] mailto:nikhitha.voxta@gmail.com [3] mailto:1002@192.168.0.106 [4] mailto:consulting@freeswitch.org [5] http://www.freeswitchsolutions.com [6] http://www.cudatel.com [7] http://www.freeswitch.org [8] http://wiki.freeswitch.org [9] http://www.cluecon.com [10] mailto:FreeSWITCH-users@lists.freeswitch.org [11] http://lists.freeswitch.org/mailman/listinfo/freeswitch-users [12] http://lists.freeswitch.org/mailman/options/freeswitch-users
Hello Iskren I have followed the instructions told by you and executing the pythoon file from the dial plan,but some issues are arised in loading the files 2014-05-12 16:57:10.046636 [ERR] mod_python.c:231 Error importing module 2014-05-12 16:57:10.046636 [ERR] mod_python.c:164 Python Error by calling script "usr.lib.python2.7.getplayfile": <type 'exceptions.ImportError'> Message: No module named usr.lib.python2.7.getplayfile On Mon, May 12, 2014 at 1:53 PM, Iskren Hadzhinedev < iskren.hadzhinedev@ikiji.com> wrote:
Hello Nikhitha,
I have a similar scenario and I'm using mod_python. It's a bit more complicated, but it is very fast and reliable. If you have that module, you can use the following as a solution:
1) Create a file getplayfile.py with the following contents:
-- Copy below --
import freeswitch
def handler(session, args):
pass
def fsapi(session, stream, env, args):
with open("/tmp/%s" % args, "r") as f:
stream.write(f.readline().rstrip('\n'))
-- End copy --
2) Place that file somewhere in the python path, for centos 6.5 that's /usr/lib/python2.6/site-packages, 64bit systems use /usr/lib64/python2.6/site-packages
3) Modify your dialplan:
<action application="set" data="RESULT=${python(getplayfile ${uuid})}"/>
P.S. I'm pretty sure the same can be done with mod_lua or mod_perl, but I'm not using them so I can't provide a solution.
Kind regards,
--
Iskren Hadzhinedev
On Monday 12 May 2014 12:52:35 Nikhitha T wrote:
Ian
As you told here the performances are unacceptable , I dont want the live caller to experience such issues.So how to overcome this issue and can you tell me what are the other approaches that solve the problem by increasing and not by increasing the complexity.
On Fri, May 9, 2014 at 5:16 PM, Ian McMaster <ian.mcmaster@gmail.com> wrote:
Nikhitha,
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.
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.
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.
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.
Ian.
On Fri, May 9, 2014 at 3:24 AM, Nikhitha T <nikhitha.voxta@gmail.com> wrote:
Ian
Thank you for the reply that worked for me and I have one more doubt.
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.
On Thu, May 8, 2014 at 7:35 PM, Ian McMaster <ian.mcmaster@gmail.com> wrote:
Nikhitha,
You are using 'sed' to print the first line (head -1), which will include a line return.
This will work:
Create a shell script "getplayfile.sh" and in your dialplan use:
data="RESULT=${system getplayfile.sh}"
The shell script can use tr to strip out the end of line as follows:
sed -n 1p /nfs/th/play/${uuid} | tr "\n" "\0"
On Thu, May 8, 2014 at 6:55 AM, Nikhitha T <nikhitha.voxta@gmail.com> wrote:
In freeswitch as I am setting the variable like this
<action application="set" data="RESULT=${system sed -n 1p /nfs/th/play/${uuid}}" inline="true"/>
Here i am trying to assign the wav file path to the variable,but here the problem is it is getting assigned as
2014-05-08 13:34:56.659049 [DEBUG] mod_dptools.c:1402 sofia/internal/ 1002@192.168.0.106 SET [RESULT]=[/usr/local/freeswitch/sounds/en/us/callie/directory/8000/dir-for_prev.wav
]
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
2014-05-08 13:34:56.679046 [ERR] switch_core_file.c:150 Invalid file format [wav
] for [/usr/local/freeswitch/sounds/en/us/callie/directory/8000/dir-for_prev.wav
]!
Can anyone help me in solving this issue.Thanks in advance
-- Thanks & Regards --------------------------------- Nikhitha
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- Thanks & Regards --------------------------------- Nikhitha
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- Thanks & Regards --------------------------------- Nikhitha
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- Thanks & Regards --------------------------------- Nikhitha
Hello again, This looks like you've put the whole path to the file in the dialplan, perhaps something like *<action application="set" data="${python(/usr/lib/python2.7/getplayfile.py ${uuid})}"/>.* If this is the case, it's incorrect. Python has internal paths for module loading and /usr/lib/python2.7 should be in them. This should be sufficient: *<action application="set" data="${python(getplayfile ${uuid})}"/>* It should pickup the path and the extension on its own. /P.S. I seem to have an error in the example from the previous email, it's trying to open */tmp/* and not */*/*/nfs/th/play*, /you should edit it in case you copy-pasted 1:1/ Kind regards, -- Iskren Hadzhinedev On Monday 12 May 2014 18:01:52 Nikhitha T wrote: Hello Iskren I have followed the instructions told by you and executing the pythoon file from the dial plan,but some issues are arised in loading the files 2014-05-12 16:57:10.046636 [ERR] mod_python.c:231 Error importing module2014-05-12 16:57:10.046636 [ERR] mod_python.c:164 Python Error by calling script "usr.lib.python2.7.getplayfile": <type 'exceptions.ImportError'>Message: No module named usr.lib.python2.7.getplayfile On Mon, May 12, 2014 at 1:53 PM, Iskren Hadzhinedev <iskren.hadzhinedev@ikiji.com[1]> wrote: Hello Nikhitha, I have a similar scenario and I'm using mod_python. It's a bit more complicated, but it is very fast and reliable. If you have that module, you can use the following as a solution: 1) Create a file getplayfile.py with the following contents: *-- Copy below --* import freeswitch def handler(session, args): pass def fsapi(session, stream, env, args): with open("/tmp/%s" % args, "r") as f: stream.write(f.readline().rstrip('\n')) *-- End copy --* 2) Place that file somewhere in the python path, for centos 6.5 that's /usr/lib/python2.6/site-packages, 64bit systems use /usr/lib64/python2.6/site-packages 3) Modify your dialplan: <action application="set" data="RESULT=${python(getplayfile ${uuid})}"/> /P.S. I'm pretty sure the same can be done with mod_lua or mod_perl, but I'm not using them so I can't provide a solution./ Kind regards, -- Iskren Hadzhinedev Ian As you told here the performances are unacceptable , I dont want the live caller to experience such issues.So how to overcome this issue and can you tell me what are the other approaches that solve the problem by increasing and not by increasing the complexity. On Fri, May 9, 2014 at 5:16 PM, Ian McMaster <ian.mcmaster@gmail.com[2]> wrote: Nikhitha, 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. 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. 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. 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. Ian. On Fri, May 9, 2014 at 3:24 AM, Nikhitha T <nikhitha.voxta@gmail.com[3]> wrote: Ian Thank you for the reply that worked for me and I have one more doubt. 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. On Thu, May 8, 2014 at 7:35 PM, Ian McMaster <ian.mcmaster@gmail.com[2]> wrote: Nikhitha, You are using 'sed' to print the first line (head -1), which will include a line return. This will work: Create a shell script "getplayfile.sh" and in your dialplan use: * data="RESULT=${system getplayfile.sh}"* The shell script can use tr to strip out the end of line as follows: sed -n 1p /nfs/th/play/${uuid} | tr "\n" "\0" On Thu, May 8, 2014 at 6:55 AM, Nikhitha T <nikhitha.voxta@gmail.com[3]> wrote: In freeswitch as I am setting the variable like this *<action application="set" data="RESULT=${system sed -n 1p /nfs/th/play/${uuid}}" inline="true"/>* *1002@192.168.0.106[4] SET [RESULT]=[/usr/local/freeswitch/sounds/en/us/callie/directory/8000/dir-for_prev.wav ]* *2014-05-08 13:34:56.679046 [ERR] switch_core_file.c:150 Invalid file format [wav ] for [/usr/local/freeswitch/sounds/en/us/callie/directory/8000/dir-for_prev.wav ]! * Can anyone help me in solving this issue.Thanks in advance _________________________________________________________________________Professional FreeSWITCH Consulting Services: consulting@freeswitch.org[5] http://www.freeswitchsolutions.com[6] http://www.cudatel.com[7] http://www.freeswitch.org[8] http://wiki.freeswitch.org[9] http://www.cluecon.com[10] FreeSWITCH-users@lists.freeswitch.org[11] http://lists.freeswitch.org/mailman/listinfo/freeswitch-users[12] http://lists.freeswitch.org/mailman/options/freeswitch-users[13] http://www.freeswitch.org[8] consulting@freeswitch.org[5] http://www.freeswitchsolutions.com[6] http://www.cudatel.com[7] http://www.freeswitch.org[8] http://wiki.freeswitch.org[9] http://www.cluecon.com[10] FreeSWITCH-users@lists.freeswitch.org[11] http://lists.freeswitch.org/mailman/listinfo/freeswitch-users[12] http://lists.freeswitch.org/mailman/options/freeswitch-users[13] http://www.freeswitch.org[8] consulting@freeswitch.org[5] http://www.freeswitchsolutions.com[6] http://www.cudatel.com[7] http://www.freeswitch.org[8] http://wiki.freeswitch.org[9] http://www.cluecon.com[10] FreeSWITCH-users@lists.freeswitch.org[11] http://lists.freeswitch.org/mailman/listinfo/freeswitch-users[12] http://lists.freeswitch.org/mailman/options/freeswitch-users[13] http://www.freeswitch.org[8] consulting@freeswitch.org[5] http://www.freeswitchsolutions.com[6] http://www.cudatel.com[7] http://www.freeswitch.org[8] http://wiki.freeswitch.org[9] http://www.cluecon.com[10] FreeSWITCH-users@lists.freeswitch.org[11] http://lists.freeswitch.org/mailman/listinfo/freeswitch-users[12] http://lists.freeswitch.org/mailman/options/freeswitch-users[13] http://www.freeswitch.org[8] consulting@freeswitch.org[5] http://www.freeswitchsolutions.com[6] http://www.cudatel.com[7] http://www.freeswitch.org[8] http://wiki.freeswitch.org[9] http://www.cluecon.com[10] FreeSWITCH-users@lists.freeswitch.org[11] http://lists.freeswitch.org/mailman/listinfo/freeswitch-users[12] http://lists.freeswitch.org/mailman/options/freeswitch-users[13] http://www.freeswitch.org[8] -------- [1] mailto:iskren.hadzhinedev@ikiji.com [2] mailto:ian.mcmaster@gmail.com [3] mailto:nikhitha.voxta@gmail.com [4] mailto:1002@192.168.0.106 [5] mailto:consulting@freeswitch.org [6] http://www.freeswitchsolutions.com [7] http://www.cudatel.com [8] http://www.freeswitch.org [9] http://wiki.freeswitch.org [10] http://www.cluecon.com [11] mailto:FreeSWITCH-users@lists.freeswitch.org [12] http://lists.freeswitch.org/mailman/listinfo/freeswitch-users [13] http://lists.freeswitch.org/mailman/options/freeswitch-users
Hello Iskren, Even though i used it is showing me the same error as it is shown previously...I've also changed the path from /tmp/ to my file path On Mon, May 12, 2014 at 7:47 PM, Iskren Hadzhinedev < iskren.hadzhinedev@ikiji.com> wrote:
Hello again,
This looks like you've put the whole path to the file in the dialplan, perhaps something like
<action application="set" data="${python(/usr/lib/python2.7/getplayfile.py ${uuid})}"/>.
If this is the case, it's incorrect. Python has internal paths for module loading and /usr/lib/python2.7 should be in them.
This should be sufficient:
<action application="set" data="${python(getplayfile ${uuid})}"/>
It should pickup the path and the extension on its own.
P.S. I seem to have an error in the example from the previous email, it's trying to open /tmp/ and not //nfs/th/play,
you should edit it in case you copy-pasted 1:1
Kind regards,
--
Iskren Hadzhinedev
On Monday 12 May 2014 18:01:52 Nikhitha T wrote:
Hello Iskren
I have followed the instructions told by you and executing the pythoon file from the dial plan,but some issues are arised in loading the files
2014-05-12 16:57:10.046636 [ERR] mod_python.c:231 Error importing module 2014-05-12 16:57:10.046636 [ERR] mod_python.c:164 Python Error by calling script "usr.lib.python2.7.getplayfile": <type 'exceptions.ImportError'> Message: No module named usr.lib.python2.7.getplayfile
On Mon, May 12, 2014 at 1:53 PM, Iskren Hadzhinedev < iskren.hadzhinedev@ikiji.com> wrote:
Hello Nikhitha,
I have a similar scenario and I'm using mod_python. It's a bit more complicated, but it is very fast and reliable. If you have that module, you can use the following as a solution:
1) Create a file getplayfile.py with the following contents:
-- Copy below --
import freeswitch
def handler(session, args):
pass
def fsapi(session, stream, env, args):
with open("/tmp/%s" % args, "r") as f:
stream.write(f.readline().rstrip('\n'))
-- End copy --
2) Place that file somewhere in the python path, for centos 6.5 that's /usr/lib/python2.6/site-packages, 64bit systems use /usr/lib64/python2.6/site-packages
3) Modify your dialplan:
<action application="set" data="RESULT=${python(getplayfile ${uuid})}"/>
P.S. I'm pretty sure the same can be done with mod_lua or mod_perl, but I'm not using them so I can't provide a solution.
Kind regards,
--
Iskren Hadzhinedev
On Monday 12 May 2014 12:52:35 Nikhitha T wrote:
Ian
As you told here the performances are unacceptable , I dont want the live caller to experience such issues.So how to overcome this issue and can you tell me what are the other approaches that solve the problem by increasing and not by increasing the complexity.
On Fri, May 9, 2014 at 5:16 PM, Ian McMaster <ian.mcmaster@gmail.com> wrote:
Nikhitha,
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.
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.
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.
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.
Ian.
On Fri, May 9, 2014 at 3:24 AM, Nikhitha T <nikhitha.voxta@gmail.com> wrote:
Ian
Thank you for the reply that worked for me and I have one more doubt.
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.
On Thu, May 8, 2014 at 7:35 PM, Ian McMaster <ian.mcmaster@gmail.com> wrote:
Nikhitha,
You are using 'sed' to print the first line (head -1), which will include a line return.
This will work:
Create a shell script "getplayfile.sh" and in your dialplan use:
data="RESULT=${system getplayfile.sh}"
The shell script can use tr to strip out the end of line as follows:
sed -n 1p /nfs/th/play/${uuid} | tr "\n" "\0"
On Thu, May 8, 2014 at 6:55 AM, Nikhitha T <nikhitha.voxta@gmail.com> wrote:
In freeswitch as I am setting the variable like this
<action application="set" data="RESULT=${system sed -n 1p /nfs/th/play/${uuid}}" inline="true"/>
Here i am trying to assign the wav file path to the variable,but here the problem is it is getting assigned as
2014-05-08 13:34:56.659049 [DEBUG] mod_dptools.c:1402 sofia/internal/ 1002@192.168.0.106 SET [RESULT]=[/usr/local/freeswitch/sounds/en/us/callie/directory/8000/dir-for_prev.wav
]
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
2014-05-08 13:34:56.679046 [ERR] switch_core_file.c:150 Invalid file format [wav
] for [/usr/local/freeswitch/sounds/en/us/callie/directory/8000/dir-for_prev.wav
]!
Can anyone help me in solving this issue.Thanks in advance
-- Thanks & Regards --------------------------------- Nikhitha
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- Thanks & Regards --------------------------------- Nikhitha
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- Thanks & Regards --------------------------------- Nikhitha
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- Thanks & Regards --------------------------------- Nikhitha
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- Thanks & Regards --------------------------------- Nikhitha
Nice to see you’re building a fork bomb machine here. One big call burst and BOOM your whole system might come crashing down on you… why exactly are you doing this forking a shell script thing? -- Brian West brian@freeswitch.org Twitter: @FreeSWITCH , @briankwest http://www.freeswitchbook.com http://www.freeswitchcookbook.com T: +1.918.420.9001 | F: +1.918.420.9002 | M: +1.918.424.WEST iNUM: +883 5100 1420 9001 ISN: 410*543 Skype:briankwest PGP Key: http://www.bkw.org/key.txt (AB93356707C76CED) On May 9, 2014, at 2:24 AM, Nikhitha T <nikhitha.voxta@gmail.com> wrote:
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.
participants (5)
-
Brian West
-
Ian McMaster
-
Iskren Hadzhinedev
-
Nikhitha T
-
Sean Devoy