├── fs-ivr-python
├── welcome.xml
├── README.rst
└── welcome.py
├── fs-mod-spy
├── user_spy.ext
└── README.rst
├── README.rst
├── fs-api-remotely
├── getvars.sh
├── channel_api.py
└── README.rst
└── fs-mod-python
├── README.rst
├── fs_module.py
└── freeswitch.py
/fs-ivr-python/welcome.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/fs-mod-spy/user_spy.ext:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/fs-mod-spy/README.rst:
--------------------------------------------------------------------------------
1 | ============================================
2 | Hidden listening sip clients with SPY module
3 | ============================================
4 |
5 |
6 | * Add the following lines to the "/etc/freeswitch/dialplan/default.xml" file before "Local_Extension"::
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | * Uncomment the following line in the "/etc/freeswitch/autoload_configs/modules.conf.xml" file::
17 |
18 |
19 |
20 |
21 | * At the end restart freeswitch with the following command::
22 |
23 | # systemctl restart freeswitch
24 |
25 |
26 | * Just call to "*01003" number to listen caller_ID "1003".
27 |
28 |
--------------------------------------------------------------------------------
/README.rst:
--------------------------------------------------------------------------------
1 | ===================================================================================
2 | This repository contains Python codes and configurations for FreeSWITCH VoIP server
3 | ===================================================================================
4 |
5 | * `How to use FreeSWITCH API remotely `_
6 | * `Configure FreeSWITCH IVR with python script `_
7 | * `Control VoIP session flow with Python codes `_
8 | * `Hidden listening sip clients with SPY module `_
9 |
10 | ============================
11 | Hyperlinks to official pages
12 | ============================
13 |
14 | * `Python ESL `_
15 | * `Command-Line Interface fs_cli `_
16 | * `Mod Python `_
17 |
--------------------------------------------------------------------------------
/fs-ivr-python/README.rst:
--------------------------------------------------------------------------------
1 | ========================================
2 | FreeSWITCH IVR configuration with Python
3 | ========================================
4 |
5 | * If you want configure your own IVR then firstly uncomment the following line in the "/etc/freeswitch/autoload_configs/modules.conf.xml" file::
6 |
7 |
8 |
9 | * In the "/etc/freeswitch/dialplan/default" folder create new "welcome.xml" IVR configuration file for the "2920" extension and add the following lines. This configuraions calls "welcome.py" python script file::
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | * In the "/usr/share/freeswitch/scripts" folder create python file `welcome.py `_
21 |
22 |
23 | * Restart FreeSWITCH server::
24 |
25 | # systemctl restart freeswitch
26 |
27 | * At the end just call from sip client to "2920" number and listen Text to Speech.
28 |
--------------------------------------------------------------------------------
/fs-api-remotely/getvars.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | # show channels - Show online channels
4 | vars="uuid direction created created_epoch name state cid_name cid_num ip_addr dest application application_data dialplan context read_codec read_rate read_bit_rate write_codec write_rate write_bit_rate secure hostname presence_id presence_data accountcode callstate callee_name callee_num callee_direction call_uuid sent_callee_name sent_callee_num initial_cid_name initial_cid_num initial_ip_addr initial_dest initial_dialplan initial_context"
5 |
6 | # show calls - Show real calls
7 | vars2="uuid direction created created_epoch name state cid_name cid_num ip_addr dest presence_id presence_data accountcode callstate callee_name callee_num callee_direction call_uuid hostname sent_callee_name sent_callee_num b_uuid b_direction b_created b_created_epoch b_name b_state b_cid_name b_cid_num b_ip_addr b_dest b_presence_id b_presence_data b_accountcode b_callstate b_callee_name b_callee_num b_callee_direction b_sent_callee_name b_sent_callee_num call_created_epoch"
8 |
9 | uuid=`fs_cli -x 'show channels' | grep inbound | cut -f1 -d','`
10 | undef="_undef_"
11 | #for var in `echo $vars`
12 | for var in `echo $vars2`
13 | do
14 | newvar=`fs_cli -x "uuid_getvar $uuid $var"`
15 | if [ "$undef" != "$newvar" ]
16 | then
17 | echo ""
18 | echo Variable name is: $var
19 | echo Result is: $newvar
20 | fi
21 | done
22 |
--------------------------------------------------------------------------------
/fs-ivr-python/welcome.py:
--------------------------------------------------------------------------------
1 | import freeswitch
2 |
3 | def handler(session, args):
4 | session.answer()
5 |
6 | while session.ready() == True:
7 | session.setAutoHangup(False)
8 | session.set_tts_params("flite", "slt")
9 | session.speak("Welcome to A T L InfoTech!")
10 | session.sleep(100)
11 | session.speak("please select an Action.")
12 | session.sleep(100)
13 | session.speak("press 1, to listen Voice Mail")
14 | session.sleep(100)
15 | session.speak("press 2, to call Freeswitch I V R")
16 | session.sleep(100)
17 | session.speak("press 3, for Music on hold")
18 | session.sleep(100)
19 | session.speak("press 4, to call Jamal Shahverdiev")
20 | session.sleep(100)
21 | session.speak("press 5, to call Ayaz Gulmammadov")
22 | session.sleep(3000)
23 | digits = session.getDigits(1, "", 3000)
24 |
25 | if digits == "1":
26 | session.setAutoHangup(False)
27 | session.set_tts_params("flite", "slt")
28 | session.speak("Welcome to RISK company!")
29 | session.sleep(100)
30 | session.speak("please select an Action.")
31 | session.sleep(100)
32 | session.speak("Call to your extension")
33 | session.sleep(100)
34 | session.speak("Or wait answer from operator!")
35 | session.sleep(4000)
36 | nums = session.getDigits(4, "", 4000)
37 |
38 | if nums == "1006":
39 | session.execute("execute_extension", "1006 XML default")
40 |
41 | if digits == "2":
42 | session.execute("transfer","5000")
43 | if digits == "3":
44 | session.execute("transfer","9999")
45 | if digits == "4":
46 | session.execute("execute_extension", "1002 XML default")
47 | if digits == "5":
48 | session.execute("execute_extension", "1006 XML default")
49 |
50 |
--------------------------------------------------------------------------------
/fs-api-remotely/channel_api.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python2.7
2 | from optparse import OptionParser
3 | import sys
4 | import ESL
5 |
6 | def main(argv):
7 | parser = OptionParser()
8 | parser.add_option('-a', '--auth', dest='auth', default='ClueCon', help='ESL password')
9 | parser.add_option('-s', '--server', dest='server', default='10.50.3.114', help='FreeSWITCH server IP address')
10 | parser.add_option('-p', '--port', dest='port', default='8021', help='FreeSWITCH server event socket port')
11 | parser.add_option('-c', '--command', dest='command', default='status', help='command to run, surround multi-word commands in ""s')
12 |
13 | (options, args) = parser.parse_args()
14 |
15 | con = ESL.ESLconnection(options.server, options.port, options.auth)
16 |
17 | if not con.connected():
18 | print('Not Connected')
19 | sys.exit(2)
20 | else:
21 | uuid = con.api("create_uuid").getBody()
22 | print(uuid)
23 | print('-----------------------')
24 | print(con.events("plain", "all"))
25 | print('-----------------------')
26 |
27 | print('######################################')
28 | print(con.socketDescriptor())
29 | print(con.connected())
30 | #print(con.send('$command'))
31 | print(con.getInfo())
32 | print('######################################')
33 | #print(con.events("plain", "all"))
34 | print(con.recvEvent())
35 | print('######################################')
36 | # Run command
37 | e = con.api(options.command)
38 | command = 'shift'
39 | args = ' '.join(argv)
40 | b = con.bgapi(command, args, uuid)
41 | print(b)
42 | if e:
43 | # print(e.serialize())
44 | print(e.getHeader('1e4ae024-972f-4f72-a3fd-15713d9847b2'))
45 | print('********************************************')
46 | print(e.getBody())
47 | print(e.getType())
48 | print(e.firstHeader())
49 | print(e.nextHeader())
50 |
51 | if __name__ == '__main__':
52 | main(sys.argv[1:])
53 |
54 |
--------------------------------------------------------------------------------
/fs-api-remotely/README.rst:
--------------------------------------------------------------------------------
1 | ====================================
2 | Control FreeSWITCH with API remotely
3 | ====================================
4 |
5 | * In the python code worked server install needed libraries::
6 |
7 | # python -m pip install esl
8 | # python -m pip install FreeSWITCH-ESL-Python
9 |
10 | * Create script with name `channel_api.py `_
11 |
12 | * Add the following lines to the "/etc/freeswitch/autoload_configs/acl.conf.xml" file in the FreeSWITCH server(10.50.63.228 IP is place from where "channel_api.py" code is connecting to the FreeSWITCH server)::
13 |
14 |
15 |
16 |
17 |
18 | * At the end restart FreeSWITCH server::
19 |
20 | # systemctl restart freeswitch
21 |
22 |
23 | * If you want to see the channel variables just create "`getvars.sh `_ " script in the FreeSWITCH server and execute it(Don't forget minimum one call must be present at script using time).
24 |
25 | * Result of this code will be as following::
26 |
27 | root@fspush:~# ./getvars.sh
28 | Variable name is: uuid
29 | Result is: 3e88b243-50ad-4845-94ce-a6d6a647fec1
30 |
31 | Variable name is: direction
32 | Result is: inbound
33 |
34 | Variable name is: presence_id
35 | Result is: 1002@10.50.3.114
36 |
37 | Variable name is: accountcode
38 | Result is: 1002
39 |
40 | Variable name is: call_uuid
41 | Result is: 3e88b243-50ad-4845-94ce-a6d6a647fec1
42 |
43 | Variable name is: hostname
44 | Result is: fspush
45 |
46 |
47 | Break selected UUID::
48 |
49 | freeswitch@fspush> uuid_break 3e88b243-50ad-4845-94ce-a6d6a647fec1 all
50 |
51 | Check UUID if exists::
52 |
53 | freeswitch@fspush> uuid_exists 3e88b243-50ad-4845-94ce-a6d6a647fec1
54 | true
55 |
56 | Print all channel variables for selected UUID::
57 |
58 | freeswitch@fspush> uuid_dump 3e88b243-50ad-4845-94ce-a6d6a647fec1
59 |
60 |
--------------------------------------------------------------------------------
/fs-mod-python/README.rst:
--------------------------------------------------------------------------------
1 | ===========================================
2 | Control VoIP session flow with Python codes
3 | ===========================================
4 |
5 | * Install Debian 8.5 and the install FreeSWITCH from official repository with the following commands::
6 |
7 | # wget -O - https://files.freeswitch.org/repo/deb/debian/freeswitch_archive_g0.pub | apt-key add -
8 | # echo "deb http://files.freeswitch.org/repo/deb/freeswitch-1.6/ jessie main" > /etc/apt/sources.list.d/freeswitch.list
9 | # apt-get update && apt-get dist-upgrade -y && apt-get install -y freeswitch-meta-all
10 |
11 |
12 | * Install Python development and pip packages::
13 |
14 | # apt-get install python-dev python-pip -y
15 |
16 | * After installation try to find `freeswitch.py `_ file for API use (This file configured automatically from FreeSWITCH packages. This file will be used as FreeSWITCH library)::
17 |
18 | root@fspush:~# find / -name freeswitch.py
19 | /usr/share/pyshared/freeswitch.py
20 | /usr/lib/pymodules/python2.7/freeswitch.py
21 |
22 | * Look at symlink::
23 |
24 | # ll /usr/lib/pymodules/python2.7/freeswitch.py
25 | lrwxrwxrwx 1 root root 33 Mar 14 07:31 /usr/lib/pymodules/python2.7/freeswitch.py -> /usr/share/pyshared/freeswitch.py
26 |
27 | * Uncomment the following line in the "/etc/freeswitch/autoload_configs/modules.conf.xml" file::
28 |
29 |
30 |
31 | * Note: If you want post data to web server then, in the "/etc/freeswitch/dialplan/default.xml" file add the following lines for the "Local_Extension"::
32 |
33 |
34 |
35 |
36 |
37 | * In the "/usr/share/freeswitch/scripts" folder create python file `fs_module.py `_
38 |
39 | * In the "/etc/freeswitch/dialplan/default.xml" file search "Local_Extension" and add the following line to this extension::
40 |
41 |
42 |
43 |
44 | * Give permission to write a file::
45 |
46 | # chown -R freeswitch:freeswitch /usr/share/freeswitch/scripts/
47 |
48 |
49 | * Restart the service::
50 |
51 | # systemctl restart freeswitch
52 |
53 | * In the "fs_cli" console check "mod_python" as following::
54 |
55 | freeswitch@fspush> module_exists mod_python
56 | true
57 |
58 |
59 | * Call from extension "1002" to "1009" and look at result in the "newfile.txt" file::
60 |
61 | root@fspush:~# cat /usr/share/freeswitch/scripts/newfile.txt
62 | Caller Number is: 1002
63 | Called Number is: 1009
64 |
65 |
66 | * If you uncomment the following lines in the "fs_module.py" file then, each call will be answered with the "hold_music" variable::
67 |
68 | #session.answer()
69 | #session.setHangupHook(hangup_hook)
70 | #session.setInputCallback(input_callback)
71 | #session.execute("playback", session.getVariable("hold_music"))
72 |
73 |
74 | * If you want forward calls for selected extension just add the following lines under "handler()" function(If extension "1002" will call to "1004" then, call will be forwarded to the "1006" and if "1003" call to "1002" it will play music file)::
75 |
76 | if session.getVariable("caller_id_name") == '1002' and session.getVariable("destination_number") == '1004':
77 | freeswitch.consoleLog('info', 'Caller Number: %s\n' % session.getVariable("caller_id_name"))
78 | with open('/usr/share/freeswitch/scripts/newfile.txt', 'w') as yaz:
79 | yaz.write('Caller number is: {0}, Called number is: {1}'.format(session.getVariable("caller_id_name"), session.getVariable("destination_number")))
80 | session.execute("execute_extension", "'{0}' XML default".format('1006'))
81 | elif session.getVariable("caller_id_name") == '1003' and session.getVariable("destination_number") == '1002':
82 | session.answer()
83 | session.streamFile("/usr/share/freeswitch/sounds/music/8000/partita-no-3-in-e-major-bwv-1006-1-preludio.wav")
84 | else:
85 | freeswitch.consoleLog('info', 'Comparing does not success result!!!\n')
86 | pass
87 |
88 |
--------------------------------------------------------------------------------
/fs-mod-python/fs_module.py:
--------------------------------------------------------------------------------
1 | import freeswitch
2 |
3 | """
4 | FreeSWITCH's mod_python usage examples.
5 |
6 | This module uses the default names looked up by mod_python, but most of
7 | these names can be overridden using :: when calling
8 | the module from FreeSWITCH.
9 |
10 | """
11 |
12 |
13 | def handler(session, args):
14 | """
15 | 'handler' is the default function name for apps.
16 |
17 | It can be overridden with ::
18 |
19 | `session` is a session object
20 | `args` is a string with all the args passed after the module name
21 |
22 | """
23 | freeswitch.consoleLog('info', 'Answering call from Python.\n')
24 | freeswitch.consoleLog('info', 'Arguments: %s\n' % args)
25 | freeswitch.consoleLog('info', 'Caller Number: %s\n' % session.getVariable("caller_id_name"))
26 | freeswitch.consoleLog('info', 'Caller Destionation Number: %s\n' % session.getVariable("destination_number"))
27 |
28 | with open('/usr/share/freeswitch/scripts/newfile.txt', 'w') as yaz:
29 | yaz.write('Caller Number is: ' + session.getVariable("caller_id_name") + '\n')
30 | with open('/usr/share/freeswitch/scripts/newfile.txt', 'a') as yaz:
31 | yaz.write('Called Number is: ' + session.getVariable("destination_number") + '\n')
32 |
33 | # session.answer()
34 | # session.setHangupHook(hangup_hook)
35 | # session.setInputCallback(input_callback)
36 | # session.execute("playback", session.getVariable("hold_music"))
37 |
38 | def hangup_hook(session, what, args=''):
39 | """
40 | Must be explicitly set up with session.setHangupHook(hangup_hook).
41 |
42 | `session` is a session object.
43 | `what` is "hangup" or "transfer".
44 | `args` is populated if you pass extra args to session.setInputCallback().
45 |
46 | """
47 | freeswitch.consoleLog("info", "hangup hook for '%s'\n" % what)
48 |
49 |
50 | def input_callback(session, what, obj, args=''):
51 | """
52 | Must be explicitly set up with session.setInputCallback(input_callback).
53 |
54 | `session` is a session object.
55 | `what` is "dtmf" or "event".
56 | `obj` is a dtmf object or an event object depending on the 'what' var.
57 | `args` is populated if you pass extra args to session.setInputCallback().
58 |
59 | """
60 | if (what == "dtmf"):
61 | freeswitch.consoleLog("info", what + " " + obj.digit + "\n")
62 | else:
63 | freeswitch.consoleLog("info", what + " " + obj.serialize() + "\n")
64 | return "pause"
65 |
66 |
67 | def fsapi(session, stream, env, args):
68 | """
69 | Handles API calls (from fs_cli, dialplan HTTP, etc.).
70 |
71 | Default name is 'fsapi', but it can be overridden with ::
72 |
73 | `session` is a session object when called from the dial plan or the
74 | string "na" when not.
75 | `stream` is a switch_stream. Anything written with stream.write() is
76 | returned to the caller.
77 | `env` is a switch_event.
78 | `args` is a string with all the args passed after the module name.
79 |
80 | """
81 | if args:
82 | stream.write("fsapi called with no arguments.\n")
83 | else:
84 | stream.write("fsapi called with these arguments: %s\n" % args)
85 | stream.write(env.serialize())
86 |
87 |
88 | def runtime(args):
89 | """
90 | Run a function in a thread (eg.: when called from fs_cli `pyrun`).
91 |
92 | `args` is a string with all the args passed after the module name.
93 |
94 | """
95 | print args + "\n"
96 |
97 |
98 | def xml_fetch(params):
99 | """
100 | Bind to an XML lookup.
101 |
102 | `params` is a switch_event with all the relevant data about what is being
103 | searched for in the XML registry.
104 |
105 | """
106 | xml = '''
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 | '''
121 |
122 | return xml
123 |
124 |
--------------------------------------------------------------------------------
/fs-mod-python/freeswitch.py:
--------------------------------------------------------------------------------
1 | # This file was automatically generated by SWIG (http://www.swig.org).
2 | # Version 2.0.12
3 | #
4 | # Do not make changes to this file unless you know what you are doing--modify
5 | # the SWIG interface file instead.
6 |
7 | from sys import version_info
8 | if version_info >= (2,6,0):
9 | def swig_import_helper():
10 | from os.path import dirname
11 | import imp
12 | fp = None
13 | try:
14 | fp, pathname, description = imp.find_module('_freeswitch', [dirname(__file__)])
15 | except ImportError:
16 | import _freeswitch
17 | return _freeswitch
18 | if fp is not None:
19 | try:
20 | _mod = imp.load_module('_freeswitch', fp, pathname, description)
21 | finally:
22 | fp.close()
23 | return _mod
24 | _freeswitch = swig_import_helper()
25 | del swig_import_helper
26 | else:
27 | import _freeswitch
28 | del version_info
29 | try:
30 | _swig_property = property
31 | except NameError:
32 | pass # Python < 2.2 doesn't have 'property'.
33 | def _swig_setattr_nondynamic(self,class_type,name,value,static=1):
34 | if (name == "thisown"): return self.this.own(value)
35 | if (name == "this"):
36 | if type(value).__name__ == 'SwigPyObject':
37 | self.__dict__[name] = value
38 | return
39 | method = class_type.__swig_setmethods__.get(name,None)
40 | if method: return method(self,value)
41 | if (not static):
42 | self.__dict__[name] = value
43 | else:
44 | raise AttributeError("You cannot add attributes to %s" % self)
45 |
46 | def _swig_setattr(self,class_type,name,value):
47 | return _swig_setattr_nondynamic(self,class_type,name,value,0)
48 |
49 | def _swig_getattr(self,class_type,name):
50 | if (name == "thisown"): return self.this.own()
51 | method = class_type.__swig_getmethods__.get(name,None)
52 | if method: return method(self)
53 | raise AttributeError(name)
54 |
55 | def _swig_repr(self):
56 | try: strthis = "proxy of " + self.this.__repr__()
57 | except: strthis = ""
58 | return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
59 |
60 | try:
61 | _object = object
62 | _newclass = 1
63 | except AttributeError:
64 | class _object : pass
65 | _newclass = 0
66 |
67 |
68 |
69 | def setGlobalVariable(*args):
70 | return _freeswitch.setGlobalVariable(*args)
71 | setGlobalVariable = _freeswitch.setGlobalVariable
72 |
73 | def getGlobalVariable(*args):
74 | return _freeswitch.getGlobalVariable(*args)
75 | getGlobalVariable = _freeswitch.getGlobalVariable
76 |
77 | def consoleLog(*args):
78 | return _freeswitch.consoleLog(*args)
79 | consoleLog = _freeswitch.consoleLog
80 |
81 | def consoleLog2(*args):
82 | return _freeswitch.consoleLog2(*args)
83 | consoleLog2 = _freeswitch.consoleLog2
84 |
85 | def consoleCleanLog(*args):
86 | return _freeswitch.consoleCleanLog(*args)
87 | consoleCleanLog = _freeswitch.consoleCleanLog
88 |
89 | def running():
90 | return _freeswitch.running()
91 | running = _freeswitch.running
92 |
93 | def email(*args):
94 | return _freeswitch.email(*args)
95 | email = _freeswitch.email
96 | class IVRMenu(_object):
97 | __swig_setmethods__ = {}
98 | __setattr__ = lambda self, name, value: _swig_setattr(self, IVRMenu, name, value)
99 | __swig_getmethods__ = {}
100 | __getattr__ = lambda self, name: _swig_getattr(self, IVRMenu, name)
101 | __repr__ = _swig_repr
102 | def __init__(self, *args):
103 | this = _freeswitch.new_IVRMenu(*args)
104 | try: self.this.append(this)
105 | except: self.this = this
106 | __swig_destroy__ = _freeswitch.delete_IVRMenu
107 | __del__ = lambda self : None;
108 | def bindAction(self, *args): return _freeswitch.IVRMenu_bindAction(self, *args)
109 | def execute(self, *args): return _freeswitch.IVRMenu_execute(self, *args)
110 | IVRMenu_swigregister = _freeswitch.IVRMenu_swigregister
111 | IVRMenu_swigregister(IVRMenu)
112 |
113 | class API(_object):
114 | __swig_setmethods__ = {}
115 | __setattr__ = lambda self, name, value: _swig_setattr(self, API, name, value)
116 | __swig_getmethods__ = {}
117 | __getattr__ = lambda self, name: _swig_getattr(self, API, name)
118 | __repr__ = _swig_repr
119 | def __init__(self, s=None):
120 | this = _freeswitch.new_API(s)
121 | try: self.this.append(this)
122 | except: self.this = this
123 | __swig_destroy__ = _freeswitch.delete_API
124 | __del__ = lambda self : None;
125 | def execute(self, *args): return _freeswitch.API_execute(self, *args)
126 | def executeString(self, *args): return _freeswitch.API_executeString(self, *args)
127 | def getTime(self): return _freeswitch.API_getTime(self)
128 | API_swigregister = _freeswitch.API_swigregister
129 | API_swigregister(API)
130 |
131 | class input_callback_state_t(_object):
132 | __swig_setmethods__ = {}
133 | __setattr__ = lambda self, name, value: _swig_setattr(self, input_callback_state_t, name, value)
134 | __swig_getmethods__ = {}
135 | __getattr__ = lambda self, name: _swig_getattr(self, input_callback_state_t, name)
136 | __repr__ = _swig_repr
137 | __swig_setmethods__["function"] = _freeswitch.input_callback_state_t_function_set
138 | __swig_getmethods__["function"] = _freeswitch.input_callback_state_t_function_get
139 | if _newclass:function = _swig_property(_freeswitch.input_callback_state_t_function_get, _freeswitch.input_callback_state_t_function_set)
140 | __swig_setmethods__["threadState"] = _freeswitch.input_callback_state_t_threadState_set
141 | __swig_getmethods__["threadState"] = _freeswitch.input_callback_state_t_threadState_get
142 | if _newclass:threadState = _swig_property(_freeswitch.input_callback_state_t_threadState_get, _freeswitch.input_callback_state_t_threadState_set)
143 | __swig_setmethods__["extra"] = _freeswitch.input_callback_state_t_extra_set
144 | __swig_getmethods__["extra"] = _freeswitch.input_callback_state_t_extra_get
145 | if _newclass:extra = _swig_property(_freeswitch.input_callback_state_t_extra_get, _freeswitch.input_callback_state_t_extra_set)
146 | __swig_setmethods__["funcargs"] = _freeswitch.input_callback_state_t_funcargs_set
147 | __swig_getmethods__["funcargs"] = _freeswitch.input_callback_state_t_funcargs_get
148 | if _newclass:funcargs = _swig_property(_freeswitch.input_callback_state_t_funcargs_get, _freeswitch.input_callback_state_t_funcargs_set)
149 | def __init__(self):
150 | this = _freeswitch.new_input_callback_state_t()
151 | try: self.this.append(this)
152 | except: self.this = this
153 | __swig_destroy__ = _freeswitch.delete_input_callback_state_t
154 | __del__ = lambda self : None;
155 | input_callback_state_t_swigregister = _freeswitch.input_callback_state_t_swigregister
156 | input_callback_state_t_swigregister(input_callback_state_t)
157 |
158 | S_HUP = _freeswitch.S_HUP
159 | S_FREE = _freeswitch.S_FREE
160 | S_RDLOCK = _freeswitch.S_RDLOCK
161 | class DTMF(_object):
162 | __swig_setmethods__ = {}
163 | __setattr__ = lambda self, name, value: _swig_setattr(self, DTMF, name, value)
164 | __swig_getmethods__ = {}
165 | __getattr__ = lambda self, name: _swig_getattr(self, DTMF, name)
166 | __repr__ = _swig_repr
167 | __swig_setmethods__["digit"] = _freeswitch.DTMF_digit_set
168 | __swig_getmethods__["digit"] = _freeswitch.DTMF_digit_get
169 | if _newclass:digit = _swig_property(_freeswitch.DTMF_digit_get, _freeswitch.DTMF_digit_set)
170 | __swig_setmethods__["duration"] = _freeswitch.DTMF_duration_set
171 | __swig_getmethods__["duration"] = _freeswitch.DTMF_duration_get
172 | if _newclass:duration = _swig_property(_freeswitch.DTMF_duration_get, _freeswitch.DTMF_duration_set)
173 | def __init__(self, *args):
174 | this = _freeswitch.new_DTMF(*args)
175 | try: self.this.append(this)
176 | except: self.this = this
177 | __swig_destroy__ = _freeswitch.delete_DTMF
178 | __del__ = lambda self : None;
179 | DTMF_swigregister = _freeswitch.DTMF_swigregister
180 | DTMF_swigregister(DTMF)
181 |
182 | class Stream(_object):
183 | __swig_setmethods__ = {}
184 | __setattr__ = lambda self, name, value: _swig_setattr(self, Stream, name, value)
185 | __swig_getmethods__ = {}
186 | __getattr__ = lambda self, name: _swig_getattr(self, Stream, name)
187 | __repr__ = _swig_repr
188 | def __init__(self, *args):
189 | this = _freeswitch.new_Stream(*args)
190 | try: self.this.append(this)
191 | except: self.this = this
192 | __swig_destroy__ = _freeswitch.delete_Stream
193 | __del__ = lambda self : None;
194 | def read(self, *args): return _freeswitch.Stream_read(self, *args)
195 | def write(self, *args): return _freeswitch.Stream_write(self, *args)
196 | def raw_write(self, *args): return _freeswitch.Stream_raw_write(self, *args)
197 | def get_data(self): return _freeswitch.Stream_get_data(self)
198 | Stream_swigregister = _freeswitch.Stream_swigregister
199 | Stream_swigregister(Stream)
200 |
201 | class Event(_object):
202 | __swig_setmethods__ = {}
203 | __setattr__ = lambda self, name, value: _swig_setattr(self, Event, name, value)
204 | __swig_getmethods__ = {}
205 | __getattr__ = lambda self, name: _swig_getattr(self, Event, name)
206 | __repr__ = _swig_repr
207 | __swig_setmethods__["event"] = _freeswitch.Event_event_set
208 | __swig_getmethods__["event"] = _freeswitch.Event_event_get
209 | if _newclass:event = _swig_property(_freeswitch.Event_event_get, _freeswitch.Event_event_set)
210 | __swig_setmethods__["serialized_string"] = _freeswitch.Event_serialized_string_set
211 | __swig_getmethods__["serialized_string"] = _freeswitch.Event_serialized_string_get
212 | if _newclass:serialized_string = _swig_property(_freeswitch.Event_serialized_string_get, _freeswitch.Event_serialized_string_set)
213 | __swig_setmethods__["mine"] = _freeswitch.Event_mine_set
214 | __swig_getmethods__["mine"] = _freeswitch.Event_mine_get
215 | if _newclass:mine = _swig_property(_freeswitch.Event_mine_get, _freeswitch.Event_mine_set)
216 | def __init__(self, *args):
217 | this = _freeswitch.new_Event(*args)
218 | try: self.this.append(this)
219 | except: self.this = this
220 | __swig_destroy__ = _freeswitch.delete_Event
221 | __del__ = lambda self : None;
222 | def chat_execute(self, *args): return _freeswitch.Event_chat_execute(self, *args)
223 | def chat_send(self, dest_proto=None): return _freeswitch.Event_chat_send(self, dest_proto)
224 | def serialize(self, format=None): return _freeswitch.Event_serialize(self, format)
225 | def setPriority(self, *args): return _freeswitch.Event_setPriority(self, *args)
226 | def getHeader(self, *args): return _freeswitch.Event_getHeader(self, *args)
227 | def getBody(self): return _freeswitch.Event_getBody(self)
228 | def getType(self): return _freeswitch.Event_getType(self)
229 | def addBody(self, *args): return _freeswitch.Event_addBody(self, *args)
230 | def addHeader(self, *args): return _freeswitch.Event_addHeader(self, *args)
231 | def delHeader(self, *args): return _freeswitch.Event_delHeader(self, *args)
232 | def fire(self): return _freeswitch.Event_fire(self)
233 | Event_swigregister = _freeswitch.Event_swigregister
234 | Event_swigregister(Event)
235 |
236 | class EventConsumer(_object):
237 | __swig_setmethods__ = {}
238 | __setattr__ = lambda self, name, value: _swig_setattr(self, EventConsumer, name, value)
239 | __swig_getmethods__ = {}
240 | __getattr__ = lambda self, name: _swig_getattr(self, EventConsumer, name)
241 | __repr__ = _swig_repr
242 | __swig_setmethods__["events"] = _freeswitch.EventConsumer_events_set
243 | __swig_getmethods__["events"] = _freeswitch.EventConsumer_events_get
244 | if _newclass:events = _swig_property(_freeswitch.EventConsumer_events_get, _freeswitch.EventConsumer_events_set)
245 | __swig_setmethods__["e_event_id"] = _freeswitch.EventConsumer_e_event_id_set
246 | __swig_getmethods__["e_event_id"] = _freeswitch.EventConsumer_e_event_id_get
247 | if _newclass:e_event_id = _swig_property(_freeswitch.EventConsumer_e_event_id_get, _freeswitch.EventConsumer_e_event_id_set)
248 | __swig_setmethods__["e_callback"] = _freeswitch.EventConsumer_e_callback_set
249 | __swig_getmethods__["e_callback"] = _freeswitch.EventConsumer_e_callback_get
250 | if _newclass:e_callback = _swig_property(_freeswitch.EventConsumer_e_callback_get, _freeswitch.EventConsumer_e_callback_set)
251 | __swig_setmethods__["e_subclass_name"] = _freeswitch.EventConsumer_e_subclass_name_set
252 | __swig_getmethods__["e_subclass_name"] = _freeswitch.EventConsumer_e_subclass_name_get
253 | if _newclass:e_subclass_name = _swig_property(_freeswitch.EventConsumer_e_subclass_name_get, _freeswitch.EventConsumer_e_subclass_name_set)
254 | __swig_setmethods__["e_cb_arg"] = _freeswitch.EventConsumer_e_cb_arg_set
255 | __swig_getmethods__["e_cb_arg"] = _freeswitch.EventConsumer_e_cb_arg_get
256 | if _newclass:e_cb_arg = _swig_property(_freeswitch.EventConsumer_e_cb_arg_get, _freeswitch.EventConsumer_e_cb_arg_set)
257 | __swig_setmethods__["enodes"] = _freeswitch.EventConsumer_enodes_set
258 | __swig_getmethods__["enodes"] = _freeswitch.EventConsumer_enodes_get
259 | if _newclass:enodes = _swig_property(_freeswitch.EventConsumer_enodes_get, _freeswitch.EventConsumer_enodes_set)
260 | __swig_setmethods__["node_index"] = _freeswitch.EventConsumer_node_index_set
261 | __swig_getmethods__["node_index"] = _freeswitch.EventConsumer_node_index_get
262 | if _newclass:node_index = _swig_property(_freeswitch.EventConsumer_node_index_get, _freeswitch.EventConsumer_node_index_set)
263 | def __init__(self, event_name=None, subclass_name="", len=5000):
264 | this = _freeswitch.new_EventConsumer(event_name, subclass_name, len)
265 | try: self.this.append(this)
266 | except: self.this = this
267 | __swig_destroy__ = _freeswitch.delete_EventConsumer
268 | __del__ = lambda self : None;
269 | def bind(self, *args): return _freeswitch.EventConsumer_bind(self, *args)
270 | def pop(self, block=0, timeout=0): return _freeswitch.EventConsumer_pop(self, block, timeout)
271 | def cleanup(self): return _freeswitch.EventConsumer_cleanup(self)
272 | EventConsumer_swigregister = _freeswitch.EventConsumer_swigregister
273 | EventConsumer_swigregister(EventConsumer)
274 |
275 | class CoreSession(_object):
276 | __swig_setmethods__ = {}
277 | __setattr__ = lambda self, name, value: _swig_setattr(self, CoreSession, name, value)
278 | __swig_getmethods__ = {}
279 | __getattr__ = lambda self, name: _swig_getattr(self, CoreSession, name)
280 | def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined - class is abstract")
281 | __repr__ = _swig_repr
282 | __swig_destroy__ = _freeswitch.delete_CoreSession
283 | __del__ = lambda self : None;
284 | __swig_setmethods__["session"] = _freeswitch.CoreSession_session_set
285 | __swig_getmethods__["session"] = _freeswitch.CoreSession_session_get
286 | if _newclass:session = _swig_property(_freeswitch.CoreSession_session_get, _freeswitch.CoreSession_session_set)
287 | __swig_setmethods__["channel"] = _freeswitch.CoreSession_channel_set
288 | __swig_getmethods__["channel"] = _freeswitch.CoreSession_channel_get
289 | if _newclass:channel = _swig_property(_freeswitch.CoreSession_channel_get, _freeswitch.CoreSession_channel_set)
290 | __swig_setmethods__["flags"] = _freeswitch.CoreSession_flags_set
291 | __swig_getmethods__["flags"] = _freeswitch.CoreSession_flags_get
292 | if _newclass:flags = _swig_property(_freeswitch.CoreSession_flags_get, _freeswitch.CoreSession_flags_set)
293 | __swig_setmethods__["allocated"] = _freeswitch.CoreSession_allocated_set
294 | __swig_getmethods__["allocated"] = _freeswitch.CoreSession_allocated_get
295 | if _newclass:allocated = _swig_property(_freeswitch.CoreSession_allocated_get, _freeswitch.CoreSession_allocated_set)
296 | __swig_setmethods__["cb_state"] = _freeswitch.CoreSession_cb_state_set
297 | __swig_getmethods__["cb_state"] = _freeswitch.CoreSession_cb_state_get
298 | if _newclass:cb_state = _swig_property(_freeswitch.CoreSession_cb_state_get, _freeswitch.CoreSession_cb_state_set)
299 | __swig_setmethods__["hook_state"] = _freeswitch.CoreSession_hook_state_set
300 | __swig_getmethods__["hook_state"] = _freeswitch.CoreSession_hook_state_get
301 | if _newclass:hook_state = _swig_property(_freeswitch.CoreSession_hook_state_get, _freeswitch.CoreSession_hook_state_set)
302 | __swig_setmethods__["cause"] = _freeswitch.CoreSession_cause_set
303 | __swig_getmethods__["cause"] = _freeswitch.CoreSession_cause_get
304 | if _newclass:cause = _swig_property(_freeswitch.CoreSession_cause_get, _freeswitch.CoreSession_cause_set)
305 | __swig_setmethods__["uuid"] = _freeswitch.CoreSession_uuid_set
306 | __swig_getmethods__["uuid"] = _freeswitch.CoreSession_uuid_get
307 | if _newclass:uuid = _swig_property(_freeswitch.CoreSession_uuid_get, _freeswitch.CoreSession_uuid_set)
308 | __swig_setmethods__["tts_name"] = _freeswitch.CoreSession_tts_name_set
309 | __swig_getmethods__["tts_name"] = _freeswitch.CoreSession_tts_name_get
310 | if _newclass:tts_name = _swig_property(_freeswitch.CoreSession_tts_name_get, _freeswitch.CoreSession_tts_name_set)
311 | __swig_setmethods__["voice_name"] = _freeswitch.CoreSession_voice_name_set
312 | __swig_getmethods__["voice_name"] = _freeswitch.CoreSession_voice_name_get
313 | if _newclass:voice_name = _swig_property(_freeswitch.CoreSession_voice_name_get, _freeswitch.CoreSession_voice_name_set)
314 | def insertFile(self, *args): return _freeswitch.CoreSession_insertFile(self, *args)
315 | def answer(self): return _freeswitch.CoreSession_answer(self)
316 | def preAnswer(self): return _freeswitch.CoreSession_preAnswer(self)
317 | def hangup(self, cause="normal_clearing"): return _freeswitch.CoreSession_hangup(self, cause)
318 | def hangupState(self): return _freeswitch.CoreSession_hangupState(self)
319 | def setVariable(self, *args): return _freeswitch.CoreSession_setVariable(self, *args)
320 | def setPrivate(self, *args): return _freeswitch.CoreSession_setPrivate(self, *args)
321 | def getPrivate(self, *args): return _freeswitch.CoreSession_getPrivate(self, *args)
322 | def getVariable(self, *args): return _freeswitch.CoreSession_getVariable(self, *args)
323 | def process_callback_result(self, *args): return _freeswitch.CoreSession_process_callback_result(self, *args)
324 | def say(self, *args): return _freeswitch.CoreSession_say(self, *args)
325 | def sayPhrase(self, *args): return _freeswitch.CoreSession_sayPhrase(self, *args)
326 | def hangupCause(self): return _freeswitch.CoreSession_hangupCause(self)
327 | def getState(self): return _freeswitch.CoreSession_getState(self)
328 | def recordFile(self, *args): return _freeswitch.CoreSession_recordFile(self, *args)
329 | def originate(self, *args): return _freeswitch.CoreSession_originate(self, *args)
330 | def destroy(self): return _freeswitch.CoreSession_destroy(self)
331 | def setDTMFCallback(self, *args): return _freeswitch.CoreSession_setDTMFCallback(self, *args)
332 | def speak(self, *args): return _freeswitch.CoreSession_speak(self, *args)
333 | def set_tts_parms(self, *args): return _freeswitch.CoreSession_set_tts_parms(self, *args)
334 | def set_tts_params(self, *args): return _freeswitch.CoreSession_set_tts_params(self, *args)
335 | def collectDigits(self, *args): return _freeswitch.CoreSession_collectDigits(self, *args)
336 | def getDigits(self, *args): return _freeswitch.CoreSession_getDigits(self, *args)
337 | def transfer(self, *args): return _freeswitch.CoreSession_transfer(self, *args)
338 | def read(self, *args): return _freeswitch.CoreSession_read(self, *args)
339 | def playAndGetDigits(self, *args): return _freeswitch.CoreSession_playAndGetDigits(self, *args)
340 | def streamFile(self, *args): return _freeswitch.CoreSession_streamFile(self, *args)
341 | def sleep(self, *args): return _freeswitch.CoreSession_sleep(self, *args)
342 | def flushEvents(self): return _freeswitch.CoreSession_flushEvents(self)
343 | def flushDigits(self): return _freeswitch.CoreSession_flushDigits(self)
344 | def setAutoHangup(self, *args): return _freeswitch.CoreSession_setAutoHangup(self, *args)
345 | def setHangupHook(self, *args): return _freeswitch.CoreSession_setHangupHook(self, *args)
346 | def ready(self): return _freeswitch.CoreSession_ready(self)
347 | def bridged(self): return _freeswitch.CoreSession_bridged(self)
348 | def answered(self): return _freeswitch.CoreSession_answered(self)
349 | def mediaReady(self): return _freeswitch.CoreSession_mediaReady(self)
350 | def waitForAnswer(self, *args): return _freeswitch.CoreSession_waitForAnswer(self, *args)
351 | def execute(self, *args): return _freeswitch.CoreSession_execute(self, *args)
352 | def sendEvent(self, *args): return _freeswitch.CoreSession_sendEvent(self, *args)
353 | def setEventData(self, *args): return _freeswitch.CoreSession_setEventData(self, *args)
354 | def getXMLCDR(self): return _freeswitch.CoreSession_getXMLCDR(self)
355 | def begin_allow_threads(self): return _freeswitch.CoreSession_begin_allow_threads(self)
356 | def end_allow_threads(self): return _freeswitch.CoreSession_end_allow_threads(self)
357 | def get_uuid(self): return _freeswitch.CoreSession_get_uuid(self)
358 | def get_cb_args(self): return _freeswitch.CoreSession_get_cb_args(self)
359 | def check_hangup_hook(self): return _freeswitch.CoreSession_check_hangup_hook(self)
360 | def run_dtmf_callback(self, *args): return _freeswitch.CoreSession_run_dtmf_callback(self, *args)
361 | def consoleLog(self, *args): return _freeswitch.CoreSession_consoleLog(self, *args)
362 | def consoleLog2(self, *args): return _freeswitch.CoreSession_consoleLog2(self, *args)
363 | CoreSession_swigregister = _freeswitch.CoreSession_swigregister
364 | CoreSession_swigregister(CoreSession)
365 |
366 |
367 | def console_log(*args):
368 | return _freeswitch.console_log(*args)
369 | console_log = _freeswitch.console_log
370 |
371 | def console_log2(*args):
372 | return _freeswitch.console_log2(*args)
373 | console_log2 = _freeswitch.console_log2
374 |
375 | def console_clean_log(*args):
376 | return _freeswitch.console_clean_log(*args)
377 | console_clean_log = _freeswitch.console_clean_log
378 |
379 | def msleep(*args):
380 | return _freeswitch.msleep(*args)
381 | msleep = _freeswitch.msleep
382 |
383 | def bridge(*args):
384 | return _freeswitch.bridge(*args)
385 | bridge = _freeswitch.bridge
386 |
387 | def hanguphook(*args):
388 | return _freeswitch.hanguphook(*args)
389 | hanguphook = _freeswitch.hanguphook
390 |
391 | def dtmf_callback(*args):
392 | return _freeswitch.dtmf_callback(*args)
393 | dtmf_callback = _freeswitch.dtmf_callback
394 | class Session(CoreSession):
395 | __swig_setmethods__ = {}
396 | for _s in [CoreSession]: __swig_setmethods__.update(getattr(_s,'__swig_setmethods__',{}))
397 | __setattr__ = lambda self, name, value: _swig_setattr(self, Session, name, value)
398 | __swig_getmethods__ = {}
399 | for _s in [CoreSession]: __swig_getmethods__.update(getattr(_s,'__swig_getmethods__',{}))
400 | __getattr__ = lambda self, name: _swig_getattr(self, Session, name)
401 | __repr__ = _swig_repr
402 | def __init__(self, *args):
403 | this = _freeswitch.new_Session(*args)
404 | try: self.this.append(this)
405 | except: self.this = this
406 | __swig_destroy__ = _freeswitch.delete_Session
407 | __del__ = lambda self : None;
408 | def begin_allow_threads(self): return _freeswitch.Session_begin_allow_threads(self)
409 | def end_allow_threads(self): return _freeswitch.Session_end_allow_threads(self)
410 | def check_hangup_hook(self): return _freeswitch.Session_check_hangup_hook(self)
411 | def destroy(self): return _freeswitch.Session_destroy(self)
412 | def run_dtmf_callback(self, *args): return _freeswitch.Session_run_dtmf_callback(self, *args)
413 | def setInputCallback(self, *args): return _freeswitch.Session_setInputCallback(self, *args)
414 | def unsetInputCallback(self): return _freeswitch.Session_unsetInputCallback(self)
415 | def setHangupHook(self, *args): return _freeswitch.Session_setHangupHook(self, *args)
416 | def ready(self): return _freeswitch.Session_ready(self)
417 | __swig_setmethods__["cb_function"] = _freeswitch.Session_cb_function_set
418 | __swig_getmethods__["cb_function"] = _freeswitch.Session_cb_function_get
419 | if _newclass:cb_function = _swig_property(_freeswitch.Session_cb_function_get, _freeswitch.Session_cb_function_set)
420 | __swig_setmethods__["cb_arg"] = _freeswitch.Session_cb_arg_set
421 | __swig_getmethods__["cb_arg"] = _freeswitch.Session_cb_arg_get
422 | if _newclass:cb_arg = _swig_property(_freeswitch.Session_cb_arg_get, _freeswitch.Session_cb_arg_set)
423 | __swig_setmethods__["hangup_func"] = _freeswitch.Session_hangup_func_set
424 | __swig_getmethods__["hangup_func"] = _freeswitch.Session_hangup_func_get
425 | if _newclass:hangup_func = _swig_property(_freeswitch.Session_hangup_func_get, _freeswitch.Session_hangup_func_set)
426 | __swig_setmethods__["hangup_func_arg"] = _freeswitch.Session_hangup_func_arg_set
427 | __swig_getmethods__["hangup_func_arg"] = _freeswitch.Session_hangup_func_arg_get
428 | if _newclass:hangup_func_arg = _swig_property(_freeswitch.Session_hangup_func_arg_get, _freeswitch.Session_hangup_func_arg_set)
429 | def setPython(self, *args): return _freeswitch.Session_setPython(self, *args)
430 | def setSelf(self, *args): return _freeswitch.Session_setSelf(self, *args)
431 | Session_swigregister = _freeswitch.Session_swigregister
432 | Session_swigregister(Session)
433 |
434 | # This file is compatible with both classic and new-style classes.
435 |
--------------------------------------------------------------------------------