mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-02-08 08:51:50 +00:00
FS-3842 here is the from and contact change but I can't remove the user agent but I added a new param to the gateway config called options_user_agent to set something specific
This commit is contained in:
parent
ce4256971b
commit
f25c5aaf27
@ -454,7 +454,9 @@ struct sofia_gateway {
|
|||||||
char *auth_username;
|
char *auth_username;
|
||||||
char *register_password;
|
char *register_password;
|
||||||
char *register_from;
|
char *register_from;
|
||||||
char *options_uri;
|
char *options_from_uri;
|
||||||
|
char *options_to_uri;
|
||||||
|
char *options_user_agent;
|
||||||
char *register_contact;
|
char *register_contact;
|
||||||
char *extension;
|
char *extension;
|
||||||
char *real_extension;
|
char *real_extension;
|
||||||
|
@ -2329,6 +2329,7 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag)
|
|||||||
*caller_id_in_from = "false",
|
*caller_id_in_from = "false",
|
||||||
*extension = NULL,
|
*extension = NULL,
|
||||||
*proxy = NULL,
|
*proxy = NULL,
|
||||||
|
*options_user_agent = NULL,
|
||||||
*context = profile->context,
|
*context = profile->context,
|
||||||
*expire_seconds = "3600",
|
*expire_seconds = "3600",
|
||||||
*retry_seconds = "30",
|
*retry_seconds = "30",
|
||||||
@ -2434,6 +2435,8 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag)
|
|||||||
ping_max = atoi(val);
|
ping_max = atoi(val);
|
||||||
} else if (!strcmp(var, "ping-min")) {
|
} else if (!strcmp(var, "ping-min")) {
|
||||||
ping_min = atoi(val);
|
ping_min = atoi(val);
|
||||||
|
} else if (!strcmp(var, "ping-user-agent")) {
|
||||||
|
options_user_agent = val;
|
||||||
} else if (!strcmp(var, "proxy")) {
|
} else if (!strcmp(var, "proxy")) {
|
||||||
proxy = val;
|
proxy = val;
|
||||||
} else if (!strcmp(var, "context")) {
|
} else if (!strcmp(var, "context")) {
|
||||||
@ -2575,6 +2578,7 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag)
|
|||||||
gateway->auth_username = switch_core_strdup(gateway->pool, auth_username);
|
gateway->auth_username = switch_core_strdup(gateway->pool, auth_username);
|
||||||
gateway->register_password = switch_core_strdup(gateway->pool, password);
|
gateway->register_password = switch_core_strdup(gateway->pool, password);
|
||||||
gateway->distinct_to = distinct_to;
|
gateway->distinct_to = distinct_to;
|
||||||
|
gateway->options_user_agent = options_user_agent;
|
||||||
|
|
||||||
if (switch_true(caller_id_in_from)) {
|
if (switch_true(caller_id_in_from)) {
|
||||||
sofia_set_flag(gateway, REG_FLAG_CALLERID);
|
sofia_set_flag(gateway, REG_FLAG_CALLERID);
|
||||||
@ -2612,8 +2616,10 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag)
|
|||||||
gateway->ping_max = ping_max;
|
gateway->ping_max = ping_max;
|
||||||
gateway->ping_min = ping_min;
|
gateway->ping_min = ping_min;
|
||||||
gateway->ping = switch_epoch_time_now(NULL) + ping_freq;
|
gateway->ping = switch_epoch_time_now(NULL) + ping_freq;
|
||||||
gateway->options_uri = switch_core_sprintf(gateway->pool, "<sip:%s;transport=%s>",
|
gateway->options_to_uri = switch_core_sprintf(gateway->pool, "<sip:%s;transport=%s>",
|
||||||
!zstr(from_domain) ? from_domain : proxy, register_transport);
|
!zstr(from_domain) ? from_domain : proxy, register_transport);
|
||||||
|
gateway->options_from_uri = switch_core_sprintf(gateway->pool, "<sip:%s;transport=%s>",
|
||||||
|
profile->extrtpip ? profile->extrtpip : profile->sipip, register_transport);
|
||||||
} 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");
|
||||||
}
|
}
|
||||||
|
@ -354,8 +354,9 @@ void sofia_reg_check_gateway(sofia_profile_t *profile, time_t now)
|
|||||||
nua_options(nh,
|
nua_options(nh,
|
||||||
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_uri), SIPTAG_FROM_STR(profile->url),
|
SIPTAG_TO_STR(gateway_ptr->options_to_uri), SIPTAG_FROM_STR(gateway_ptr->options_from_uri),
|
||||||
SIPTAG_CONTACT_STR(gateway_ptr->register_contact), TAG_END());
|
TAG_IF(gateway_ptr->options_user_agent, SIPTAG_USER_AGENT_STR(gateway_ptr->options_user_agent)),
|
||||||
|
TAG_END());
|
||||||
|
|
||||||
switch_safe_free(user_via);
|
switch_safe_free(user_via);
|
||||||
user_via = NULL;
|
user_via = NULL;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user