Is Dial(SIP/<Pattern>) possible?

At the moment, when I receive an external call from via my SIP provider, I dial all my internal extensions as follows:

exten => SIP-ID, 1, Dial(SIP/2000&SIP/2001&…, 15, t)

However, sometimes, not all my extensions are online, and Asterisk gives a warning when it can’t find one or more of them.

Is it possible to Dial a ‘group’ of phones or use a pattern in the parameter given to the Dial command? e.g. Dial(SIP/, 15, t)?


You could, explicitly, iterate over the device states to build a shortened dial string.

Thanks, have got it working. For anyone interested:

exten => SIP-ID,1,Set(i=2000)
exten => SIP-ID,n,While($[${i} < 2004])
exten => SIP-ID,n,ExecIf($["${DEVICE_STATE(SIP/${i})}" != “UNAVAILABLE”]?Set(DIALLIST=${DIALLIST}&SIP/${i}))
exten => SIP-ID,n,Set(i=$[${i}+1])
exten => SIP-ID,n,EndWhile
exten => SIP-ID,n,Dial(${DIALLIST:1}, 15, t)
exten => SIP-ID,n,VoiceMail(2000,u)