[Asterisk-Dev] IAX2 call variable passing between servers

John Todd jtodd at loligo.com
Tue Dec 2 08:42:10 MST 2003

Here's an idea for you all to shoot down.  I'll await the nonexistant 
comments before I open a feature request.

We have the luxury of moving calls around with IAX2, where we (the 
Asterisk community) have control of the protocol.  Various hacks are 
being installed into SIP headers to move data around, as I'm 
experiencing with some of the installations I've now seen.  With 
IAX2, it seems apparent that we should be able to move variables 
around semi-transparently, since IAX2 integrates with Asterisk 

Sending all variables might be difficult/insecure/silly, as we don't 
want to clutter the call setup with a slew of variables, some of 
which may be inherently "secure" and should not leave the server on 
which they were generated.  Perhaps some naming convention could be 
used to differentiate variables that would be passed to the remote 
end as "special case" variables.

There are two possible methods that could be used to determine if 
certain variables might get passed.  The first method is the 
simplest, which is to simply search all the named variables and see 
if any of them begin with "resend." and then transmit those 
automatically.  Alternately (and perhaps, in addition to this method) 
one could add yet another modifier to the Dial command, such as "v" 
which stands for "send [v]ariables".

I propose a format like this for outbound:  outbound.VARNAME
I propose a format like this for inbound:   inbound.VARNAME

I think that it would be wise to "sandbox" the variables with a 
distinguishing feature (name prefix) so that we do not inadvertently 
move variables out of or into local/remote dialplan executions.  The 
extra two steps is a small enough effort.  (really, one step at each 
end is needed to be "clean", but we could skip the re-translation at 
the far end and just use ${inbound.VARNAME} if we were lazy.)

As an example:
exten => 123,1,SetVar(GREETING=hello there)
exten => 123,2,SetVar(NAME=John Doe)
exten => 123,3,SetVar(outbound.GREETING=${GREETING})
exten => 123,4,SetVar(outbound.NUMBER=${EXTEN})
exten => 123,5,Dial(IAX2/remote1 at hub1/${EXTEN},,v)

Upon receiving the call, the other host (hub1) would then have to 
translate back like this:

exten => _X.,1,SetVar(OURGREETING=${inbound.GREETING})
exten => _X.,2,SetVar(DIALEDNUMBER=${inbound.NUMBER})
exten => _X.,3,blah blah blah

As far as having this work across channels other than IAX2: SIP can 
handle almost any number of additional headers.  It could be possible 
to incorporate a "custom" header if there are any variables that fall 
into the 'resend.' group.  Of course, fully escaped syntax would need 
to be followed.  As an example, a custom header could be 

Asterisk-Variables: FOO="hello there";NUMBER="123"

There are special areas in the PRI outbound call which could contain 
a limited number of variables passed along.  See: 

No idea.

No idea.

No idea.

Multiple methods: db[put/get] or native bridge variable transfers.


More information about the asterisk-dev mailing list