[asterisk-dev] SMDI Module Requests

Bill Sofko wills at wildwood.edu
Tue Jan 19 16:31:30 CST 2010


We've (finally) started using the res_smdi module in Asterisk 1.6.1.x in
production use. It is working very, very well for us, so my hats off to
its developers, especially Russell, who, at my request, had added some
functionality our situation required.

The module we're currently using has a couple of modifications I made that
I think would make good sense for the "general" version. One is, in my
mind, a bug fix while the second is an enhancement.

The "bug fix" modification I made regards the initialization of the
module's serial connection. We were having a problem wherein all of the MD
messages Asterisk received from our switch were being echoed back to the
switch whenever an MWI message was sent that way. This resulted in very
odd MWI behavior on the switch side. Obviously, the connection's ECHO
setting was on when it should have been off. I fixed the problem by adding
the following line in the smdi_load() function after iface->mode.c_cflag
parameters were completely initialized. These seemed a logical collection
of default settings that work nicely for us...

iface->mode.c_lflag = ~(ICANON | ECHO | ECHOE | ISIG);

The enhancement I made regards the padding and stripping of digits to and
from SMDI messages. In its current "shipping" incarnation, if msdstrip is
non-zero, then res_smdi.c will take the setting and (left) strip that
number of digits from incoming MD messages and (left) pad the same number
of characters to outgoing MWI messages.

The problem we had with the number of padding and stripping characters
being the same was that we use the app_voicemail notification mechanism
for MWI handling. It's much simpler than maintaining a separate "mapping"
in smdi.conf and it works for us (though it'd be nice to have an "smdi"
option per mailbox configuration to indicate which should use MWI for
switch notifications). Given that we use four digit mailboxes, we need to
(left) pad our MWI messages with three zeros to make the seven character
numbers our switch expects to see. With the default code, I'd have to set
msdstrip = 3 in smdi.conf, but then our e-mail notifications of voicemail
messages wouldn't show 7 character numbers (fine since most of our calls
our local), which looked confusing to our users.

As such, I added a configuration option to smdi.conf I called
"vmdigitpad". I patched res_smdi.c to read it during smdi_load() and
modified smdi_toggle_mwi() to use that value rather than msdstrip for
padding. As such, we can use app_voicemail's configuration without an
smdi.conf mapping, we get 7 digit dialing numbers in our e-mail
notifications, and our MWI handling works perfectly.

A side note: It seems to me easier and cleaner to use variable substring
syntax in the dialplan to strip unwanted digits than to depend on
msdstrip. We actually use that functionality to great effect in setting
caller ID information that is external versus internal in the dialplan.

I posted this message to determine if there was interest in these changes
being made back to Asterisk. If so, I am happy to send some patches along.

Again, thanks to those who created the SMDI functionality in Asterisk.
It's terrific.

- Bill

--
Bill Sofko
Chief Technology Officer
Wildwood Programs





More information about the asterisk-dev mailing list