Failed calls after migrate from sip to pjsip

when i was using asterisk 18 with sip.conf on ubuntu 18.04 all was working fine until I did an upgrade from asterisk 18 to 20 and Ubuntu 22.04 now using pjsip.conf.
pjsip show registrations indicate that it has registered successfully but when in coming call comes in it fails and shows the log below.
where it now show the 401 error, on the previous version my server was sending codec compability.

pjsip.conf

[general]
transport = udp

[startsip]
defaultuser = 3212345

[transudp]
type = transport
protocol = udp
bind = 0.0.0.0:5060

[reg_98.34.33.22]
type = registration
retry_interval = 5
max_retries = 0
expiration = 120
transport = transudp
outbound_auth = auth_reg_98.34.33.22
client_uri = sip:3212345@98.34.33.22
server_uri = sip:98.34.33.22

[auth_reg_98.34.33.22]
type=auth
auth_type=userpass
password=secretpwd
3212345=3212345
realm=huawei.com

[startsip]
type = aor
contact = sip:3212345@98.34.33.22

[startsip]
type = identify
endpoint = startsip
match = 98.34.33.22

[startsip]
type=auth
auth_type=userpass
username=3212345
password=secretpwd
realm=huawei.com

[startsip]
type=endpoint
context=stario
dtmf_mode=rfc4733
disallow=all
allow=!all
from_user=3212345
rtp_symmetric=yes
force_rport=yes
rewrite_contact=yes
direct_media=yes
trust_id_inbound=yes
send_rpid=yes
auth=startsip
outbound_auth=startsip
aors=startsip
transport=transudp

sip.conf that was working fine

[general]
transport=udp           ; This is asterisk default
        context=phone           ; All incoming calls are directed to context
                                ; [phoneglue] (see extensions.conf for details)
        allowguest=yes          ; asterisk default. But it is absolutely
                                ;   needed, so, we state it explicitely.
                                ; NOTE: It would be VERY DANGEROUS
                                ;   without iptables firewall

        registerattempts=0      ; retry forever (asterisk default)
                                ;   We state it explicitely, since there
                                ;   is nothing sensible to do otherwise
                                ;   if sip.Skype.com does not answer
;        directmedia=yes
disallow=all

dtmfmode=rfc2833
toneduration=300
relaxdtmf=yes
rfc2833compensate=yes
allow=alaw
rtpkeepalive=0




register => 3212345:secretpwd@98.34.33.22
registerattempts=0
registertimeout=5

[star]
type=friend
host=98.34.33.22
defaultuser=2203000227
secret=secretpwd
;canreinvite=no
disallow=all
;allow=ulaw
allow=alaw 
insecure=port,invite
sendrpid = yes
dtmfmode=auto
;toneduration=300
sendrpid = yes
trustrpid = yes
context=stario
nat=force_rport,comedia
allowguest=yes
;directmedia=no
;nat=no
;qualify=yes

log:

<--- Received SIP request (1278 bytes) from UDP:98.34.33.22:5068 --->
INVITE sip:3212345@DAN-BON SIP/2.0
Via: SIP/2.0/UDP 98.34.33.22:5068;branch=z9hG4bKggbmm9xkn39hy3bshwwewls9e;X-DispMsg=1400
Route: <sip:212.34.22.11:5060;transport=udp;lr>
Call-ID: tg3nytxmxnfk3x99fstyxxe9bbxfyss9@10.18.5.64
From: "6534236"<sip:6534236@Asterisk-PBX.com>;tag=txwxbxkk-CC-1004-OFC-45
To: "5000335"<sip:5000335@DAN-BON>
CSeq: 1 INVITE
P-Access-Network-Info: GEN-ACCESS;"area-number=+2201"
Max-Forwards: 70
Contact: <sip:98.34.33.22:5060>
Allow: INVITE,ACK,OPTIONS,BYE,CANCEL,INFO,PRACK,NOTIFY,MESSAGE,UPDATE
P-Asserted-Identity: <tel:6534236>
P-Early-Media: supported
Supported: 100rel,timer,histinfo,precondition
Min-SE: 90
Session-Expires: 1800;refresher=uac
Content-Length: 522
Content-Type: application/sdp

v=0
o=HuaweiSoftx3000 1074112886 1074112887 IN IP4 98.34.33.22
s=SipCall
c=IN IP4 98.34.33.25
t=0 0
m=audio 51044 RTP/AVP 108 102 8 0 18 4 3
a=rtpmap:108 AMR/8000
a=fmtp:108 mode-change-neighbor=1;mode-change-period=2
a=rtpmap:102 AMR/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:18 G729/8000
a=rtpmap:4 G723/8000
a=rtpmap:3 GSM/8000
a=ptime:20
a=maxptime:20
a=curr:qos local none
a=curr:qos remote none
a=des:qos mandatory local sendrecv
a=des:qos optional remote sendrecv
a=3gOoBTC

<--- Transmitting SIP response (573 bytes) to UDP:98.34.33.22:5068 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 98.34.33.22:5068;rport=5068;received=98.34.33.22;branch=z9hG4bKggbmm9xkn39hy3bshwwewls9e;X-DispMsg=1400
Call-ID: tg3nytxmxnfk3x99fstyxxe9bbxfyss9@10.18.5.64
From: "6534236" <sip:6534236@Asterisk-PBX.com>;tag=txwxbxkk-CC-1004-OFC-45
To: "5000335" <sip:5000335@DAN-BON>;tag=z9hG4bKggbmm9xkn39hy3bshwwewls9e
CSeq: 1 INVITE
WWW-Authenticate: Digest realm="huawei.com",nonce="1706805641/f7cfd2916ee506b88a42077238a85a85",opaque="3ef4e0ca7676fca4",algorithm=MD5,qop="auth"
Server: Asterisk PBX 20.5.2
Content-Length:  0


<--- Received SIP request (434 bytes) from UDP:98.34.33.22:5068 --->
ACK sip:3212345@DAN-BON SIP/2.0
Via: SIP/2.0/UDP 98.34.33.22:5068;branch=z9hG4bKggbmm9xkn39hy3bshwwewls9e;X-DispMsg=1400
Route: <sip:212.34.22.11:5060;transport=udp;lr>
Call-ID: tg3nytxmxnfk3x99fstyxxe9bbxfyss9@10.18.5.64
From: "6534236"<sip:6534236@Asterisk-PBX.com>;tag=txwxbxkk-CC-1004-OFC-45
To: "5000335"<sip:5000335@DAN-BON>;tag=z9hG4bKggbmm9xkn39hy3bshwwewls9e
CSeq: 1 ACK
Max-Forwards: 70
Content-Length: 0

The “startsip” endpoint has been configured to challenge for authentication on incoming calls. If you don’t want this, then you’d remove the “auth” option from it.

The reason it works on chan_sip is that, whilst secret sets up for both way authentication, insecure=invite disables the authentication for incoming calls. The insecure=port is, almost certainly, simply insecure, and the the result of copy and paste coding, by the provider.

You right

Noted and thanks

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.