[Asterisk-Users] Define variable in sip.conf

steve at daviesfam.org steve at daviesfam.org
Wed Oct 5 14:16:39 MST 2005



On Wed, 5 Oct 2005, Benjamin Lawetz wrote:

> I'm looking for a way to transmit a user specific variable to my dialplan
> 
> If we use the example of the hair color, I was thinking of having something
> like:

Hi,

I do like the idea of stashing variable settings in sip peers, zapata
channels etc.  But in the meantime, I use an extensions.conf "trick" to
make it easy to set variables and other settings that depend on the caller
and not the called number.

Here's an attempt to show the idea:

[macro-callersettings]
; arg1 comes in as the caller's cid number
exten => s,1,Goto(${ARG1},1)
exten => 200,1,Noop(settings for extension 200 go here)
exten => 200,n,Set(EMAIL=steve at daviesfam.org)
exten => 201,1,Noop(settings for extension 201 go here)
; etc etc
exten => _3XX,1,Noop(can also use patterns to make settings for multiple extensions)

[from-exten]
; for any number dialled, first call the callersettings macro
; the pattern matches two digits or more; you might need to
; add other patterns if you use codes starting with *, or
; single digits.
exten => _X.,1,Macro(callersettings,${CALLERIDNUM})
; having called the macro, jump to a more "normal" from-exten-style context
exten => _X.,n,Goto(from-exten-more,${EXTEN},1)

[from-exten-more]
; all the usual stuff you want extensions to be able to dial
; anything here has available the variables setup in macro-callersettings
include => extensions
exten => _XXXXXXX,1,Dial(Zap/g1/${EXTEN})
; etc


Regards,
Steve




More information about the asterisk-users mailing list