From 578f6511ef3c1a0bf1df3265161cc78c28804d92 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 14 Mar 2008 19:07:24 +0000 Subject: [PATCH] update git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7893 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/mod/endpoints/mod_sofia/mod_sofia.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index c348026635..63155d2030 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -1456,13 +1456,19 @@ SWITCH_STANDARD_API(sofia_contact_function) char *profile_name = NULL; char *p; sofia_profile_t *profile = NULL; - + const char *exclude_contact = NULL; if (!cmd) { stream->write_function(stream, "%s", ""); return SWITCH_STATUS_SUCCESS; } + if (session) { + switch_channel_t *channel = switch_core_session_get_channel(session); + exclude_contact = switch_channel_get_variable(channel, "exclude_contact"); + } + + data = strdup(cmd); switch_assert(data); @@ -1505,7 +1511,13 @@ SWITCH_STANDARD_API(sofia_contact_function) cb.profile = profile; cb.stream = &mystream; - sql = switch_mprintf("select contact from sip_registrations where sip_user='%q' and sip_host='%q'", user, domain); + if (exclude_contact) { + sql = switch_mprintf("select contact from sip_registrations where sip_user='%q' and sip_host='%q' and contact not like '%%%s%%'", + user, domain, exclude_contact); + } else { + sql = switch_mprintf("select contact from sip_registrations where sip_user='%q' and sip_host='%q'", user, domain); + } + switch_assert(sql); sofia_glue_execute_sql_callback(profile, SWITCH_FALSE, profile->ireg_mutex, sql, contact_callback, &cb); switch_safe_free(sql);