[Twisted-Python] [SIP]
![](https://secure.gravatar.com/avatar/e1e14cc8ab70b3248b4ebdafc5a7f3c0.jpg?s=120&d=mm&r=g)
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 !
![](https://secure.gravatar.com/avatar/356bcf6a048e9104538ae3b19b9fe6a5.jpg?s=120&d=mm&r=g)
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@enseirb.fr> wrote:
![](https://secure.gravatar.com/avatar/356bcf6a048e9104538ae3b19b9fe6a5.jpg?s=120&d=mm&r=g)
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@enseirb.fr> wrote:
participants (2)
-
Godson Gera
-
Rémi BUISSON