[asterisk-users] Dial(${PJSIP_DIAL_CONTACTS(Alice)} & ${PJSIP_DIAL_CONTACTS(Bob)}) how not to fail if one endpoint has no registered AOR?

Benoit Panizzon benoit.panizzon at imp.ch
Sun Jun 9 06:19:02 CDT 2019


Dear List

It's probably been more than a year now I switched from chan_sip to
pjsip. pjsip works much cleaner than chan_sip.

But!

I have come across a Problem I was not able to solve with Asterisk
Dialplan Logic.

With pjsip an endpoint can have multiple AOR, so you need to expand
them with ${PJSIP_DIAL_CONTACTS()} to be able to Dial() all of them
simultaneously.

But there are also situation where you need to Dial() not only one
endpoint, but multiple ones, even mixing technologies like IAX and SIP.

You can specify those multiple endpoints with the & separator in the
Dial() function.

Unfortunately if an pjsip endpoint has NO registered AORs,
${PJSIP_DIAL_CONTACTS()} returns an empty sting.

So consider:

same => n,Dial(IAX2/guest at pbx.digium.com/s at default &
${PJSIP_DIAL_CONTACTS(Guest)})

If there is no Guest registered, the resulting string to dial passed to
Dial() is: "IAX2/guest at pbx.digium.com/s at default &" which Dial complains
is not valid, because of a missing second line to dial after the &.

Well, I could try to expand all the PJSIP Endpoints in a perl AGI
script and then compose a variable to contain a valid string for
Dial(), but I would prefer to do this with Asterisk Logic.

(Yes, with only two endpoints this can somehow be done with Set(if and
compare for empty string), but the more endpoints to ring the more
complicated it is getting.

Anyone having figured an 'easy' way to do this? Or is there even an
alternative to ${PJSIP_DIAL_CONTACTS(Guest)} which would Dial all AOR,
and still work if no AOR is present?

Sidenote:

Set Variable IF(string emptry) constructions also return en empty sting
if the condition does NOT match, is there a reversed way to do it?
IF(string empty) SET variable= ?

-BenoƮt-



More information about the asterisk-users mailing list