From e6bfa118ec6ae98e5c3ff6f0f21ee6f7ecbd243e Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 9 Feb 2012 16:47:32 -0600 Subject: [PATCH] minor presence tweaks --- src/mod/applications/mod_conference/mod_conference.c | 10 ++++++++-- src/mod/endpoints/mod_sofia/sofia_presence.c | 4 ++-- src/switch_ivr.c | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 777fdd2f27..e92971ab80 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -6957,7 +6957,7 @@ static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_c switch_uuid_t uuid; switch_codec_implementation_t read_impl = { 0 }; switch_channel_t *channel = NULL; - const char *force_rate = NULL, *force_interval = NULL; + const char *force_rate = NULL, *force_interval = NULL, *presence_id = NULL; uint32_t force_rate_i = 0, force_interval_i = 0; /* Validate the conference name */ @@ -6972,6 +6972,8 @@ static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_c switch_core_session_get_read_impl(session, &read_impl); channel = switch_core_session_get_channel(session); + presence_id = switch_channel_get_variable(channel, "presence_id"); + if ((force_rate = switch_channel_get_variable(channel, "conference_force_rate"))) { if (!strcasecmp(force_rate, "auto")) { force_rate_i = read_impl.actual_samples_per_second; @@ -7365,7 +7367,11 @@ static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_c conference->name = switch_core_strdup(conference->pool, name); - if ((name_domain = strchr(conference->name, '@'))) { + if (presence_id && (name_domain = strchr(presence_id, '@'))) { + name_domain++; + conference->domain = switch_core_strdup(conference->pool, name_domain); + } else if ((name_domain = strchr(conference->name, '@'))) { + name_domain++; conference->domain = switch_core_strdup(conference->pool, name_domain); } else if (domain) { conference->domain = switch_core_strdup(conference->pool, domain); diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index ad11706022..75b7b9f0d3 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -1090,7 +1090,7 @@ static void actual_sofia_presence_event_handler(switch_event_t *event) } if (!strcmp(proto, "dp")) { - sql = switch_mprintf("update sip_presence set rpid='%q',status='%q' where hostname='%q' nad profile_name='%q' and " + sql = switch_mprintf("update sip_presence set rpid='%q',status='%q' where hostname='%q' and profile_name='%q' and " "sip_user='%q' and sip_host='%q'", rpid, status, mod_sofia_globals.hostname, profile->name, euser, host); sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE); @@ -3299,7 +3299,7 @@ void sofia_presence_handle_sip_i_subscribe(int status, np.network_port, np.network_ip, orig_proto, full_to, to_tag); switch_assert(sql != NULL); - + if (mod_sofia_globals.debug_presence > 0 || mod_sofia_globals.debug_sla > 0) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "%s SUBSCRIBE %s@%s %s@%s\n%s\n", diff --git a/src/switch_ivr.c b/src/switch_ivr.c index c56a862584..a4046b32b4 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -3184,7 +3184,7 @@ SWITCH_DECLARE(char *) switch_ivr_check_presence_mapping(const char *exten_name, for (x_domain = switch_xml_child(x_domains, "domain"); x_domain; x_domain = x_domain->next) { const char *dname = switch_xml_attr(x_domain, "name"); - if (!dname || strcasecmp(domain_name, dname)) continue; + if (!dname || (strcasecmp(dname, "*") && strcasecmp(domain_name, dname))) continue; for (x_exten = switch_xml_child(x_domain, "exten"); x_exten; x_exten = x_exten->next) { const char *regex = switch_xml_attr(x_exten, "regex");