Skip to content

Instantly share code, notes, and snippets.

@muromec
Created July 13, 2013 08:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save muromec/5990047 to your computer and use it in GitHub Desktop.
Save muromec/5990047 to your computer and use it in GitHub Desktop.
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