]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
[mod_sofia] Fix handling of sip-options-respond-503-on-busy profile parameter master vertoreload
authorGustavo Almeida <gustavo.abcdef@hotmail.com>
Mon, 25 May 2026 18:15:13 +0000 (19:15 +0100)
committerGitHub <noreply@github.com>
Mon, 25 May 2026 18:15:13 +0000 (21:15 +0300)
src/mod/endpoints/mod_sofia/sofia.c

index 77e47508129817e47ee6b318029d5c1d3eeb9b74..d2e94f16ceb98b9263185e2acb0a8fcf33e67e80 100644 (file)
@@ -2460,13 +2460,15 @@ void sofia_event_callback(nua_event_t event,
                }
 
                if (!sofia_private) {
-                       if (sess_count >= sess_max || !sofia_test_pflag(profile, PFLAG_RUNNING) || !switch_core_ready_inbound()) {
+                       int unavailable = (sess_count >= sess_max || !sofia_test_pflag(profile, PFLAG_RUNNING) || !switch_core_ready_inbound());
+                       int bypass = (event == nua_i_options && !sofia_test_pflag(profile, PFLAG_OPTIONS_RESPOND_503_ON_BUSY));
+
+                       if (unavailable && !bypass) {
                                nua_respond(nh, 503, "Maximum Calls In Progress", SIPTAG_RETRY_AFTER_STR("300"), NUTAG_WITH_THIS(nua), TAG_END());
                                nua_handle_destroy(nh);
                                goto end;
                        }
 
-
                        if (switch_queue_size(mod_sofia_globals.msg_queue) > (unsigned int)critical) {
                                nua_respond(nh, 503, "System Busy", SIPTAG_RETRY_AFTER_STR("300"), NUTAG_WITH_THIS(nua), TAG_END());
                                nua_handle_destroy(nh);