PJSIP - Dial application try to dial sip trunk event if it's unreacheable

Hi,

I’m trying to make this work since mor than 4 hours and I’m requesting you help. I have this in my pjsip.conf :

[ABC_TG]
type=aor
contact=sip:192.168.2.1:5060
qualify_frequency=15

[ABC_TG]
type = auth
auth_type=userpass
username = ABC_TG
password = password

[ABC_TG]
type = endpoint
context = customerIncoming
dtmf_mode = rfc4733
disallow = all
allow = ulaw,g722
rtp_symmetric = yes
force_rport = yes
rewrite_contact = yes
direct_media = no
tos_audio = ef
tos_video = af41
auth = ABC_TG
outbound_auth = ABC_TG
aors = ABC_TG
set_var=COMPANYID=2

[ABC_TG]
type=identify
endpoint=ABC_TG
match=192.168.2.1

When I try to dial this endpoinds which is down because the aor 192.168.2.1 does not even exist on my network, the Dial application still try to dial instead of returning a DIALSTATUS of UNAVAiLABLE right away without even trying to dial like chan_sip would do.

My dial string :

Dial(PJSIP/5555555555@ABC_TG)
or
Dial(${PJSIP_DIAL_CONTACTS(${ABC_TG},5555555555)}))

Please help ! :slight_smile:

Thx !

A bug is already present on the issue tracker[1] for this specific problem.

[1] https://issues.asterisk.org/jira/browse/ASTERISK-26281

Thx, I’m glad it’s a known issue

I was wondering, could something like this be a workaround?

same => n, GotoIf($[ "${DEVICE_STATE(target)}" = "UNAVAILABLE" ]?end:dial)
same => n(dial), Dial(target)
same => n(end), Hangup()

(This message can be deleted if it is considered wrong or bad practice)