Index: configure =================================================================== --- configure (revision 169480) +++ configure (working copy) @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.ac Revision: 168522 . +# From configure.ac Revision: 168734 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.61 for asterisk 1.6. # @@ -990,7 +990,6 @@ PBX_MISDN_FAC_RESULT PBX_MISDN_FAC_ERROR CONFIG_NETSNMP -PBX_ODBC PG_CONFIG PTLIB_CONFIG PWLIBDIR @@ -13333,13 +13332,11 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include /* for off_t */ - #include +#include int main () { -int (*fp) (FILE *, off_t, int) = fseeko; - return fseeko (stdin, 0, 0) && fp (stdin, 0, 0); +return fseeko (stdin, 0, 0) && (fseeko) (stdin, 0, 0); ; return 0; } @@ -13379,13 +13376,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #define _LARGEFILE_SOURCE 1 -#include /* for off_t */ - #include +#include int main () { -int (*fp) (FILE *, off_t, int) = fseeko; - return fseeko (stdin, 0, 0) && fp (stdin, 0, 0); +return fseeko (stdin, 0, 0) && (fseeko) (stdin, 0, 0); ; return 0; } @@ -20401,6 +20396,82 @@ + + if test "x${PBX_DAHDI_LINEREVERSE_VMWI}" != "x1" -a "${USE_DAHDI_LINEREVERSE_VMWI}" != "no"; then + if test "xenhanced dahdi vmwi support" != "x"; then + { echo "$as_me:$LINENO: checking for enhanced dahdi vmwi support" >&5 +echo $ECHO_N "checking for enhanced dahdi vmwi support... $ECHO_C" >&6; } + else + { echo "$as_me:$LINENO: checking if \"struct dahdi_vmwi_info booger\" compiles using dahdi/user.h" >&5 +echo $ECHO_N "checking if \"struct dahdi_vmwi_info booger\" compiles using dahdi/user.h... $ECHO_C" >&6; } + fi + saved_cppflags="${CPPFLAGS}" + if test "x${DAHDI_LINEREVERSE_VMWI_DIR}" != "x"; then + DAHDI_LINEREVERSE_VMWI_INCLUDE="-I${DAHDI_LINEREVERSE_VMWI_DIR}/include" + fi + CPPFLAGS="${CPPFLAGS} ${DAHDI_LINEREVERSE_VMWI_INCLUDE}" + + cat >conftest.$ac_ext <<_ACEOF + /* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ + struct dahdi_vmwi_info booger; + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + PBX_DAHDI_LINEREVERSE_VMWI=1 + +cat >>confdefs.h <<\_ACEOF +#define HAVE_DAHDI_LINEREVERSE_VMWI 1 +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define HAVE_DAHDI_LINEREVERSE_VMWI_VERSION +_ACEOF + + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CPPFLAGS="${saved_cppflags}" + fi + + # BSD might not have exp2, and/or log2 if test "x${PBX_EXP2L}" != "x1" -a "${USE_EXP2L}" != "no"; then @@ -38183,13 +38254,7 @@ fi -PBX_ODBC=0 -if test "$PBX_IODBC" = "1" -o "$PBX_UNIXODBC" = "1"; then - PBX_ODBC=1 -fi - - if test "x${PBX_OGG}" != "x1" -a "${USE_OGG}" != "no"; then pbxlibdir="" # if --with-OGG=DIR has been specified, use it. @@ -53664,7 +53729,6 @@ PBX_MISDN_FAC_RESULT!$PBX_MISDN_FAC_RESULT$ac_delim PBX_MISDN_FAC_ERROR!$PBX_MISDN_FAC_ERROR$ac_delim CONFIG_NETSNMP!$CONFIG_NETSNMP$ac_delim -PBX_ODBC!$PBX_ODBC$ac_delim PG_CONFIG!$PG_CONFIG$ac_delim PTLIB_CONFIG!$PTLIB_CONFIG$ac_delim PWLIBDIR!$PWLIBDIR$ac_delim @@ -53681,6 +53745,7 @@ AIS_LIB!$AIS_LIB$ac_delim CONFIG_GMIME!$CONFIG_GMIME$ac_delim EDITLINE_LIB!$EDITLINE_LIB$ac_delim +PBX_H323!$PBX_H323$ac_delim _ACEOF if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then @@ -53722,7 +53787,6 @@ ac_delim='%!_!# ' for ac_last_try in false false false false false :; do cat >conf$$subs.sed <<_ACEOF -PBX_H323!$PBX_H323$ac_delim PBX_IXJUSER!$PBX_IXJUSER$ac_delim CONFIG_SDL!$CONFIG_SDL$ac_delim CONFIG_GTK!$CONFIG_GTK$ac_delim @@ -53734,7 +53798,7 @@ LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 10; then + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 9; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 Index: channels/chan_dahdi.c =================================================================== --- channels/chan_dahdi.c (revision 169480) +++ channels/chan_dahdi.c (working copy) @@ -264,7 +264,7 @@ /*! Run this script when the MWI state changes on an FXO line, if mwimonitor is enabled */ static char mwimonitornotify[PATH_MAX] = ""; -#ifndef DAHDI_VMWI_FSK +#ifndef HAVE_DAHDI_LINEREVERSE_VMWI static int mwisend_rpas = 0; #endif @@ -732,7 +732,7 @@ int onhooktime; int fxsoffhookstate; int msgstate; - int mwisendtype; /*!< Which VMWI methods to use */ + struct dahdi_vmwi_info mwisend_setting; /*!< Which VMWI methods to use */ int distinctivering; /*!< Which distinctivering to use */ int cidrings; /*!< Which ring to deliver CID on */ int dtmfrelax; /*!< whether to run in relaxed DTMF mode */ @@ -871,8 +871,8 @@ .mailbox = "", -#ifdef DAHDI_VMWI_FSK - .mwisendtype = DAHDI_VMWI_FSK, +#ifdef HAVE_DAHDI_LINEREVERSE_VMWI + .mwisend_setting.fsk = 1, #endif .polarityonanswerdelay = 600, @@ -7716,12 +7716,12 @@ { int x, res; -#ifdef DAHDI_VMWI_FSK +#ifdef HAVE_DAHDI_LINEREVERSE_VMWI /* Determine how this spill is to be sent */ - if (pvt->mwisendtype & DAHDI_VMWI_RPAS) { + if (pvt->mwisend_setting.rpas) { pvt->mwisend_data.mwisend_current = MWI_SEND_SA; pvt->mwisendactive = 1; - } else if (pvt->mwisendtype & DAHDI_VMWI_FSK) { + } else if (pvt->mwisend_setting.fsk) { pvt->mwisend_data.mwisend_current = MWI_SEND_SPILL; pvt->mwisendactive = 1; } else { @@ -7753,13 +7753,13 @@ res = ioctl(pvt->subs[SUB_REAL].dfd, DAHDI_FLUSH, &x); x = 3000; ioctl(pvt->subs[SUB_REAL].dfd, DAHDI_ONHOOKTRANSFER, &x); -#ifdef DAHDI_VMWI_FSK - if (pvt->mwisendtype & DAHDI_VMWI_FSK) { +#ifdef HAVE_DAHDI_LINEREVERSE_VMWI + if (pvt->mwisend_setting.fsk) { #endif pvt->cidlen = vmwi_generate(pvt->cidspill, has_voicemail(pvt), CID_MWI_TYPE_MDMF_FULL, AST_LAW(pvt), pvt->cid_name, pvt->cid_num, 0); pvt->cidpos = 0; -#ifdef DAHDI_VMWI_FSK +#ifdef HAVE_DAHDI_LINEREVERSE_VMWI } #endif return 0; @@ -7791,14 +7791,14 @@ case MWI_SEND_SA_WAIT: /* do nothing until I get RINGEROFF event */ break; case MWI_SEND_PAUSE: /* Wait between alert and spill - min of 500 mS*/ -#ifdef DAHDI_VMWI_FSK - if (pvt->mwisendtype & DAHDI_VMWI_FSK) { +#ifdef HAVE_DAHDI_LINEREVERSE_VMWI + if (pvt->mwisend_setting.fsk) { #endif gettimeofday(&now, NULL); if ((int)(now.tv_sec - pvt->mwisend_data.pause.tv_sec) * 1000000 + (int)now.tv_usec - (int)pvt->mwisend_data.pause.tv_usec > 500000) { pvt->mwisend_data.mwisend_current = MWI_SEND_SPILL; } -#ifdef DAHDI_VMWI_FSK +#ifdef HAVE_DAHDI_LINEREVERSE_VMWI } else { /* support for mwisendtype=nofsk */ pvt->mwisend_data.mwisend_current = MWI_SEND_CLEANUP; } @@ -8249,7 +8249,7 @@ !ast_strlen_zero(last->mailbox) && (thispass - last->onhooktime > 3)) { res = has_voicemail(last); if (last->msgstate != res) { -#ifndef DAHDI_VMWI_FSK +#ifndef HAVE_DAHDI_LINEREVERSE_VMWI /* Set driver resources for signalling VMWI */ res2 = ioctl(last->subs[SUB_REAL].dfd, DAHDI_VMWI, &res); if (res2) { @@ -8257,13 +8257,8 @@ ast_debug(3, "Unable to control message waiting led on channel %d: %s\n", last->channel, strerror(errno)); } #else - /* New DAHDI_VMWI ioctl supports upto 65535 messages*/ - if (res > DAHDI_VMWI_NUMBER_MASK) { - res2 = (last->mwisendtype | DAHDI_VMWI_NUMBER_MASK); - } else { - res2 = (last->mwisendtype | (res & DAHDI_VMWI_NUMBER_MASK)); - } - res2 = ioctl(last->subs[SUB_REAL].dfd, DAHDI_VMWI, &res2); + last->mwisend_setting.messages = res; + res2 = ioctl(last->subs[SUB_REAL].dfd, DAHDI_VMWI, &last->mwisend_setting); if (res2) { /* TODO: This message will ALWAYS be generated on some cards; any way to restrict it to those cards where it is interesting? */ ast_debug(3, "Unable to control MWI on channel %d: %s\n", last->channel, strerror(errno)); @@ -9025,7 +9020,7 @@ AST_EVENT_IE_END); } tmp->msgstate = -1; - tmp->mwisendtype = conf->chan.mwisendtype; + tmp->mwisend_setting = conf->chan.mwisend_setting; if (chan_sig & __DAHDI_SIG_FXO) { memset(&p, 0, sizeof(p)); res = ioctl(tmp->subs[SUB_REAL].dfd, DAHDI_GET_PARAMS, &p); @@ -14238,7 +14233,7 @@ } else if (!strcasecmp(v->name, "mwimonitornotify")) { ast_copy_string(mwimonitornotify, v->value, sizeof(mwimonitornotify)); } else if (!strcasecmp(v->name, "mwisendtype")) { -#ifndef DAHDI_VMWI_FSK /* backward compatibility for older dahdi VMWI implementation */ +#ifndef HAVE_DAHDI_LINEREVERSE_VMWI /* backward compatibility for older dahdi VMWI implementation */ if (!strcasecmp(v->value, "rpas")) { /* Ring Pulse Alert Signal */ mwisend_rpas = 1; } else { @@ -14246,22 +14241,23 @@ } #else /* Default is fsk, to turn it off you must specify nofsk */ + memset(&confp->chan.mwisend_setting, 0, sizeof(confp->chan.mwisend_setting)); if (strcasestr(v->value, "nofsk")) { /* NoFSK */ - confp->chan.mwisendtype = 0; + confp->chan.mwisend_setting.fsk = 0; } else { /* Default FSK */ - confp->chan.mwisendtype = DAHDI_VMWI_FSK; + confp->chan.mwisend_setting.fsk = 1; } if (strcasestr(v->value, "rpas")) { /* Ring Pulse Alert Signal, normally followed by FSK */ - confp->chan.mwisendtype |= DAHDI_VMWI_RPAS; + confp->chan.mwisend_setting.rpas = 1; } if (strcasestr(v->value, "lrev")) { /* Line Reversal */ - confp->chan.mwisendtype |= DAHDI_VMWI_LREV; + confp->chan.mwisend_setting.linereverse = 1; } if (strcasestr(v->value, "hvdc")) { /* HV 90VDC */ - confp->chan.mwisendtype |= DAHDI_VMWI_HVDC; + confp->chan.mwisend_setting.hvdc = 1; } if ( (strcasestr(v->value, "neon")) || (strcasestr(v->value, "hvac")) ){ /* 90V DC pulses */ - confp->chan.mwisendtype |= DAHDI_VMWI_HVAC; + confp->chan.mwisend_setting.hvac = 1; } #endif } else if (reload != 1) { Index: configure.ac =================================================================== --- configure.ac (revision 169480) +++ configure.ac (working copy) @@ -617,6 +617,8 @@ AST_C_DEFINE_CHECK([DAHDI_HALF_FULL], [DAHDI_POLICY_HALF_FULL], [dahdi/user.h]) +AST_C_COMPILE_CHECK([DAHDI_LINEREVERSE_VMWI], [struct dahdi_vmwi_info booger], [dahdi/user.h], , [enhanced dahdi vmwi support]) + # BSD might not have exp2, and/or log2 AST_EXT_LIB_CHECK([EXP2L], [m], [exp2l]) AST_EXT_LIB_CHECK([LOG2L], [m], [log2l]) Index: include/asterisk/autoconfig.h.in =================================================================== --- include/asterisk/autoconfig.h.in (revision 169480) +++ include/asterisk/autoconfig.h.in (working copy) @@ -192,6 +192,12 @@ /* Define DAHDI_HALF_FULL headers version */ #undef HAVE_DAHDI_HALF_FULL_VERSION +/* Define if your system has the DAHDI_LINEREVERSE_VMWI headers. */ +#undef HAVE_DAHDI_LINEREVERSE_VMWI + +/* Define DAHDI_LINEREVERSE_VMWI headers version */ +#undef HAVE_DAHDI_LINEREVERSE_VMWI_VERSION + /* Define DAHDI headers version */ #undef HAVE_DAHDI_VERSION