tayler6000 / pyVoIP

Pure python VoIP/SIP/RTP library. Currently supports PCMA, PCMU, and telephone-event
https://pypi.org/project/pyVoIP/
GNU General Public License v3.0
234 stars 109 forks source link

password is empty in 2.0.0a4 #237

Open hanswang73 opened 10 months ago

hanswang73 commented 10 months ago

I provide the password, but password in message is empty.


my code:

cm = CredentialsManager()
cm.add(username="hanswang73_2", password="Huqiuxia3", user="hanswang73_2") ##### , server="sip.antisip.com", realm="sip.antisip.com")
params = VoIPPhoneParameter(server="sip.antisip.com", port=5060, user="hanswang73_2", credentials_manager=cm, call_class=Call) ##### , bind_ip=socket.gethostbyname(socket.gethostname()))
phone = VoIPPhone(params)
phone.start()
input('Press enter to disable the phone\n')
phone.stop()

debug message:

SENT: REGISTER sip:sip.antisip.com:5060 SIP/2.0

Headers: Via: [{'type': 'SIP/2.0/UDP', 'address': ('0.0.0.0', 5060), 'branch': 'z9hG4bK896459b408864defbc8e6a4e7'}] From: {'raw': '"hanswang73_2" sip:hanswang73_2@0.0.0.0:5060;tag=a2f125c0', 'tag': 'a2f125c0', 'uri': 'sip:hanswang73_2@0.0.0.0:5060', 'uri-type': 'sip', 'user': 'hanswang73_2', 'password': '', 'display-name': 'hanswang73_2', 'host': '0.0.0.0', 'port': 5060} To: {'raw': '"hanswang73_2" sip:hanswang73_2@sip.antisip.com:5060', 'tag': '', 'uri': 'sip:hanswang73_2@sip.antisip.com:5060', 'uri-type': 'sip', 'user': 'hanswang73_2', 'password': '', 'display-name': 'hanswang73_2', 'host': 'sip.antisip.com', 'port': 5060} Call-ID: 6b86b273ff34fce19d6b804eff5a3f57@0.0.0.0:5060 CSeq: {'check': 1, 'method': 'REGISTER'} Contact: {'raw': 'sip:hanswang73_2@0.0.0.0;transport=UDP;+sip.instance=""', 'tag': '', 'uri': 'sip:hanswang73_2@0.0.0.0', 'uri-type': 'sip', 'user': 'hanswang73_2', 'password': '', 'display-name': '', 'host': '0.0.0.0', 'port': 5060} Allow: ['INVITE', 'ACK', 'BYE', 'CANCEL', 'OPTIONS', 'NOTIFY'] Max-Forwards: 70 Allow-Events: org.3gpp.nwinitdereg User-Agent: pyVoIP 2.0.0a4 Expires: 120 Content-Length: 0

Body:

Raw: b'REGISTER sip:sip.antisip.com:5060 SIP/2.0\r\nVia: SIP/2.0/UDP 0.0.0.0:5060;branch=z9hG4bK896459b408864defbc8e6a4e7\r\nFrom: "hanswang73_2" sip:hanswang73_2@0.0.0.0:5060;tag=a2f125c0\r\nTo: "hanswang73_2" sip:hanswang73_2@sip.antisip.com:5060\r\nCall-ID: 6b86b273ff34fce19d6b804eff5a3f57@0.0.0.0:5060\r\nCSeq: 1 REGISTER\r\nContact: sip:hanswang73_2@0.0.0.0;transport=UDP;+sip.instance=""\r\nAllow: INVITE, ACK, BYE, CANCEL, OPTIONS, NOTIFY\r\nMax-Forwards: 70\r\nAllow-Events: org.3gpp.nwinitdereg\r\nUser-Agent: pyVoIP 2.0.0a4\r\nExpires: 120\r\nContent-Length: 0\r\n\r\n'

Received UDP Message: SIP/2.0 403 Forbidden On This Server

Headers: Via: [{'type': 'SIP/2.0/UDP', 'address': ('0.0.0.0', 5060), 'branch': 'z9hG4bK896459b408864defbc8e6a4e7', 'rport': 5060, 'received': '116.172.93.253'}] From: {'raw': '"hanswang73_2" sip:hanswang73_2@0.0.0.0:5060;tag=a2f125c0', 'tag': 'a2f125c0', 'uri': 'sip:hanswang73_2@0.0.0.0:5060', 'uri-type': 'sip', 'user': 'hanswang73_2', 'password': '', 'display-name': 'hanswang73_2', 'host': '0.0.0.0', 'port': 5060} To: {'raw': '"hanswang73_2" sip:hanswang73_2@sip.antisip.com:5060;tag=d63ab876884a17429d22e020c5a5c91a.0144dc1c', 'tag': 'd63ab876884a17429d22e020c5a5c91a.0144dc1c', 'uri': 'sip:hanswang73_2@sip.antisip.com:5060', 'uri-type': 'sip', 'user': 'hanswang73_2', 'password': '', 'display-name': 'hanswang73_2', 'host': 'sip.antisip.com', 'port': 5060} Call-ID: 6b86b273ff34fce19d6b804eff5a3f57@0.0.0.0:5060 CSeq: {'check': 1, 'method': 'REGISTER'} Server: kamailio (5.6.5 (x86_64/linux)) Content-Length: 0

Body:

Raw: b'SIP/2.0 403 Forbidden On This Server\r\nVia: SIP/2.0/UDP 0.0.0.0:5060;branch=z9hG4bK896459b408864defbc8e6a4e7;rport=5060;received=116.172.93.253\r\nFrom: "hanswang73_2" sip:hanswang73_2@0.0.0.0:5060;tag=a2f125c0\r\nTo: "hanswang73_2" sip:hanswang73_2@sip.antisip.com:5060;tag=d63ab876884a17429d22e020c5a5c91a.0144dc1c\r\nCall-ID: 6b86b273ff34fce19d6b804eff5a3f57@0.0.0.0:5060\r\nCSeq: 1 REGISTER\r\nServer: kamailio (5.6.5 (x86_64/linux))\r\nContent-Length: 0\r\n\r\n' New Connection Started Deregistering <pyVoIP.networking.sock.VoIPConnection object at 0x7fe361014670> self.conns=[<pyVoIP.networking.sock.VoIPConnection object at 0x7fe361014670>] listening: [["6b86b273ff34fce19d6b804eff5a3f57@0.0.0.0:5060", "a2f125c0", "d63ab876884a17429d22e020c5a5c91a.0144dc1c", 0]]

key2peace commented 10 months ago

hmmm, normally you'd expect the remote end sending back a 401 or 407 ((Proxy) Authentication Required), and according to kamailio's website, Digest SIP User authentication is supported.

Since I highly doubt they want you to really send your password in plaintext over a non-encrypted UDP port, and I do see on antisip that they support TLS, you might wanna try TLS instead of UDP

hanswang73 commented 10 months ago

thx

key2peace commented 9 months ago

if this fixed your problem, please close this issue :)