FS-6688: don't update the contact when the original had fs_path, the new one doesnt, and the contact didn't change. This will fix the normal case of record route from a proxy without breaking normal changing of a contact

This commit is contained in:
Michael Jerris 2014-12-04 12:34:05 -05:00
parent fb59217f3e
commit 5376e82669
1 changed files with 12 additions and 3 deletions

View File

@ -3882,7 +3882,7 @@ void sofia_presence_handle_sip_i_subscribe(int status,
} }
if ((sub_state != nua_substate_terminated)) { if ((sub_state != nua_substate_terminated)) {
sql = switch_mprintf("select call_id from sip_subscriptions where call_id='%q' and profile_name='%q' and hostname='%q'", sql = switch_mprintf("select contact from sip_subscriptions where call_id='%q' and profile_name='%q' and hostname='%q'",
call_id, profile->name, mod_sofia_globals.hostname); call_id, profile->name, mod_sofia_globals.hostname);
sofia_glue_execute_sql2str(profile, profile->dbh_mutex, sql, buf, sizeof(buf)); sofia_glue_execute_sql2str(profile, profile->dbh_mutex, sql, buf, sizeof(buf));
@ -3900,15 +3900,24 @@ void sofia_presence_handle_sip_i_subscribe(int status,
} }
if (sub_state == nua_substate_active) { if (sub_state == nua_substate_active) {
char *contact = contact_str;
sstr = switch_mprintf("active;expires=%ld", exp_delta); sstr = switch_mprintf("active;expires=%ld", exp_delta);
if (strstr(buf, "fs_path=") && !strstr(contact_str, "fs_path=")) {
char *e = strchr(buf,';');
size_t l = e ? buf-e : strlen(buf);
if (strncmp(contact_str,buf,l)) {
contact = buf;
}
}
sql = switch_mprintf("update sip_subscriptions " sql = switch_mprintf("update sip_subscriptions "
"set expires=%ld, " "set expires=%ld, "
"network_ip='%q',network_port='%d',sip_user='%q',sip_host='%q',full_via='%q',full_to='%q',full_from='%q' " "network_ip='%q',network_port='%d',sip_user='%q',sip_host='%q',full_via='%q',full_to='%q',full_from='%q',contact='%q' "
"where call_id='%q' and profile_name='%q' and hostname='%q'", "where call_id='%q' and profile_name='%q' and hostname='%q'",
(long) switch_epoch_time_now(NULL) + exp_delta, (long) switch_epoch_time_now(NULL) + exp_delta,
np.network_ip, np.network_port, from_user, from_host, full_via, full_to, full_from, np.network_ip, np.network_port, from_user, from_host, full_via, full_to, full_from, contact,
call_id, profile->name, mod_sofia_globals.hostname); call_id, profile->name, mod_sofia_globals.hostname);