]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-10598: [mod_sofia] add replaces header call_id and params to channel
authorLuis Azedo <luis@2600hz.com>
Fri, 18 Aug 2017 18:29:16 +0000 (19:29 +0100)
committerlazedo <luis.azedo@factorlusitano.com>
Tue, 12 Feb 2019 15:43:45 +0000 (15:43 +0000)
variables

src/mod/endpoints/mod_sofia/sofia.c

index b9f52d8fadf21a57ed0f243c0d4c08a38912e338..f7ab4ccd3b5c9eeb0d2abe02a2676a4e77b3aa69 100644 (file)
@@ -10991,6 +10991,24 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia
                }
        }
 
+       if (sip && sip->sip_replaces) {
+               msg_common_t *rp_common = sip->sip_replaces->rp_common;
+               switch_channel_set_variable(channel, "sip_replaces_call_id", sip->sip_replaces->rp_call_id);
+               if (rp_common && rp_common->h_class->hc_params) {
+                       int i, n;
+                       msg_param_t const *params = * (msg_param_t const **) ((char *)rp_common + rp_common->h_class->hc_params);
+                       for (i = 0; params[i]; i++) {
+                               msg_param_t param = params[i];
+                               if (strchr(param, '=')) {
+                                       n = strcspn(param, "=");
+                                       switch_channel_set_variable_name_printf(channel, param + n + 1, "sip_replaces_%.*s", n, param);
+                               } else {
+                                       switch_channel_set_variable_name_printf(channel, "true", "sip_replaces_%s", param);
+                               }
+                       }
+               }
+       }
+
        if (bnh) {
                sofia_private_t *b_private = NULL;
                if ((b_private = nua_handle_magic(bnh))) {