Register authorization error

357 views
Skip to first unread message

Bodonyi Titusz

unread,
Jan 11, 2021, 8:15:25 PM1/11/21
to SIP.js
I've followed your guide and I faced this issue regarding to registration.
It seems I was wrong with configuration to register, but I couldn't find any solution about authorization of registration.
I got this log:

Sun Jan 10 2021 08:18:26 GMT-0800 (Pacific Standard Time) | sip.Transport | Sending WebSocket message:
REGISTER sip:sip...com SIP/2.0
Via: SIP/2.0/WSS mf4kmiau48r5.invalid;branch=z9hG4bK9728582
From: "John" < sip:9...@sip...com  >;tag=qcalgoeqed
CSeq: 3 REGISTER
Call-ID: 0ihmna2rf8rngnk944nk
Max-Forwards: 70
Authorization: Digest algorithm=MD5, username="903", realm="sip...com", nonce="3d120af1-a126-4ef1-9977-8c31d5f4c6ff", uri="sip:sip...com", response="10ad4cd728953a827ef5f64938e59d57", qop=auth, cnonce="5st0sn2viec0", nc=00000001
Contact: <sip:j4ea...@mf4kmiau48r5.invalid;transport=ws>;expires=600
Allow: ACK,CANCEL,INVITE,MESSAGE,BYE,OPTIONS,INFO,NOTIFY,REFER
Supported: outbound, path, gruu
User-Agent: SIP.js/0.17.1
Content-Length: 0


logger-factory.js:80 Sun Jan 10 2021 08:18:26 GMT-0800 (Pacific Standard Time) | sip.Transport | Received WebSocket text message:
SIP/2.0 401 Unauthorized
Via: SIP/2.0/WSS 16n1ocot4dm3.invalid;branch=z9hG4bK3354066;received=50.97.232.186;rport=25026
From: "John" < sip:9...@sip...com  >;tag=qml54hiivf
To: < sip:9...@sip...com  >;tag=gvg5DSQKr6Z7Q
Call-ID: s937kr2k8ujmrkt3fnde
CSeq: 2 REGISTER
User-Agent: FreeSWITCH
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY, PUBLISH, SUBSCRIBE
Supported: timer, path, replaces
WWW-Authenticate: Digest realm="sip...com", nonce="cf038b1e-bb3b-4179-b860-b6aa5f051cc5", algorithm=MD5, qop="auth"
Content-Length: 0


logger-factory.js:80 Sun Jan 10 2021 08:18:26 GMT-0800 (Pacific Standard Time) | sip.Transport | Sending WebSocket message:
REGISTER sip:sip...com SIP/2.0
Via: SIP/2.0/WSS 16n1ocot4dm3.invalid;branch=z9hG4bK6167732
From: "John" < sip:9...@sip...com  >;tag=qml54hiivf
CSeq: 3 REGISTER
Call-ID: s937kr2k8ujmrkt3fnde
Max-Forwards: 70
Authorization: Digest algorithm=MD5, username="903", realm="sip...com", nonce="cf038b1e-bb3b-4179-b860-b6aa5f051cc5", uri="sip:sip...com", response="50e5f710d73518d0a9fafd93821fff08", qop=auth, cnonce="u4ok47dnd2n7", nc=00000001
Contact: <sip:5ksf...@16n1ocot4dm3.invalid;transport=ws>;expires=600
Allow: ACK,CANCEL,INVITE,MESSAGE,BYE,OPTIONS,INFO,NOTIFY,REFER
Supported: outbound, path, gruu
User-Agent: SIP.js/0.17.1
Content-Length: 0


logger-factory.js:80 Sun Jan 10 2021 08:18:27 GMT-0800 (Pacific Standard Time) | sip.Transport | Received WebSocket text message:
SIP/2.0 403 Forbidden
Via: SIP/2.0/WSS mf4kmiau48r5.invalid;branch=z9hG4bK9728582;received=50.97.232.186;rport=24974
From: "John" < sip:9...@sip...com  >;tag=qcalgoeqed
To: < sip:9...@sip...com  >;tag=H59XFm8pNFptK
Call-ID: 0ihmna2rf8rngnk944nk
CSeq: 3 REGISTER
User-Agent: FreeSWITCH
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY, PUBLISH, SUBSCRIBE
Supported: timer, path, replaces
Content-Length: 0


logger-factory.js:75 Sun Jan 10 2021 08:18:27 GMT-0800 (Pacific Standard Time) | sip.Registerer | Failed to register, status code 403

As you seen from the log, I used FreeSWITCH server and my attemption to connect to the server was success.
It would be great if you suggest any way to get rid of this ridiculous configuration issue, or give me any tip.
Thank you a lot in advance.

Slavik Bialik

unread,
Jan 13, 2021, 5:54:25 AM1/13/21
to SIP.js
Are you sure it is not misconfigurations on FreeSWITCH side? Try to go into your FreeSWITCH and do "fs_cli".
Then make an additional REGISTER attempt and see if you get some logs about it (you'll get probably a log colored in purple if I am right).
Anyway, the Authorization header looks fine. The username and the realm (unless the domain in the realm is not the domain configured for the directory users on your FreeSWITCH).

Can you also try and register to this user with a MicroSIP / Zoiper and see if it works?



Message has been deleted

Bodonyi Titusz

unread,
Jan 13, 2021, 10:19:23 AM1/13/21
to sip...@googlegroups.com
Hello Slavik 
Thank you for your kind response.
Yes I am sure about configurations of FreeSWITCH. I have tried voip phone with same credentials and that's why I am gonna fix something on client-side.
Here you can see my code in order to integrate SIP.js

        const target = "sip:903@sip...com";
        const webSocketServer = "wss://myWebsocketAdress";
        const displayName = "John";
        const password = "userPassword";
       
        const simpleUserOptions = {
          aor: target,
          delegate: {
            onCallCreated() {},
            onCallReceived() {
              ...
            },
            onCallAnswered() {
              ...
            },
            onCallHangup() {
              ...
            },
            onCallHold(held) {},
          },
          media: {
            remote: {
              audio: document.getElementById('remoteAudio'),
            },
          },
          userAgentOptions: {
            authorizationPassword: password,
            authorizationUsername: displayName
          },
        };

        const simpleUser = new Web.SimpleUser(
          webSocketServer,
          simpleUserOptions
        );

        simpleUser
          .connect()
          .catch(error => {
            console.error(`failed to connect`);
            console.error(error);
          })
          .then(() => {
            this.simpleUser.register().then(() => {
              simpleUser.delegate = {
                onCallReceived() {
                  ...
                },
                onCallAnswered() {
                  ...
                },
                onCallHangup() {
                  ...
                },
              };
            })
            .catch((e) => {
              console.warn(`failed to register`);
            });
         
I will be pleasure you let me know what's wrong with my code.
Thank you in advance.

--
You received this message because you are subscribed to a topic in the Google Groups "SIP.js" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sip_js/V4KiSynj0Mo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sip_js+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sip_js/502a9852-a24c-49a9-91ca-719bcd4aa94en%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages