aboutsummaryrefslogtreecommitdiffstats
path: root/channels
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2008-06-15 15:21:16 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2008-06-15 15:21:16 +0000
commit86f9034a9fca696b8efaab1d5e297f29b8b3f0d5 (patch)
tree4d29faf212e6bde95b0e34afa1676f9dd01e15b2 /channels
parent3fe169d130010e34cfd4b76ec210aa271b97cad3 (diff)
Add some more IAX2-specific information about the channel to the CHANNEL()
function and begin the transition from SIPCHANINFO() to just using CHANNEL(). (closes issue #12856) Reported by: mostyn Patches: iax_and_sip_channel_info.patch uploaded by mostyn (license 398) (with some additional cleanup by me) git-svn-id: http://svn.digium.com/svn/asterisk/trunk@122802 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_iax2.c9
-rw-r--r--channels/chan_sip.c26
2 files changed, 32 insertions, 3 deletions
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c
index a53b6bb56..2bd1de10b 100644
--- a/channels/chan_iax2.c
+++ b/channels/chan_iax2.c
@@ -11749,10 +11749,15 @@ static int acf_channel_read(struct ast_channel *chan, const char *funcname, char
return -1;
}
- if (!strcasecmp(args, "osptoken"))
+ if (!strcasecmp(args, "osptoken")) {
ast_copy_string(buf, pvt->osptoken, buflen);
- else
+ } else if (!strcasecmp(args, "peerip")) {
+ ast_copy_string(buf, pvt->addr.sin_addr.s_addr ? ast_inet_ntoa(pvt->addr.sin_addr) : "", buflen);
+ } else if (!strcasecmp(args, "peername")) {
+ ast_copy_string(buf, pvt->username, buflen);
+ } else {
res = -1;
+ }
ast_mutex_unlock(&iaxsl[callno]);
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index b5ac72d59..81ea9e96e 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -15510,6 +15510,7 @@ struct ast_custom_function sippeer_function = {
static int function_sipchaninfo_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
{
struct sip_pvt *p;
+ static int deprecated = 0;
*buf = 0;
@@ -15525,6 +15526,11 @@ static int function_sipchaninfo_read(struct ast_channel *chan, const char *cmd,
return -1;
}
+ if (deprecated++ % 20 == 0) {
+ /* Deprecated in 1.6.1 */
+ ast_log(LOG_WARNING, "SIPCHANINFO() is deprecated. Please transition to using CHANNEL().\n");
+ }
+
p = chan->tech_pvt;
/* If there is no private structure, this channel is no longer alive */
@@ -18524,7 +18530,25 @@ static int acf_channel_read(struct ast_channel *chan, const char *funcname, char
memset(buf, 0, buflen);
- if (!strcasecmp(args.param, "rtpdest")) {
+ if (!strcasecmp(args.param, "peerip")) {
+ ast_copy_string(buf, p->sa.sin_addr.s_addr ? ast_inet_ntoa(p->sa.sin_addr) : "", buflen);
+ } else if (!strcasecmp(args.param, "recvip")) {
+ ast_copy_string(buf, p->recv.sin_addr.s_addr ? ast_inet_ntoa(p->recv.sin_addr) : "", buflen);
+ } else if (!strcasecmp(args.param, "from")) {
+ ast_copy_string(buf, p->from, buflen);
+ } else if (!strcasecmp(args.param, "uri")) {
+ ast_copy_string(buf, p->uri, buflen);
+ } else if (!strcasecmp(args.param, "useragent")) {
+ ast_copy_string(buf, p->useragent, buflen);
+ } else if (!strcasecmp(args.param, "peername")) {
+ ast_copy_string(buf, p->peername, buflen);
+ } else if (!strcasecmp(args.param, "t38passthrough")) {
+ if (p->t38.state == T38_DISABLED) {
+ ast_copy_string(buf, "0", sizeof("0"));
+ } else { /* T38 is offered or enabled in this call */
+ ast_copy_string(buf, "1", sizeof("1"));
+ }
+ } else if (!strcasecmp(args.param, "rtpdest")) {
struct sockaddr_in sin;
if (ast_strlen_zero(args.type))