[Freeswitch-users] return to shell only when call from originate is complete?
Bipin Patel
bipin at xbipin.com
Sun May 21 12:32:55 UTC 2017
hi,
i converted the bash script to python as below:
ret = subprocess.Popen('sudo fs_cli -x \"show channels\" | grep -c
\"'+UUID+'\"', shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
sout, serr = ret.communicate()
print sout
the reason i use -c instead of -q is because fs_cli always returns a 0
exit code so it doesnt work through python when combined with grep so i
tried to exit loop when the counter is 0 meaning the call is completed,
but the above returns some weird numbers in sout, when the call is
running it shows 5 and when done shows 3 but same if i run directly
through console it shows accurately.
any idea how to fix this?
Regards,
Bipin
------------------------------------------------------------------------
-------- Original Message --------
Subject: Re: [Freeswitch-users] return to shell only when call from
originate is complete?
From: William Simon <wsimon at stratusvideo.com>
To: FreeSWITCH Users Help <freeswitch-users at lists.freeswitch.org>
Date: 5/20/2017, 1:29:05 AM
> If you are using fs_cli then a simple shell script can monitor the
> call and return when the call completes:
>
> #!/bin/bash
>
> RESULT=$( fs_cli -x "originate leg1 leg2" )
>
> if [[ $RESULT =~ "OK" ]]; then
> UUID=$( echo "$RESULT" | cut -f 2 -d ' ' )
> while fs_cli -x "show channels" | grep -q $UUID ;
> do
> sleep 5;
> done
> echo "Call completed."
> fi
>
>
>
>
>> On May 19, 2017, at 12:31 PM, Bipin Patel <bipin at xbipin.com
>> <mailto:bipin at xbipin.com>> wrote:
>>
>> hi,
>>
>> any other way this can be done
>>
>>
>> Regards,
>> Bipin
>>
>>
>> ------------------------------------------------------------------------
>> -------- Original Message --------
>> Subject: Re: [Freeswitch-users] return to shell only when call from
>> originate is complete?
>> From: Michael Jerris<mike at jerris.com>
>> To: Bipin Patel<bipin at xbipin.com>
>> Date: 5/19/2017, 7:48:22 PM
>>> No, thats not what originate does.
>>>
>>>> On May 19, 2017, at 11:43 AM, Bipin Patel <bipin at xbipin.com
>>>> <mailto:bipin at xbipin.com>> wrote:
>>>>
>>>> hi,
>>>>
>>>> does it happen right after answer?
>>>> is there any way to lock it so it returns only after failure or
>>>> after hangup? yes im using ignore_early_media
>>>>
>>>>
>>>> Regards,
>>>> Bipin
>>>>
>>>>
>>>> ------------------------------------------------------------------------
>>>> -------- Original Message --------
>>>> Subject: Re: [Freeswitch-users] return to shell only when call from
>>>> originate is complete?
>>>> From: Michael Jerris<mike at jerris.com>
>>>> To: FreeSWITCH Users Help<freeswitch-users at lists.freeswitch.org>
>>>> Date: 5/19/2017, 7:34:35 PM
>>>>> originate returns when we get call progress, or in the case of
>>>>> ignore_early_media, on answer or failure.
>>>>>
>>>>>> On May 19, 2017, at 10:36 AM, Bipin Patel <bipin at xbipin.com
>>>>>> <mailto:bipin at xbipin.com>> wrote:
>>>>>>
>>>>>> hi,
>>>>>>
>>>>>> i was wondering if its possible to to release handle from an
>>>>>> originate command only once the call is completed, i mean i send
>>>>>> a originate command from shell using fs_cli but only return back
>>>>>> to prompt once the call is completed rather than as soon as a
>>>>>> bridge is created or a UUID generated
>>>>>>
>>>>>
>>>
>>
>>
>>
>> “The information transmitted is intended only for the person or
>> entity to which it is addressed and may contain proprietary,
>> business-confidential and/or privileged material. If you are not the
>> intended recipient of this message you are hereby notified that any
>> use, review, retransmission, dissemination, distribution,
>> reproduction or any action taken in reliance upon this message is
>> prohibited. If you received this in error, please contact the sender
>> and delete the material from any computer.”
>> _________________________________________________________________________
>> Professional FreeSWITCH Consulting Services:
>> consulting at freeswitch.org <mailto:consulting at freeswitch.org>
>> http://www.freeswitchsolutions.com <http://www.freeswitchsolutions.com/>
>>
>> Official FreeSWITCH Sites
>> http://www.freeswitch.org <http://www.freeswitch.org/>
>> http://confluence.freeswitch.org <http://confluence.freeswitch.org/>
>> http://www.cluecon.com <http://www.cluecon.com/>
>>
>> FreeSWITCH-users mailing list
>> FreeSWITCH-users at lists.freeswitch.org
>> <mailto:FreeSWITCH-users at lists.freeswitch.org>
>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>> http://www.freeswitch.org <http://www.freeswitch.org/>
>
>
>
> “The information transmitted is intended only for the person or entity
> to which it is addressed and may contain proprietary,
> business-confidential and/or privileged material. If you are not the
> intended recipient of this message you are hereby notified that any
> use, review, retransmission, dissemination, distribution, reproduction
> or any action taken in reliance upon this message is prohibited. If
> you received this in error, please contact the sender and delete the
> material from any computer.”
>
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
>
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://confluence.freeswitch.org
> http://www.cluecon.com
>
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20170521/5050dd4a/attachment-0001.html>
More information about the FreeSWITCH-users
mailing list