From ef18989d5648f897bad4fc0267267814d3624e45 Mon Sep 17 00:00:00 2001
From: Anthony Minessale <anthm@freeswitch.org>
Date: Thu, 6 May 2010 15:24:58 -0500
Subject: [PATCH] sip_acl_authed_by and sip_acl_token vars to tell when you are
 authed by an acl

---
 src/mod/endpoints/mod_sofia/sofia.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c
index bbc0321d78..5801c26a57 100644
--- a/src/mod/endpoints/mod_sofia/sofia.c
+++ b/src/mod/endpoints/mod_sofia/sofia.c
@@ -5830,6 +5830,10 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_
 			if (sofia_test_pflag(profile, PFLAG_AUTH_CALLS)) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "IP %s Approved by acl \"%s[%s]\". Access Granted.\n",
 								  network_ip, switch_str_nil(last_acl), acl_token);
+				switch_channel_set_variable(channel, "sip_acl_authed_by", last_acl);
+				if (token) {
+					switch_channel_set_variable(channel, "sip_acl_token", acl_token);
+				}
 				is_auth = 1;
 			}
 		} else {
@@ -5888,6 +5892,10 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "IP %s Approved by acl \"%s[%s]\". Access Granted.\n",
 									  proxied_client_ip, switch_str_nil(last_acl), acl_token);
 					is_auth = 1;
+					switch_channel_set_variable(channel, "sip_acl_authed_by", last_acl);
+					if (token) {
+						switch_channel_set_variable(channel, "sip_acl_token", acl_token);
+					}
 				}
 			}
 		}