]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
[mod_sofia] Prevent crash in sofia_handle_sip_i_state on switch_channel_set_state...
authorAndrey Volk <andywolk@gmail.com>
Fri, 13 Nov 2020 17:23:20 +0000 (21:23 +0400)
committerAndrey Volk <andywolk@gmail.com>
Wed, 17 Mar 2021 15:21:49 +0000 (18:21 +0300)
src/mod/endpoints/mod_sofia/sofia.c

index 87b09e54060f504a581c6a9c185677f4bf641080..7e71717aff965fce4e44880272e5b735d8ec88de 100644 (file)
@@ -7930,7 +7930,9 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
                                        //switch_core_media_gen_local_sdp(session, NULL, 0, NULL, 0);
                                        sofia_set_flag(tech_pvt, TFLAG_LATE_NEGOTIATION);
                                        //Moves into CS_INIT so call moves forward into the dialplan
-                                       switch_channel_set_state(channel, CS_INIT);
+                                       if (switch_channel_get_state(channel) == CS_NEW) {
+                                               switch_channel_set_state(channel, CS_INIT);
+                                       }
                                } else {
                                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "No SDP in INVITE and 3pcc not enabled, hanging up.\n");
                                        switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "3PCC DISABLED");