From: Anthony Minessale Date: Fri, 12 Oct 2012 21:49:15 +0000 (-0400) Subject: add username to sql stmt to differentiate silly devices who use the same exact contac... X-Git-Tag: v1.3.0~63 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fe8c5326a839fe7e9f64fdf2b3ff4e975796481f;p=thirdparty%2Ffreeswitch.git add username to sql stmt to differentiate silly devices who use the same exact contact addr --- diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index 6a7febdbe0..ca2ff0f5c5 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -1557,7 +1557,10 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE); } else { char buf[32] = ""; - sql = switch_mprintf("select count(*) from sip_registrations where sip_user='%q' and sip_host='%q' and contact='%q'", to_user, reg_host, contact_str); + + + sql = switch_mprintf("select count(*) from sip_registrations where sip_user='%q' and sip_username='%q' and sip_host='%q' and contact='%q'", + to_user, username, reg_host, contact_str); @@ -1592,10 +1595,10 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand } else { sql = switch_mprintf("update sip_registrations set " "sub_host='%q', network_ip='%q',network_port='%q'," - "expires = %ld where sip_user='%q' and sip_host='%q' and contact='%q'", + "expires = %ld where sip_user='%q' and sip_username='%q' and sip_host='%q' and contact='%q'", sub_host, network_ip, network_port_c, (long) switch_epoch_time_now(NULL) + (long) exptime + 60, - to_user, reg_host, contact_str); + to_user, username, reg_host, contact_str); } if (sql) {