-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathoutbound.py
38 lines (22 loc) · 869 Bytes
/
outbound.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/python
from fsprotocol import *
log = logging.getLogger("OutboundSocket")
class OutboundProtocol(FSProtocol):
"""
Outbound connection from FreeSWITCH.
"""
state = "READ_CHANNELINFO" #set state to read cahnnel info up on connect
def connectionMade(self):
log.info("New connection from FreeSWITCH %s"%self.transport.getPeer())
FSProtocol.connectionMade(self)
self.connect()
def connect(self):
self.sendLine("connect")
def onConnect(self):
self.state= "READ_CONTENT"
self.message.decode()
self.connectComplete(self.message)
def connectComplete(self, callinfo):
log.error("Method not implemented")
class OutboundFactory(protocol.ServerFactory):
protocol = OutboundProtocol