I’ve found and unexpected (For me) behavior in my dialplan,
Using this Wiki guide
3rd option dials Unavailable channels (Not replying SIP OPTIONS)
Something that is expected after reading the explanation a 2nd time
I was wondering how can i select an specific IP and dial it only if its available with the 4th adviced option of the guide:
exten => _9NXXNXXXXXX,1,Dial(PJSIP/${EXTEN:1}@mytrunk)
Should I replace @mytrunk with @IP?
Or how can i tell the Dialplan
I want @IP1, then @IP2, then @IP3
Any advice or idea is going to be appreciated
Warm Regards
I think you would need to read the status of the specific contact, prior to the Dial, as I’d expect Dial to use the status of the AOR, which will be the best of all its contacts’.
Unfortunately, as all too often the case, the documentation (PJSIP_CONTACT function) seems to beg more questions than it answers; how do you find the contact name, when all contacts are anonymous in pjsip.conf?
Checking before the DIal opens the race condition window wider, but there will always be one, so you must always cope with the actual Dial attempt finding it unreachable.
If we compare Chan SIP with Chan pjsip when dialling some trunks, Chan sip didn’t dial them if the Trunk became unavailable/unresponsive only when using Dial app on the extensions.conf file.
You’re suggesting that, i should use other apps in order to create evaluations before dialling the trunk?
Like: If peer contact/options unresponsive, don’t dial
About PJSIP_CONTACT i will do some tests with
PJSIP_CONTACT(name,status) → Variable
chan_sip didn’t allow multiple contacts, so the whole endpoint became unavailable when the only contact became unavailable. As I understand it, you have multiple contacts and you want to test the availability of a specific one, when another one is up, so the endpoint is up.
I think we need to see the specific configuration along with “pjsip show contacts” along with version of Asterisk. Modern PJSIP should only dial a reachable contact, be it if the endpoint is dialed directly or using PJSIP_DIAL_CONTACTS.
“As I understand it, you have multiple contacts and you want to test the availability of a specific one, when another one is up, so the endpoint is up”
Yes indeed, since calls are being sent whether SIP OPTIONS is replied or not with my Dial syntax ill have to create somehow validations of every IP … something that could “Clog” the Dialplan
“I think we need to see the specific configuration along with “pjsip show contacts” along with version of Asterisk. Modern PJSIP should only dial a reachable contact, be it if the endpoint is dialed directly or using PJSIP_DIAL_CONTACTS.”
Before sharing the “Logic” of Endpoints/Contacts, i would like to know if with the 4th example is feasible to dial contacts individually (Per IP) only if available,
Currently im using the 3rd example (Like stated in the first post)
If you explicitly specify an IP address in the Dial line, then OPTIONS and qualify doesn’t apply. You’re using the endpoint configuration for the call, but not the AORs/contacts.
The contact has to be configured in pjsip.conf to be qualified, and it has to be dialed from the dialplan. You can’t specify the IP address in the dialplan.
If you want absolute control then individual endpoints with individual AORs are an option.
No further validation was required, When using ${PJSIP_DIAL_CONTACTS()} function inside Dial application the behavior works as expected, no calls are beign sent to non-reachable peers, instead, those will “fail” with CONGESTION, a re-routable “code” that can be captured in order to try to send another call.
exten => _X!,n,Dial(${PJSIP_DIAL_CONTACTS(${EndpointName},${AorName},${EXTEN})},60)
60s ring timeout