This will automatically use whichever one you have available (preferring the FreeSWITCH one) try: import ESL except ImportError: import PyESL as ESL On 26 May 2017 at 13:23, Steven Ayre <steveayre@gmail.com> wrote:
Try https://github.com/sjthomason/PyESL - pure python implementation using the same API as the official one.
I'd generate the UUID yourself and set origination_uuid in the dialstring, which means you can subscribe to events on that call before the origination. CHANNEL_HANGUP and CHANNEL_DESTROY might be good ones to watch for to know when it's complete.
On 22 May 2017 at 11:21, Bipin Patel <bipin@xbipin.com> wrote:
hi,
i tried to install the python-ESL module using pip but it wont compile even with swig, complaining about sys/time.h
Regards, Bipin
------------------------------ -------- Original Message -------- Subject: Re: [Freeswitch-users] return to shell only when call from originate is complete? From: Bipin Patel <bipin@xbipin.com> <bipin@xbipin.com> To: FreeSWITCH Users Help <freeswitch-users@lists.freeswitch.org> <freeswitch-users@lists.freeswitch.org> Date: 5/22/2017, 10:33:53 AM
hi,
btw is it possible to use python with esl on windows, i cant seem to find any guide to it
Regards, Bipin
------------------------------ -------- Original Message -------- Subject: Re: [Freeswitch-users] return to shell only when call from originate is complete? From: Bipin Patel <bipin@xbipin.com> <bipin@xbipin.com> To: FreeSWITCH Users Help <freeswitch-users@lists.freeswitch.org> <freeswitch-users@lists.freeswitch.org> Date: 5/22/2017, 10:10:17 AM
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@gmail.com> <anthony.minessale@gmail.com> To: FreeSWITCH Users Help <freeswitch-users@lists.freeswitch.org> <freeswitch-users@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@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@gmail.com> <tculjaga@gmail.com> To: FreeSWITCH Users Help <freeswitch-users@lists.freeswitch.org> <freeswitch-users@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@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@stratusvideo.com> <wsimon@stratusvideo.com> To: FreeSWITCH Users Help <freeswitch-users@lists.freeswitch.org> <freeswitch-users@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@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@jerris.com> <mike@jerris.com> To: Bipin Patel <bipin@xbipin.com> <bipin@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@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@jerris.com> <mike@jerris.com> To: FreeSWITCH Users Help <freeswitch-users@lists.freeswitch.org> <freeswitch-users@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@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@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@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/ freeswitch-users 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@freeswitch.orghttp://www.freeswitchsolutions.com
Official FreeSWITCH Siteshttp://www.freeswitch.orghttp://confluence.freeswitch.orghttp://www.cluecon....
FreeSWITCH-users mailing listFreeSWITCH-users@lists.freeswitch.orghttp://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-usershttp://www.frees...
____________________________________________________________ _____________ Professional FreeSWITCH Consulting Services: consulting@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@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.orghttp://www.freeswitchsolutions.com
Official FreeSWITCH Siteshttp://www.freeswitch.orghttp://confluence.freeswitch.orghttp://www.cluecon....
FreeSWITCH-users mailing listFreeSWITCH-users@lists.freeswitch.orghttp://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-usershttp://www.frees...
____________________________________________________________ _____________ Professional FreeSWITCH Consulting Services: consulting@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@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 #freeswitch ☞ *http://freeswitch.org/g+ <http://freeswitch.org/g+>*
ClueCon Weekly Development Call ☎ sip:888@conference.freeswitch.org ☎ +19193869900 <(919)%20386-9900>
https://www.youtube.com/watch?v=9XXgW34t40s https://www.youtube.com/watch?v=NLaDpGQuZDA
_________________________________________________________________________ Professional FreeSWITCH Consulting Services:consulting@freeswitch.orghttp://www.freeswitchsolutions.com
Official FreeSWITCH Siteshttp://www.freeswitch.orghttp://confluence.freeswitch.orghttp://www.cluecon....
FreeSWITCH-users mailing listFreeSWITCH-users@lists.freeswitch.orghttp://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-usershttp://www.frees...
_________________________________________________________________________ Professional FreeSWITCH Consulting Services:consulting@freeswitch.orghttp://www.freeswitchsolutions.com
Official FreeSWITCH Siteshttp://www.freeswitch.orghttp://confluence.freeswitch.orghttp://www.cluecon....
FreeSWITCH-users mailing listFreeSWITCH-users@lists.freeswitch.orghttp://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-usershttp://www.frees...
_________________________________________________________________________ Professional FreeSWITCH Consulting Services:consulting@freeswitch.orghttp://www.freeswitchsolutions.com
Official FreeSWITCH Siteshttp://www.freeswitch.orghttp://confluence.freeswitch.orghttp://www.cluecon....
FreeSWITCH-users mailing listFreeSWITCH-users@lists.freeswitch.orghttp://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-usershttp://www.frees...
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@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@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org