Summary:ASTERISK-07423: [patch][post-2.0] IAX2 remote variables
Reporter:Tilghman Lesher (tilghman)Labels:
Date Opened:2006-07-30 00:27:05Date Closed:2007-01-16 02:39:35.000-0600
Versions:Frequency of
Environment:Attachments:( 0) 20060804__bug7619__2.diff.txt
( 1) 20061210__bug7619__iaxvars.diff.txt
Description:For discussion, an implementation for setting variables to be passed to a
remote system, as well as retrieving them on the remote system.


Note that I do not agree with the concept, but I am providing an implementation to end a thread on the mailing list.
Comments:By: John Todd (jtodd) 2006-07-30 21:14:11

Looks promising!  Patches and compiles without a hitch on TRUNK.  Now, to upgrade a machine somewhere that isn't in production to see if the variable transfer works.

By: Andrew Kohlsmith (akohlsmith) 2006-08-04 09:40:58

This looks very cool; set up the variables you want to pass by "pushing" them to the IAXVARs in the dialplan... Dial() and then on the receiving side the dialplan pulls the ones it wants out, you can use ISNULL() to check for lack of vars...  nothing gets transferred unless it's pushed so the security risks are small...  I'm liking this quite a bit.  Now to get something together to test it out.

The only thing I could see to add would be an iax.conf directive that you put in [global] to disable any variable passing whatsoever (marked 'true' by default), and then the ability to specify the same parameter in an individual user/peer to allow the system to "accept" the variables.  This would tighten up security further.

As mentioned in the -dev channel, iax.conf.example and perhaps README.iax2 should be updated to reflect that if you pass a gazillion parameters you may exceed your MTU and the call setup would never work.  This is an extreme corner case though and really shouldn't be a reason not to include something like this in 1.4.

As Mr. Garstang put it, IAX2 was *designed* for this kind of functionality, and it solves a LOT of problems.  Corydon's implementation is a great proof-of-concept!

By: Tilghman Lesher (tilghman) 2006-08-04 12:49:12

Second patch, when I realized that the first implementation wouldn't actually pass variables at all.

By: Tim Panton (mexuar-tim) 2006-08-04 14:06:06

Thanks for the patch, very useful!
I built from second patch, and the IAX protocol level seems to work. I tested
passing a single var from and to our java IAX stack (modified to support iaxvars).

However I can't get the result back into the dialplan, it shows in the IAX2 debug:
  VARIABLE        : foobar=724024
Set("IAX2/", "FOOBAR=")
in the CLI.
What am I doing wrong?

By: Tilghman Lesher (tilghman) 2006-08-04 14:55:06

Moved code around a little more.

By: Tim Panton (mexuar-tim) 2006-08-04 15:29:35

Built from 3rd patch.
Setting a single variable works great, I can now get at it from the dialplan too.


By: Andrew Kohlsmith (akohlsmith) 2006-08-11 12:42:27

This is cool.  This is really cool.  I am wondering though... should this be a generic function?  DIALVAR() or somesuch?  that way we can pass information around in whatever protocol (current or future) can transport it?  With SIP, perhaps with X-Asterisk-Variable headers.  With IAX2 using VARIABLE IEs.  With Zapata using a similar method...  

This isn't some kind of off-the-cuff request.  It's an important feature which can be used to increase interoperability.

By: Tilghman Lesher (tilghman) 2006-08-11 14:07:55

akohlsmith:  the world is waiting for your proposed patch.  If you can make it work, I'd like to see it.  Especially with zapata channels.

By: Di-Shi Sun (homesick) 2006-10-03 16:17:13

Built from 3rd patch, need one change for svn trunk 44274. Setting three variables (split a long string variable into three) works fine. It is what we want.

I also agree with akohlsmith. If this function is standarized for general channel, it will be great.


By: John Todd (jtodd) 2006-10-24 15:14:28

Patches not-quite cleanly on SVN of today, but seems to work.

Discussion at Astricon Developer's: about 8-10 people thought this would be a useful thing to add.  Steve Uhler commented that he's doing this with IAX text messages, and having this functionality would help him remove some hacks in his dialplan.

By: John Todd (jtodd) 2006-10-24 15:17:10

Astricon: I brought up that it might be possible to do this with UUI as another method of sending variables via PSTN (ISDN) channels.  This would be horribly ugly and extremely limited, so probably should not be attempted as part of what is "built in" to Asterisk, but might be worth mentioning here anyway for future ugly dialplan coders.

By: John Todd (jtodd) 2006-11-13 12:57:05.000-0600

Just a reminder: this seems to work, and I can't see any reason that it wouldn't be committed to TRUNK unless there is some objection... I could _really_ use this for a variety of things that I'm doing with IAX2 trunking between semi-unrelated Asterisk systems.

By: Tilghman Lesher (tilghman) 2006-12-10 19:38:41.000-0600

Updated to current.  Also changed such that variable values may be of any length (and will be subdivided amongst as many IEs as required to encode the full length).

By: Tilghman Lesher (tilghman) 2007-01-16 02:39:35.000-0600

Committed, rev 51123.