]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
add sip_authorized variable
authorAnthony Minessale <anthony.minessale@gmail.com>
Sat, 25 Nov 2006 16:52:35 +0000 (16:52 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Sat, 25 Nov 2006 16:52:35 +0000 (16:52 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@3456 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/endpoints/mod_sofia/mod_sofia.c

index 84a2e5303149820ba1561669c43072a212785f68..dcf5e6111ae9d9c21f610f82f62e1f7b56847d4a 100644 (file)
@@ -4275,6 +4275,9 @@ static void event_callback(nua_event_t event,
        if ((profile->pflags & PFLAG_AUTH_ALL) && tech_pvt && tech_pvt->key && sip) {
                sip_authorization_t const *authorization = NULL;
 
+               switch_channel_t *channel = switch_core_session_get_channel(tech_pvt->session);
+               assert(channel != NULL);
+
                if (sip->sip_authorization) {
                        authorization = sip->sip_authorization;
                } else if (sip->sip_proxy_authorization) {
@@ -4286,11 +4289,14 @@ static void event_callback(nua_event_t event,
                }
 
                if (auth_res != AUTH_OK) {
-                       switch_channel_t *channel = switch_core_session_get_channel(tech_pvt->session);
                        switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
                        nua_respond(nh, SIP_401_UNAUTHORIZED, TAG_END());
                        goto done;
                }
+
+               if (session) {
+                       switch_channel_set_variable(channel, "sip_authorized", "true");
+               }
        }
 
        if (status == 401 || status == 407) {