Merge pull request #139 in FS/freeswitch from bugfix/FS-6688-notify-message-record-route-tag to master

* commit '5376e82669d2f53d8acd06f49a27949bfbb21fcd':
  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:
Mike Jerris 2014-12-10 09:35:28 -06:00
commit a073997dac
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)) {
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);
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) {
char *contact = contact_str;
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 "
"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'",
(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);