--- asterisk-11.16.0.orig/channels/chan_sip.c 2015-03-03 14:37:11.209715100 +1300 +++ build/channels/chan_sip.c 2015-03-03 14:43:19.630712170 +1300 @@ -30577,7 +30577,6 @@ peer->stimer.st_max_se = global_max_se; peer->timer_t1 = global_t1; peer->timer_b = global_timer_b; - clear_peer_mailboxes(peer); peer->disallowed_methods = sip_cfg.disallowed_methods; peer->transports = default_transports; peer->default_outbound_transport = default_primary_transport; @@ -30632,7 +30631,7 @@ while ((mbox = context = strsep(&next, ","))) { struct sip_mailbox *mailbox; - int duplicate = 0; + /* remove leading/trailing whitespace from mailbox string */ mbox = ast_strip(mbox); strsep(&context, "@"); @@ -30644,11 +30643,11 @@ /* Check whether the mailbox is already in the list */ AST_LIST_TRAVERSE(&peer->mailboxes, mailbox, entry) { if (!strcmp(mailbox->mailbox, mbox) && !strcmp(S_OR(mailbox->context, ""), S_OR(context, ""))) { - duplicate = 1; break; } } - if (duplicate) { + if (mailbox) { + mailbox->delme = 0; continue; }