res_pjsip.c: Added disable_rport option for pjsip.conf

Currently when the pjsip making an outgoing request, it keep adding the
rport parameter in a request message as a default.

This causes unexpected rport handle at the other end.

Added option for disable this behaviour in the pjsip.conf.

This is a system option, but working as a gloabl option.

ASTERISK-28959

Change-Id: I9596675e52a742774738b5aad5d1fec32f477abc
This commit is contained in:
sungtae kim
2020-06-24 01:27:47 +02:00
parent d093e44b1e
commit 81b5e4a73f
5 changed files with 61 additions and 0 deletions

View File

@@ -59,6 +59,8 @@ struct system_config {
*/
unsigned int follow_early_media_fork;
unsigned int accept_multiple_sdp_answers;
/*! Disable the use of rport in outgoing requests */
unsigned int disable_rport;
};
static struct ast_threadpool_options sip_threadpool_options = {
@@ -131,6 +133,8 @@ static int system_apply(const struct ast_sorcery *sorcery, void *obj)
pjsip_cfg()->endpt.disable_tcp_switch =
system->disable_tcp_switch ? PJ_TRUE : PJ_FALSE;
pjsip_cfg()->endpt.disable_rport = system->disable_rport ? PJ_TRUE : PJ_FALSE;
return 0;
}
@@ -209,6 +213,8 @@ int ast_sip_initialize_system(void)
OPT_BOOL_T, 1, FLDSET(struct system_config, follow_early_media_fork));
ast_sorcery_object_field_register(system_sorcery, "system", "accept_multiple_sdp_answers", "no",
OPT_BOOL_T, 1, FLDSET(struct system_config, accept_multiple_sdp_answers));
ast_sorcery_object_field_register(system_sorcery, "system", "disable_rport", "no",
OPT_BOOL_T, 1, FLDSET(struct system_config, disable_rport));
ast_sorcery_load(system_sorcery);