sipsorcery-org / sipsorcery

A WebRTC, SIP and VoIP library for C# and .NET. Designed for real-time communications apps.
https://sipsorcery-org.github.io/sipsorcery
Other
1.38k stars 422 forks source link

When get a SIP OPTIONS, reply 405 MethodNotAllowed #813

Open webrtcccccc opened 1 year ago

webrtcccccc commented 1 year ago

Remote SIP client send SIP OPTIONS to SIPUserAgent, but SIPUserAgent reply 405 MethodNotAllowed. How can I let SIPUserAgent reply 200 OK when I get a SIP OPTIONS request?

R->L SIP OPTIONS L->R 405 MethodNotAllowed

How to be R->L SIP OPTIONS L->R 200 OK

PabloZafra commented 2 months ago

Same here. On Android (MAUI):

`[0:] [0] Request sent: udp:10.0.2.16:5060->udp:185.99.186.125:5060 REGISTER sip:mydomain.com SIP/2.0 [0:] [0] REGISTER sip:mydomain.com SIP/2.0 Via: SIP/2.0/UDP 10.0.2.16:5060;branch=z9hG4bK4b8b50132cc54efc93ea45491538fc1b;rport To: sip:400@mydomain.com From: sip:400@mydomain.com;tag=YSDEFGNDUV Call-ID: 7ee09d34-362f-4bba-9618-d76d77b542b3 CSeq: 1 REGISTER Contact: Max-Forwards: 70 User-Agent: sipsorcery_v6.2.3.0 Expires: 60 Allow: ACK, BYE, CANCEL, INFO, INVITE, NOTIFY, OPTIONS, PRACK, REFER, REGISTER, SUBSCRIBE Content-Length: 0

[0:] [0] Response received: udp:0.0.0.0:5060<-udp:185.99.186.125:5060 REGISTER 401 Unauthorized [0:] [0] SIP/2.0 401 Unauthorized Via: SIP/2.0/UDP 10.0.2.16:5060;rport=53107;received=83.39.233.63;branch=z9hG4bK4b8b50132cc54efc93ea45491538fc1b To: sip:400@mydomain.com;tag=z9hG4bK4b8b50132cc54efc93ea45491538fc1b From: sip:400@mydomain.com;tag=YSDEFGNDUV Call-ID: 7ee09d34-362f-4bba-9618-d76d77b542b3 CSeq: 1 REGISTER WWW-Authenticate: Digest realm="asterisk",nonce="1714117087/ed912ba55d622be023bcbda95becd54b",qop=auth,opaque="7adc9bbe3c83d80a" Server: FPBX-15.0.29(16.8) Content-Length: 0

[0:] [0] Server response Unauthorised received for sip:400@mydomain.com. [0:] [0] Request sent: udp:10.0.2.16:5060->udp:185.99.186.125:5060 REGISTER sip:mydomain.com SIP/2.0 [0:] [0] REGISTER sip:mydomain.com SIP/2.0 Via: SIP/2.0/UDP 10.0.2.16:5060;branch=z9hG4bKfb595da6cd4d484abc3d805b1c53aa16;rport To: sip:400@mydomain.com From: sip:400@mydomain.com;tag=YSDEFGNDUV Call-ID: 7ee09d34-362f-4bba-9618-d76d77b542b3 CSeq: 2 REGISTER Contact: Max-Forwards: 70 User-Agent: sipsorcery_v6.2.3.0 Expires: 60 Allow: ACK, BYE, CANCEL, INFO, INVITE, NOTIFY, OPTIONS, PRACK, REFER, REGISTER, SUBSCRIBE Authorization: Digest username="400",realm="asterisk",nonce="1714117087/ed912ba55d622be023bcbda95becd54b",uri="sip:mydomain.com",response="03ca18bdc53b269f834ec1120638c70b",cnonce="1478964100",nc=00000001,qop=auth,opaque="7adc9bbe3c83d80a",algorithm=MD5 Content-Length: 0

[0:] [0] Response received: udp:0.0.0.0:5060<-udp:185.99.186.125:5060 REGISTER 200 OK [0:] [0] SIP/2.0 200 OK Via: SIP/2.0/UDP 10.0.2.16:5060;rport=53107;received=83.39.233.63;branch=z9hG4bKfb595da6cd4d484abc3d805b1c53aa16 To: sip:400@mydomain.com;tag=z9hG4bKfb595da6cd4d484abc3d805b1c53aa16 From: sip:400@mydomain.com;tag=YSDEFGNDUV Call-ID: 7ee09d34-362f-4bba-9618-d76d77b542b3 CSeq: 2 REGISTER Contact: ;expires=59 Expires: 60 Date: Fri, 26 Apr 2024 07:38:07 GMT Server: FPBX-15.0.29(16.8) Content-Length: 0

[0:] [0] Server auth response Ok received for sip:400@mydomain.com. [0:] [0] sip:400@mydomain.com registration succeeded. [0:] [0] SIPRegistrationUserAgent was successful, scheduling next registration to sip:400@mydomain.com in 54s. [0:] [0] Request received: udp:0.0.0.0:5060<-udp:185.99.186.125:5060 OPTIONS sip:83.39.233.63:53107;x-ast-orig-host=10.0.2.16:5060 SIP/2.0 [0:] [0] OPTIONS sip:83.39.233.63:53107;x-ast-orig-host=10.0.2.16:5060 SIP/2.0 Via: SIP/2.0/UDP 172.20.0.2:5060;rport;branch=z9hG4bKPjfd9a3bdd-9d39-4053-8239-78c54b4a4a06 To: <sip:83.39.233.63;x-ast-orig-host=10.0.2.16:5060> From: sip:400@172.20.0.2;tag=0cb75ccc-8ddc-42d3-828e-880eb6b883e8 Call-ID: 92ceadd4-7b1a-4596-9fc8-871976bd70ae CSeq: 8824 OPTIONS Contact: sip:400@172.20.0.2:5060 Max-Forwards: 70 User-Agent: FPBX-15.0.29(16.8) Content-Length: 0

[0:] [0] Response sent: udp:10.0.2.16:5060->udp:185.99.186.125:5060 OPTIONS 405 MethodNotAllowed [0:] [0] SIP/2.0 405 MethodNotAllowed Via: SIP/2.0/UDP 172.20.0.2:5060;rport=5060;branch=z9hG4bKPjfd9a3bdd-9d39-4053-8239-78c54b4a4a06;received=185.99.186.125 To: <sip:83.39.233.63;x-ast-orig-host=10.0.2.16:5060> From: sip:400@172.20.0.2;tag=0cb75ccc-8ddc-42d3-828e-880eb6b883e8 Call-ID: 92ceadd4-7b1a-4596-9fc8-871976bd70ae CSeq: 8824 OPTIONS Allow: ACK, BYE, CANCEL, INFO, INVITE, NOTIFY, OPTIONS, PRACK, REFER, REGISTER, SUBSCRIBE Content-Length: 0`