[Home]

Summary:ASTERISK-12817: variables set in sip.conf using "setvar=VARIABLE_NAME=xxxx" are not honoured when doing a blind transfer
Reporter:Chris Walton (crjw)Labels:
Date Opened:2008-10-03 00:23:26Date Closed:2011-06-07 14:07:56
Priority:MinorRegression?No
Status:Closed/CompleteComponents:PBX/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:sip.conf allows variables to be defined for each phone using the format:
setvar=VARIABLE_NAME=xxxx  where "xxxx" is some arbitrary value.

Such variables can generally be accessed inside the dialplan.

e.g. in sip.conf
########################
[A](polycom)
setvar=OTHER_EXTENSIONS="SIP/B&SIP/C"
[B](polycom)
setvar=OTHER_EXTENSIONS="SIP/A&SIP/C"
[C](polycom)
setvar=OTHER_EXTENSIONS="SIP/A&SIP/B"
#######################################

In my dial plan I have an extension (900) which dials "${OTHER_EXTENSIONS}". All the extensions except the one I am dialing from will ring.  It works well for regular dialing or for attended transfers.

But, If I attempt a blind transfer to extension 900 the value of $OTHER_EXTENSIONS is NULL and the transfer fails.

It gets a little more complicated:
If I do a blind transfer after doing any number of attended transfers, the $OTHER_EXTENSIONS variable is non-null; but it does not contain the proper settings for the phone doing the blind transfer; it contains the settings for the last phone that did an attended transfer.


****** ADDITIONAL INFORMATION ******

I am blind transferring from a polycom 650 using "REFER" method.
i.e. this is not a transfer that is initiated via DTMF tones.
Comments:By: Jared Smith (jsmith) 2008-10-03 07:20:32

This could easily be a variable inheritance issue.

Have you tried either:

setvar=_VARNAME=xxx  (notice the underscore)
or
setvar=__VARNAME=xxx  (two underscores)

The single underscore denotes that this variable should be inherited by any derivative channels from this original channel, and the double underscore indicates that the variable can be inherited by any derivative channel at any depth.

Please try those two and then come back and report whether or not they worked for you.

By: Chris Walton (crjw) 2008-10-03 14:30:58

Adding underscores made a difference.
But I did not get the results I was hoping for.

It seems that miscellaneous variables defined in sip.conf are set at the beginning of the call; the values of such variables remain unchanged when a blind transfer takes place.

e.g. assume I have the following entries in sip.conf:
########################
[A](polycom)
setvar=_X="AAA"
[B](polycom)
setvar=_X="BBB"
[C](polycom)
setvar=_X="CCC"
#######################################

If I make a call from A to B,  $X is assigned a value of "AAA" as expected.

If I start repeatedly blind transferring the call back and forth between A, B, and C, the value of $X will always remain set to "AAA"; this was not expected.
i.e. it does not matter where the blind transfers are initiated, what matters is where the original call was placed.

However, if I do an attended transfer instead of a blind transfer, the value will be set for the phone where the transfer is initiated.
e.g. If I initiate an attended transfer on B, the value of $X will be set to "BBB".  I can then start blind transferring again and the value of $X will stay as "BBB".

Bottom line is that I can not rely on variables defined in sip.conf because the behavior for blind transfers and attended transfers is not the same.

I can work around this problem... it just means a longer and more convoluted dialplan.

By: Tilghman Lesher (tilghman) 2008-11-05 10:18:59.000-0600

I don't think this is really a bug.  It is performing as expected.  Just because the channels don't behave the way that you'd like doesn't make this a bug.

I would suggest that instead of putting this information in a configuration file, instead you put this information in a database and retrieve it out filtering out a single channel, instead.  This scales better and will work much better for your purpose of being able to determine just what the "other" extensions are.

By: Chris Walton (crjw) 2008-11-06 21:39:28.000-0600

Yes I could use a database instead of defining variables in sip.conf.
But I would still have the same problem... I would need to identify the phone that is executing the transfer and then use the name of that phone as a key in the database.
Asterisk does not appear to provide a variable or function that returns the name of the phone that is executing a blind transfer.

My workaround was to place each phone in its own context. I can than use the ${CONTEXT} variable to determine which phone is executing the transfer.
This is not a scalable solution but I was to get away with it because I have very few phones.  Since this works for me, and since nobody else seems to be complaining, I won't be upset if you wish to close this bug report.

By: Tilghman Lesher (tilghman) 2008-11-06 22:45:30.000-0600

You can't use ${CUT(CHANNEL,-,1)} ?

By: Chris Walton (crjw) 2008-11-06 23:44:37.000-0600

For an attended transfer, "${CUT(CHANNEL,-,1)}" returns the name of the phone that is executing the transfer.
But for a blind transfer it returns the phone that is being transfered.

e.g.
If "A" calls "B" and then "B" blind transfers the call to "C" the value of ${CUT(CHANNEL,-,1)} will be "A".
If the same sequence is performed with an attended transfer, the value of ${CUT(CHANNEL,-,1)} will be "B".

So the answer is "no", this does not solve the problem.

By: Tilghman Lesher (tilghman) 2008-11-07 00:25:11.000-0600

Right, but the real issue here is how SIP does transfers.  For a blind transfer, it acts like a redirect, where the calling phone is sent a new location.  But for an attended transfer, you're setting up a whole new call, then bridging the two calls.  That's why it acts the way it does.

By: Tilghman Lesher (tilghman) 2008-11-07 00:30:11.000-0600

One thing you could do is to remove both ${CUT(CHANNEL,-,1)} as well as ${DIALEDPEERNAME} from the list of channels.  In either case, only one channel would probably be relevant.

By: Chris Walton (crjw) 2008-11-07 21:48:20.000-0600

Understanding that blind and attended transfers are handled very differently, I think it would be great if somebody took to time to create a new function that would consistantly return the name of the phone that is executing a transfer.

But as I stated earlier, I can conutine to place each phone in its own context and then use the "${CONTEXT}" variable to determine which phone executes a transfer.
So please don't feel compelled to write any new code on my account!

By: Joshua C. Colp (jcolp) 2008-12-10 12:27:29.000-0600

Suspending since this is a feature request without a patch.