From 4d2c7c23f8ccfe61c0b8bdc53802862d4d763fe4 Mon Sep 17 00:00:00 2001 From: Kinsey Moore Date: Wed, 1 Oct 2014 12:28:05 +0000 Subject: PJSIP: Handle defaults properly This updates the code behind PJSIP configuration options with custom handlers to deal with the assigned default values properly where it makes sense and adjusting the default value where it doesn't. Before applying this patch, there were several cases where the default value for an option would prevent that config section from loading properly. Reported by: Thomas Thompson Review: https://reviewboard.asterisk.org/r/4019/ ........ Merged revisions 424263 from http://svn.asterisk.org/svn/asterisk/branches/12 ........ Merged revisions 424266 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@424267 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- res/res_pjsip/config_transport.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'res/res_pjsip/config_transport.c') diff --git a/res/res_pjsip/config_transport.c b/res/res_pjsip/config_transport.c index 0a56b9263..9996ddd08 100644 --- a/res/res_pjsip/config_transport.c +++ b/res/res_pjsip/config_transport.c @@ -349,7 +349,7 @@ static int transport_tls_method_handler(const struct aco_option *opt, struct ast { struct ast_sip_transport *transport = obj; - if (!strcasecmp(var->value, "default")) { + if (ast_strlen_zero(var->value) || !strcasecmp(var->value, "default")) { transport->tls.method = PJSIP_SSL_DEFAULT_METHOD; } else if (!strcasecmp(var->value, "unspecified")) { transport->tls.method = PJSIP_SSL_UNSPECIFIED_METHOD; @@ -416,6 +416,10 @@ static int transport_tls_cipher_handler(const struct aco_option *opt, struct ast struct ast_sip_transport *transport = obj; pj_ssl_cipher cipher; + if (ast_strlen_zero(var->value)) { + return 0; + } + if (transport->tls.ciphers_num == (SIP_TLS_MAX_CIPHERS - 1)) { return -1; } @@ -468,6 +472,12 @@ static int transport_localnet_handler(const struct aco_option *opt, struct ast_v struct ast_sip_transport *transport = obj; int error = 0; + if (ast_strlen_zero(var->value)) { + ast_free_ha(transport->localnet); + transport->localnet = NULL; + return 0; + } + if (!(transport->localnet = ast_append_ha("d", var->value, transport->localnet, &error))) { return -1; } -- cgit v1.2.3