From 6e02348c3639862a14312973ac34c9c68f13d552 Mon Sep 17 00:00:00 2001 From: Traun Leyden Date: Fri, 26 Oct 2007 05:52:41 +0000 Subject: [PATCH] transfer calls git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6063 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- scripts/socket/freepy/__init__.py | 16 +++++++++++++++- scripts/socket/freepy/fshelper.py | 11 +++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/scripts/socket/freepy/__init__.py b/scripts/socket/freepy/__init__.py index d1fe6edf29..f1f9fcac52 100644 --- a/scripts/socket/freepy/__init__.py +++ b/scripts/socket/freepy/__init__.py @@ -323,7 +323,21 @@ class FreepyDispatcher(LineReceiver): print "sending to fs: %s" % msg self.transport.write("%s\n\n" % msg) return req.getDeferred() - + + def transfer(self, uuid, dest_ext, legs, bgapi = False): + """ + transfer [-bleg|-both] + """ + if bgapi == True: + msg = "bgapi transfer %s %s %s" % (uuid, legs, dest_ext) + req = request.BgApiRequest() + else: + msg = "api transfer %s %s %s" % (uuid, legs, dest_ext) + 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): if not self.active_request: diff --git a/scripts/socket/freepy/fshelper.py b/scripts/socket/freepy/fshelper.py index b62d894ca3..a06ed40985 100644 --- a/scripts/socket/freepy/fshelper.py +++ b/scripts/socket/freepy/fshelper.py @@ -302,6 +302,17 @@ class FsHelper(ClientFactory): d.addCallback(broadcast_inner) return d + def transfer(self, uuid, dest_ext, legs="-both", bgapi=True): + """ + @legs -bleg|-both + """ + def transfer_inner(ignored): + df = self.freepyd.transfer(uuid, dest_ext, legs, bgapi) + return df + + d = self.connect() + d.addCallback(transfer_inner) + return d def sofia_profile_restart(self, profile_name, bgapi=True):