Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
query texr.net version
mport socket
msg = '''OPTIONS sip:texr.net SIP/2.0
Via: SIP/2.0/UDP texr.net;branch=z9hG4bK5cb072362f08f6a3
Content-Length: 0
From: "neko" <sip:neko@texr.net>;tag=4158f3dc
To: "neko" <sip:neko@texr.net>
User-Agent: pygay
CSeq: 55216 OPTIONS
Max-Forwards: 70
Call-ID: 1740c212b2be8e267b7c16ee1bd7
'''
to_ip = socket.gethostbyname("sip.texr.net")
to_port = 5060
sock = socket.socket( socket.AF_INET, socket.SOCK_STREAM )
sock.connect((to_ip, to_port))
sock.send(str(msg))
msg, addr = sock.recvfrom(4096)
print msg
msg, addr = sock.recvfrom(4096)
print msg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment