From 27268166d7a8fa38c280c823d8aba49b67184bd5 Mon Sep 17 00:00:00 2001 From: Traun Leyden Date: Mon, 22 Oct 2007 19:50:34 +0000 Subject: [PATCH] broadcast wav functionality git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6019 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- scripts/socket/freepy/INSTALL | 18 ++++++++++++++++++ scripts/socket/freepy/__init__.py | 12 +++++++++++- scripts/socket/freepy/fshelper.py | 13 +++++++++++++ 3 files changed, 42 insertions(+), 1 deletion(-) diff --git a/scripts/socket/freepy/INSTALL b/scripts/socket/freepy/INSTALL index 9e5075dec4..1817af5893 100644 --- a/scripts/socket/freepy/INSTALL +++ b/scripts/socket/freepy/INSTALL @@ -1,4 +1,22 @@ +DEPENDENCIES +============ + +The State Machine Compiler is needed for the freepy connection library to function. + + * wget http://ufpr.dl.sourceforge.net/sourceforge/smc/smc_5_0_0.tgz + * tar xvfz smc_5_0_0.tgz + * cd smc_5_0_0 + * cd lib + * python setup.py install + +PYTHONPATH +========== + - Add /path/to/freeswitch/scripts/socket to your PYTHONPATH + +TESTING +======= + - Copy/Paste the code from test1() in fshelper.py to your own test module - Adapt code as needed and run \ No newline at end of file diff --git a/scripts/socket/freepy/__init__.py b/scripts/socket/freepy/__init__.py index 0d1cea37a1..d1fe6edf29 100644 --- a/scripts/socket/freepy/__init__.py +++ b/scripts/socket/freepy/__init__.py @@ -312,7 +312,17 @@ class FreepyDispatcher(LineReceiver): self.transport.write("%s\n\n" % msg) return req.getDeferred() - + def broadcast(self, uuid, path, legs, bgapi = False): + if bgapi == True: + msg = "bgapi broadcast %s %s %s" % (uuid, path, legs) + req = request.BgApiRequest() + else: + msg = "api broadcast %s %s %s" % (uuid, path, legs) + req = request.ApiRequest() + self.requestq.put(req) + print "sending to fs: %s" % msg + self.transport.write("%s\n\n" % msg) + return req.getDeferred() def lineReceived(self, line): diff --git a/scripts/socket/freepy/fshelper.py b/scripts/socket/freepy/fshelper.py index 84e749b6b4..b62d894ca3 100644 --- a/scripts/socket/freepy/fshelper.py +++ b/scripts/socket/freepy/fshelper.py @@ -290,6 +290,19 @@ class FsHelper(ClientFactory): return d + def broadcast(self, uuid, path, legs="both", bgapi=True): + """ + @legs - one of the following strings: aleg|bleg|both + """ + def broadcast_inner(ignored): + df = self.freepyd.broadcast(uuid, path, legs, bgapi) + return df + + d = self.connect() + d.addCallback(broadcast_inner) + return d + + def sofia_profile_restart(self, profile_name, bgapi=True): def sofia_profile_restart_inner(ignored):