[asterisk-users] Using existing extensions.conf macros, and co-habitation

Anselm Martin Hoffmeister anselm at hoffmeister-online.de
Sat Dec 1 02:54:42 CST 2007


Am Freitag, den 30.11.2007, 15:08 -0800 schrieb Philip Prindeville:
> bump...
> 
> Philip Prindeville wrote:
> > I'm trying to set up my extensions.conf file using some of the existing
> > macros like stdexten, etc. while at the same time having two logically
> > separate virtual PBX's (with no "default" context) and two trunks coming
> > into separate contexts, i.e. one for residence and one for my at-home
> > business.
> >
> > I noticed, however, that macro-stdexten depends on the "default" context:
> >
> > [macro-stdexten];
> > ;
> > ; Standard extension macro:
> > ;   ${ARG1} - Extension  (we could have used ${MACRO_EXTEN} here as well)
> > ;   ${ARG2} - Device(s) to ring
> > ;
> > exten => s,1,Dial(${ARG2},20)					; Ring the interface, 20 seconds maximum
> > exten => s,2,Goto(s-${DIALSTATUS},1)				; Jump based on status (NOANSWER,BUSY,CHANUNAVAIL,CONGESTION,ANSWER)
> >
> > exten => s-NOANSWER,1,Voicemail(u${ARG1})		; If unavailable, send to voicemail w/ unavail announce
> > exten => s-NOANSWER,2,Goto(default,s,1)			; If they press #, return to start
> >
> > exten => s-BUSY,1,Voicemail(b${ARG1})			; If busy, send to voicemail w/ busy announce
> > exten => s-BUSY,2,Goto(default,s,1)			; If they press #, return to start
> >
> > exten => _s-.,1,Goto(s-NOANSWER,1)				; Treat anything else as no answer
> >
> > exten => a,1,VoicemailMain(${ARG1})
> >
> >
> > The issue is that I have, per "virtual pbx" (i.e. home or business), two contexts
> > that these get used from.  The "internal-xyzzy" and "incoming-xyzzy" contexts (one
> > for each pbx, ie. "xyzzy" is "home" or else it's "office").
> >
> > I was wondering if there wasn't a more flexible solution to this issue, than
> > hard-coding a "Goto(default,s,1)" into them (I have no default context, because it
> > would be meaningless).
> >
> > Perhaps using "Gosub" and "Return".  Or do I need to hack the macro, and pass in a
> > 3rd argument (bletch)?
> >

I am not a macro guy, but I see three possible ways of operation:

1. extend the macro to have a third parameter, which would be the
"Context" the macro is called from (and have

exten => s-BUSY,2,GOTO(${ARG3},s,1)

2. use a global variable for the same purpose

3. Check wether the ${CONTEXT} variable is still set to the calling
context in a Macro (no idea if it is, worth a NOOP, right?)

HTH
Anselm




More information about the asterisk-users mailing list