[Twisted-Python] [SIP]
Godson Gera
godson.g at gmail.com
Mon Jul 7 12:53:23 MDT 2008
Hi, this little script redirects all the sip requests it receives to other
sip server residing and 192.168.1.100, this is a learning example for me as
well, but good enough to start with SIP in twisted.
from twisted.internet import reactor
from twisted.protocols import sip
from twisted.internet.protocol import ServerFactory
class SipProxy(sip.Proxy):
def __init__(self):
sip.Proxy.__init__(self,host='192.168.1.3',port=5060)
self.tries=0
def handle_request(self,message,addr):
print message.toString()
print dir(message)
if message.method=='ACK':return
r = self.responseFromRequest(301,message)
r.addHeader("Contact","sip:192.168.1.100:5061")
r.creationFinished()
self.deliverResponse(r)
print r.toString()
print addr
self.tries+=1
class sipfactory(ServerFactory):
protocol=SipProxy
reactor.listenUDP(5060,SipProxy(),'192.168.1.3')
reactor.run()
Thanks & Regards,
Godson Gera
On 6/30/08, Rémi BUISSON <buisson at enseirb.fr> wrote:
>
> Hi everyone,
>
> I didn't succeed in using twisted.protocols.sip ?
>
> Do you have a simple example for me ? It will be very nice ...
>
> Thanks in advance !
>
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20080708/b24b7b82/attachment.htm
More information about the Twisted-Python
mailing list