PJSIP_DIAL_CONTACTS Issue

Home » Asterisk Users » PJSIP_DIAL_CONTACTS Issue
Asterisk Users 3 Comments

Hi, I’m facing a strange dialplan issue with a PJSIP_DIAL_CONTACTS.

When I try to call an offline endpoint with PJSIP_DIAL_CONTACTS, the dial command breaks and the call control go to hangup block instead of next priority. The error in CLI says “*Dial requires an argument
(technology/resource)*”. This error seems legit as there are no contacts for an offline endpoint. The dialplan should jump to the next priority.

exten => 1001,1,Dial(${PJSIP_DIAL_CONTACTS(${EXTEN})})
exten => 1001,2,,NoOP(${DIALSTATUS})
exten => 1001,3,Dial(PJSIP/mytrunk/sip:${mob}@10.0.0.1)

exten => h,1,NoOp()
exten => h,n,NoOP(${DIALSTATUS})

———————————————————————

3 thoughts on - PJSIP_DIAL_CONTACTS Issue

  • You need to examine if the returned dial string is empty in your dialplan. PJSIP_DIAL_CONTACTS returns an ‘&’ separated list of available contacts. If there are no contacts the list is empty. Dial doesn’t like an empty list.

    Richard

  • My solution to this problem was to use a gotoif and check if PJSIP_DIAL_CONTACTS has any contacts before trying to dial, if it does not then I skip the dial and goto the next step. So:

    exten => 1001,1,GotoIf($[“${PJSIP_DIAL_CONTACTS(${EXTEN})}” = “”]?nocon)
    exten => 1001,n,Dial(${PJSIP_DIAL_CONTACTS(${EXTEN})})
    exten => 1001,n(nocon),SomethingElse

    Telecomunicaciones Abiertas de M