Summary:ASTERISK-06143: remote MWI
Reporter:Vadim Berezniker (kryptolus)Labels:
Date Opened:2006-01-20 06:51:05.000-0600Date Closed:2011-06-07 14:03:09
Versions:Frequency of
Environment:Attachments:( 0) mwi.diff
This is like bugs 0004371 and 0004236. We wanted to have a push model for voicemail but we didn't want to have to make 20 configuration changes just to have remote MWI (which is a problem with the patch in 0004371).
Configuration is quite easy and only requires modification of voicemail.conf
A remote mailbox looks like this:

1234 => peername/

This means if any device checks mailbox 1234@context, it will get the last known status of the mailbox 1234@context on the peer 'peername'. This is actually a shortcut notation.

The full syntax is
1234 => IAX2/peername/mailbox@context
so the mailbox name doesn't have to map 1-to-1

There is also support for patterns
_XXXX => peername/
Any device that checks a 4 digit mailbox in that context will get the last known status of that mailbox on 'peername'.

How it works:
When a peer becomes available, the client sends all the subscriptions to the server. If any mailbox changes matching a subscription, it's sent back to the subscriber.

Known Problems:
If you restart the server (asterisk that's hosting voicemail) really fast, the client will stop receiving voicemail updates. This basically happens due to the way IAX works. The client doesn't realize that the server ever went away so it doesn't realize that it needs to resubscribe. Restarting the client quickly has a similiar issue. The remote peer doesn't expect for the sequence ids to be reset. So when it receives a packet from the client, it thinks it has already seen it and just acks it and doesn't process it. As a workaround, I have an option 'resubscribe_mins' that will cause the client to resubscribe every n minutes. [This undermines the whole idea of using push notifications though...]

The bad news:
Since we plan to use this in production, the patch is against 1.2.1. I have not looked into updating it to the trunk.
Comments:By: Olle Johansson (oej) 2006-01-20 07:05:20.000-0600

Can we make this less IAX specific so we can subscribe to remote mailboxes with SIP as well?

By: Vadim Berezniker (kryptolus) 2006-01-20 08:00:57.000-0600

It's already quite generic. I added subscribe and unsubscribe methods to the channel. If you implement the subscribe/unsubscribe methods in the SIP channel, it  should work. However, I made a somewhat bad decision by making the subscribe function take a chunk of data as a parameter. The channel's responsibility is to just send it across to the peer. I'm not too familiar with SIP, but from what I've seen I have a feeling that SIP would prefer to send the parameters as text. It shoulnd't be too hard to redesign it so that the subscribe function gets a key/pair list of data to pass on to the peer. That way the channel can implement it any way it wants.

By: Olle Johansson (oej) 2006-03-08 02:57:54.000-0600

Closing this issue. It will stay in the bug tracker archives to be reached by people who want to experiment with it.