From ca725e1cf65469e34d38128841c820091a13fbbc Mon Sep 17 00:00:00 2001
From: Mark Michelson <mmichelson@digium.com>
Date: Mon, 4 Aug 2014 20:25:16 +0000
Subject: [PATCH] Add the ability to retrieve the source port of a SIP call.

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 | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/channels/sip/dialplan_functions.c b/channels/sip/dialplan_functions.c
index af69dac458..03770845aa 100644
--- a/channels/sip/dialplan_functions.c
+++ b/channels/sip/dialplan_functions.c
@@ -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")) {
-- 
GitLab