PFLAG_BLIND_REG = (1 << 1),
PFLAG_AUTH_ALL = (1 << 2),
PFLAG_FULL_ID = (1 << 3),
- PFLAG_USE_ME = (1 << 4),
+ PFLAG_MULTIREG_CONTACT = (1 << 4),
PFLAG_PASS_RFC2833 = (1 << 5),
PFLAG_DISABLE_TRANSCODING = (1 << 6),
PFLAG_REWRITE_TIMESTAMPS = (1 << 7),
profile->pflags &= ~PFLAG_SECURE;
}
} else if (!strcasecmp(var, "multiple-registrations")) {
- if (switch_true(val)) {
+ if (!strcasecmp(val, "contact")) {
+ profile->pflags |= PFLAG_MULTIREG;
+ profile->pflags |= PFLAG_MULTIREG_CONTACT;
+ } else if (switch_true(val)) {
profile->pflags |= PFLAG_MULTIREG;
} else {
profile->pflags &= ~PFLAG_MULTIREG;
profile->pflags |= PFLAG_SECURE;
}
} else if (!strcasecmp(var, "multiple-registrations")) {
- if (switch_true(val)) {
+ if (!strcasecmp(val, "contact")) {
profile->pflags |= PFLAG_MULTIREG;
+ profile->pflags |= PFLAG_MULTIREG_CONTACT;
+ } else if (switch_true(val)) {
+ profile->pflags |= PFLAG_MULTIREG;
+ } else {
+ profile->pflags &= ~PFLAG_MULTIREG;
}
} else if (!strcasecmp(var, "supress-cng") || !strcasecmp(var, "suppress-cng")) {
if (switch_true(val)) {
const char *reg_host = profile->reg_db_domain;
char contact_str[1024] = "";
int nat_hack = 0;
- uint8_t multi_reg = 0, avoid_multi_reg = 0;
+ uint8_t multi_reg = 0, multi_reg_contact = 0, avoid_multi_reg = 0;
uint8_t stale = 0, forbidden = 0;
auth_res_t auth_res;
long exptime = 60;
/* Does this profile supports multiple registrations ? */
multi_reg = ( sofia_test_pflag(profile, PFLAG_MULTIREG) ) ? 1 : 0;
+ multi_reg_contact = ( sofia_test_pflag(profile, PFLAG_MULTIREG_CONTACT) ) ? 1 : 0;
if ( multi_reg && avoid_multi_reg ) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
}
if (multi_reg) {
- sql = switch_mprintf("delete from sip_registrations where call_id='%q'", call_id);
+ if (multi_reg_contact) {
+ sql = switch_mprintf("delete from sip_registrations where contact='%q'", contact_str);
+ } else {
+ sql = switch_mprintf("delete from sip_registrations where call_id='%q'", call_id);
+ }
} else {
sql = switch_mprintf("delete from sip_registrations where sip_user='%q' and sip_host='%q' and hostname='%q'",
to_user, reg_host, mod_sofia_globals.hostname);
if ((p = strchr(icontact + 4, ':'))) {
*p = '\0';
}
- if ((sql = switch_mprintf("delete from sip_subscriptions where call_id='%q'", call_id))) {
- sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
+
+ if (multi_reg_contact) {
+ sql = switch_mprintf("delete from sip_subscriptions where contact='%q'", contact_str);
+ } else {
+ sql = switch_mprintf("delete from sip_subscriptions where call_id='%q'", call_id);
}
- if ((sql = switch_mprintf("delete from sip_registrations where call_id='%q'", call_id))) {
- sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
+ sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
+
+ if (multi_reg_contact) {
+ sql = switch_mprintf("delete from sip_registrations where contact='%q'", contact_str);
+ } else {
+ sql = switch_mprintf("delete from sip_registrations where call_id='%q'", call_id);
}
+
+ sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
+
switch_safe_free(icontact);
} else {
if ((sql = switch_mprintf("delete from sip_subscriptions where sip_user='%q' and sip_host='%q' and hostname='%q'", to_user, reg_host,