SIP REGISTER failed - vb.net

I'm attempting to create a small VoIP Client in Visual Studio 2012.
i'm trying to send a REGISTER SIP message from a pc to an AsteriskNOW PBX via UDP. The devices are the following:
IP PBX AsteriskNOW: 192.168.1.37
PC that sends REGISTER message: 192.168.1.104
SIP account username: 117
SIP account password: abcd1234
so, the REGISTER message i'm trying to send is the following:
REGISTER sip:192.168.1.37 SIP/2.0
Via: SIP/2.0/UDP 192.168.1.104:5060;branch=z9hG4bK213760691;rport
From: <sip:117#192.168.1.37>;tag=1270517038
To: <sip:117#192.168.1.37>
Call-ID: 1808066864-5060-1#BJC.BGI.B.D
CSeq: 2001 REGISTER
Contact: <sip:117#192.168.1.104:5060>;reg-id=1;
+sip.instance="<urn:uuid:00000000-0000-1000-8000-AABBCCDDEEFF>"
Max-Forwards: 70
User-Agent: Grandstream GXP1165 1.0.6.7
Supported: path
Expires: 3600
Allow: INVITE, ACK, OPTIONS, CANCEL, BYE, SUBSCRIBE, NOTIFY, INFO, REFER,
UPDATE, MESSAGE
Content-Length: 0
of course, at the line
+sip.instance="<urn:uuid:00000000-0000-1000-8000-AABBCCDDEEFF>"
there's the PC,s Network adapter MAC, instead of "AABBCCDDEEFF".
However, when I try to send the message, i get the following response from the server:
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP
192.168.1.104:5060;rport=5060;received=192.168.1.104;branch=z9hG4bK213760691
Call-ID: 1808066864-5060-1#BJC.BGI.B.D
From: <sip:117#192.168.1.37>;tag=1270517038
To: <sip:117#192.168.1.37>;tag=z9hG4bK2137606914
CSeq: 2001 REGISTER
WWW-Authenticate: Digest
realm="asterisk",nonce="1428402653/99967d603c38695f1c328332db91a43b",
opaque="416e7e1767513798",algorithm=md5,qop="auth"
Server: FPBX-AsteriskNOW-12.0.43(13.0.1)
Content-Length: 0
what can be the problem? Thank you!

I solved by using the ozeki library to manage SIP messages
I found the library here
http://www.voip-sip-sdk.com/p_179-windows-forms-softphone-vb-net-voip.html
Thank you!

Related

RTSP: Not receiving SDP from the server after sending "describe" request

I have a Bosch camera(server) and my end goal is to get the video content description via metadata from it. I am using LwIP Raw API's(1.4.0) for this purpose. At present, I am trying to authenticate with the camera and receive the SDP so I can setup the session. However, after I authenticate by resending the describe request with the digest, I don't get any response from the server and after a while the server resets the connection. Below is the sequence of operations I perform for authentication.
Step 1: Client to Server (mcu sends 1st describe request)
DESCRIBE rtsp://service:PRBUWPCs7*f40j#192.168.1.129/?enablevideo=0&vcd=1 RTSP/1.0
CSeq: 1
User-Agent: rtsp://service:PRBUWPCs7*f40j#192.168.1.129(LIVE555 Streaming Media v2018.02.28)
Accept: application/sdp
Step 2: Server to Client (server responds with nonce for authentication, rx via callback)
Payload:RTSP/1.0 401 Unauthorized
CSeq: 1
WWW-Authenticate: Digest realm="Please log in with a valid
username",nonce="7bd251bb670e45966c415838679f778f",opaque="",stale=FALSE,algorithm=MD5
Step 3: Client to Server (mcu computes the response and resends the describe command )
DESCRIBE rtsp://service:PRBUWPCs7*f40j#192.168.1.129/?enablevideo=0&vcd=1 RTSP/1.0
CSeq: 2
Authorization: Digest username="service", realm="Please log in with a valid username", nonce="7bd251bb670e45966c415838679f778f", uri="rtsp://service:PRBUWPCs7*f40j#192.168.1.129/?enablevideo=0&vcd=1", response="4c87974de2e3ecc3d534beddef9e6962"
User-Agent: rtsp://service:PRBUWPCs7*f40j#192.168.1.129(LIVE555 Streaming Media v2018.02.28)
Accept: application/sdp
Step 4: mcu waiting for SDP, but instead receives pbuf *p as null in the receive call back function.
After a few seconds, also receives a tcp err callback with err code ERR_RST i.e. connection reset.
Could anyone please clarify if my above procedure is correct and if so, any insights on what could likely cause the camera not to respond with the SDP description leading to connection reset and receiving pbuff as NULL in the receive callback? 
Fixed it. There was an issue with md5 module.

Error 488 Not acceptable here

Hello I know there are already lot of topics about this error (or perhaps I don't have the same problem) but none of them answered my question, I am in a local network with blink on my PC and my asterisk server is on an external server hosted by ovh (so there is nat to do). I control the server via encrypted ssh session ofc.
As long as the call is not encrypted, everything is fine, I can call any user I want. But when I started to encrypt my traffic everything went wrong and I can't find why.I've generated certficate for both client and server, the traffic is encrypted because I can't see anything in wireshark(I can't see encrypted traffic but I see non-encrypted traffic). Blink is configured correctly with SDES mandatory, .pem file, car.crt , proxy on port 5061 tls, but I think the error is somewhere else.
Myconig for sip.conf is like this:
[general]
udpbindaddr=0.0.0.0
tcpenable=yes ; Enable server for incoming TCP connections (default is no)
tcpbindaddr=0.0.0.0 ; IP address for TCP server to bind to (0.0.0.0 binds to all interfaces) ; Optionally add a port number, 192.168.1.1:5062 (default is port 5060)
tlsenable=yes ; Enable server for incoming TLS (secure) connections (default is no)
tlsbindaddr=0.0.0.0
transport=udp
disallow=all
allow=ulaw ; Allow codecs in order of preference
allow=alaw
dtmfmode = rfc2833
tlscertfile=/etc/asterisk/keys/asterisk.pem
tlscafile=/etc/asterisk/keys/ca.crt
tlscipher=ALL
tlsclientmethod=tlsv1
[201](can't communicate instant 488 error)
type=friend
username=vincent
context=from-sip
host=dynamic
secret=not4usry
callerid=vincent<201>
mailbox=201#default
nat=comedia
transport=tls
encryption=yes
[203](no tls user and can communicate with the ones who don't use tls)
type=friend
username=antoine
context=from-sip
host=dynamic
secret=not4usry
callerid=antoine<203>
mailbox=203#default
nat=comedia
Certificates have been generated using ./ast_tls_cert....
RTP logs
== Using SIP RTP CoS mark 5 [May 11 15:34:33]
WARNING[21893][C-00000d0e]: chan_sip.c:10803 process_sdp: Rejecting
secure audio stream without encryption details: audio 50026 RTP/SAVP
113 9 0 8 101
SIP LOGS
INVITE sip:203#vps466556.ovh.net SIP/2.0
Via: SIP/2.0/TLS
192.168.1.35:53076;rport;branch=z9hG4bKPj275105fe6a304b89b2b18ee5186b5085;alias
Max-Forwards: 70
From: "Vincent"
;tag=523fe49e3a8646608481fbac0801b605
To:
Contact:
Call-ID: 0fb841de523e4ff0a74514247bb3445a
CSeq: 4966 INVITE
Allow: SUBSCRIBE, NOTIFY, INVITE, ACK, BYE, CANCEL, UPDATE, MESSAGE,
REFER
Supported: replaces, norefersub, gruu
User-Agent: Blink 3.0.0 (Windows)
Content-Type: application/sdp
Content-Length: 425
v=0
o=- 3735043210 3735043210 IN IP4 192.168.1.35
s=Blink 3.0.0 (Windows)
t=0 0
m=audio 50004 RTP/AVP 113 9 0 8 101
c=IN IP4 192.168.1.35
a=rtcp:50005
a=rtpmap:113 opus/48000/2
a=fmtp:113 useinbandfec=1
a=rtpmap:9 G722/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=zrtp-hash:1.10
af10bf32a78e03147ffbf2859f96cc8d401048ee46a1f2cb961c20139b219913
a=sendrecv
-- 2018-05-11 16:00:11.003276 [blink.exe 3320]: RECEIVED: Packet 136, +0:06:21.266013
54.37.8.124:5061 -(SIP over TLS)-> 192.168.1.35:53076 SIP/2.0 401 Unauthorized
Via: SIP/2.0/TLS
192.168.1.35:53076;branch=z9hG4bKPj275105fe6a304b89b2b18ee5186b5085;alias;received=90.112.223.194;rport=53076
From: "Vincent"
;tag=523fe49e3a8646608481fbac0801b605
To: ;tag=as50eb1885
Call-ID: 0fb841de523e4ff0a74514247bb3445a
CSeq: 4966 INVITE
Server: Asterisk PBX 13.21.0
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY,
INFO, PUBLISH, MESSAGE
Supported: replaces, timer
-Authenticate: Digest algorithm=MD5, realm="asterisk", nonce="6650a402"
Content-Length: 0
-- 2018-05-11 16:00:11.004276 [blink.exe 3320]: SENDING: Packet 137, +0:06:21.267013
192.168.1.35:53076 -(SIP over TLS)-> 54.37.8.124:5061 ACK sip:203#vps466556.ovh.net SIP/2.0
Via: SIP/2.0/TLS
192.168.1.35:53076;rport;branch=z9hG4bKPj275105fe6a304b89b2b18ee5186b5085;alias
Max-Forwards: 70
From: "Vincent"
;tag=523fe49e3a8646608481fbac0801b605
To: ;tag=as50eb1885
Call-ID: 0fb841de523e4ff0a74514247bb3445a
CSeq: 4966 ACK
User-Agent: Blink 3.0.0 (Windows)
Content-Length: 0
-- 2018-05-11 16:00:11.005276 [blink.exe 3320]: SENDING: Packet 138, +0:06:21.268013
192.168.1.35:53076 -(SIP over TLS)-> 54.37.8.124:5061 INVITE sip:203#vps466556.ovh.net SIP/2.0
Via: SIP/2.0/TLS
192.168.1.35:53076;rport;branch=z9hG4bKPj3e8da342afaa41a385d9989648fd069f;alias
Max-Forwards: 70
From: "Vincent"
;tag=523fe49e3a8646608481fbac0801b605
To:
Contact:
Call-ID: 0fb841de523e4ff0a74514247bb3445a
CSeq: 4967 INVITE
Allow: SUBSCRIBE, NOTIFY, INVITE, ACK, BYE, CANCEL, UPDATE, MESSAGE,
REFER
Supported: replaces, norefersub, gruu
User-Agent: Blink 3.0.0 (Windows)
Authorization: Digest username="201", realm="asterisk",
nonce="6650a402", uri="sip:203#vps466556.ovh.net",
response="dcd6fcd9d8b7381f86f07e1326aa9134", algorithm=MD5
Content-Type: application/sdp
Content-Length: 425
v=0
o=- 3735043210 3735043210 IN IP4 192.168.1.35
s=Blink 3.0.0 (Windows)
t=0 0
m=audio 50004 RTP/AVP 113 9 0 8 101
c=IN IP4 192.168.1.35
a=rtcp:50005
a=rtpmap:113 opus/48000/2
a=fmtp:113 useinbandfec=1
a=rtpmap:9 G722/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=zrtp-hash:1.10
af10bf32a78e03147ffbf2859f96cc8d401048ee46a1f2cb961c20139b219913
a=sendrecv
-- 2018-05-11 16:00:11.087226 [blink.exe 3320]: RECEIVED: Packet 139, +0:06:21.349963
54.37.8.124:5061 -(SIP over TLS)-> 192.168.1.35:53076 SIP/2.0 488 Not acceptable here
Via: SIP/2.0/TLS
192.168.1.35:53076;branch=z9hG4bKPj3e8da342afaa41a385d9989648fd069f;alias;received=90.112.223.194;rport=53076
From: "Vincent"
;tag=523fe49e3a8646608481fbac0801b605
To: ;tag=as50eb1885
Call-ID: 0fb841de523e4ff0a74514247bb3445a
CSeq: 4967 INVITE
Server: Asterisk PBX 13.21.0
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY,
INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0
-- 2018-05-11 16:00:11.088227 [blink.exe 3320]: SENDING: Packet 140, +0:06:21.350964
192.168.1.35:53076 -(SIP over TLS)-> 54.37.8.124:5061 ACK sip:203#vps466556.ovh.net SIP/2.0
Via: SIP/2.0/TLS
192.168.1.35:53076;rport;branch=z9hG4bKPj3e8da342afaa41a385d9989648fd069f;alias
Max-Forwards: 70
From: "Vincent"
;tag=523fe49e3a8646608481fbac0801b605
To: ;tag=as50eb1885
Call-ID: 0fb841de523e4ff0a74514247bb3445a
CSeq: 4967 ACK
User-Agent: Blink 3.0.0 (Windows)
Content-Length: 0
Thanks for your help, Vince
Your SIP endpoint specifies encryption=yes, but the INVITE from your client specifies RTP/AVP, not RTP/SAVP. iirc, Blink has an option for optimistic or mandatory encryption; you'll need to change it to mandatory.
If you have the same problem as me, reinstall the Srtp library and asterisk, also log sip request because I had a bug where Blink didn't send register request anymore (even when pushing that register button 1000times) so I downloaded PhonerLite and everything worked perfectly

Rescomm Call fails due to: "Media path is lost due to connectivity issues" error

I am using RestComm Connect installed on a cloud VPS.
When making a basic test call to verify setup and connectivity (use default RestComm accounts Bob & Alice; in this case Bob called Alice) the callee side reports the following error:
Media path is lost due to connectivity issues; call has been hung up
and then then call fails after a SIP '480 Temporarily Unavailable' is sent from callee to caller.
The browser console output looks as follows:
WebRTComm.js:4925 2017-10-10 17:06:31.370 WebRTCommCall:onRtcPeerConnectionIceChangeEvent(): Media path is lost due to connectivity issues; call has been hung up
Stack trace:
at commonLog (https://api-test.click2callme.pl/olympus/resources/js/mobicents-libs/WebRTComm.js:4884:10)
at console.error (https://api-test.click2callme.pl/olympus/resources/js/mobicents-libs/WebRTComm.js:4957:4)
at WebRTCommCall.onRtcPeerConnectionIceChangeEvent (https://api-test.click2callme.pl/olympus/resources/js/mobicents-libs/WebRTComm.js:3871:12)
at RTCPeerConnection.peerConnection.oniceconnectionstatechange (https://api-test.click2callme.pl/olympus/resources/js/mobicents-libs/WebRTComm.js:3047:9)
commonLog # WebRTComm.js:4925
console.error # WebRTComm.js:4957
WebRTCommCall.onRtcPeerConnectionIceChangeEvent # WebRTComm.js:3871
peerConnection.oniceconnectionstatechange # WebRTComm.js:3047
WebRTComm.js:4925 2017-10-10 17:06:31.399 WebRTCommCall:close(), received media stats
[Arguments.<anonymous> (https://api-test.click2callme.pl/olympus/resources/js/mobicents-libs/WebRTComm.js:2354:13)]
WebRTComm.js:4925 2017-10-10 17:06:31.400 WebRTCommCall:hangup()
[WebRTCommCall.hangup (https://api-test.click2callme.pl/olympus/resources/js/mobicents-libs/WebRTComm.js:2186:10)]
WebRTComm.js:4925 2017-10-10 17:06:31.401 PrivateJainSipCallConnector:close(): this.sipCallState=INVITED_INITIAL_STATE
[PrivateJainSipCallConnector.close (https://api-test.click2callme.pl/olympus/resources/js/mobicents-libs/WebRTComm.js:484:10)]
WebRTComm.js:4925 2017-10-10 17:06:31.402 SIP message sent: SIP/2.0 480 Temporarily Unavailable
Call-ID: 9b591496fb3bc5aac39075c5ea227d8b#213.32.22.60
CSeq: 1 INVITE
From: <sip:bob#77.255.251.128:57765>;tag=80839608_220982c6_57a5b08a_2ccbc3df
To: <sip:alice#178.43.83.112:63131>;tag=1507647967531
Max-Forwards: 70
Via: SIP/2.0/WSS 213.32.22.60:5083;branch=z9hG4bK2ccbc3df_57a5b08a_b9a9c4de-4268-4b16-a02b-4f8795cb4c2c;rport
Contact: <sip:alice#SpUEEE9qhnZn.invalid;transport=wss>
Content-Length: 0
The excerpt from RestComm's server.log is as follows:
17:04:22,641 INFO [gov.nist.javax.sip.stack.SIPTransactionStack] (pool-AffinityJAIN-thread-47) <message
from="178.43.83.112:63131"
to="213.32.22.60:5083"
time="1507647862640"
isSender="false"
transactionId="z9hg4bk2ccbc3df_57a5b08a_b9a9c4de-4268-4b16-a02b-4f8795cb4c2c"
callId="9b591496fb3bc5aac39075c5ea227d8b#213.32.22.60"
firstLine="SIP/2.0 480 Temporarily Unavailable"
>
<![CDATA[SIP/2.0 480 Temporarily Unavailable
Call-ID: 9b591496fb3bc5aac39075c5ea227d8b#213.32.22.60
CSeq: 1 INVITE
From: <sip:bob#77.255.251.128:57765>;tag=80839608_220982c6_57a5b08a_2ccbc3df
To: <sip:alice#178.43.83.112:63131>;tag=1507647967531
Max-Forwards: 70
Via: SIP/2.0/WSS 213.32.22.60:5083;branch=z9hG4bK2ccbc3df_57a5b08a_b9a9c4de-4268-4b16-a02b-4f8795cb4c2c;rport
Contact: <sip:alice#178.43.83.112:63131;transport=wss>
Content-Length: 0
]]>
</message>
This looks like some kind of NAT traversal issue related to ICE/STUN.
I am using a custom STUN server and checked that is works using the below command:
vps404561:/$ stun 213.32.22.60:3478
STUN client version 0.96
Primary: Open
Return value is 0x000001
Any ideas what might be the exact cause of this problem?
I'm also looking for some hints / tips how to further troubleshoot this issue.
Thanks,
Dominik

MobileFirst: At Public IP- Unable to Call adapter from application

On Production I am receiving the error below.
POST http://publicIP:9080/AppName/apps/services/api/proj/common/query
403 (Forbidden ( The server denied the specified Uniform Resource
Locator (URL). Contact the server administrator. ))worklight.js:1099
window.WLJSX.Ajax.Request.WLJSX.Class.create.requestworklight.js:1062
window.WLJSX.Ajax.Request.WLJSX.Class.create.initializeworklight.js:526
klassworklight.js:3410
window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.sendRequestworklight.js:3278
window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.initializeworklight.js:526
klassworklight.js:8580 __invokeProcedureworklight.js:8623 (anonymous
function) worklight.js:5061
[/AppName/apps/services/api/AppName/common/query] failure. state: 403,
response: The server was unable to process the request from the
application. Please try again later.worklight.js:5061
WL.Logger.__logworklight.js:5445 PUBLIC_API.(anonymous
function)worklight.js:3559
window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.onFailureworklight.js:3522
window.WLJSX.Ajax.WLRequest.WLJSX.Class.create.onWlFailureworklight.js:958
(anonymous function)worklight.js:1181
window.WLJSX.Ajax.Request.WLJSX.Class.create.respondToReadyStateworklight.js:1114
window.WLJSX.Ajax.Request.WLJSX.Class.create.onStateChangeworklight.js:958
(anonymous function)
I am using
IBM MobileFirst 6.3 Consumer Edition
Liberty profile 8.5.3
Scenarios Run
This App is running on Localhost and within internal Network perfectly well.
But at Public IP, I am unable to access the httpadapter from Application.
//********ERROR Browser LoG On Calling App
Blockquote
Denied Connection
INTERNALTMG 2/26/2015 1:43:12 PM
Log type: Web Proxy (Reverse)
Status: 12202 Forefront TMG denied the specified Uniform Resource Locator (URL).
Rule: mobileapps
Source: Internal (10.39.30.64:52151)
Destination: Local Host (worklightsvr.local.machine 132.20.68.46:9080)
Request: POST http://132.20.68.46:9080/AppName/apps/services/api/example/common/query
Filter information: Req ID: 0a68784f; Compression: client=Yes, server=No, compress rate=0% decompress rate=0%
Protocol: http
User: anonymous
Description: C:\Program Files\Microsoft Forefront Threat Management Gateway\UI_HTMLs_image\general\minusImg.gifAdditional information
1. Client agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.115 Safari/537.36
2. Object source: Internet (Source is the Internet. Object was added to the cache.)
3. Cache info: 0x51c0000 (Response includes the CACHE-CONTROL: NO-CACHE or PRAGMA: NO-CACHE header. Response includes the CACHE-CONTROL: NO-STORE header. Response includes either the CACHE-CONTROL: MUST-REVALIDATE or CACHE-CONTROL: PROXY-REVALIDATE header. Response includes the EXPIRES header. Response includes the WWW-AUTHENTICATE header.)
4. Processing time: 1 MIME type:
Blockquote
As the error says, verify with your IT department that you are not blocking the URL/domain somewhere in your corporate firewall.

Regarding rails4-mongoid-devise

I developed an application using rails4 mongoid and devise by following the instructions at http://railsapps.github.io/tutorial-rails-mongoid-devise.html. Application is running successfully except confirmation mail and password reset instruction mail features. In my app logs it is showing something like:
Sent mail to csecse.great#gmail.com (8.4ms)
Date: Wed, 11 Dec 2013 13:56:39 +0530
From: sender#mail.com
Reply-To: sender#mail.com
To: csecse.great#gmail.com
Message-ID: <52a821bf82f6c_b1f3fc131e38fa07856e#TEST.local.mail>
Subject: Reset password instructions
Mime-Version: 1.0
Content-Type: text/html;
charset=UTF-8
Content-Transfer-Encoding: 7bit
I am getting this in logs whenever I am requesting for send password instructions but mail is not arriving to my mail id. please suggest me a solution for this.