]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
[mod_sofia] add sip_refer_continue_after_reply channel variable.
authorChris Rienzo <chris@signalwire.com>
Thu, 11 Feb 2021 02:16:41 +0000 (21:16 -0500)
committerAndrey Volk <andywolk@gmail.com>
Sat, 23 Oct 2021 19:00:41 +0000 (22:00 +0300)
Set to true to prevent hangup when response to REFER request is received.
Added sip_refer_target_status_code and sip_refer_target_provisional_status_code
channel variables to store responses from NOTIFY sipfrags.

src/mod/endpoints/mod_sofia/mod_sofia.c
src/mod/endpoints/mod_sofia/sofia.c

index 835717e7e920690a74a14d1cfb3df67872a2ceeb..5de26b1d0063250a628577593b64aa5a3e5022ba 100644 (file)
@@ -1553,7 +1553,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
 
                if (msg->string_array_arg[0]) {
                        tech_pvt->proxy_refer_uuid = (char *)msg->string_array_arg[0];
-               } else {
+               } else if (!switch_channel_var_true(tech_pvt->channel, "sip_refer_continue_after_reply")) {
                        switch_mutex_unlock(tech_pvt->sofia_mutex);
                        sofia_wait_for_reply(tech_pvt, 9999, 10);
                        switch_mutex_lock(tech_pvt->sofia_mutex);
index bb5b969552e5822143664ab0fd23105ad25ab962..6e6bce28278a094360bcc42d0c48cbffefa5da5d 100644 (file)
@@ -679,13 +679,16 @@ void sofia_handle_sip_i_notify(switch_core_session_t *session, int status,
                                        status_val = atoi(p);
                                }
                                if (!status_val || status_val >= 200) {
+                                       switch_channel_set_variable_printf(channel, "sip_refer_target_status_code", "%d", status_val);
                                        switch_channel_set_variable(channel, "sip_refer_reply", sip->sip_payload->pl_data);
-                                       if (status_val == 200) {
+                                       if (status_val == 200 && !switch_channel_var_true(channel, "sip_refer_continue_after_reply")) {
                                                switch_channel_hangup(channel, SWITCH_CAUSE_BLIND_TRANSFER);
                                        }
                                        if ((int)tech_pvt->want_event == 9999) {
                                                tech_pvt->want_event = 0;
                                        }
+                               } else if (status_val < 200) {
+                                       switch_channel_set_variable_printf(channel, "sip_refer_target_provisional_status_code", "%d", status_val);
                                }
                        }
                }