00001 import sys
00002 from Router import LM_ERR
00003
00004 class test:
00005 def __init__(self):
00006 LM_ERR('test.__init__\n')
00007
00008 def child_init(self, y):
00009 LM_ERR('test.child_init(%d)\n' % y)
00010 return 0
00011
00012 def handler(self, msg, args):
00013 LM_ERR('test.handler(%s, %s)\n' % (msg.Type, str(arg)))
00014 if msg.Type == 'SIP_REQUEST':
00015 if msg.Method == 'INVITE':
00016 msg.rewrite_ruri('sip:0022@192.168.2.24:5073')
00017 LM_ERR('SIP request, method = %s, RURI = %s, From = %s\n' % (msg.Method, msg.RURI, msg.getHeader('from')))
00018 LM_ERR('received from %s:%d\n' % msg.src_address)
00019 else:
00020 LM_ERR('SIP reply, status = %s\n' % msg.Status)
00021 LM_ERR('received from %s:%d\n' % msg.src_address)
00022 msg.call_function('append_hf', 'This-is: test\r\n')
00023 return 1
00024
00025 def mod_init():
00026 return test()