This directory contains software used for interfacing the
FreeSWITCH voicemail application with the AT&T (aka Lucent
aka Avaya) System 25 PBX.  It's possible that System 75
and Definity PBXs may also work.

s25vmail.js goes into the FreeSWITCH scripts directory.
s25vmail_mwi.c should be compiled and the resulting binary
put into the FreeSWITCH bin directory.  Modify the FreeSWITCH
rc.d script to also start / stop s25vmail_mwi.

Configuration fragments look something like:

  conf/openzap.conf:

    [span zt]
    ; A204DX
    name => OpenZAP
    dtmf_hangup = ##99

    number => 551
    fxo-channel => 49

    number => 552
    fxo-channel => 50

    number => 553
    fxo-channel => 51

    number => 554
    fxo-channel => 52

  conf/dialplan/default.xml

    <extension name="system25_vmail">
      <condition field="destination_number" expression="^(55[1-4])$">
        <action application="javascript" data="s25vmail.js"/>
      </condition>
    </extension>

Tested using FreeSWITCH SVN 10428 running on FreeBSD 6.3
with a Sangoma A200DX Analog Series w/ Echo Cancellation
ports card containing 2 FXO modules.

Note that the PBX is * very * sensitive to how long it takes
for the line to be hung up after it sends the DTMF hangup
command.  Failure to apply the following patch will cause
the PBX to occasionally believe that some vmail lines were
off hook for too long and are therfore out of service.

Index: src/zap_io.c
===================================================================
--- src/zap_io.c	(revision 745)
+++ src/zap_io.c	(working copy)
@@ -1728,7 +1728,8 @@
 			zchan->dtmf_hangup_buf[zchan->span->dtmf_hangup_len - 1] = *p;
 			if (!strcmp(zchan->dtmf_hangup_buf, zchan->span->dtmf_hangup)) {
 				zap_log(ZAP_LOG_DEBUG, "DTMF hangup detected.\n");
-				zap_set_state_locked(zchan, ZAP_CHANNEL_STATE_HANGUP);
+				zchan->caller_data.hangup_cause = ZAP_CAUSE_NORMAL_CLEARING;
+				zap_set_state_locked(zchan, ZAP_CHANNEL_STATE_DOWN);
 				break;
 			}
 		}
