Somewhat related to this, I am switching to pjsip for the asterisk (SBC ). I can make an outbound call from an endpoint to a PSTN but not the other way round.
My pjsip.conf
;=========== General settings ===========
[global]
type=global
user_agent=Asterisk PBX SBC
[transport-udp]
type=transport
protocol=udp
bind=0.0.0.0:{{asterisk-port}}
;=========== Extension 1000 ===========
[1000]
type=endpoint
context=from-internal
disallow=all
allow=alaw,ulaw
auth=auth1000
aors=1000
[auth1000]
type=auth
auth_type=userpass
username=1000
password=password
[1000]
type=aor
max_contacts=1
;======================== Registration ============================
; register={{sip-user}}:{{sip-pass}}@{{sip-url}}/{{sip-user}} ; old from sip.conf
[my_provider]
type=registration
transport=transport-udp
outbound_auth=my_provider-auth
server_uri=sip:{{sip-url}}:{{port}}
client_uri=sip:{{sip-user}}@{{sip-url}}:{{port}}
retry_interval=60
contact_user={{sip-user}}
[my_provider-auth]
type=auth
auth_type=userpass
password={{sip-pass}}
username={{sip-user}}
[my_provider_aor]
type=aor
contact=sip:@{{sip-url}}:{{port}}
qualify_frequency=200
;max_contacts=1
[my_provider_endpoint]
type=endpoint
context=from-external
disallow=all
allow=ulaw
outbound_auth=my_provider-auth
aors=my_provider_aor
[my_provider_identify]
type=identify
endpoint=my_provider_endpoint
match={{sip-url}}
;======================= End Registration ===================================
extensions.conf
From the 1000
endpoint,I can dial 100
or my phone number from zoiper and it will ring.
[from-internal]
exten => 100,1,Answer()
same => n,Wait(1)
same => n,Playback(hello-world)
same => n,Hangup()
exten => _xxxxxxxxxx,1,Dial(PJSIP/${EXTEN}@my_provider_endpoint)
I expect dialing DID number provided by the sip provider to ring and reply with hello-world
[from-external]
exten => _.,1,Answer()
same => n,Wait(1)
same => n,Playback(hello-world)
same => n,Hangup()
exten => _XXXXXXXXXX,1,Answer()
same => n,Wait(1)
same => n,Playback(hello-world)
same => n,Hangup()
No firewall is on.
Asterisk 16.13.0
No NAT.
It cannot qualify the sip provider url:
[Oct 22 06:09:39] ERROR[33]: res_pjsip.c:3888 create_out_of_dialog_request: Unable to create outbound OPTIONS request to endpoint my_provider_endpoint as URI 'sip:@{{sip-url}}:{{port}} is not valid
[Oct 22 06:09:39] ERROR[33]: res_pjsip/pjsip_options.c:877 sip_options_qualify_contact: Unable to create request to qualify contact sip:@{{sip-url}}:{{port}} on AOR my_provider_aor
I have:
core set verbose 4
core set debug 4
pjsip set logger on
but there’s nothing in the logs when I try to make a call from my mobile phone with the DID number.
Then after some time, these logs appear:
<--- Transmitting SIP response (479 bytes) to UDP:54.36.164.135:61785 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 192.168.137.1:51146;rport=61785;received=54.36.164.135;branch=z9hG4bK291620204
Call-ID: 1877624853-145661301-2018722593
From: <sip:101@{{asterisk-public-IP}}>;tag=131507514
To: <sip:000000917652305118@{{asterisk-public-IP}}>;tag=z9hG4bK291620204
CSeq: 6 INVITE
WWW-Authenticate: Digest realm="asterisk",nonce="1603347275/c38def55e927e8ec3899fca582476224",opaque="1f859afb3362878d",algorithm=md5,qop="auth"
Server: Asterisk PBX
Content-Length: 0
<--- Received SIP request (886 bytes) from UDP:101.2.168.7:31243 --->
REGISTER sip:{{asterisk-public-IP}}:5060;transport=UDP SIP/2.0
Via: SIP/2.0/UDP 101.2.168.7:31243;branch=z9hG4bK-5210007-1---1a52f43dfb597750;rport
Max-Forwards: 70
Contact: <sip:1000@101.2.168.7:31243;rinstance=b656a02547b0e08f;transport=UDP>
To: <sip:1000@{{asterisk-public-IP}}:5060;transport=UDP>
From: <sip:1000@{{asterisk-public-IP}}:5060;transport=UDP>;tag=0db6ac0c
Call-ID: AnL-wvofLBPO64LKGGmAOA..
CSeq: 847 REGISTER
Expires: 60
Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, MESSAGE, OPTIONS, INFO, SUBSCRIBE
User-Agent: Z 5.4.6 rv2.10.10.2-mod
Authorization: Digest username="1000",realm="asterisk",nonce="1603347256/9caeac75b45de8879ed3798107e9d753",uri="sip:{{asterisk-public-IP}}:5060;transport=UDP",response="69dcafb668416c52d8a77929ee6beccd",cnonce="5e77297fbeaf3dd4292041028a141258",nc=00000002,qop=auth,algorithm=md5,opaque="625270b153987c40"
Allow-Events: presence, kpml, talk
Content-Length: 0
<--- Transmitting SIP response (505 bytes) to UDP:101.2.168.7:31243 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 101.2.168.7:31243;rport=31243;received=101.2.168.7;branch=z9hG4bK-5210007-1---1a52f43dfb597750
Call-ID: AnL-wvofLBPO64LKGGmAOA..
From: <sip:1000@{{asterisk-public-IP}}>;tag=0db6ac0c
To: <sip:1000@{{asterisk-public-IP}}>;tag=z9hG4bK-5210007-1---1a52f43dfb597750
CSeq: 847 REGISTER
WWW-Authenticate: Digest realm="asterisk",nonce="1603347309/fa716ab204e0401ac7916bd0cbc12ac0",opaque="6f68f5cd7719e153",stale=true,algorithm=md5,qop="auth"
Server: Asterisk PBX
Content-Length: 0
<--- Received SIP request (886 bytes) from UDP:101.2.168.7:31243 --->
REGISTER sip:{{asterisk-public-IP}}:5060;transport=UDP SIP/2.0
Via: SIP/2.0/UDP 101.2.168.7:31243;branch=z9hG4bK-5210007-1---09f615b42fce6816;rport
Max-Forwards: 70
Contact: <sip:1000@101.2.168.7:31243;rinstance=b656a02547b0e08f;transport=UDP>
To: <sip:1000@{{asterisk-public-IP}}:5060;transport=UDP>
From: <sip:1000@{{asterisk-public-IP}}:5060;transport=UDP>;tag=0db6ac0c
Call-ID: AnL-wvofLBPO64LKGGmAOA..
CSeq: 848 REGISTER
Expires: 60
Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, MESSAGE, OPTIONS, INFO, SUBSCRIBE
User-Agent: Z 5.4.6 rv2.10.10.2-mod
Authorization: Digest username="1000",realm="asterisk",nonce="1603347309/fa716ab204e0401ac7916bd0cbc12ac0",uri="sip:{{asterisk-public-IP}}:5060;transport=UDP",response="ebe7ef9ea10fa88d495d028392781ab4",cnonce="46414a2c54c5c19b3c1bca06e2be8b62",nc=00000001,qop=auth,algorithm=md5,opaque="6f68f5cd7719e153"
Allow-Events: presence, kpml, talk
Content-Length: 0
<--- Transmitting SIP response (478 bytes) to UDP:101.2.168.7:31243 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 101.2.168.7:31243;rport=31243;received=101.2.168.7;branch=z9hG4bK-5210007-1---09f615b42fce6816
Call-ID: AnL-wvofLBPO64LKGGmAOA..
From: <sip:1000@{{asterisk-public-IP}}>;tag=0db6ac0c
To: <sip:1000@{{asterisk-public-IP}}>;tag=z9hG4bK-5210007-1---09f615b42fce6816
CSeq: 848 REGISTER
Date: Thu, 22 Oct 2020 06:15:09 GMT
Contact: <sip:1000@101.2.168.7:31243;transport=UDP;rinstance=b656a02547b0e08f>;expires=59
Expires: 60
Server: Asterisk PBX
Content-Length: 0
<--- Received SIP request (386 bytes) from UDP:{{sip-ip}}:5060 --->
OPTIONS sip:25772350001@{{asterisk-public-IP}}:5060 SIP/2.0
Via: SIP/2.0/UDP {{sip-ip}};branch=z9hG4bK312a.680fdd94000000000000000000000000.0
To: <sip:25772350001@{{asterisk-public-IP}}:5060>
From: <sip:voipnow@{{sip-ip}}>;tag=47546faa90a5df61ca65b19e3b051eb0-9a69
CSeq: 10 OPTIONS
Call-ID: 0d8c858a09aeddbe-10559@{{sip-ip}}
Max-Forwards: 70
Content-Length: 0
User-Agent: VoIP Networks
<--- Transmitting SIP response (896 bytes) to UDP:{{sip-ip}}:5060 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP {{sip-ip}};rport=5060;received={{sip-ip}};branch=z9hG4bK312a.680fdd94000000000000000000000000.0
Call-ID: 0d8c858a09aeddbe-10559@{{sip-ip}}
From: <sip:voipnow@{{sip-ip}}>;tag=47546faa90a5df61ca65b19e3b051eb0-9a69
To: <sip:25772350001@{{asterisk-public-IP}}>;tag=z9hG4bK312a.680fdd94000000000000000000000000.0
CSeq: 10 OPTIONS
Accept: application/dialog-info+xml, application/simple-message-summary, application/pidf+xml, application/xpidf+xml, application/cpim-pidf+xml, application/simple-message-summary, application/pidf+xml, application/dialog-info+xml, application/sdp, message/sipfrag;version=2.0
Allow: OPTIONS, REGISTER, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, MESSAGE, REFER
Supported: 100rel, timer, replaces, norefersub
Accept-Encoding: text/plain
Accept-Language: en
Server: Asterisk PBX
Content-Length: 0