[Asterisk-Dev] Feature: assigned channel variables - is this
reasonable?
John Todd
jtodd at loligo.com
Mon Jul 12 16:55:34 MST 2004
At 1:06 PM -0700 on 7/12/04, Chris A. Icide wrote:
>Feature Request:
>
>Each context should have a variables section that allows you to set
>variables for that will be attached to any channel that enters that
>context.
>
>For example: Steven's vPBX problem
>
>
>sip.conf
>
>[vpbx1#user1]
>blah, blah, blah
>context=vpbx1-user
>
>
>extensions.conf
>
>[vpbx1-user]
>
>variable => vpbx,1
>variable => ld-nufone,0
>variable => playswithmonkeys,1
>
>include => one-plus-ld
>
>
>. . . .
>
>Now any channel entering vpbx1-user will have three variables
>assigned to that channel, and in this case they would be
>
>vpbx1 = 1
>ld-nufone = 0
>playswithmonkeys = 1
>
>so later on in the dialplan we can always check these variables to
>make any decisions needed.
>
>
>
>I know that we could use SetVar in an extension, but what if I have
>a bunch of different extensions in my context, or my context is
>merely a list of includes? As in the above example, I have a
>generic one-plus-ld context which handles 1 plus us long distance
>dialing, but I handle users from different vpbxs differently, some
>are sent via a nufone account perhaps (if the variable
>ld-nufone=1)...
>
>I think this would definately work in steve s's issue about vpbx's
>and would help me in a number of situations as well
>
>-Chris
The way to do this currently would be this:
[vpbx1-user]
exten => _X.,1,SetVar(vpbx=1)
exten => _X.,2,SetVar(ld-nufone=0)
exten => _X.,3,SetVar(playswithmonkeys=1)
exten => _X.,4,Goto(vpbx1-user2,${EXTEN},1)
exten => h,1,Hangup
[vpbx1-user2]
include => one-plus-ld
<etc. etc. etc.>
You could get risky and match with a "_." if you need to match on
alpha as well as numeric, but then you run the risk of having a
hangup during those routines, and "_." matches "h" so you'd get all
kinds of nasty errors.
I think that the ability to assign variables from inside a channel
configuration file would be ideal. I think this has been discussed
in the past on this or the -users list...
Hypothetical configuration in sip.conf:
[1234]
canreinvite=no
type=user
host=dynamic
secret=hongkongcavaliers
setvar=vpbx=1
setvar=ld-nufone=0
setvar=playswithmonkeys=1
JT
More information about the asterisk-dev
mailing list