Extension List/Range in variable

Hello,

What is the best way to achieve something like this:

extensions.conf
exten=> s,n,Set(allowed=101,107,108,200-299,350-369,801)
exten=> s,n,GotoIf($[${CALLERID(num)} <insert operator> ${allowed}]?destination)

In other words, I am trying to set a list of extensions that includes extension ranges and then check if the caller is in that list.

Thanks

exten => s/_10[178],n,Goto(destination)
exten => s/_2XX,s,Goto(destination)
exten => s/_3[56]X,s,Goto(destination)
exten => s/801,s,Goto(destination)
exten => s,s,Noop(Not allowed)
exten => s,n,Noop(Still not allowed)

You could also use the ExecIf application along with the Regex function

This is what I am trying to avoid. I would imagine setting a global ‘allowed’ variable and only have to update the value as we want to add/remove extensions

I don’t see how Regex can read extension ranges and individual extensions, like in the example above.

Use a subroutine

This sounds like a job for an AGI that will look up the extension in a custom database and respond accordingly.

If I do through AGI then there’s no need for a DB lookup as most programming languages can do this.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.