Skip to content

Commit

Permalink
modify setuptools files
Browse files Browse the repository at this point in the history
  • Loading branch information
tanbro committed Apr 8, 2016
1 parent a3305d5 commit 70ac0a2
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 2 deletions.
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
# This flag says that the code is written to work on both Python 2 and Python
# 3. If at all possible, it is good practice to do this. If you cannot, you
# will need to generate wheels for each Python version that you support.
# universal=1
universal=1
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

pyver = '%s.%s' % (version_info[0], version_info[1])

if pyver < '3':
if pyver < '3.2':
INSTALL_REQUIRES = ['enum34', 'futures']
if pyver < '3.4':
INSTALL_REQUIRES = ['enum34']
Expand Down
51 changes: 51 additions & 0 deletions src/examples/simple_register.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import sys
import logging
import logging.config

from exosip2ctypes import initialize, Context, register, EventType

logging.basicConfig(
level=logging.DEBUG, stream=sys.stdout,
format='%(asctime)-15s [%(threadName)-10s] [%(levelname)-7s] %(name)s - %(message)s'
)


def on_sip_event(context, evt):
if evt.type == EventType.registration_success:
logging.info('registration success: %s', evt)

elif evt.type == EventType.registration_failure:
logging.error('registration failure: %s', evt)

elif evt.type == EventType.message_new:
logging.debug('%s', evt.request)


initialize()
ctx = Context(event_callback=on_sip_event, contact_address=('192.168.56.101', 5060))

logging.debug('listening...')
ctx.listen_on_address(port=55160)
logging.debug('starting...')

ctx.start()
logging.debug('started!')

with ctx.lock:
ctx.add_authentication_info('user2', 'user2', '123', 'sip.linkrtc.com')

while True:
s = sys.stdin.readline().strip().lower()
if s in ('q', 'quit'):
ctx.stop()
break
elif s == 'r':
with ctx.lock:
register_req = register.InitialRegister(
ctx,
'sip:user2@sip.linkrtc.com',
'sip:sip.linkrtc.com'
)
logging.debug('rid=%s', register_req.rid)
logging.debug('InitialRegister=%s', register_req)
register_req.send()

0 comments on commit 70ac0a2

Please sign in to comment.