Merged revisions 47497 via svnmerge from
authorRussell Bryant <russell@russellbryant.com>
Sun, 12 Nov 2006 06:31:39 +0000 (06:31 +0000)
committerRussell Bryant <russell@russellbryant.com>
Sun, 12 Nov 2006 06:31:39 +0000 (06:31 +0000)
https://origsvn.digium.com/svn/asterisk/branches/1.4

................
r47497 | russell | 2006-11-12 01:23:23 -0500 (Sun, 12 Nov 2006) | 12 lines

Merged revisions 47496 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r47496 | russell | 2006-11-12 01:09:03 -0500 (Sun, 12 Nov 2006) | 4 lines

Only do the check to determine whether the channel calling this function is an
IAX2 channel when getting the IP address using the special argument,
CURRENTCHANNEL.  (issue #8341, jcovert)

........

................

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47498 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_iax2.c

index c8f185e..1c636ca 100644 (file)
@@ -9502,14 +9502,14 @@ static int function_iaxpeer(struct ast_channel *chan, char *cmd, char *data, cha
        struct iax2_peer *peer;
        char *peername, *colname;
 
-       if (chan->tech != &iax2_tech)
-               return -1;
-
        peername = ast_strdupa(data);
 
        /* if our channel, return the IP address of the endpoint of current channel */
        if (!strcmp(peername,"CURRENTCHANNEL")) {
-               unsigned short callno = PTR_TO_CALLNO(chan->tech_pvt);
+               unsigned short callno;
+               if (chan->tech != &iax2_tech)
+                       return -1;
+               callno = PTR_TO_CALLNO(chan->tech_pvt); 
                ast_copy_string(buf, iaxs[callno]->addr.sin_addr.s_addr ? ast_inet_ntoa(iaxs[callno]->addr.sin_addr) : "", len);
                return 0;
        }