mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
major dialplan functions update
deprecate LANGUAGE() and MUSICCLASS(), in favor of CHANNEL() git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@9674 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -9170,31 +9170,29 @@ static int iax2_exec(struct ast_channel *chan, const char *context, const char *
|
||||
return -1;
|
||||
}
|
||||
|
||||
static char *function_iaxpeer(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
|
||||
static int function_iaxpeer(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
|
||||
{
|
||||
char *ret = NULL;
|
||||
struct iax2_peer *peer;
|
||||
char *peername, *colname;
|
||||
char iabuf[INET_ADDRSTRLEN];
|
||||
|
||||
if (!(peername = ast_strdupa(data)))
|
||||
return ret;
|
||||
return -1;
|
||||
|
||||
/* 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);
|
||||
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;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((colname = strchr(peername, ':'))) {
|
||||
*colname = '\0';
|
||||
colname++;
|
||||
} else {
|
||||
if ((colname = strchr(peername, ':')))
|
||||
*colname++ = '\0';
|
||||
else
|
||||
colname = "ip";
|
||||
}
|
||||
|
||||
if (!(peer = find_peer(peername, 1)))
|
||||
return ret;
|
||||
return -1;
|
||||
|
||||
if (!strcasecmp(colname, "ip")) {
|
||||
ast_copy_string(buf, peer->addr.sin_addr.s_addr ? ast_inet_ntoa(iabuf, sizeof(iabuf), peer->addr.sin_addr) : "", len);
|
||||
@@ -9229,16 +9227,15 @@ static char *function_iaxpeer(struct ast_channel *chan, char *cmd, char *data, c
|
||||
ast_copy_string(buf, ast_getformatname(codec), len);
|
||||
}
|
||||
}
|
||||
ret = buf;
|
||||
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct ast_custom_function iaxpeer_function = {
|
||||
.name = "IAXPEER",
|
||||
.synopsis = "Gets IAX peer information",
|
||||
.syntax = "IAXPEER(<peername|CURRENTCHANNEL>[:item])",
|
||||
.read = function_iaxpeer,
|
||||
.name = "IAXPEER",
|
||||
.synopsis = "Gets IAX peer information",
|
||||
.syntax = "IAXPEER(<peername|CURRENTCHANNEL>[:item])",
|
||||
.read = function_iaxpeer,
|
||||
.desc = "If peername specified, valid items are:\n"
|
||||
"- ip (default) The IP address.\n"
|
||||
"- status The peer's status (if qualify=yes)\n"
|
||||
|
Reference in New Issue
Block a user