[Asterisk-Dev] [RFC] Remote MWI using IAX2

Gil Kloepfer astr-dev at kloepfer.org
Tue May 3 18:09:30 MST 2005


I have made some improvements in the patch for remote voicemail MWI (message
waiting indication) over IAX2 that have solved some of the issues
I listed originally.  Here are the changes:

On Fri, Apr 29, 2005 at 11:59:58PM -0500, Gil Kloepfer wrote:
> Limitations/problems with my proof-of-concept patch:
[...]
> 2.  I am not handling the call creation properly and so it only
> appears to connect to the remote host via a "default" IAX connection.

This now is working correctly.  I rewrote the subroutine involved
so it no longer abuses cache_get_callno_locked().

It also speaks more out-of-band (for lack of a better term) rather than
doing a lot of unnecessary call setup it would never use.  It works
more like I intended it to work:  quick and quiet.

> 3.  There is no security so anyone who can attach via IAX can query
> the status of anyone's mailbox.  A configuration option in iax.conf
> should be added so that only specified trusted servers can do the
> remote mailbox queries.

This ended up being a LOT more difficult than I would ever have imagined.
I really need someone's help doing this in a clean way (someone who
knows their way around chan_iax2.c better).

> 5.  There may be scalability issues with many phones doing remote MWI
> queries as, in the case of Zap/ channels, the MWI checking is done
> once a second.

I changed the service loop in chan_zap.c that was being done once
a second to once every 3 seconds.  I'm not sure whether or not this
will have other ill effects, but so far I haven't seen any.

The code is also a little cleaner, and I discovered a file descriptor
leak or two, some locking stuff I did wrong, and a few other small bugs.

The updated patch is available at:

     http://www.kloepfer.org/gc2/rmwipatch3a.txt
     (patched to the v1-0 "release" train, not the cvs developer train)

I am going to leave the old one around for a little longer in case
someone wants to compare them, but will eventually make both of these
the same.

Andrew Kohlsmith <akohlsmith-asterisk at benshaw.com> replied about
the issue I discussed with the Zap/ service loop and (paraphrasing)
asked about a "push" approach rather than a "poll" approach.  I agree
that this is the correct way to do this whole thing, but it would require
a serious rewrite of how the MWI is handled in general.  That
should likely be done, but is more than I can handle by myself
at the moment (especially because I'm not an expert at this).

MWI would be better handled by having a separate thread which maintains
the status of an internal cache of mailbox statuses.  I envision
this as acquiring the initial status of all local mailboxes and
all remote mailboxes for Asterisk servers referenced for remote MWI.
Then the local and remote voicemail systems should "push" updates
to all listeners as the status changes, somewhat like the way SIP
notifies work now.  The cache thread should periodically (once every
hour or two) reread all the data to ensure it is all in sync.  The
polling done by the various chan_* functions would poll against the
internal cache rather than the physical mailboxes.  This cache could
be in memory, or a DBM file (if we're worried about memory usage and
scalability).

Again, I am very interested in help and comments about the remote
MWI idea.  I would like to suggest this as an enhancement to Asterisk
and get the IAX_COMMAND_MWI behavior into the upcoming RFC for IAX2.
Please indicate if this is useful and/or if you can revise any of
the coding I did to make it work better.  I really need to make this work!!

---
Gil Kloepfer
astrepl at kloepfer.org



More information about the asterisk-dev mailing list