[Freeswitch-svn] [commit] r6063 - freeswitch/trunk/scripts/socket/freepy

Freeswitch SVN greenlizard at freeswitch.org
Fri Oct 26 01:52:41 EDT 2007


Author: greenlizard
Date: Fri Oct 26 01:52:41 2007
New Revision: 6063

Modified:
   freeswitch/trunk/scripts/socket/freepy/__init__.py
   freeswitch/trunk/scripts/socket/freepy/fshelper.py

Log:
transfer calls

Modified: freeswitch/trunk/scripts/socket/freepy/__init__.py
==============================================================================
--- freeswitch/trunk/scripts/socket/freepy/__init__.py	(original)
+++ freeswitch/trunk/scripts/socket/freepy/__init__.py	Fri Oct 26 01:52:41 2007
@@ -323,7 +323,21 @@
         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 <uuid> [-bleg|-both] <dest-exten>
+        """
+        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:

Modified: freeswitch/trunk/scripts/socket/freepy/fshelper.py
==============================================================================
--- freeswitch/trunk/scripts/socket/freepy/fshelper.py	(original)
+++ freeswitch/trunk/scripts/socket/freepy/fshelper.py	Fri Oct 26 01:52:41 2007
@@ -302,6 +302,17 @@
         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):
 



More information about the Freeswitch-svn mailing list