Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SIP INVITE Failing with "401 Unauthorized" Response from Asterisk [v1.2.3] #3402

Open
mamoun-mohammed opened this issue Jul 7, 2024 · 2 comments
Labels
multistream Related to Janus 1.x

Comments

@mamoun-mohammed
Copy link

mamoun-mohammed commented Jul 7, 2024

What version of Janus is this happening on?
v1.2.3

Have you tested a more recent version of Janus too?
Yes

Was this working before?
No
Is there a gdb or libasan trace of the issue?
Not Sure

Additional context
I'm facing an issue with SIP plugin where SIP INVITE requests fail with a "401 Unauthorized" response from the Asterisk server when I use the SIP demo to create audio calls. The same setup works perfectly when receiving calls from the sip demo but when I try to make calls it fails due to an authorization error even though it works with receiving. I have been looking into this for a long time without any productive outcome. any help would be appreciated.

Configuration:

Janus WebRTC Server SIP Plugin version: 0.0.9
Asterisk version: FPBX-16.0.33(18.16.0)
Janus logs:

Sending event to janus.transport.http (0x7fde1c022440)
Got a Janus API event to send (0x7fde1c022440)
We have a message to serve...
        [
   {
      "janus": "event",
      "session_id": 647694817353594,
      "transaction": "SwZp6rdRup2B",
      "sender": 7586608400691431,
      "plugindata": {
         "plugin": "janus.plugin.sip",
         "data": {
            "sip": "event",
            "result": {
               "event": "calling",
               "call_id": "hGZeS2EF1CRYm9LJcyOT6WS"
            },
            "call_id": "hGZeS2EF1CRYm9LJcyOT6WS"
         }
      }
   }
]
  >> Pushing event: 0 (Success)
[2][nua_i_state]: 0 INVITE sent, call state [calling]
[2][nua_r_invite]: 401 Unauthorized
        Digest:"asterisk":2:0785431125Mm
[2][nua_i_state]: 0 INVITE sent, call state [calling]
New connection on REST API: ::1
Session: 647694817353594
Handle: 7586608400691431
Processing POST data (application/json) (244 bytes)...
Session: 647694817353594
Handle: 7586608400691431
Processing POST data (application/json) (0 bytes)...
{"janus":"trickle","candidate":{"candidate":"candidate:3719411463 1 udp 2113937151 22be25f2-a78f-441b-b255-4d8d7570ef3e.local 56093 typ host generation 0 ufrag +zar network-cost 999","sdpMid":"0","sdpMLineIndex":0},"transaction":"bnO2Gy50fjIE"}
Forwarding request to the core (0x7fde1c011fa0)
Got a Janus API request from janus.transport.http (0x7fde1c005460)
[7586608400691431] Still waiting for the answer, queueing this trickle to wait until we're done there...
Sending Janus API response to janus.transport.http (0x7fde1c005460)
Got a Janus API response to send (0x7fde1c005460)
Session: 647694817353594
Got a Janus API request from janus.transport.http (0x7fde1c008b40)
Session 647694817353594 found... returning up to 10 messages
Got a keep-alive on session 647694817353594
Sending Janus API response to janus.transport.http (0x7fde1c008b40)
Got a Janus API response to send (0x7fde1c008b40)
[7586608400691431] Gathering done for stream 1
[2][nua_i_options]: 200 OK`

Janus INVITE Request:

`[2024-07-06 22:58:23] VERBOSE[2129] res_pjsip_logger.c: <--- Received SIP request (1351 bytes) from UDP:192.168.1.147:60200 --->
INVITE sip:[email protected] SIP/2.0
Via: SIP/2.0/UDP 172.28.49.29:45182;rport;branch=z9hG4bKS1FX4724m8D7a
Max-Forwards: 70
From: "john" sip:[email protected];tag=4rtvDyeaU913K
To: sip:[email protected]
Call-ID: lW78YaWRJmVliYyJP6Slae6
CSeq: 982337813 INVITE
Contact: johnsip:[email protected]:45182;transport=udp
User-Agent: Janus WebRTC Server SIP Plugin 0.0.9
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, REFER, MESSAGE, INFO, NOTIFY
Supported: replaces
Content-Type: application/sdp
Content-Disposition: session
Content-Length: 800

Asterisk Response to Janus:

SIP/2.0 401 Unauthorized Via: SIP/2.0/UDP 172.28.49.29:45182;rport=60200;received=192.168.1.147;branch=z9hG4bKS1FX4724m8D7a Call-ID: lW78YaWRJmVliYyJP6Slae6 From: "john" <sip:[email protected]>;tag=4rtvDyeaU913K To: <sip:[email protected]>;tag=z9hG4bKS1FX4724m8D7a CSeq: 982337813 INVITE WWW-Authenticate: Digest realm="asterisk",nonce="1720306703/b09119604c79ccafc29d8ef9522a1932",opaque="68110e3d0b662ee4",algorithm=MD5,qop="auth" Server: FPBX-16.0.33(18.16.0) Content-Length: 0

@mamoun-mohammed mamoun-mohammed added the multistream Related to Janus 1.x label Jul 7, 2024
@lminiero
Copy link
Member

lminiero commented Jul 8, 2024

Please do NOT paste huge logs inline. As explained in the guidelines, you should either use an external service for that, or use the details/summary feature of github. I fixed it this time for you, but please notice that next time I'll just close the issue.

@mamoun-mohammed
Copy link
Author

@lminiero , i'm sorry about that I didn't know the guidelines. any idea on how to tackle this? thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
multistream Related to Janus 1.x
Projects
None yet
Development

No branches or pull requests

2 participants