How to use regex in extensions.conf

Hi everyone,

I wanted to use regex in my extensions.conf file so I translated this:

[internal]
exten => 7001,1,Answer()
exten => 7001,2,Dial(SIP/7001,60)
exten => 7001,3,Playback(vm-nobodyavail)
exten => 7001,4,VoiceMail(7001@main)
exten => 7001,5,Hangup()

exten => 7002,1,Answer()
exten => 7002,2,Dial(SIP/7002,60)
exten => 7002,3,Playback(vm-nobodyavail)
exten => 7002,4,VoiceMail(7002@main)
exten => 7002,5,Hangup()

exten => 8001,1,VoicemailMain(7001@main)
exten => 8001,2,Hangup()

exten => 8002,1,VoicemailMain(7002@main)
exten => 8002,2,Hangup()

Into this:

[internal]
exten => _700X,1,Answer()
exten => _700X,2,Dial(SIP/_700X,60)
exten => _700X,3,Playback(vm-nobodyavail)
exten => _700X,4,VoiceMail(_700X@main)
exten => _700X,5,Hangup()

exten => _800X,1,VoicemailMain(_700X@main)
exten => _800X,2,Hangup()

I tried to call but I couldn’t. So it didn’t work. Is what I did make sense or is there is a flaws in it? Any comment would be great!

you need to use ${EXTEN} after the match

1 Like

https://wiki.asterisk.org/wiki/display/AST/Pattern+Matching

1 Like

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