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);
{
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),