]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-4882 --resolve
authorAnthony Minessale <anthm@freeswitch.org>
Thu, 29 Nov 2012 18:59:33 +0000 (12:59 -0600)
committerAnthony Minessale <anthm@freeswitch.org>
Thu, 29 Nov 2012 18:59:33 +0000 (12:59 -0600)
src/mod/endpoints/mod_sofia/sofia.c
src/mod/endpoints/mod_sofia/sofia_reg.c

index ed3428555eea173a62d66a87370a8a67c9260558..a00a0d21bd4eabc8a0fcb7f6c490cfb9f31b25d8 100644 (file)
@@ -4781,10 +4781,10 @@ static void sofia_handle_sip_r_options(switch_core_session_t *session, int statu
                gateway->ping = switch_epoch_time_now(NULL) + gateway->ping_freq;
                sofia_reg_release_gateway(gateway);
                gateway->pinging = 0;
-       } else if (sofia_test_pflag(profile, PFLAG_UNREG_OPTIONS_FAIL) && (status != 200 && status != 486) && sip && sip->sip_to) {
+       } else if (sofia_test_pflag(profile, PFLAG_UNREG_OPTIONS_FAIL) && (status != 200 && status != 486) && sip && sip->sip_to && strchr(sip->sip_call_id->i_id, '_')) {
                char *sql;
                time_t now = switch_epoch_time_now(NULL);
-               const char *call_id = sip->sip_call_id->i_id;
+               const char *call_id = strchr(sip->sip_call_id->i_id, '_') + 1;
 
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Expire registration '%s@%s' due to options failure\n",
                                                  sip->sip_to->a_url->url_user, sip->sip_to->a_url->url_host);
index 507ace43916c062f2abf0efd3b5831f42f231ba4..f3d3bb205bcd33fc9ba7512878e68e75c8097a0d 100644 (file)
@@ -557,17 +557,23 @@ int sofia_reg_nat_callback(void *pArg, int argc, char **argv, char **columnNames
 {
        sofia_profile_t *profile = (sofia_profile_t *) pArg;
        nua_handle_t *nh;
-       char to[512] = "";
+       char to[512] = "", call_id[512] = "";
        sofia_destination_t *dst = NULL;
+       switch_uuid_t uuid;
 
        switch_snprintf(to, sizeof(to), "sip:%s@%s", argv[1], argv[2]);
 
+       // create call-id for OPTIONS in the form "<uuid>_<original-register-call-id>"
+       switch_uuid_get(&uuid);
+       switch_uuid_format(call_id, &uuid);
+       strcat(call_id, "_");
+       strncat(call_id, argv[0], sizeof(call_id) - SWITCH_UUID_FORMATTED_LENGTH - 2);
+
        dst = sofia_glue_get_destination(argv[3]);
        switch_assert(dst);
        
        nh = nua_handle(profile->nua, NULL, SIPTAG_FROM_STR(profile->url), SIPTAG_TO_STR(to), NUTAG_URL(dst->contact), SIPTAG_CONTACT_STR(profile->url),
-                                       TAG_END());
-                                       //SIPTAG_CALL_ID_STR(argv[0]), TAG_END());
+                                       SIPTAG_CALL_ID_STR(call_id), TAG_END());
        nua_handle_bind(nh, &mod_sofia_globals.destroy_private);
        nua_options(nh, 
                                NTATAG_SIP_T2(5000),