]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Only do the check to determine whether the channel calling this function is an
authorRussell Bryant <russell@russellbryant.com>
Sun, 12 Nov 2006 06:09:03 +0000 (06:09 +0000)
committerRussell Bryant <russell@russellbryant.com>
Sun, 12 Nov 2006 06:09:03 +0000 (06:09 +0000)
IAX2 channel when getting the IP address using the special argument,
CURRENTCHANNEL.  (issue #8341, jcovert)

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

channels/chan_iax2.c

index 5e4648f377fba2e59db1727102c5f4634115a577..5be2e08f983207101bbe21ac25d88ab79be823fa 100644 (file)
@@ -9347,9 +9347,6 @@ static char *function_iaxpeer(struct ast_channel *chan, char *cmd, char *data, c
 
        buf[0] = '\0';
 
-       if (chan->tech != &iax2_tech)
-               return buf;
-
        if (!(peername = ast_strdupa(data))) {
                ast_log(LOG_ERROR, "Memory Error!\n");
                return ret;
@@ -9357,7 +9354,10 @@ static char *function_iaxpeer(struct ast_channel *chan, char *cmd, char *data, c
 
        /* 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 buf;
+               callno = PTR_TO_CALLNO(chan->tech_pvt); 
                ast_copy_string(buf, iaxs[callno]->addr.sin_addr.s_addr ? ast_inet_ntoa(iabuf, sizeof(iabuf), iaxs[callno]->addr.sin_addr) : "", len);
                return buf;
        }