Add the ability to retrieve the source port of a SIP call.
authorMark Michelson <mmichelson@digium.com>
Mon, 4 Aug 2014 20:25:16 +0000 (20:25 +0000)
committerMark Michelson <mmichelson@digium.com>
Mon, 4 Aug 2014 20:25:16 +0000 (20:25 +0000)
This adds the ability to call CHANNEL(recvport) on chan_sip
channels to see the port on which an INVITE was received.

ASTERISK-24040 #close
Reported by dtryba
Patches:
dialplan_functions.patch uploaded by dtryba (License #6628)

Review: https://reviewboard.asterisk.org/r/3781

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

channels/sip/dialplan_functions.c

index af69dac..0377084 100644 (file)
@@ -76,6 +76,8 @@ int sip_acf_channel_read(struct ast_channel *chan, const char *funcname, char *p
                ast_copy_string(buf, ast_sockaddr_isnull(&p->sa) ? "" : ast_sockaddr_stringify_addr(&p->sa), buflen);
        } else if (!strcasecmp(args.param, "recvip")) {
                ast_copy_string(buf, ast_sockaddr_isnull(&p->recv) ? "" : ast_sockaddr_stringify_addr(&p->recv), buflen);
+       } else if (!strcasecmp(args.param, "recvport")) {
+               ast_copy_string(buf, ast_sockaddr_isnull(&p->recv) ? "" : ast_sockaddr_stringify_port(&p->recv), buflen);
        } else if (!strcasecmp(args.param, "from")) {
                ast_copy_string(buf, p->from, buflen);
        } else if (!strcasecmp(args.param, "uri")) {