From: Tilghman Lesher Date: Thu, 7 May 2009 16:29:08 +0000 (+0000) Subject: Eliminate repetition of fullcontact during reconstruction. X-Git-Tag: 1.4.25-rc1~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c57efbe571c001fdddb92e36775fe0efd5497a3d;p=thirdparty%2Fasterisk.git Eliminate repetition of fullcontact during reconstruction. If the fullcontact field appears in both the sippeers and the sipregs table, then during reconstruction of the field, it will otherwise be doubled. (closes issue #14754) Reported by: Alexei Gradinari Patches: 20090506__bug14754.diff.txt uploaded by tilghman (license 14) Tested by: lmadsen git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@192932 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/channels/chan_sip.c b/channels/chan_sip.c index baec6e3028..ddcc81773e 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -17421,6 +17421,7 @@ static struct sip_peer *build_peer(const char *name, struct ast_variable *v, str struct ast_variable *tmpvar = NULL; struct ast_flags peerflags[2] = {{(0)}}; struct ast_flags mask[2] = {{(0)}}; + int alt_fullcontact = alt ? 1 : 0; char fullcontact[sizeof(peer->fullcontact)] = ""; if (!realtime || ast_test_flag(&global_flags[1], SIP_PAGE2_RTCACHEFRIENDS)) @@ -17479,6 +17480,15 @@ static struct sip_peer *build_peer(const char *name, struct ast_variable *v, str } else if (realtime && !strcasecmp(v->name, "name")) ast_copy_string(peer->name, v->value, sizeof(peer->name)); else if (realtime && !strcasecmp(v->name, "fullcontact")) { + if (alt_fullcontact && !alt) { + /* Reset, because the alternate also has a fullcontact and we + * do NOT want the field value to be doubled. It might be + * tempting to skip this, but the first table might not have + * fullcontact and since we're here, we know that the alternate + * absolutely does. */ + alt_fullcontact = 0; + fullcontact[0] = '\0'; + } /* Reconstruct field, because realtime separates our value at the ';' */ if (!ast_strlen_zero(fullcontact)) { strncat(fullcontact, ";", sizeof(fullcontact) - strlen(fullcontact) - 1);