[asterisk-users] simplify

David Gomillion david.gomillion at gmail.com
Mon Apr 2 08:39:39 MST 2007


On 4/2/07, Josu Lazkano Lete <jlazkano at somesi.com> wrote:
>
>  hello friends,
>
> is there any way to simplify that extensions.conf file?
>
> [miprimerejemplo]
> exten => 20000,1,Dial(SIP/20000,30,Ttm)
> exten => 20000,2,Hangup
> exten => 20000,102,Voicemail(20000)
> exten => 20000,103,Hangup
>
> exten => 20100,1,Dial(SIP/20100,30,Ttm)
> exten => 20100,2,Hangup
> exten => 20100,102,Voicemail(20100)
> exten => 20100,103,Hangup
>
> exten => 20200,1,Dial(SIP/20200,30,Ttm)
> exten => 20200,2,Hangup
> exten => 202000,102,Voicemail(20200)
> exten => 20200,103,Hangup
>
> exten => 20300,1,Dial(SIP/20300,30,Ttm)
> exten => 20300,2,Hangup
> exten => 203000,102,Voicemail(20300)
> exten => 20300,103,Hangup
>
> exten => 20400,1,Dial(SIP/20400,30,Ttm)
> exten => 20400,2,Hangup
> exten => 204000,102,Voicemail(20400)
> exten => 20400,103,Hangup
>

Yes, 2 ways:

1. Use a macro:

[macro-whatever]
exten => s,1,Dial(SIP/${ARG1},30,Ttm)
exten => s,2,Hangup
exten => s,102, Voicemail(b${ARG1})
exten => s,103,Hangup

2. Use pattern matching
exten => _20[0-4]00,1,Macro(whatever,${EXTEN})

Is that simpler?
By the way, I took the liberty of adding b for busy to the macro. But you
may want to consider using the standard extension macro provided with
Asterisk instead. It allows people to press * to check their voicemail, and
a few other handy features. Why reinvent the wheel?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20070402/646053f4/attachment-0001.htm


More information about the asterisk-users mailing list