Summary:ASTERISK-08113: ${IAXPEER(targetchannel)} returns null string when called from a SIP (or other non-IAX2) channel
Reporter:John Covert (jcovert)Labels:
Date Opened:2006-11-10 21:13:49.000-0600Date Closed:2006-11-12 00:26:35.000-0600
Versions:Frequency of
Description:In chan_iax2.c, at the beginning of function_iaxpeer, there is a test

 if (chan->tech != &iax2_tech)

which prevents the use of the IAXPEER function (even for a specified target IAX2 channel).

This bug was introduced between and 1.2.13.  I have commented out the test and rebuilt 1.2.13, and my dialplan works again.  I suspect the code was introduced to prevent problems if the argument to IAXPEER is CURRENTCHANNEL and the call is made from a non-IAX2 channel.

I believe the fix is to make the test a few lines later, within the test

   if (!strcmp(peername,"CURRENTCHANNEL")) {

so that it only applies when necessary.


The bug exists not only in 1.2.13, but also in CVS HEAD of both the main branch and the 1.2 branch, and although the CVS code is different (return -1 rather than return buf), the fix in both cases is the same: move the test into the code that is specific to CURRENTCHANNEL.


p.s.: This is my first report; please forgive but tell me if I've violated any of the conventions used when reporting bugs here.
Comments:By: John Covert (jcovert) 2006-11-10 21:55:59.000-0600

Introduced in branch 1.2 at version 43552 and in trunk at version 43554 on 24 Sep 2006.

By: Russell Bryant (russell) 2006-11-12 00:26:35.000-0600

You are exactly correct.  Thank you very much for catching this, and I'm sorry for breaking it in the first place.  :(

Fixed in 1.2, 1.4, and the trunk in revisions 47496, 47497, and 47498.