Can't make internal/outbound calls with PJSIP

Hello,

I’m new there and I don’t have a lot of knowledge on Asterisk and the PJSIP module. So there are my problems actually. I recently move from a VPS to my home servers the Asterisk PBX and during the re-installation I forgot to add CHAN_SIP module so I get the opportunity to start migrate my configuration from chan_sip to pjsip then I wouldn’t have known it would be such harder as it is. I have 5 Cisco 7940 and 7960 IP phones in my home all configured to the SIP firmware and everything was working fine before I started to move.

Then from now, I can : receive calls from the SIP trunk I configured, call internal but only to the number registered using MicroSIP from my computer on the same network of all of my Cisco phones. When I try to make a call using the MicroSIP (103) client to my Cisco phone (100) the request timeout. I can hear my voice when I do that too, can of course call the standard 8002. When I try to call outside I stuck on “Proceeding in 100” on the Cisco Phones and Request timeout on MicroSIP client. I’m literally lost for the moment and don’t know what I can do furthermore.

Here is my pjsip.conf file.

[transport-udp]
type=transport
protocol=udp
bind=0.0.0.0
local_net=192.168.20.0/24
external_media_address=217.x.x.x.
external_signaling_address=217.x.x.x.

[homesip_reg]
type=registration
transport=transport-udp
outbound_auth=homesip_auth
server_uri=sip:sip5.ovh.fr:5060
client_uri=sip:00331@sip5.ovh.fr:5060
retry_interval=60
max_retries=10
expiration=3600
line=yes
endpoint=homesip

[homesip_auth]
type=auth
auth_type=userpass
password=
username=00331
realm=sip5.ovh.fr

[homesip]
type=aor
contact=sip:sip5.ovh.fr:5060
qualify_frequency=5
remove_existing=yes

[homesip]
disallow=all
type=endpoint
transport=transport-udp
context=homesip-in
from_user=00331
rtp_symmetric = yes
force_rport = yes
rewrite_contact = yes
allow = alaw,ulaw,gsm
direct_media=no
aors=homesip
ice_support=yes
outbound_auth=homesip_auth

[homesip]
type=identify
endpoint=homesip
match=sip5.ovh.fr

;Users

;100-louis

[100]
type=endpoint
transport=transport-udp
context=home
disallow=all
allow=gsm,ulaw,alaw
force_rport=no
aors=100
auth=100-auth

[100-auth]
type=auth
auth_type=userpass
password=
username=100
realm=asterisk

[100]
type=aor
max_contacts=1
qualify_frequency=5
remove_existing=yes

;101-gabriel
[101]
type=endpoint
transport=transport-udp
context=home
disallow=all
allow=gsm,ulaw,alaw
force_rport=no
aors=101
auth=101-auth

[101-auth]
type=auth
auth_type=userpass
password=
username=101
realm=asterisk

[101]
type=aor
max_contacts=1
qualify_frequency=5
remove_existing=yes

;Cuisine

[102]
type=endpoint
transport=transport-udp
context=home
disallow=all
allow=gsm,ulaw,alaw
force_rport=no
aors=102
auth=102-auth

[102-auth]
type=auth
auth_type=userpass
password=
username=102
realm=asterisk

[102]
type=aor
max_contacts=1
qualify_frequency=5
remove_existing=yes


;103-ChMaitre
[103]
type=endpoint
transport=transport-udp
context=home
disallow=all
allow=gsm,ulaw,alaw
force_rport=no
aors=103
auth=103-auth

[103-auth]
type=auth
auth_type=userpass
password=
username=103
realm=asterisk

[103]
type=aor
max_contacts=3
qualify_frequency=5
remove_existing=yes

So, I removed passwords, SIP trunk user, then ip adresses.

Here is my extensions.

[general]

static=yes
writeprotect=no
clearglobalvars=no

[globals]
CONSOLE=Console/dsp                             ; Console interface for demo
IAXINFO=guest                                   ; IAXtel username/password
TRUNK=DAHDI/G2                                  ; Trunk interface
TRUNKMSD=1                                      ; MSD digits to strip (usually 1 or 0)

[guest]
;Ce groupe ne peut pas recevoir d'appels


;Appels internes
exten => _1XX,1,Dial(PJSIP/${EXTEN},35)

;Appels d'urgence
exten => _18,1,Dial(PJSIP/homesip/${EXTEN})
exten => _15,1,Dial(PJSIP/homesip/${EXTEN})
exten => _17,1,Dial(PJSIP/homesip/${EXTEN})
exten => _112,1,Dial(PJSIP/homesip/${EXTEN})

[home]
;Ce groupe peut recevoir des appels

;Serveur vocal params
exten => 8002,1,Goto(ivr-home,s,1)

;Appels internes
exten => _1XX,1,Dial(PJSIP/${EXTEN},35)

;Appels externes
exten => _0[1-9]XXXXXXXX,1,Set(CALLFILENAME=${EXTEN}${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)})
exten => _0[1-9]XXXXXXXX,2,MixMonitor(/var/spool/asterisk/recording/${CALLFILENAME}.wav,bW(3))
exten => _0[1-9]XXXXXXXX,3,Dial(PJSIP/${EXTEN}@homesip)
exten => _[1-9]XXX,1,Set(CALLFILENAME=${EXTEN}${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)})
exten => _[1-9]XXX,2,MixMonitor(/var/spool/asterisk/recording/${CALLFILENAME}.wav,bW(3))
exten => _[1-9]XXX,3,Dial(PJSIP/${EXTEN}@homesip)

;Recording IVRs
exten => _5XXX,1,Record(IVR-${EXTEN:1}:ulaw)
exten => _5XXX,2,Playback(IVR-${EXTEN:1})

;exten => 900,1,ConfBridge(Room_1,ConfRoom_1,User_NoAuth)
;exten => 901,1,ConfBridge(Room_1,ConfRoom_1,User_Admin,ConfMenu)
;exten => 903,1,ConfBridge(Room_2,ConfRoom_2,User_Auth)
;exten => 904,1,ConfBridge(Room_2,ConfRoom_2,User_Admin)

;Appels d'urgence
exten => _18,1,Dial(PJSIP/homesip/${EXTEN})
exten => _15,1,Dial(PJSIP/homesip/${EXTEN})
exten => _17,1,Dial(PJSIP/homesip/${EXTEN})
exten => _112,1,Dial(PJSIP/homesip/${EXTEN})

[homesip-in]
exten => s,1,GotoIf($["${CALLERID(num)}" = "04"]?dial1)
exten => s,n,GotoIf($["${CALLERID(num)}" != "04"]?10)
exten => s,n(dial1),Dial(PJSIP/100,25)
exten => s,n,Goto(ivr-busy-louis,s,1)
exten => s,10,Goto(home,8002,1)
exten => s,n,Hangup()

[ivr-home]
exten => s,1,Answer()
exten => s,2,Set(TIMEOUT(response)=10)
exten => s,3,Background(IVR-005)
exten => s,4,WaitExten()

exten => 1,1,Playback(waiting2)
exten => 1,2,Dial(PJSIP/100&PJSIP/101&PJSIP/102&PJSIP/103,30)
exten => 1,3,Background(IVR-007)
exten => 1,4,Hangup

exten => 2,1,Goto(ivr-home-choose,s,1)

exten => 9,1,Playback(IVR-011)
exten => 9,2,Goto(home,8002,1)

[ivr-home-choose]
exten => s,1,Answer()
exten => s,2,Set(CALLFILENAME=${CALLERID(num)}${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)})
exten => s,3,MixMonitor(/var/spool/asterisk/recording/${CALLFILENAME}.wav,bW(3))
exten => s,4,Background(IVR-006)
exten => s,5,Set(TIMEOUT(response)=10)
exten => s,6,WaitExten()

exten => 1,1,Answer()
exten => 1,2,Playback(waiting2)
exten => 1,3,Dial(PJSIP/100,25)
exten => 1,4,Goto(ivr-busy-louis,s,1)

exten => 2,1,Answer
exten => 2,2,Playback(waiting2)
exten => 2,3,Dial(PJSIP/101,25)
exten => 2,4,Goto(ivr-busy-gab,s,1)

exten => 3,1,Answer
exten => 3,2,Playback(waiting2)
exten => 3,3,Dial(PJSIP/102,25)
exten => 3,4,Background(IVR-008)
exten => 3,5,Hangup

exten => 4,1,Answer
exten => 4,2,Playback(waiting2)
exten => 4,3,Dial(PJSIP/103,25)
exten => 4,4,Background(IVR-008)
exten => 4,5,Hangup

exten => 5,1,Answer
exten => 5,2,Playback(waiting2)
exten => 5,3,Dial(PJSIP/104,25)
exten => 5,4,Background(IVR-008)
exten => 5,5,Hangup

[ivr-busy-louis]
exten => s,1,Background(IVR-009)
exten => s,2,Set(TIMEOUT(response)=10)
exten => s,3,WaitExten()

exten => 1,1,Dial(PJSIP/xxxxx@homesip)

[ivr-busy-gab]
exten => s,1,Background(IVR-009)
exten => s,2,Set(TIMEOUT(response)=10)
exten => s,3,WaitExten()

exten => 1,1,Dial(PJSIP/xxxxx@homesip)

Do you have any recommendations?

Sincerly.

Louis

What is the console output that is seen in Asterisk? What is the SIP traffic (pjsip set logger on)? As well this:

Dial(PJSIP/homesip/${EXTEN})

Is not correct for PJSIP. It is:

Dial(PJSIP/${EXTEN}@homesip)

Done. I knew it.
For the logs here it is.

<--- Transmitting SIP request (435 bytes) to UDP:82.:5060 --->
OPTIONS sip:100@82.:5060;transport=udp SIP/2.0
Via: SIP/2.0/UDP 217.9:5060;rport;branch=z9hG4bKPj2db644c6-b147-4f64-aa31-7eec915d58e4
From: <sip:100@192.168.20.63>;tag=89b22260-0004-4455-bcd0-625fe21c2eb3
To: <sip:100@82.>
Contact: <sip:100@217.:5060>
Call-ID: ce641f5d-c667-4081-afdf-d653cd5d4acb
CSeq: 36418 OPTIONS
Max-Forwards: 70
User-Agent: Asterisk PBX 18.1.0
Content-Length:  0


<--- Received SIP response (937 bytes) from UDP:82.6:5060 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 217.:5060;rport;branch=z9hG4bKPj2db644c6-b147-4f64-aa31-7eec915d58e4
From: <sip:100@192.168.20.63>;tag=89b22260-0004-4455-bcd0-625fe21c2eb3
To: <sip:100@82.6>;tag=00146a743a220708402ffefd-60f1f30e
Call-ID: ce641f5d-c667-4081-afdf-d653cd5d4acb
Date: Fri, 11 Dec 2020 10:17:56 GMT
CSeq: 36418 OPTIONS
Server: Cisco-CP7960G/8.0
Allow: ACK,BYE,CANCEL,INVITE,NOTIFY,OPTIONS,REFER,REGISTER,UPDATE
Accept: application/sdp,multipart/mixed,multipart/alternative
Accept-Encoding: identity
Accept-Language: en
Supported: replaces,join,norefersub
Content-Length: 237
Content-Type: application/sdp
Content-Disposition: session;handling=optional

v=0
o=Cisco-SIPUA 23592 0 IN IP4 82.
s=SIP Call
t=0 0
m=audio 0 RTP/AVP 0 8 18 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15

<--- Transmitting SIP request (431 bytes) to UDP:91.121.129.29:5060 --->
OPTIONS sip:sip5.ovh.fr:5060 SIP/2.0
Via: SIP/2.0/UDP 217.:5060;rport;branch=z9hG4bKPj7fd5b705-700a-4da8-be07-ed903f39adf3
From: <sip:0033@192.168.20.63>;tag=8ca85b8a-4945-4812-a6ee-0fb039729511
To: <sip:sip5.ovh.fr>
Contact: <sip:00331@217.1:5060>
Call-ID: 1af61d70-e6c0-4ecd-95d1-e28875180f38
CSeq: 12012 OPTIONS
Max-Forwards: 70
User-Agent: Asterisk PBX 18.1.0
Content-Length:  0


<--- Received SIP response (382 bytes) from UDP:91.121.129.29:5060 --->
SIP/2.0 501 Not Implemented
Call-ID: 1af61d70-e6c0-4ecd-95d1-e28875180f38
CSeq: 12012 OPTIONS
From: <sip:00331@192.168.20.63>;tag=8ca85b8a-4945-4812-a6ee-0fb039729511
To: <sip:sip5.ovh.fr>;tag=00-23233-13ea4cfc1-5fec2f61
Via: SIP/2.0/UDP 217:5060;received=217;rport=10913;branch=z9hG4bKPj7fd5b705-700a-4da8-be07-ed903f39adf3
Content-Length: 0

Those are OPTIONS requests which are used to confirm the remote side is present. There’s no calls in that log, which if you’re experiencing issues with would need to be done while logging.

<--- Transmitting SIP response (505 bytes) to UDP:82:5060 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 192.168.1.140:5060;received=82.65;branch=z9hG4bK180e683a
Call-ID: 00078551-fbf00002-29ef7572-12105ed1@192.168.1.140
From: <sip:102@217>;tag=00078551fbf0001672197821-77c1521e
To: <sip:102@217.>;tag=z9hG4bK180e683a
CSeq: 119 REGISTER
WWW-Authenticate: Digest realm="asterisk",nonce="1607681873/8f90e700849fcfff7e87d08060379da5",opaque="6e00956e33a75464",algorithm=md5,qop="auth"
Server: Asterisk PBX 18.1.0
Content-Length:  0


<--- Transmitting SIP request (1457 bytes) to UDP:91.:5060 --->
INVITE sip:049365@sip5.ovh.fr:5060 SIP/2.0
Via: SIP/2.0/UDP 217.:5060;rport;branch=z9hG4bKPja0dd463b-b65c-4680-84c9-29ec6bb2d484
From: <sip:00331@192.168.20.63>;tag=0c662dc2-7b31-4d42-bc24-dc975c0850a1
To: <sip:049365@sip5.ovh.fr>
Contact: <sip:00331@217:5060>
Call-ID: 83615f8d-5830-42ef-9ef1-6b7ae820737b
CSeq: 20938 INVITE
Allow: OPTIONS, REGISTER, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, MESSAGE, REFER
Supported: 100rel, timer, replaces, norefersub, histinfo, histinfo
Session-Expires: 1800
Min-SE: 90
Max-Forwards: 70
User-Agent: Asterisk PBX 18.1.0
Proxy-Authorization: Digest username="00331", realm="sip5.ovh.fr", nonce="3d71ecfb17a9e9d60ae101cb6646d5e3", uri="sip:049365@sip5.ovh.fr:5060", response="3bdf4c73efcc606eae57b32c445ea58d", algorithm=MD5, opaque="3d568ac449d30c6"
Content-Type: application/sdp
Content-Length:   516

v=0
o=- 1247992649 1247992649 IN IP4 217.128.22.249
s=Asterisk
c=IN IP4 217.
t=0 0
m=audio 10794 RTP/AVP 0 8 3 101
a=ice-ufrag:7ca0cd5f06082e7f6e6544be6c1899e7
a=ice-pwd:3f7adb050d56468975b181a5738fff3f
a=candidate:Hc0a8143f 1 UDP 2130706431 192.168.20.63 10794 typ host
a=candidate:Hc0a8143f 2 UDP 2130706430 192.168.20.63 10795 typ host
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:3 GSM/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv

<--- Transmitting SIP response (424 bytes) to UDP:6:5060 --->
SIP/2.0 503 Service Unavailable
Via: SIP/2.0/UDP 82.2.186:5060;received=8186;branch=z9hG4bK4b838946
Call-ID: 00146a74-3a22001e-2701e96a-0c5598ca@82.65.12.186
From: "ChLouis" <sip:100@21.249>;tag=00146a743a2207001b2dbea9-69d8b78a
To: <sip:049365@217.1249>;tag=b21298f6-98ad-4a23-8b4a-8b4594847cf0
CSeq: 102 INVITE
Server: Asterisk PBX 18.1.0
Reason: Q.850;cause=34
Content-Length:  0


<--- Received SIP request (392 bytes) from UDP:82.:5060 --->
ACK sip:0493651024@49 SIP/2.0
Via: SIP/2.0/UDP :5060;branch=z9hG4bK4b838946
From: "ChLouis" <sip:100@217>;tag=00146a743a2207001b2dbea9-69d8b78a
To: <sip:0493651024@2.249>;tag=b21298f6-98ad-4a23-8b4a-8b4594847cf0
Call-ID: 00146a74-3a22001e-2701e96a-0c5598ca@82.65.12.186
Date: Fri, 11 Dec 2020 10:17:54 GMT
CSeq: 102 ACK
Content-Length: 0


<--- Received SIP request (547 bytes) from UDP:9:18534 --->
REGISTER sip:217.249 SIP/2.0
Via: SIP/2.0/UDP 149.:5060;branch=z9hG4bK092d5a93
From: <sip:102@217..249>;tag=001469e054121e3420ed7aeb-463c8d91
To: <sip:102@217..249>
Call-ID: 001469e0-54120003-36f460f1-47fd55c1@149.91.83.185
Max-Forwards: 70
Date: Fri, 11 Dec 2020 10:17:34 GMT
CSeq: 6765 REGISTER
User-Agent: Cisco-CP7960G/8.0
Contact: <sip:102@14:5060;transport=udp>;+sip.instance="<urn:uuid:00000000-0000-0000-0000-001469e05412>";+u.sip!model.ccm.cisco.com="7"
Content-Length: 0
Expires: 120


<--- Transmitting SIP response (507 bytes) to UDP:915:5060 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 149:5060;received=91.;branch=z9hG4bK092d5a93
Call-ID: 001469e0-54120003-36f460f1-47fd55c1@149
From: <sip:102@217>;tag=001469e054121e3420ed7aeb-463c8d91
To: <sip:102@217.>;tag=z9hG4bK092d5a93
CSeq: 6765 REGISTER
WWW-Authenticate: Digest realm="asterisk",nonce="1607681875/9aa1ababe17587451a05a3489fa11bad",opaque="098b9af511948374",algorithm=md5,qop="auth"
Server: Asterisk PBX 18.1.0
Content-Length:  0

sorry here it is…
although I see that my cisco phones are no longer registering the only one who is registered is my phone in my bedroom…

You have ice_support enabled and it is unlikely that your provider supports it. As well as you may have a “stunaddr” configured in rtp.conf which is no longer responding causing call setup to block for an extended period of time, I’d suggest commenting out the line for testing in rtp.conf.

Omg. You’re my saver! It works, I can now make outbound calls with my SIP voip provider OVH. There was no stun server line it was already commented in rtp.conf I only remove ice_support line !!. We fixed one problem I’m so happy, now for my Cisco Phones what do you think cause the Unauthorized registration even though my bedroom phone is registered successfully :frowning:

I have no idea, someone else may have input in that regard.

That’s ok we can not be great everywhere! But you saved my life haha, thank you so much for your help!

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