]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-3012
authorAnthony Minessale <anthm@freeswitch.org>
Thu, 27 Jan 2011 14:18:22 +0000 (08:18 -0600)
committerAnthony Minessale <anthm@freeswitch.org>
Thu, 27 Jan 2011 14:18:22 +0000 (08:18 -0600)
src/mod/endpoints/mod_sofia/sofia.c

index 643b3dd81418b61ba2c4be8599f6118dfb0cb7fe..47f94b151a5cc7ddd2f82d876c2017b9f8010671 100644 (file)
@@ -808,6 +808,18 @@ void sofia_event_callback(nua_event_t event,
                }
        }
        
+       if ((event == nua_i_invite) && (!session)) {
+               uint32_t sess_count = switch_core_session_count();
+               uint32_t sess_max = switch_core_session_limit(0);
+               
+               if (sess_count >= sess_max || !sofia_test_pflag(profile, PFLAG_RUNNING) || !switch_core_ready()) {
+                       nua_respond(nh, 503, "Maximum Calls In Progress", SIPTAG_RETRY_AFTER_STR("300"), TAG_END());
+
+                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "No more sessions allowed at this time.\n");
+
+                       goto done;
+               }
+       }
        
        if (sofia_test_pflag(profile, PFLAG_AUTH_ALL) && tech_pvt && tech_pvt->key && sip) {
                sip_authorization_t const *authorization = NULL;