[Asterisk-Users] PHP Gui for Asterisk (AGI questions)

Mark Spencer markster at digium.com
Tue Mar 18 07:53:53 MST 2003


> Call it a RDBMS, LDAP server or even an NIS map.

Asterisk is designed to support multiple switch backends, so you can put a
statement like this in your dialplan:

switch => IAX2/<host>/<context>

Which pulls in extensions from another remote host.  But just as easily
one could create a switch for MySQL, LDAP, NIS, etc.

> Sepporate from the above is the flow of control that a call takes.
> (ring phone(s), answer or go to voice mail or secritary)  You
> should only have to define how a "type-D' phone flows once then
> in the above on-line database simple note that the extension
> is of "type-D"
.
.
.

> The best thing might be to seporate the two types of data.
> The simple thing to do is use a preprocessor like M4.
> Defin a macro for a "type-D" phone and then have lines like
>
>    extn-type_D(6578)
>    extn-type_D(6579)

Asterisk *does* have macros (as of about 3-4 weeks ago).  Just take a look
at configs/extensions.conf.sample which has been greatly rewritten to
utilize them.  Consider the following, somewhat overdone example:

[macro-stdexten]
;
; Let ${ARG1} be the extension number
; Let ${ARG2} be the device(s) to ring
;
exten => s,1,Dial(${ARG2}|20)
exten => s,2,Voicemail(u${ARG1})
exten => s,102,Voicemail(b${ARG1})

[macro-sipexten]
;
; Let ${ARG1} be the extension/SIP peer
;
exten => s,1,Macro(stdexten,${ARG1},SIP/${ARG1})

[macro-sipext]
;
; Like a SIP extension, but with no arguments, we just
; use the extension we were provided
;
exten => s,1,Macro(sipexten,${MACRO_EXTEN})

[default]
exten => 1000,Macro(sipext)             ; Mark at 1000
exten => 1001,Macro(sipext)             ; Wil at 1001
exten => 1002,Macro(sipexten,1001)      ; Alias for 1001
exten => 1003,Macro(stdexten,1003,Zap/1) ; Old analog extension
exten => 0,Macro(stdexten,1000,Zap/1&Zap/2&SIP/1000) ; Operator

Mark




More information about the asterisk-users mailing list