From 2a0f0439e525a80c08f46e2ca3a84e1ae84c6178 Mon Sep 17 00:00:00 2001 From: Tilghman Lesher Date: Thu, 7 May 2009 16:45:23 +0000 Subject: [PATCH] Merged revisions 192933 via svnmerge from https://origsvn.digium.com/svn/asterisk/trunk ................ r192933 | tilghman | 2009-05-07 11:43:56 -0500 (Thu, 07 May 2009) | 17 lines Merged revisions 192932 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r192932 | tilghman | 2009-05-07 11:29:08 -0500 (Thu, 07 May 2009) | 10 lines 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.6.0@192934 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- channels/chan_sip.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/channels/chan_sip.c b/channels/chan_sip.c index d8812d3cd7..7ebade4b12 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -20765,6 +20765,7 @@ static struct sip_peer *build_peer(const char *name, struct ast_variable *v, str char callback[256] = ""; const char *srvlookup = NULL; static int deprecation_warning = 1; + int alt_fullcontact = alt ? 1 : 0; struct ast_str *fullcontact = ast_str_alloca(512); if (!realtime || ast_test_flag(&global_flags[1], SIP_PAGE2_RTCACHEFRIENDS)) { @@ -20848,6 +20849,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; + ast_str_reset(fullcontact); + } /* Reconstruct field, because realtime separates our value at the ';' */ if (fullcontact->used > 0) { ast_str_append(&fullcontact, 0, ";%s", v->value);