]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
hangup unauth calls with rejected cause
authorAnthony Minessale <anthm@freeswitch.org>
Fri, 14 Sep 2012 16:19:36 +0000 (11:19 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Fri, 14 Sep 2012 16:19:36 +0000 (11:19 -0500)
src/mod/endpoints/mod_sofia/sofia.c

index f475882e65ad3f12b57800280b96d2c28dfd6555..40b1a9778b51595179a54fda7b5294cb2256216f 100644 (file)
@@ -1712,7 +1712,7 @@ void sofia_event_callback(nua_event_t event,
 
        switch(event) {
        case nua_i_terminated:
-        if ((status == 401 || status == 407) && sofia_private && sofia_private->uuid) {
+        if ((status == 401 || status == 407 || status == 403) && sofia_private && sofia_private->uuid) {
                        switch_core_session_t *session;
 
                        if ((session = switch_core_session_locate(sofia_private->uuid))) {
@@ -1722,19 +1722,22 @@ void sofia_event_callback(nua_event_t event,
                                if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_INBOUND && !switch_channel_test_flag(channel, CF_ANSWERED)) {
                                        private_object_t *tech_pvt = switch_core_session_get_private(session);
 
-                                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "detaching session %s\n", sofia_private->uuid);
-                                       
-                                       if (!zstr(tech_pvt->call_id)) {
-                                               tech_pvt->sofia_private = NULL;
-                                               tech_pvt->nh = NULL;
-                                               sofia_set_flag(tech_pvt, TFLAG_BYE);
-                                               switch_mutex_lock(profile->flag_mutex);
-                                               switch_core_hash_insert(profile->chat_hash, tech_pvt->call_id, strdup(switch_core_session_get_uuid(session)));
-                                               switch_mutex_unlock(profile->flag_mutex);
+                                       if (status == 403) {
+                                               switch_channel_hangup(channel, SWITCH_CAUSE_CALL_REJECTED);
                                        } else {
-                                               switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
+                                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "detaching session %s\n", sofia_private->uuid);
+                                       
+                                               if (!zstr(tech_pvt->call_id)) {
+                                                       tech_pvt->sofia_private = NULL;
+                                                       tech_pvt->nh = NULL;
+                                                       sofia_set_flag(tech_pvt, TFLAG_BYE);
+                                                       switch_mutex_lock(profile->flag_mutex);
+                                                       switch_core_hash_insert(profile->chat_hash, tech_pvt->call_id, strdup(switch_core_session_get_uuid(session)));
+                                                       switch_mutex_unlock(profile->flag_mutex);
+                                               } else {
+                                                       switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
+                                               }
                                        }
-
                                        end++;
                                }