voiceip / tinyphone

Minimalist Windows / OSx / Linux SIP Softphone with API Control
GNU General Public License v3.0
117 stars 36 forks source link

Login fails on 3CX - missing "login" field #33

Closed matko238 closed 3 years ago

matko238 commented 3 years ago

Hi, when I try to login to 3CX, i get this (in 3CX log):

02/05/2021 2:18:24 PM - [CM102001]: Authentication failed for AuthFail Recv Req REGISTER from 192.168.4.226:18437 tid=Pj06b2879a07b243ba95552c277079e4ba Call-ID=1a80b33572124f73b19350e600773b73:
REGISTER sip:192.168.4.195;transport=tcp SIP/2.0
Via: SIP/2.0/TCP 192.168.4.226:18437;rport=18437;branch=z9hG4bKPj06b2879a07b243ba95552c277079e4ba;alias
Max-Forwards: 70
Contact: <sip:103@192.168.4.226:18437;transport=TCP;ob>;reg-id=1;+sip.instance="<urn:uuid:00000000-0000-0000-0000-000097ad08d1>"
To: <sip:103@192.168.4.195>
From: <sip:103@192.168.4.195>;tag=7bec73af99f246aebc8c6633792b7c45
Call-ID: 1a80b33572124f73b19350e600773b73
CSeq: 18510 REGISTER
Expires: 600
Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS
Proxy-Authorization: Digest username="103",realm="3CXPhoneSystem",nonce="414d5359601d45a083:47bb22553dc552c83b26fd6b077f78f5",uri="sip:192.168.4.195;transport=tcp",response="1fca031cc1b2f85162db0ec0f5bd4ff2",algorithm=MD5
Supported: outbound, path
User-Agent: TinyPhone Pjsua2 v36.0.0.79
Content-Length: 0
; Reason: Credentials don't match, check that authorization-ID and password match the ones in extension settings

tinyphone log:

2021-02-05 14:18:25.409   pjsua_core.c !.RX 328 bytes Response msg 404/REGISTER/cseq=18510 (rdata038CCF60) from TCP 192.168.4.195:5060:
SIP/2.0 404 User unknown.
Via: SIP/2.0/TCP 192.168.4.226:18437;rport=18437;branch=z9hG4bKPj06b2879a07b243ba95552c277079e4ba;alias
To: <sip:103@192.168.4.195>;tag=e240be14
From: <sip:103@192.168.4.195>;tag=7bec73af99f246aebc8c6633792b7c45
Call-ID: 1a80b33572124f73b19350e600773b73
CSeq: 18510 REGISTER
Content-Length: 0
--end msg--

MicroSIP logs in ok with same login data BUT it's sending another field ("Username" - 103 and "Login" - CJ7TuEHxxx) and you can see this additional field here:

https://www.microsip.org/help#login

How we can send "Login" and "Username"? I tried this but it isn't working:

{
    "username": "103",
    "password" : "password",
    "domain" : "192.168.4.195",
        "login":"CJ7TuEHxxx"
}
kingster commented 3 years ago

Hi,

Login field is currently not supported yet, since most of the systems that I have access to doesn't require this feature, but this should be a easy feature to add.

From the log's that you shared, it seems that the registration request is of tinyphone only. Can you please share an example request of MicroSIP registration?

matko238 commented 3 years ago

Hi,

thanks for quick response, here is log when MicroSIP account successfully logs in:

02/06/2021 9:33:48 AM - Updating device Dev(1737692821):[sip:100@127.0.0.1:49915;ob / 100] by message: DevUpd Recv Req REGISTER from 127.0.0.1:49915 tid=Pje086b230678147f8ba8a999cc8dd11d7 Call-ID=636ec0169dc943918ae4897ccd2530c9:
REGISTER sip:127.0.0.1 SIP/2.0
Via: SIP/2.0/UDP 127.0.0.1:49915;rport=49915;branch=z9hG4bKPje086b230678147f8ba8a999cc8dd11d7
Max-Forwards: 70
Contact: <sip:100@127.0.0.1:49915;ob>
To: <sip:100@127.0.0.1>
From: <sip:100@127.0.0.1>;tag=3ee465343b874244bb586c06782087f6
Call-ID: 636ec0169dc943918ae4897ccd2530c9
CSeq: 48656 REGISTER
Expires: 300
Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS
Proxy-Authorization: Digest username="PYeX1GFoVS",realm="3CXPhoneSystem",nonce="414d535c162ee56c13:829e7ffb777ab928acaa629a9bc478a7",uri="sip:127.0.0.1",response="23bbc531444ad67b137c4fb48d1133a6",algorithm=MD5
User-Agent: MicroSIP/3.20.3
Content-Length: 0

Username used for registration is "PYeX1GFoVS". If needed, I can provide pcap file with capture of login/registration flow.

You can easily get 3CX Phone System trial (one year) for free on their site.

kingster commented 3 years ago

Can you try out with the build from #36 pr?

Here is the sequence with 3CX

REGISTER sip:1.1.1.1 SIP/2.0
Via: SIP/2.0/UDP 2.2.2.2:16797;rport;branch=z9hG4bKPjyIOE-YB0xMgVgGu0fCGUFCHeTgGxk8ut
Max-Forwards: 70
From: <sip:100@1.1.1.1>;tag=vQkgosoEe.qZ-.biTay8T5GcEIF6Hv2h
To: <sip:100@1.1.1.1>
Call-ID: iRK94aJpM.1FCpe.my-DyVAwScdv.kTx
CSeq: 64676 REGISTER
User-Agent: TinyPhone Pjsua2 v36.0.0.81
Contact: <sip:100@2.2.2.2:16797;ob>
Expires: 600
Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS
Proxy-Authorization: Digest username="RfRRjz...5", realm="3CXPhoneSystem", nonce="414d535960201c4c45:bb5bbaba8e72c65e65b67c3c526ef6e0", uri="sip:1.1.1.1", response="8e7a5c8937d4943a3cdb4841caeb318f", algorithm=MD5
Content-Length:  0

--end msg--
2021-02-07 22:28:52.670           pjsua_core.c  .RX 411 bytes Response msg 200/REGISTER/cseq=64676 (rdata0x107018e28) from UDP 1.1.1.1:5060:
SIP/2.0 200 OK
Via: SIP/2.0/UDP 2.2.2.2:16797;rport=16797;branch=z9hG4bKPjyIOE-YB0xMgVgGu0fCGUFCHeTgGxk8ut
Contact: <sip:100@2.2.2.2:16797;ob>;expires=600
To: <sip:100@1.1.1.1>;tag=b1476228
From: <sip:100@1.1.1.1>;tag=vQkgosoEe.qZ-.biTay8T5GcEIF6Hv2h
Call-ID: iRK94aJpM.1FCpe.my-DyVAwScdv.kTx
CSeq: 64676 REGISTER
User-Agent: 3CXPhoneSystem 16.0.7.1078 (1078)
Content-Length: 0