diff options
author | Kinsey Moore <kmoore@digium.com> | 2014-10-01 12:28:05 +0000 |
---|---|---|
committer | Kinsey Moore <kmoore@digium.com> | 2014-10-01 12:28:05 +0000 |
commit | 4d2c7c23f8ccfe61c0b8bdc53802862d4d763fe4 (patch) | |
tree | 09f716224b83a459aef8f20eb76a250b926973c6 /res/res_pjsip/config_transport.c | |
parent | 122cc050d0f8473e5f662aee35555f1aef062566 (diff) |
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
Diffstat (limited to 'res/res_pjsip/config_transport.c')
-rw-r--r-- | res/res_pjsip/config_transport.c | 12 |
1 files changed, 11 insertions, 1 deletions
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; } |