From: Jeff Peeler Date: Mon, 28 Sep 2009 19:10:10 +0000 (+0000) Subject: Fix building of registration entry in build_peer when using callbackextension X-Git-Tag: 11.0.0-beta1~4119 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=05f94a05c222943cc7c54c930a345e97bfe408d2;p=thirdparty%2Fasterisk.git Fix building of registration entry in build_peer when using callbackextension Check for remotesecret option was unintentionally always true, which therefore caused the secret option to never be used. Thanks to dvossel for pointing out the exact fix. (closes issue #15943) Reported by: tpsast git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@220718 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 08f2128fc0..731453fe8b 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -24641,7 +24641,7 @@ static struct sip_peer *build_peer(const char *name, struct ast_variable *v, str ast_free_ha(oldha); if (!ast_strlen_zero(callback)) { /* build string from peer info */ char *reg_string; - if (asprintf(®_string, "%s?%s:%s@%s/%s", peer->name, peer->username, peer->remotesecret ? peer->remotesecret : peer->secret, peer->tohost, callback) < 0) { + if (asprintf(®_string, "%s?%s:%s@%s/%s", peer->name, peer->username, !ast_strlen_zero(peer->remotesecret) ? peer->remotesecret : peer->secret, peer->tohost, callback) < 0) { ast_log(LOG_WARNING, "asprintf() failed: %s\n", strerror(errno)); } else if (reg_string) { sip_register(reg_string, 0); /* XXX TODO: count in registry_count */