From def7b77e15cb949f2ef01867c2a5e65188c3692a Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Thu, 1 Oct 2015 15:55:42 +0200 Subject: [PATCH] proxy.c: linphone_proxy_config_set_route now returns -1 if route is invalid --- coreapi/linphone_proxy_config.h | 1 + coreapi/proxy.c | 11 +++-------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/coreapi/linphone_proxy_config.h b/coreapi/linphone_proxy_config.h index e69e813c0..a84a8c8f3 100644 --- a/coreapi/linphone_proxy_config.h +++ b/coreapi/linphone_proxy_config.h @@ -87,6 +87,7 @@ LINPHONE_PUBLIC int linphone_proxy_config_set_identity_address(LinphoneProxyConf * Sets a SIP route. * When a route is set, all outgoing calls will go to the route's destination if this proxy * is the default one (see linphone_core_set_default_proxy() ). + * @Return -1 if route is invalid, 0 otherwise. **/ LINPHONE_PUBLIC int linphone_proxy_config_set_route(LinphoneProxyConfig *cfg, const char *route); diff --git a/coreapi/proxy.c b/coreapi/proxy.c index cf597e5ee..61c56e611 100644 --- a/coreapi/proxy.c +++ b/coreapi/proxy.c @@ -259,11 +259,6 @@ const char *linphone_proxy_config_get_domain(const LinphoneProxyConfig *cfg){ return cfg->identity_address ? linphone_address_get_domain(cfg->identity_address) : NULL; } -/** - * Sets a SIP route. - * When a route is set, all outgoing calls will go to the route's destination if this proxy - * is the default one (see linphone_core_set_default_proxy() ). -**/ int linphone_proxy_config_set_route(LinphoneProxyConfig *cfg, const char *route) { if (cfg->reg_route!=NULL){ @@ -280,13 +275,13 @@ int linphone_proxy_config_set_route(LinphoneProxyConfig *cfg, const char *route) addr=sal_address_new(tmp); if (addr!=NULL){ sal_address_destroy(addr); + cfg->reg_route=tmp; + return 0; }else{ ms_free(tmp); - tmp=NULL; } - cfg->reg_route=tmp; } - return 0; + return -1; } bool_t linphone_proxy_config_check(LinphoneCore *lc, LinphoneProxyConfig *cfg){