Summary:ASTERISK-00604: Spool calls setvar doesn't set variables in both ends
Reporter:thansen (thansen)Labels:
Date Opened:2003-12-01 07:36:46.000-0600Date Closed:2011-06-07 14:10:08
Versions:Frequency of
Description:Using "SetVar" in the call spool file apparently only sets the variable in the channel defined by "Channel" and not on the C/E/P side.

Channel: Local/1234@default
Context: hello
Extension: s
Priority: 1
SetVar: id=4321

This would call 1234 and if answered connect the call to extension hello,s,1. The 'id' variable is however empty when used in the latter extension.
Comments:By: ww (ww) 2003-12-05 17:04:24.000-0600

I believe that is because variable setting is done on the
reciept of a call. hello,s,1 recieves the call so it sets
the variable. setting variables on outgoing calls is not
possible at the moment, although there has been some discussion
on the list about how this might be implemented for certain
channel types.

By: thansen (thansen) 2003-12-16 04:50:03.000-0600

After re-reading this bug I have a correction, which also makes ww's reply make sense. :)

The variable is set on the context/extension/priority side and not on the channel defined by "Channel:", as I wrote previously.

By: zoa (zoa) 2004-01-09 21:44:54.000-0600

bit off topic but if you use an application instead of an extension, the setvar will not work, you need to add them to the parameters of the application i suppose.

By: florian (florian) 2004-01-15 06:46:32.000-0600

I am experiencing the following:

I have a call-file that I am using to start a call and drop it into a context.

Channel: <STUFF>
Context: trinidad
Extension: s
Priority: 1
SetVar: MSG=message

The context 'trinidad' can be as simple as:

exten = s,1,NoOp(${MSG})

Now, the behaviour of this setup depends on the channel used:

Local/7001@pbx is a channel in my setup that points to a SIP phone. In this setup ${MSG} contains 'message'.

Local/00531234567@pbx is a channel in my setup that points to an external number via an IAX provider. In this setup ${MSG} is emptied.

IAX/providerinfo/0531234567 is a channel that is behind the Local statement above. In this setup ${MSG} does properly contain 'message'.

So it seems to be related to some chan_local thing?

By: florian (florian) 2004-01-15 06:58:27.000-0600

Ah, as Mark has noted in another bugreport on chan_local, it may have to do with channel optimisation. If I add the /n parameter to chan_local definitions in the spool file, initial testing shows the variable is passed properly.

Would be nice to confirm :-)

By: Olle Johansson (oej) 2004-03-21 08:43:08.000-0600

Is this still considered a bug or is it ready to be closed? From reading the comments, it seems like facts of life - "that's how it works" more than an actual bug or feature request. Please correct me if I'm wrong and update the bug # so the request/bug becomes more clear again.

By: thansen (thansen) 2004-03-22 10:39:48.000-0600

I think this bugreport strayed from the original meaning but the "/n parameter for chan_local" enabled me to solve the problem I had in a different way.

By: Olle Johansson (oej) 2004-03-22 10:54:31.000-0600

Problem solved by other means.