aboutsummaryrefslogtreecommitdiffstats
path: root/channels/chan_iax2.c
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2006-11-12 06:09:03 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2006-11-12 06:09:03 +0000
commit694e116fcb455a59b36dc3c1e0926761a6c2af3c (patch)
treebc953c239388f345215ab98a68e58a25fb64bbde /channels/chan_iax2.c
parent9b3e49ea799d2ff34c750f038de009223fa5d39b (diff)
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: http://svn.digium.com/svn/asterisk/branches/1.2@47496 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_iax2.c')
-rw-r--r--channels/chan_iax2.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c
index 5e4648f37..5be2e08f9 100644
--- a/channels/chan_iax2.c
+++ b/channels/chan_iax2.c
@@ -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;
}