mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-10-23 03:34:15 +00:00
add presence_map
This commit is contained in:
1 parent
4ceca1890d
commit
4ee1722f3e
6 files changed
+76
No files matched your search
@@ -253,6 +253,7 @@ typedef enum {
|
||||
PFLAG_AUTO_ASSIGN_PORT,
|
||||
PFLAG_AUTO_ASSIGN_TLS_PORT,
|
||||
PFLAG_SHUTDOWN,
|
||||
PFLAG_PRESENCE_MAP,
|
||||
/* No new flags below this line */
|
||||
PFLAG_MAX
|
||||
} PFLAGS;
|
||||
|
||||
@@ -2875,6 +2875,12 @@ switch_status_t reconfig_sofia(sofia_profile_t *profile)
|
||||
} else {
|
||||
sofia_clear_pflag(profile, PFLAG_LOG_AUTH_FAIL);
|
||||
}
|
||||
} else if (!strcasecmp(var, "presence-proto-lookup")) {
|
||||
if (switch_true(val)) {
|
||||
sofia_set_pflag(profile, PFLAG_PRESENCE_MAP);
|
||||
} else {
|
||||
sofia_clear_pflag(profile, PFLAG_PRESENCE_MAP);
|
||||
}
|
||||
} else if (!strcasecmp(var, "liberal-dtmf")) {
|
||||
if (switch_true(val)) {
|
||||
sofia_set_pflag(profile, PFLAG_LIBERAL_DTMF);
|
||||
@@ -3590,6 +3596,12 @@ switch_status_t config_sofia(int reload, char *profile_name)
|
||||
} else {
|
||||
sofia_clear_pflag(profile, PFLAG_LOG_AUTH_FAIL);
|
||||
}
|
||||
} else if (!strcasecmp(var, "presence-proto-lookup")) {
|
||||
if (switch_true(val)) {
|
||||
sofia_set_pflag(profile, PFLAG_PRESENCE_MAP);
|
||||
} else {
|
||||
sofia_clear_pflag(profile, PFLAG_PRESENCE_MAP);
|
||||
}
|
||||
} else if (!strcasecmp(var, "liberal-dtmf")) {
|
||||
if (switch_true(val)) {
|
||||
sofia_set_pflag(profile, PFLAG_LIBERAL_DTMF);
|
||||
|
||||
@@ -2632,6 +2632,7 @@ void sofia_presence_handle_sip_i_subscribe(int status,
|
||||
char *my_to_user = NULL;
|
||||
char *sql, *event = NULL;
|
||||
char *proto = "sip";
|
||||
char *alt_proto = NULL;
|
||||
char *d_user = NULL;
|
||||
char *contact_str = "";
|
||||
const char *call_id = NULL;
|
||||
@@ -2647,6 +2648,7 @@ void sofia_presence_handle_sip_i_subscribe(int status,
|
||||
const char *ipv6;
|
||||
const char *contact_user;
|
||||
sofia_nat_parse_t np = { { 0 } };
|
||||
int found_proto = 0;
|
||||
|
||||
if (!sip) {
|
||||
return;
|
||||
@@ -2730,6 +2732,8 @@ void sofia_presence_handle_sip_i_subscribe(int status,
|
||||
nua_respond(nh, SIP_404_NOT_FOUND, NUTAG_WITH_THIS_MSG(de->data->e_msg), TAG_END());
|
||||
goto end;
|
||||
}
|
||||
|
||||
found_proto++;
|
||||
}
|
||||
|
||||
call_id = sip->sip_call_id->i_id;
|
||||
@@ -2740,6 +2744,9 @@ void sofia_presence_handle_sip_i_subscribe(int status,
|
||||
sip->sip_expires->ex_delta = 31536000;
|
||||
}
|
||||
|
||||
if (sofia_test_pflag(profile, PFLAG_PRESENCE_MAP) && !found_proto && (alt_proto = switch_ivr_check_presence_mapping(to_user, to_host))) {
|
||||
proto = alt_proto;
|
||||
}
|
||||
|
||||
if ((sub_state == nua_substate_active) && (switch_stristr("dialog", (const char *) event))) {
|
||||
|
||||
@@ -3047,6 +3054,7 @@ void sofia_presence_handle_sip_i_subscribe(int status,
|
||||
switch_safe_free(d_user);
|
||||
switch_safe_free(to_str);
|
||||
switch_safe_free(contact_str);
|
||||
switch_safe_free(alt_proto);
|
||||
|
||||
if (!sent_reply) {
|
||||
nua_respond(nh, 481, "INVALID SUBSCRIPTION", TAG_END());
|
||||
|
||||
Reference in new issue
Block a user