Merged revisions 192932 via svnmerge from
[asterisk/asterisk.git] / channels / chan_sip.c
index 866738c..1fc93cc 100644 (file)
@@ -23220,6 +23220,7 @@ static struct sip_peer *build_peer(const char *name, struct ast_variable *v, str
        struct sip_peer tmp_peer;
        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)) {
@@ -23310,6 +23311,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);