[Freeswitch-users] return to shell only when call from originate is complete?

Bipin Patel bipin at xbipin.com
Mon May 22 06:10:17 UTC 2017


hi,

that was a good one, the reason im not using esl directly from python is 
because all i want to do is send originate command and get UUID and 
thats about it and stop the python script as soon as its done, ill try 
it once the requirements go higher with the client :)


Regards,
Bipin


------------------------------------------------------------------------
-------- Original Message --------
Subject: Re: [Freeswitch-users] return to shell only when call from 
originate is complete?
From: Anthony Minessale <anthony.minessale at gmail.com>
To: FreeSWITCH Users Help <freeswitch-users at lists.freeswitch.org>
Date: 5/22/2017, 8:38:13 AM
> I am trying to catch a fish can you help me?
>
> Get a pole and use some fishing line with a hook and add a worm.
>
> I dont really want to use a pole, I am just going to throw a grenade 
> in the water and a fish will fall into my boat.
>
>
>
>
>
>
> On Sun, May 21, 2017 at 10:43 AM Bipin Patel <bipin at xbipin.com 
> <mailto:bipin at xbipin.com>> wrote:
>
>     hi,
>
>     im trying to avoid going the esl route, for now i solved this by
>     calling a bash script from python which monitors the call once the
>     UUID is passed to it so that holds the python command till call is
>     over and then it proceeds further
>
>
>     Regards,
>     Bipin
>
>
>     ------------------------------------------------------------------------
>     -------- Original Message --------
>     Subject: Re: [Freeswitch-users] return to shell only when call
>     from originate is complete?
>     From: Tihomir Culjaga <tculjaga at gmail.com> <mailto:tculjaga at gmail.com>
>     To: FreeSWITCH Users Help <freeswitch-users at lists.freeswitch.org>
>     <mailto:freeswitch-users at lists.freeswitch.org>
>     Date: 5/21/2017, 7:25:31 PM
>>     i still think you are better consume events with python...
>>     its easy and straightforward
>>
>>
>>     #!/usr/bin/env python
>>
>>     import string
>>     import sys
>>
>>     from ESL import *
>>
>>     con = ESLconnection("127.0.0.1","8021","ClueCon")
>>     #are we connected?
>>     callDirection = "unknown"
>>
>>
>>     if con.connected:
>>       print "we connected \n"
>>       con.events("plain", "all");
>>
>>       while 1:
>>       #my $e = $con->recvEventTimed(100);
>>         e = con.recvEvent()
>>
>>         if e:
>>           #print e.serialize()
>>           en = e.getHeader("Event-Name")
>>           print "Name =>" ,en
>>
>>           if en == "CHANNEL_OUTGOING":
>>             callDirection = "OUT"
>>             print "Direction =", callDirection
>>
>>           elif en == "CHANNEL_ORIGINATE":
>>             print "Originate call - direction =", callDirection
>>
>>           elif en == "CHANNEL_CALLSTATE":
>>             print "Call State =>", e.getHeader("Answer-State")
>>
>>           elif en == "CHANNEL_ANSWER":
>>             print "Call START - direction =", callDirection
>>
>>           elif en == "CHANNEL_HANGUP":
>>             print "Call END - direction =", callDirection
>>
>>           elif en == "CHANNEL_PARK":
>>             callDirection = "IN"
>>             print "Call PARK - direction =", callDirection
>>
>>
>>
>>     you can work it out from here pretty everything you want.
>>
>>
>>     T.
>>
>>     On 21 May 2017 at 14:32, Bipin Patel <bipin at xbipin.com
>>     <mailto:bipin at xbipin.com>> wrote:
>>
>>         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>
>>         <mailto:wsimon at stratusvideo.com>
>>         To: FreeSWITCH Users Help
>>         <freeswitch-users at lists.freeswitch.org>
>>         <mailto: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> <mailto:mike at jerris.com>
>>>>         To: Bipin Patel<bipin at xbipin.com> <mailto: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>
>>>>>>         <mailto:mike at jerris.com>
>>>>>>         To: FreeSWITCH Users
>>>>>>         Help<freeswitch-users at lists.freeswitch.org>
>>>>>>         <mailto: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 <mailto: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
>>>         <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
>>
>>
>>         _________________________________________________________________________
>>         Professional FreeSWITCH Consulting Services:
>>         consulting at freeswitch.org <mailto: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
>>         <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
>>
>>
>>
>>
>>     _________________________________________________________________________
>>     Professional FreeSWITCH Consulting Services:
>>     consulting at freeswitch.org <mailto: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
>>     <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
>
>     _________________________________________________________________________
>     Professional FreeSWITCH Consulting Services:
>     consulting at freeswitch.org <mailto: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
>     <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
>
> -- 
> Anthony Minessale II       ♬ @anthmfs  ♬ @FreeSWITCH  ♬
>
>http://freeswitch.org/http://cluecon.com/> http://twitter.com/FreeSWITCH
> ☞ irc.freenode.net <http://irc.freenode.net> #freeswitch ☞ 
> _http://freeswitch.org/g+_
>
> ClueCon Weekly Development Call
> ☎ sip:888 at conference.freeswitch.org 
> <mailto:sip%3A888 at conference.freeswitch.org>  ☎ +19193869900
>
> https://www.youtube.com/watch?v=9XXgW34t40s
> https://www.youtube.com/watch?v=NLaDpGQuZDA
>
>
> _________________________________________________________________________
> 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/20170522/061f3f4b/attachment-0001.html>


More information about the FreeSWITCH-users mailing list