Pattern Regexten And Dialing To Trunk

Home » Asterisk Users » Pattern Regexten And Dialing To Trunk
Asterisk Users No Comments

Hi list! I’m currently stucked and don’t know how to properly resolve next situation:

I’m using asterisk with regcontext and regexten, so far its works: NoOps with prio 1 dynammicaly added or removed as expected.

Example: 3 trunks: tr1 with regexten _1XXX; tr2 with regexten _2XXX and tr3 with regexten _3XXX

‘_1XXX’ => 1. NoOp(tr1) [SIP]
‘_1XXX’ => 2. Dial(SIP/tr1/${EXTEN})
[pbx_config]
‘_2XXX’ => 1. NoOp(tr2) [SIP]
‘_2XXX’ => 2. Dial(SIP/tr2/${EXTEN})
[pbx_config]
‘_3XXX’ => 1. NoOp(tr3) [SIP]
‘_3XXX’ => 2. Dial(SIP/tr3/${EXTEN})
[pbx_config]

I can’t just write _X.,2,Dial(SIP/${EXTEN}) because it is trunks, and i have to write extension with priority 2 for each trunk i have.

It is possible somehow use _X.,2,Dial(..) in this situation? because when it is just 3 trunks it is not a big problem, but when their amount is about hundred…

….

I’m thinking about adding additional option “regapp” to set custom app instead of default NoOp. Something like this:

sip.config:

[general]
regcontext = internal regapp = Set(CALLED_TRUNK={$name})

[tr1]
… regexten = _1XXX

dialplan show internal:

[ Context ‘internal’ created by ‘pbx_config’ ]
‘_1XXX’ => 1. Set(CALLED_TRUNK=tr1) [SIP]
‘_2XXX’ => 1. Set(CALLED_TRUNK=tr2) [SIP]
‘_3XXX’ => 1. Set(CALLED_TRUNK=tr3) [SIP]
‘_X.’ => 2. Dial(SIP/${CALLED_TRUNK}/${EXTEN})
[pbx_config]

But i hope it is possible to achieve this with default options…