Summary:ASTERISK-03447: [patch] Send vars across a call
Reporter:Anthony Minessale (anthm)Labels:
Date Opened:2005-02-07 12:15:14.000-0600Date Closed:2011-06-07 14:05:23
Versions:Frequency of
Environment:Attachments:( 0) send_rec_vars_rev0.diff
( 1) send_rec_vars_rev1.diff
( 2) typescript
Description:This patch implements the capability to transmit channel variables to the other side of a call when calls are placed to / from channels supporting text frames.


To use this feature it reqires a flag in app_dial and a remote application called on the other end of the call.

Sending variables example

Local Side (box A)
exten => 1,1,SetVar(SENDME=true)
exten => 1,2,Dial(IAX2/guest@boxa/1234|60|v)

Remote Side (box B)
exten => 1234,1,ReceiveVars()
exten => 1234,2,Dial(Zap/1)

Receiving variables example

Local Side (box A)
exten => 1,1,Dial(IAX2/guest@boxa/1234|60|V)

Remote Side (box B)
exten => 1234,1,SetVar(SENDME=TRUE)
exten => 1234,2,SendVars()
exten => 1234,3Dial(Zap/1)

So, depending on the setup you can either arrange for box b to end up with the vars from box a or vica-versa


Disclaimer on file

This patch was designed with non-protocol specificity in mind, thus the reason for the implmentation this paticular way.
Comments:By: Olle Johansson (oej) 2005-02-07 13:11:33.000-0600

Hmmm. If this happens during channel setup, we could also add vars to SIP by using the internal sipaddheader function... Should possibly also add an MD5 checksum or something...

By: Clod Patry (junky) 2005-02-10 12:50:08.000-0600

I've tried your patch:
on my gate machine i've:
exten => 5149853396,2,NoOp(${UNIQUEID});
exten => 5149853396,3,SetVar(SENDME=${UNIQUEID});
exten => 5148553396,4,Dial(IAX2/gate@|3|v); anastasia

and on my agi machine i've:
exten => 69,1,ReceiveVars();
exten => 69,2,NoOp(${SENDME});
exten => 69,3,AGI(anastasia/anastasia.agi|69);

When calling my exten, my gate is crashing.
on my agi machine, i've this:
   -- Accepting UNAUTHENTICATED call from
      > requested format = ilbc,
      > requested prefs = (),
      > actual format = gsm,
      > host prefs = (),
      > priority = caller
   -- Executing ReceiveVars("IAX2/gate@", "") in new stack
   -- Executing NoOp("IAX2/gate@", "1108060938.0") in new stack
   -- Executing AGI("IAX2/gate@", "anastasia/anastasia.agi|69") in new stack
   -- Launched AGI Script /var/lib/asterisk/agi-bin/anastasia/anastasia.agi
   -- AGI Script Executing Application: (BUSY) Options: ((null))
 == Spawn extension (default, 69, 3) exited non-zero on 'IAX2/gate@'
   -- Hungup 'IAX2/gate@'

and for the crash on my gate, i'm attaching the typescript

By: Anthony Minessale (anthm) 2005-02-11 10:14:28.000-0600

try that

By: Clod Patry (junky) 2005-02-11 11:44:25.000-0600

rev1 works fine for me.

By: Clod Patry (junky) 2005-02-13 10:07:02.000-0600

someone else can try it and give feedbacks??

By: Olle Johansson (oej) 2005-02-13 12:40:24.000-0600

Anthm, can we find a way to do this in another way, so we can make it work in multiple channels...

In SIP we can only send messages during a call, not before the call...
If we do not use the message text send function, but add this to the call structure, we could use sipaddheader to add custom headers with a checksum that is sent with the INVITE...

By: Clod Patry (junky) 2005-02-13 22:48:43.000-0600

if that could be possible to do that not only for IAX2, but for SIP too, that would be great.

I've tested it with anthm and the rev1 works fine on my side. If he wants to make a new version for SIP too, that's up to him, but i think it's a really good idea, oej.

By: Anthony Minessale (anthm) 2005-02-14 08:57:17.000-0600

could we tweak sip to support text frames transparently? then it would work right?

By: jets (jets) 2005-02-14 15:47:10.000-0600

I tried rev1 and it works really well.

We could tweak  SIP to add a text frame only when this function is called on the Dial for a SIP device.  I'm not sure how many devices would ignore the text frame, but on that token, we'd be assuming the other end was running * or a similar patch... We'd also assume people won't try and pass variables through a text frame for all of there dial() and sip endpoints.

If a text frame SIP I was also thinking we could append variables on to the URI, or use SIP's MESSAGE method, which I noticed chan_sip has some support for now.

URI or using the SIP MESSAGE method before the call is set up would probably be ideal.

By: Anthony Minessale (anthm) 2005-02-14 16:52:02.000-0600

can't chan_sip learn to send a text frame anytime it wants , do some tests to see what stage of the call it's at etc?

By: Olle Johansson (oej) 2005-02-15 09:47:35.000-0600

anthm: Find me on the IRC and I'll try to explain the problem...

By: Anthony Minessale (anthm) 2005-03-03 09:29:59.000-0600

This patch has been officially broken by some other commit.
I refuse to work on patches any more that I have in here for a month and then they get ruined by some other patch so go ahead and close it.

By: Clod Patry (junky) 2005-03-03 11:40:42.000-0600

any idea what could have broke that?

By: Olle Johansson (oej) 2005-03-17 08:34:29.000-0600

---no interest in pursuing the patch from submitter.