[mod_sofia] Add new gateway param 'contact-in-ping' to support for Microsoft Teams Direct Routing
This commit is contained in:
parent
477086b3e2
commit
5805addbeb
|
@ -533,6 +533,7 @@ struct sofia_gateway {
|
||||||
int pinging;
|
int pinging;
|
||||||
sofia_gateway_status_t status;
|
sofia_gateway_status_t status;
|
||||||
switch_time_t uptime;
|
switch_time_t uptime;
|
||||||
|
uint32_t contact_in_ping;
|
||||||
uint32_t ping_freq;
|
uint32_t ping_freq;
|
||||||
int ping_count;
|
int ping_count;
|
||||||
int ping_max;
|
int ping_max;
|
||||||
|
|
|
@ -3716,7 +3716,7 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag,
|
||||||
if ((gateway = switch_core_alloc(profile->pool, sizeof(*gateway)))) {
|
if ((gateway = switch_core_alloc(profile->pool, sizeof(*gateway)))) {
|
||||||
const char *sipip, *format;
|
const char *sipip, *format;
|
||||||
switch_uuid_t uuid;
|
switch_uuid_t uuid;
|
||||||
uint32_t ping_freq = 0, extension_in_contact = 0, ping_monitoring = 0, distinct_to = 0, rfc_5626 = 0;
|
uint32_t ping_freq = 0, extension_in_contact = 0, contact_in_ping = 0, ping_monitoring = 0, distinct_to = 0, rfc_5626 = 0;
|
||||||
int ping_max = 1, ping_min = 1;
|
int ping_max = 1, ping_min = 1;
|
||||||
char *register_str = "true", *scheme = "Digest",
|
char *register_str = "true", *scheme = "Digest",
|
||||||
*realm = NULL,
|
*realm = NULL,
|
||||||
|
@ -3831,6 +3831,8 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag,
|
||||||
caller_id_in_from = val;
|
caller_id_in_from = val;
|
||||||
} else if (!strcmp(var, "extension")) {
|
} else if (!strcmp(var, "extension")) {
|
||||||
extension = val;
|
extension = val;
|
||||||
|
} else if (!strcmp(var, "contact-in-ping")) {
|
||||||
|
contact_in_ping = switch_true(val);
|
||||||
} else if (!strcmp(var, "ping")) {
|
} else if (!strcmp(var, "ping")) {
|
||||||
ping_freq = atoi(val);
|
ping_freq = atoi(val);
|
||||||
} else if (!strcmp(var, "ping-max")) {
|
} else if (!strcmp(var, "ping-max")) {
|
||||||
|
@ -4029,6 +4031,9 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag,
|
||||||
gateway->options_to_uri = switch_core_sprintf(gateway->pool, "<sip:%s>",
|
gateway->options_to_uri = switch_core_sprintf(gateway->pool, "<sip:%s>",
|
||||||
!zstr(from_domain) ? from_domain : proxy);
|
!zstr(from_domain) ? from_domain : proxy);
|
||||||
gateway->options_from_uri = gateway->options_to_uri;
|
gateway->options_from_uri = gateway->options_to_uri;
|
||||||
|
if (contact_in_ping) {
|
||||||
|
gateway->contact_in_ping = contact_in_ping;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ERROR: invalid ping!\n");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ERROR: invalid ping!\n");
|
||||||
}
|
}
|
||||||
|
|
|
@ -389,6 +389,7 @@ void sofia_reg_check_gateway(sofia_profile_t *profile, time_t now)
|
||||||
TAG_IF(gateway_ptr->register_sticky_proxy, NUTAG_PROXY(gateway_ptr->register_sticky_proxy)),
|
TAG_IF(gateway_ptr->register_sticky_proxy, NUTAG_PROXY(gateway_ptr->register_sticky_proxy)),
|
||||||
TAG_IF(user_via, SIPTAG_VIA_STR(user_via)),
|
TAG_IF(user_via, SIPTAG_VIA_STR(user_via)),
|
||||||
SIPTAG_TO_STR(gateway_ptr->options_to_uri), SIPTAG_FROM_STR(gateway_ptr->options_from_uri),
|
SIPTAG_TO_STR(gateway_ptr->options_to_uri), SIPTAG_FROM_STR(gateway_ptr->options_from_uri),
|
||||||
|
TAG_IF(gateway_ptr->contact_in_ping, SIPTAG_CONTACT_STR(gateway_ptr->register_contact)),
|
||||||
TAG_IF(gateway_ptr->options_user_agent, SIPTAG_USER_AGENT_STR(gateway_ptr->options_user_agent)),
|
TAG_IF(gateway_ptr->options_user_agent, SIPTAG_USER_AGENT_STR(gateway_ptr->options_user_agent)),
|
||||||
TAG_END());
|
TAG_END());
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue