I have a windows desktop application, made by my mobile network provider, that does all kind of things with SIP: call, send message, etc. Screenshot of how does this app successfully send MESSAGE
(the last 4 lines):
MESSAGE
request, from desktop application, is sent as (4th line from behind) :
MESSAGE sip:FROM@DOMAIN SIP/2.0
Via: SIP/2.0/UDP LOCALIP:2112;branch=z9hG4bK-d8754z-905183245f478c76-1---d8754z-;rport
Max-Forwards: 70
To: "TO"<sip:TO@DOMAIN>
From: "FROM"<sip:USERNAME@DOMAIN>;tag=63088d09
Call-ID: NGVhMDJhYzQwNmExOTQyNThmNjc5OGNmOTViNDUyYWM.
CSeq: 2 MESSAGE
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO
Content-Type: text/plain
Content-Length: 4
test
and successfull response for that is:
SIP/2.0 407 Proxy Authentication Required
Via: SIP/2.0/UDP LOCALIP:2112;received=EXTERNALIP;branch=z9hG4bK-d8754z-905183245f478c76-1---d8754z-;rport=2112
To: "TO"<sip:TO@DOMAIN>;tag=c005f0e30133ec730add76fc91f4bea
From: "FROM"<sip:USERNAME@DOMAIN>;tag=63088d09
Call-ID: NGVhMDJhYzQwNmExOTQyNThmNjc5OGNmOTViNDUyYWM.
CSeq: 2 MESSAGE
Content-Length: 0
Proxy-Authenticate: Digest nonce="3F178051B97E1F52000123000A3C53D4B",realm="DOMAIN",algorithm=MD5,qop="auth"
Then I try to send identical (and n-variations) request from PHP, but I always receive SIP/2.0 403 Forbidden
instead of SIP/2.0 407 Proxy Authentication Required
:
SIP/2.0 403 Forbidden
Via: SIP/2.0/UDP LOCALIP;received=EXTERNALIP
To: "TO"<sip:TO@DOMAIN>;tag=aprqngfrt-f7ccjj0000020
From: "FROM"<sip:USERNAME@DOMAIN>;tag=8f7be81d
Call-ID: 526576901edcc@localhost
CSeq: 1 MESSAGE
Reason: Q.850;cause=55;text="Call Terminated"
Content-Length: 0
The funny part is, that if I send REGISTER
request it works, and I successfully receive SIP/2.0 401 Unauthorized
header with WWW-Authenticate
. I recalculate authorization, and resend it. Then I receive SIP/2.0 200 OK
. Which is how it should work with MESSAGE
.
What could be wrong? What did I miss? Does MESSAGE
request need some other request before that (I have already tried REGISTER
before)?
I have read RFC 3428 up and down, tried all the examples possible, but without success.