Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add copyright notice to all source files

  • Loading branch information...
commit 3ca27708bf9b367dc564d80ae0770fb273d26442 1 parent 9179f62
bevenky authored
Showing with 124 additions and 75 deletions.
  1. +2 −1  src/examples/freeswitch/inbound/inbound_api.py
  2. +2 −1  src/examples/freeswitch/inbound/inbound_api_notfound.py
  3. +6 −5 src/examples/freeswitch/inbound/inbound_autoreconnect.py
  4. +2 −1  src/examples/freeswitch/inbound/inbound_bgapi.py
  5. +2 −1  src/examples/freeswitch/inbound/inbound_bgapi2.py
  6. +2 −0  src/examples/freeswitch/inbound/inbound_concurrent_bgapi.py
  7. +2 −0  src/examples/freeswitch/inbound/inbound_concurrent_dialer_server.py
  8. +2 −2 src/examples/freeswitch/inbound/inbound_connectfailure.py
  9. +2 −3 src/examples/freeswitch/inbound/inbound_filter.py
  10. +2 −1  src/examples/freeswitch/inbound/inbound_stop.py
  11. +2 −1  src/examples/freeswitch/inbound/inbound_stop_spawned.py
  12. +3 −2 src/examples/freeswitch/outbound/outbound_async_server_test.py
  13. +2 −1  src/examples/freeswitch/outbound/outbound_sync_server_test.py
  14. +4 −3 src/plivo/core/errors.py
  15. +2 −0  src/plivo/core/freeswitch/commands.py
  16. +18 −17 src/plivo/core/freeswitch/eventsocket.py
  17. +10 −11 src/plivo/core/freeswitch/eventtypes.py
  18. +5 −5 src/plivo/core/freeswitch/inboundsocket.py
  19. +2 −0  src/plivo/core/freeswitch/outboundsocket.py
  20. +3 −2 src/plivo/core/freeswitch/transport.py
  21. +2 −1  src/plivo/core/transport.py
  22. +2 −0  src/plivo/rest/freeswitch/helpers.py
  23. +2 −0  src/plivo/rest/freeswitch/inbound_socket.py
  24. +2 −0  src/plivo/rest/freeswitch/outbound_server.py
  25. +2 −0  src/plivo/rest/freeswitch/outbound_socket.py
  26. +2 −0  src/plivo/rest/freeswitch/rest_api.py
  27. +2 −0  src/plivo/rest/freeswitch/rest_server.py
  28. +2 −0  src/plivo/rest/freeswitch/restexceptions.py
  29. +2 −0  src/plivo/rest/freeswitch/verbs.py
  30. +11 −10 src/plivo/utils/daemonize.py
  31. +3 −2 src/plivo/utils/logger.py
  32. +2 −0  src/scripts/initscript/debian/plivo-myscript
  33. +2 −0  src/scripts/plivod
  34. +2 −0  src/scripts/tests.py
  35. +2 −0  src/tests.py
  36. +4 −3 src/tests/freeswitch/test_events.py
  37. +3 −2 src/tests/freeswitch/test_inboundsocket.py
  38. +2 −0  tools/profiler.sh
View
3  src/examples/freeswitch/inbound/inbound_api.py
@@ -1,3 +1,5 @@
+# Copyright (c) 2011 Plivo Team. See LICENSE for details.
+
# -*- coding: utf-8 -*-
from plivo.core.freeswitch.inboundsocket import InboundEventSocket
from plivo.core.errors import ConnectError
@@ -25,4 +27,3 @@
except (SystemExit, KeyboardInterrupt): pass
log.info("exit")
-
View
3  src/examples/freeswitch/inbound/inbound_api_notfound.py
@@ -1,3 +1,5 @@
+# Copyright (c) 2011 Plivo Team. See LICENSE for details.
+
# -*- coding: utf-8 -*-
from plivo.core.freeswitch.inboundsocket import InboundEventSocket
from plivo.core.errors import ConnectError
@@ -24,4 +26,3 @@
except (SystemExit, KeyboardInterrupt): pass
log.info("exit")
-
View
11 src/examples/freeswitch/inbound/inbound_autoreconnect.py
@@ -1,3 +1,5 @@
+# Copyright (c) 2011 Plivo Team. See LICENSE for details.
+
# -*- coding: utf-8 -*-
import gevent
from plivo.core.freeswitch.inboundsocket import InboundEventSocket
@@ -6,7 +8,7 @@
class MyInboundEventSocket(InboundEventSocket):
- '''Inbound eventsocket connector that automatically reconnects
+ '''Inbound eventsocket connector that automatically reconnects
when the freeswitch eventsocket module closed the connection
'''
def __init__(self, host, port, password, filter="ALL", pool_size=500, connect_timeout=5):
@@ -23,14 +25,13 @@ def start(self):
self.serve_forever()
except ConnectError, e:
self.log.error("ConnectError: %s" % str(e))
- except (SystemExit, KeyboardInterrupt):
+ except (SystemExit, KeyboardInterrupt):
break
self.log.error("Inbound socket closed, try to reconnect ...")
gevent.sleep(1.0)
self.log.info("Inbound socket terminated")
-
+
if __name__ == '__main__':
c = MyInboundEventSocket('127.0.0.1', 8021, 'ClueCon')
- c.start()
-
+ c.start()
View
3  src/examples/freeswitch/inbound/inbound_bgapi.py
@@ -1,3 +1,5 @@
+# Copyright (c) 2011 Plivo Team. See LICENSE for details.
+
# -*- coding: utf-8 -*-
from plivo.core.freeswitch.inboundsocket import InboundEventSocket
from plivo.core.errors import ConnectError
@@ -31,4 +33,3 @@
except (SystemExit, KeyboardInterrupt): pass
log.info("exit")
-
View
3  src/examples/freeswitch/inbound/inbound_bgapi2.py
@@ -1,3 +1,5 @@
+# Copyright (c) 2011 Plivo Team. See LICENSE for details.
+
# -*- coding: utf-8 -*-
from plivo.core.freeswitch.inboundsocket import InboundEventSocket
from plivo.core.errors import ConnectError
@@ -53,4 +55,3 @@ def wait_background_job(self):
except (SystemExit, KeyboardInterrupt): pass
log.info("exit")
-
View
2  src/examples/freeswitch/inbound/inbound_concurrent_bgapi.py
@@ -1,3 +1,5 @@
+# Copyright (c) 2011 Plivo Team. See LICENSE for details.
+
# -*- coding: utf-8 -*-
from plivo.core.freeswitch.inboundsocket import InboundEventSocket
from plivo.core.errors import ConnectError
View
2  src/examples/freeswitch/inbound/inbound_concurrent_dialer_server.py
@@ -1,3 +1,5 @@
+# Copyright (c) 2011 Plivo Team. See LICENSE for details.
+
from plivo.core.freeswitch.inboundsocket import InboundEventSocket
from plivo.core.errors import ConnectError
from plivo.utils.logger import StdoutLogger
View
4 src/examples/freeswitch/inbound/inbound_connectfailure.py
@@ -1,3 +1,5 @@
+# Copyright (c) 2011 Plivo Team. See LICENSE for details.
+
# -*- coding: utf-8 -*-
import traceback
from plivo.core.freeswitch.inboundsocket import InboundEventSocket
@@ -34,5 +36,3 @@
log.info('#'*60 + '\n')
log.info('exit')
-
-
View
5 src/examples/freeswitch/inbound/inbound_filter.py
@@ -1,3 +1,5 @@
+# Copyright (c) 2011 Plivo Team. See LICENSE for details.
+
# -*- coding: utf-8 -*-
from plivo.core.freeswitch.inboundsocket import InboundEventSocket
from plivo.core.errors import ConnectError
@@ -24,6 +26,3 @@
except (SystemExit, KeyboardInterrupt): pass
log.info("exit")
-
-
-
View
3  src/examples/freeswitch/inbound/inbound_stop.py
@@ -1,3 +1,5 @@
+# Copyright (c) 2011 Plivo Team. See LICENSE for details.
+
# -*- coding: utf-8 -*-
from plivo.core.freeswitch.inboundsocket import InboundEventSocket
from plivo.core.errors import ConnectError
@@ -19,4 +21,3 @@
except (SystemExit, KeyboardInterrupt): pass
log.info("exit")
-
View
3  src/examples/freeswitch/inbound/inbound_stop_spawned.py
@@ -1,3 +1,5 @@
+# Copyright (c) 2011 Plivo Team. See LICENSE for details.
+
# -*- coding: utf-8 -*-
from plivo.core.freeswitch.inboundsocket import InboundEventSocket
from plivo.core.errors import ConnectError
@@ -27,4 +29,3 @@ def stop(inbound_event_listener, log):
except (SystemExit, KeyboardInterrupt): pass
log.info("exit")
-
View
5 src/examples/freeswitch/outbound/outbound_async_server_test.py
@@ -1,3 +1,5 @@
+# Copyright (c) 2011 Plivo Team. See LICENSE for details.
+
# -*- coding: utf-8 -*-
"""
Outbound server example in async mode full .
@@ -44,7 +46,7 @@ def run(self):
self.answer()
self.log.info("Wait answer")
event = self._action_queue.get()
- gevent.sleep(1) # sleep 1 sec: sometimes sound is truncated after answer
+ gevent.sleep(1) # sleep 1 sec: sometimes sound is truncated after answer
self.log.info("Channel answered")
# play file
@@ -74,4 +76,3 @@ def do_handle(self, socket, address):
if __name__ == '__main__':
outboundserver = AsyncOutboundServer(('127.0.0.1', 8084), AsyncOutboundEventSocket)
outboundserver.serve_forever()
-
View
3  src/examples/freeswitch/outbound/outbound_sync_server_test.py
@@ -1,3 +1,5 @@
+# Copyright (c) 2011 Plivo Team. See LICENSE for details.
+
# -*- coding: utf-8 -*-
"""
Outbound server example in sync mode full .
@@ -68,4 +70,3 @@ def do_handle(self, socket, address):
if __name__ == '__main__':
outboundserver = SyncOutboundServer(('127.0.0.1', 8084), SyncOutboundEventSocket)
outboundserver.serve_forever()
-
View
7 src/plivo/core/errors.py
@@ -1,14 +1,15 @@
+# Copyright (c) 2011 Plivo Team. See LICENSE for details.
+
# -*- coding: utf-8 -*-
"""
Exceptions classes
"""
-class LimitExceededError(Exception):
+class LimitExceededError(Exception):
'''Exception class when MAXLINES_PER_EVENT is reached'''
pass
-class ConnectError(Exception):
+class ConnectError(Exception):
'''Exception class for connection'''
pass
-
View
2  src/plivo/core/freeswitch/commands.py
@@ -1,3 +1,5 @@
+# Copyright (c) 2011 Plivo Team. See LICENSE for details.
+
# -*- coding: utf-8 -*-
"""
FreeSWITCH Commands class
View
35 src/plivo/core/freeswitch/eventsocket.py
@@ -1,3 +1,5 @@
+# Copyright (c) 2011 Plivo Team. See LICENSE for details.
+
# -*- coding: utf-8 -*-
"""
Event Socket class
@@ -77,7 +79,7 @@ def stop_event_handler(self):
'''
if self._handler_thread:
self._handler_thread.kill()
-
+
def handle_events(self):
'''
Gets and Dispatches events in an endless loop using gevent spawn.
@@ -96,7 +98,7 @@ def handle_events(self):
except GreenletExit, e:
self.connected = False
return
-
+
def read_event(self):
'''
Reads one Event from socket until EOL.
@@ -188,11 +190,11 @@ def _event_plain(self, event):
'''
# Gets raw data for this event
raw = self.read_raw(event)
- # If raw was found drops current event
+ # If raw was found drops current event
# and replaces with Event created from raw
if raw:
event = Event(raw)
- # Gets raw response from Event Content-Length header
+ # Gets raw response from Event Content-Length header
# and raw buffer
raw_response = self.read_raw_response(event, raw)
# If rawresponse was found, this is our Event body
@@ -218,7 +220,7 @@ def _unknown_event(self, event):
def dispatch_event(self, event):
'''
Dispatches one event with callback.
-
+
E.g. Receives Background_Job event and calls on_background_job function.
'''
method = 'on_' + event.get_header('Event-Name').lower()
@@ -228,27 +230,27 @@ def dispatch_event(self, event):
callback = self.unbound_event(event)
# Calls callback.
# On exception calls callback_failure method.
- try:
+ try:
callback(event)
- except:
+ except:
self.callback_failure(event)
-
+
def unbound_event(self, event):
'''
Catches all unbound events from FreeSWITCH.
-
+
Can be implemented by the subclass.
'''
pass
-
+
def callback_failure(self, event):
'''
Called when callback to an event fails.
-
+
Can be implemented by the subclass.
'''
pass
-
+
def disconnect(self):
'''
Disconnects from eventsocket and stops handling events.
@@ -269,7 +271,7 @@ def _send(self, cmd):
if isinstance(cmd, types.UnicodeType):
cmd = cmd.encode("utf-8")
self.transport.write(cmd + EOL*2)
-
+
def _sendmsg(self, name, arg=None, uuid="", lock=False, loops=1):
if isinstance(name, types.UnicodeType):
name = name.encode("utf-8")
@@ -285,7 +287,7 @@ def _sendmsg(self, name, arg=None, uuid="", lock=False, loops=1):
arglen = len(arg)
msg += "content-type: text/plain\ncontent-length: %d\n\n%s\n" % (arglen, arg)
self.transport.write(msg + EOL)
-
+
def _protocol_send(self, command, args=""):
with self._lock:
self._send("%s %s" % (command, args))
@@ -294,18 +296,17 @@ def _protocol_send(self, command, args=""):
# Casts to ApiResponse, if event is api
if command == 'api':
event = ApiResponse.cast(event)
- # Casts to BgapiResponse, if event is bgapi
+ # Casts to BgapiResponse, if event is bgapi
elif command == "bgapi":
event = BgapiResponse.cast(event)
# Casts to CommandResponse by default
else:
event = CommandResponse.cast(event)
return event
-
+
def _protocol_sendmsg(self, name, args=None, uuid="", lock=False, loops=1):
with self._lock:
self._sendmsg(name, args, uuid, lock, loops)
event = self._response_queue.get()
# Always casts Event to CommandResponse
return CommandResponse.cast(event)
-
View
21 src/plivo/core/freeswitch/eventtypes.py
@@ -1,3 +1,5 @@
+# Copyright (c) 2011 Plivo Team. See LICENSE for details.
+
# -*- coding: utf-8 -*-
"""
Event Types classes
@@ -20,7 +22,7 @@ def __init__(self, buffer=""):
try:
var, val = line.rstrip().split(': ', 1)
self.set_header(var, val)
- except ValueError:
+ except ValueError:
pass
def __getitem__(self, key):
@@ -49,12 +51,12 @@ def get_reply_text(self):
Returns None if header not found.
'''
- return self.get_header('Reply-Text')
+ return self.get_header('Reply-Text')
def is_reply_text_success(self):
'''
Returns True if ReplyText header begins with +OK.
-
+
Returns False otherwise.
'''
reply = self.get_reply_text()
@@ -140,8 +142,8 @@ def get_unquoted_raw_event(self):
def __str__(self):
return '<%s headers=%s, body=%s>' \
- % (self.__class__.__name__,
- str(self.get_unquoted_raw_headers().replace('\n', '\\n')),
+ % (self.__class__.__name__,
+ str(self.get_unquoted_raw_headers().replace('\n', '\\n')),
str(self.get_body()).replace('\n', '\\n'))
@@ -167,7 +169,7 @@ def get_response(self):
def is_success(self):
'''
Returns True if api command is a success.
-
+
Otherwise returns False.
'''
return self._raw_body and self._raw_body[:3] == '+OK'
@@ -201,7 +203,7 @@ def get_job_uuid(self):
def is_success(self):
'''
Returns True if bgapi command is a success.
-
+
Otherwise returns False.
'''
return self.is_reply_text_success()
@@ -229,10 +231,7 @@ def get_response(self):
def is_success(self):
'''
Returns True if command is a success.
-
+
Otherwise returns False.
'''
return self.is_reply_text_success()
-
-
-
View
10 src/plivo/core/freeswitch/inboundsocket.py
@@ -1,3 +1,5 @@
+# Copyright (c) 2011 Plivo Team. See LICENSE for details.
+
# -*- coding: utf-8 -*-
"""
Inbound Event Socket class
@@ -27,12 +29,12 @@ def _wait_auth_request(self):
timer = Timeout(self.transport.get_connect_timeout())
timer.start()
try:
- # When auth/request is received,
+ # When auth/request is received,
# _authRequest method in BaseEventSocket will push this event to queue
# so we will just wait this event here.
return self._response_queue.get()
except Timeout:
- raise ConnectError("Timeout waiting auth/request")
+ raise ConnectError("Timeout waiting auth/request")
finally:
timer.cancel()
@@ -76,7 +78,5 @@ def serve_forever(self):
"""
Starts waiting for events in endless loop.
"""
- while self.is_connected():
+ while self.is_connected():
gevent.sleep(0.1)
-
-
View
2  src/plivo/core/freeswitch/outboundsocket.py
@@ -1,3 +1,5 @@
+# Copyright (c) 2011 Plivo Team. See LICENSE for details.
+
# -*- coding: utf-8 -*-
"""
Outbound Event Socket class
View
5 src/plivo/core/freeswitch/transport.py
@@ -1,3 +1,5 @@
+# Copyright (c) 2011 Plivo Team. See LICENSE for details.
+
# -*- coding: utf-8 -*-
"""
Freeswitch Transport classes
@@ -27,7 +29,7 @@ def write(self, data):
raise ConnectError('not connected')
self.sockfd.write(data)
self.sockfd.flush()
-
+
class OutboundTransport(Transport):
@@ -36,4 +38,3 @@ def __init__(self, socket, address, connect_timeout=5):
self.sockfd = socket.makefile()
self.address = address
self.timeout = connect_timeout
-
View
3  src/plivo/core/transport.py
@@ -1,3 +1,5 @@
+# Copyright (c) 2011 Plivo Team. See LICENSE for details.
+
# -*- coding: utf-8 -*-
"""
Transport class
@@ -26,4 +28,3 @@ def close(self):
def get_connect_timeout(self):
return self.timeout
-
View
2  src/plivo/rest/freeswitch/helpers.py
@@ -1,3 +1,5 @@
+# Copyright (c) 2011 Plivo Team. See LICENSE for details.
+
import re
import urlparse
View
2  src/plivo/rest/freeswitch/inbound_socket.py
@@ -1,3 +1,5 @@
+# Copyright (c) 2011 Plivo Team. See LICENSE for details.
+
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from gevent import monkey; monkey.patch_all()
View
2  src/plivo/rest/freeswitch/outbound_server.py
@@ -1,3 +1,5 @@
+# Copyright (c) 2011 Plivo Team. See LICENSE for details.
+
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from gevent import monkey; monkey.patch_all()
View
2  src/plivo/rest/freeswitch/outbound_socket.py
@@ -1,3 +1,5 @@
+# Copyright (c) 2011 Plivo Team. See LICENSE for details.
+
#!/usr/bin/env python
# -*- coding: utf-8 -*-
View
2  src/plivo/rest/freeswitch/rest_api.py
@@ -1,3 +1,5 @@
+# Copyright (c) 2011 Plivo Team. See LICENSE for details.
+
from gevent import monkey; monkey.patch_all()
from flask import Flask, request
View
2  src/plivo/rest/freeswitch/rest_server.py
@@ -1,3 +1,5 @@
+# Copyright (c) 2011 Plivo Team. See LICENSE for details.
+
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from gevent import monkey; monkey.patch_all()
View
2  src/plivo/rest/freeswitch/restexceptions.py
@@ -1,3 +1,5 @@
+# Copyright (c) 2011 Plivo Team. See LICENSE for details.
+
#!/usr/bin/env python
# -*- coding: utf-8 -*-
View
2  src/plivo/rest/freeswitch/verbs.py
@@ -1,3 +1,5 @@
+# Copyright (c) 2011 Plivo Team. See LICENSE for details.
+
#!/usr/bin/env python
# -*- coding: utf-8 -*-
View
21 src/plivo/utils/daemonize.py
@@ -1,3 +1,5 @@
+# Copyright (c) 2011 Plivo Team. See LICENSE for details.
+
# -*- coding: utf-8 -*-
"""
Daemonize application.
@@ -115,32 +117,32 @@ def daemon_script(script, user, group, path='/', pidfile=None, script_args=(), o
def main():
parser = optparse.OptionParser()
parser.add_option("-s", "--script", action="store", type="string",
- dest="script", help="python script SCRIPT to run (argument is mandatory)",
+ dest="script", help="python script SCRIPT to run (argument is mandatory)",
metavar="SCRIPT")
parser.add_option("-p", "--pidfile", action="store", type="string",
dest="pidfile", help="write pid to PIDFILE (argument is mandatory)",
metavar="PIDFILE")
parser.add_option("-u", "--user", action="store", type="string",
- dest="user", help="set uid to USER (argument is mandatory)",
+ dest="user", help="set uid to USER (argument is mandatory)",
metavar="USER")
parser.add_option("-g", "--group", action="store", type="string",
- dest="group", help="set gid to GROUP (argument is mandatory)",
+ dest="group", help="set gid to GROUP (argument is mandatory)",
metavar="GROUP")
parser.add_option("-G", "--groups", action="append", type="string", default=[],
- dest="groups", help="set other groups gid to OTHERGROUP (can be added multiple times)",
+ dest="groups", help="set other groups gid to OTHERGROUP (can be added multiple times)",
metavar="OTHERGROUP")
parser.add_option("-P", "--pybin", action="store", type="string", default=None,
- dest="pybin", help="set python binary PYBIN to run script",
+ dest="pybin", help="set python binary PYBIN to run script",
metavar="PYBIN")
parser.add_option("-a", "--scriptarg", action="append", type="string", default=[],
- dest="scriptargs", help="add ARG to python script (can be added multiple times)",
+ dest="scriptargs", help="add ARG to python script (can be added multiple times)",
metavar="ARG")
(options, args) = parser.parse_args()
script = options.script
user = options.user
group = options.group
- pidfile = options.pidfile
+ pidfile = options.pidfile
ogroups = options.groups
pybin = options.pybin
scriptargs = options.scriptargs
@@ -149,11 +151,10 @@ def main():
parser.print_help()
sys.exit(1)
- daemon_script(script, user, group, pidfile=pidfile,
- script_args=scriptargs, other_groups=ogroups,
+ daemon_script(script, user, group, pidfile=pidfile,
+ script_args=scriptargs, other_groups=ogroups,
python_bin=pybin)
if __name__ == '__main__':
main()
-
View
5 src/plivo/utils/logger.py
@@ -1,3 +1,5 @@
+# Copyright (c) 2011 Plivo Team. See LICENSE for details.
+
# -*- coding: utf-8 -*-
"""
Log classes : stdout, syslog and file loggers
@@ -38,7 +40,7 @@ def __init__(self, loglevel=LOG_DEBUG, servicename=__default_servicename__):
def set_debug(self):
self.loglevel = LOG_DEBUG
self._logger.setLevel(self.loglevel)
-
+
def set_info(self):
self.loglevel = LOG_INFO
self._logger.setLevel(self.loglevel)
@@ -159,4 +161,3 @@ def __init__(self, logfile='/tmp/%s.log' % __default_servicename__, \
h.setFormatter(fmt)
self._logger = RootLogger(loglevel)
self._logger.addHandler(h)
-
View
2  src/scripts/initscript/debian/plivo-myscript
@@ -1,3 +1,5 @@
+# Copyright (c) 2011 Plivo Team. See LICENSE for details.
+
#! /bin/sh
### BEGIN INIT INFO
# Provides: plivo service
View
2  src/scripts/plivod
@@ -1,3 +1,5 @@
+# Copyright (c) 2011 Plivo Team. See LICENSE for details.
+
#!/usr/bin/env python
"""
Daemonizer for python scripts.
View
2  src/scripts/tests.py
@@ -1,3 +1,5 @@
+# Copyright (c) 2011 Plivo Team. See LICENSE for details.
+
import plivo.tests
plivo.tests.run_test()
View
2  src/tests.py
@@ -1,3 +1,5 @@
+# Copyright (c) 2011 Plivo Team. See LICENSE for details.
+
# -*- coding: utf-8 -*-
import unittest
View
7 src/tests/freeswitch/test_events.py
@@ -1,3 +1,5 @@
+# Copyright (c) 2011 Plivo Team. See LICENSE for details.
+
# -*- coding: utf-8 -*-
from unittest import TestCase
@@ -31,8 +33,8 @@ class TestEvent(TestCase):
def test_command_reply(self):
ev = Event(self.EVENT_COMMAND_REPLY)
- self.assertEquals(ev.get_content_type(), "command/reply")
- self.assertEquals(ev.get_reply_text(), "+OK accepted")
+ self.assertEquals(ev.get_content_type(), "command/reply")
+ self.assertEquals(ev.get_reply_text(), "+OK accepted")
self.assertTrue(ev.is_reply_text_success())
def test_auth_request(self):
@@ -46,4 +48,3 @@ def test_event_plain(self):
ev2 = Event(self.EVENT_PLAIN)
self.assertEquals(ev2.get_header("Event-Name"), "RE_SCHEDULE")
self.assertEquals(len(self.EVENT_PLAIN), ev1.get_content_length())
-
View
5 src/tests/freeswitch/test_inboundsocket.py
@@ -1,3 +1,5 @@
+# Copyright (c) 2011 Plivo Team. See LICENSE for details.
+
# -*- coding: utf-8 -*-
from unittest import TestCase
@@ -217,7 +219,7 @@ def tearDown(self):
self.server_proc.kill()
except:
pass
-
+
def test_login_failure(self):
isock = InboundEventSocket('127.0.0.1', 23333, 'ClueCon')
self.assertRaises(ConnectError, isock.connect)
@@ -249,4 +251,3 @@ def test_events(self):
self.assertEquals(ev.get_header('Event-Name'), 'HEARTBEAT')
for ev in isock.re_schedule_events:
self.assertEquals(ev.get_header('Event-Name'), 'RE_SCHEDULE')
-
View
2  tools/profiler.sh
@@ -1,3 +1,5 @@
+# Copyright (c) 2011 Plivo Team. See LICENSE for details.
+
#!/bin/bash
# profile a python script with cProfile
Please sign in to comment.
Something went wrong with that request. Please try again.