-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Comments
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. |
@lminiero , i'm sorry about that I didn't know the guidelines. any idea on how to tackle this? thanks. |
@lminiero this seems like a legit issue as after upgrading to latest version we cant make calls as it is giving unauthorized error even though we pass correct credentials |
I just tried with Asterisk 18.3.0 and it seems to be working fine for me. Of course, I may have a much more basic setup, since I rarely use SIP for anything myself except simple tests. On unauthorized errors, if the user is registered and an INVITE requires a challenge, we use the same credendials we used for a REGISTER. If you're using guest accounts on the Janus SIP plugin side and you get a challenge, there's no credentials available to challenge that and so it will obviously fail. |
but we are using sip providers like commpeak and bpo earlier same code used to work and our register request looks like this {
"request": "register",
"username": "sip:[email protected]",
"force_udp": true,
"rfc2543_cancel": true,
"secret": "somepassword",
"proxy": "sip:pbx.bpotel.com"
} and janus always give 401 unauthorized even tried on sip demo page however when i pass {
"request": "register",
"type": "guest",
"proxy": "sip:pbx.bpotel.com",
"username": "sip:[email protected]"
} register works and but we cant make a call since authorization is needed which makes sense could you please guide what can i be doing wrong? btw thank you very much in advance and for replying back at the earliest |
If you say it used to work before and doesn't now, please use |
interesting just found out there is no problem with janus but this underlying problem stems from sip dependency i suspect from sofia sip as i was trying to use latest sofia sip version and it is happening on it when i switched to old janus deps image of mine it works fine, i am gonna verify which new version of sofia sip it last worked on thanks for your input i will keep you guys posted |
Thanks, that would help, as it may suggest that either some of the latest versions of Sofia SIP are broken somewhere, or the flow to handle authentication changed. |
strange the sofia sip version that my old docker image is using is # this is a base image for compiling janus with all dependencies
docker pull shivanshtalwar0/januscoredeps:x86_64 can be used like this ARG architecture=x86_64
FROM shivanshtalwar0/januscoredeps:${architecture}
LABEL maintainer="shivansh talwar <[email protected]>"
LABEL description="Provides an image with Janus Gateway"
RUN cd ~ \
&& git clone https://github.com/meetecho/janus-gateway.git \
&& cd janus-gateway \
&& sh autogen.sh \
&& ./configure --prefix=/opt/janus \
&& make \
&& make install \
&& make configs
COPY conf/*.jcfg /opt/janus/etc/janus/
EXPOSE 7088 8088 8188 8089 7188
EXPOSE 10000-10200/udp
CMD /opt/janus/bin/janus or alternatively you can see my community project https://github.com/flutterjanus/JanusDocker for all files dockerfile,docker-compose.yaml etc. |
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:
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
The text was updated successfully, but these errors were encountered: