asterisk:/tmp# diff /usr/src/asterisk/channels/chan_sip.c asterisk/channels/chan_sip.c
5383c5383
< if (user && ast_apply_ha(user->ha, sin)) {
---
> if (!mailbox && user && ast_apply_ha(user->ha, sin)) {
5440c5440
< if (user && debug)
---
> if (!mailbox && user && debug)
7529d7528
< char rbox[256];
7530a7530
>
7559,7560c7559,7572
< snprintf(rbox, sizeof(rbox), ",%s@%s,", p->exten, p->context);
< if (strstr(mailbox, rbox))
---
>
> /* At this point, we should check if they subscribe to a mailbox that
> has the same extension as the peer or the mailbox id. If we configure
> the context to be the same as a SIP domain, we could check mailbox
> context as well. To be able to securely accept subscribes on mailbox
> IDs, not extensions, we need to check the digest auth user to make
> sure that the user has access to the mailbox.
>
> Since we do not act on this subscribe anyway, we might as well
> accept any authenticated peer with a mailbox definition in their
> config section.
>
> */
> if (!ast_strlen_zero(mailbox)) {
7562,7565d7573
< if (!found) {
< snprintf(rbox, sizeof(rbox), ",%s,", p->exten);
< if (strstr(mailbox, rbox))
< found++;
7566a7575
>