[Freeswitch-svn] [commit] r10112 - freeswitch/trunk/src/mod/endpoints/mod_sofia
Freeswitch SVN
anthm at freeswitch.org
Wed Oct 22 13:40:43 EDT 2008
Author: anthm
Date: Wed Oct 22 13:40:43 2008
New Revision: 10112
Modified:
freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h
freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c
freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c
Log:
setting profile option multiple-registrations=contact key multi reg off the contact string
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h Wed Oct 22 13:40:43 2008
@@ -138,7 +138,7 @@
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),
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c Wed Oct 22 13:40:43 2008
@@ -1149,7 +1149,10 @@
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;
@@ -1605,8 +1608,13 @@
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)) {
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c Wed Oct 22 13:40:43 2008
@@ -516,7 +516,7 @@
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;
@@ -776,6 +776,7 @@
/* 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,
@@ -793,7 +794,11 @@
}
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);
@@ -856,13 +861,23 @@
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,
More information about the Freeswitch-svn
mailing list