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

Tilghman Lesher tilghman at mail.jeffandtilghman.com
Fri Nov 30 22:14:48 CST 2007


On Thursday 29 November 2007 13:29:17 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)?

MacroExit or Gosub/Return would certainly be possibilities.

The main thing to note is that this macro that you call standard is actually
just an arbitrary example.  It is by no means perfect, so feel free to adapt
it to your own liking.

-- 
Tilghman



More information about the asterisk-users mailing list