Add MFC/R2 support for chan_dahdi.

This commit introduces official support for R2 signaling in chan_dahdi.  The
modifications to chan_dahdi, and the supporting library, LibOpenR2, were both
written by Moises Silva.

Many users are using this code, or a variant of it, in Asterisk 1.2, 1.4 and 1.6
in Brazil, México and Argentina. An unknown number of users (but at least 1) 
are using it in each of the following countries: Colombia, Nepal, Thailand, 
Venezuela, Perú, and probably others.

To use this code, LibOpenR2 must be installed from http://www.libopenr2.org/.
Information about configuration can be found in configs/chan_dahdi.conf.sample.

The code committed is the most up to date version, which was being maintained
in svn/asterisk/team/moy/mfcr2/.

I would also like to include a Thank You to the many others that tested this
code beyond those listed in this commit message.  These are the names that I
could find in the mantis issue.

(closes issue #12509)
Reported by: moy
Patches:
      chan_zap-mfr2.patch uploaded by moy (license 222)
Tested by: moy, korihor, viniciusfontes, Skarmeth, loloski, asbestoshead, titogarrido, heliocoelhojr, konsultex, ncorrare, ecarruda, rtorresduque, PTorres, ychen

Review: http://reviewboard.digium.com/r/40/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@182355 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Russell Bryant
2009-03-16 20:35:58 +00:00
parent 18ac659dc6
commit 77a6840fd3
8 changed files with 2022 additions and 33 deletions

322
configure vendored
View File

@@ -1,5 +1,5 @@
#! /bin/sh
# From configure.ac Revision: 180944 .
# From configure.ac Revision: 182170 .
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.61 for asterisk 1.6.
#
@@ -879,6 +879,10 @@ SS7_LIB
SS7_INCLUDE
SS7_DIR
PBX_SS7
OPENR2_LIB
OPENR2_INCLUDE
OPENR2_DIR
PBX_OPENR2
PWLIB_LIB
PWLIB_INCLUDE
PWLIB_DIR
@@ -1659,6 +1663,7 @@ Optional Packages:
--with-resample=PATH use LIBRESAMPLE files in PATH
--with-spandsp=PATH use SPANDSP files in PATH
--with-ss7=PATH use ISDN SS7 files in PATH
--with-openr2=PATH use MFR2 files in PATH
--with-pwlib=PATH use PWlib files in PATH
--with-h323=PATH use OpenH323 files in PATH
--with-radius=PATH use Radius Client files in PATH
@@ -9298,6 +9303,37 @@ fi
OPENR2_DESCRIP="MFR2"
OPENR2_OPTION="openr2"
PBX_OPENR2=0
# Check whether --with-openr2 was given.
if test "${with_openr2+set}" = set; then
withval=$with_openr2;
case ${withval} in
n|no)
USE_OPENR2=no
# -1 is a magic value used by menuselect to know that the package
# was disabled, other than 'not found'
PBX_OPENR2=-1
;;
y|ye|yes)
ac_mandatory_list="${ac_mandatory_list} OPENR2"
;;
*)
OPENR2_DIR="${withval}"
ac_mandatory_list="${ac_mandatory_list} OPENR2"
;;
esac
fi
PWLIB_DESCRIP="PWlib"
PWLIB_OPTION="pwlib"
PBX_PWLIB=0
@@ -43130,6 +43166,268 @@ _ACEOF
fi
if test "x${PBX_OPENR2}" != "x1" -a "${USE_OPENR2}" != "no"; then
pbxlibdir=""
# if --with-OPENR2=DIR has been specified, use it.
if test "x${OPENR2_DIR}" != "x"; then
if test -d ${OPENR2_DIR}/lib; then
pbxlibdir="-L${OPENR2_DIR}/lib"
else
pbxlibdir="-L${OPENR2_DIR}"
fi
fi
pbxfuncname="openr2_chan_new"
if test "x${pbxfuncname}" = "x" ; then # empty lib, assume only headers
AST_OPENR2_FOUND=yes
else
as_ac_Lib=`echo "ac_cv_lib_openr2_${pbxfuncname}" | $as_tr_sh`
{ echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lopenr2" >&5
echo $ECHO_N "checking for ${pbxfuncname} in -lopenr2... $ECHO_C" >&6; }
if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lopenr2 ${pbxlibdir} $LIBS"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char ${pbxfuncname} ();
int
main ()
{
return ${pbxfuncname} ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (ac_try="$ac_link"
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_link") 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_exeext &&
$as_test_x conftest$ac_exeext; then
eval "$as_ac_Lib=yes"
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
eval "$as_ac_Lib=no"
fi
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
ac_res=`eval echo '${'$as_ac_Lib'}'`
{ echo "$as_me:$LINENO: result: $ac_res" >&5
echo "${ECHO_T}$ac_res" >&6; }
if test `eval echo '${'$as_ac_Lib'}'` = yes; then
AST_OPENR2_FOUND=yes
else
AST_OPENR2_FOUND=no
fi
fi
# now check for the header.
if test "${AST_OPENR2_FOUND}" = "yes"; then
OPENR2_LIB="${pbxlibdir} -lopenr2 "
# if --with-OPENR2=DIR has been specified, use it.
if test "x${OPENR2_DIR}" != "x"; then
OPENR2_INCLUDE="-I${OPENR2_DIR}/include"
fi
OPENR2_INCLUDE="${OPENR2_INCLUDE} "
if test "xopenr2.h" = "x" ; then # no header, assume found
OPENR2_HEADER_FOUND="1"
else # check for the header
saved_cppflags="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${OPENR2_INCLUDE}"
if test "${ac_cv_header_openr2_h+set}" = set; then
{ echo "$as_me:$LINENO: checking for openr2.h" >&5
echo $ECHO_N "checking for openr2.h... $ECHO_C" >&6; }
if test "${ac_cv_header_openr2_h+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
fi
{ echo "$as_me:$LINENO: result: $ac_cv_header_openr2_h" >&5
echo "${ECHO_T}$ac_cv_header_openr2_h" >&6; }
else
# Is the header compilable?
{ echo "$as_me:$LINENO: checking openr2.h usability" >&5
echo $ECHO_N "checking openr2.h usability... $ECHO_C" >&6; }
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
#include <openr2.h>
_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
ac_header_compiler=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_header_compiler=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
echo "${ECHO_T}$ac_header_compiler" >&6; }
# Is the header present?
{ echo "$as_me:$LINENO: checking openr2.h presence" >&5
echo $ECHO_N "checking openr2.h presence... $ECHO_C" >&6; }
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <openr2.h>
_ACEOF
if { (ac_try="$ac_cpp conftest.$ac_ext"
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_cpp conftest.$ac_ext") 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); } >/dev/null && {
test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
test ! -s conftest.err
}; then
ac_header_preproc=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_header_preproc=no
fi
rm -f conftest.err conftest.$ac_ext
{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
echo "${ECHO_T}$ac_header_preproc" >&6; }
# So? What about this header?
case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
yes:no: )
{ echo "$as_me:$LINENO: WARNING: openr2.h: accepted by the compiler, rejected by the preprocessor!" >&5
echo "$as_me: WARNING: openr2.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
{ echo "$as_me:$LINENO: WARNING: openr2.h: proceeding with the compiler's result" >&5
echo "$as_me: WARNING: openr2.h: proceeding with the compiler's result" >&2;}
ac_header_preproc=yes
;;
no:yes:* )
{ echo "$as_me:$LINENO: WARNING: openr2.h: present but cannot be compiled" >&5
echo "$as_me: WARNING: openr2.h: present but cannot be compiled" >&2;}
{ echo "$as_me:$LINENO: WARNING: openr2.h: check for missing prerequisite headers?" >&5
echo "$as_me: WARNING: openr2.h: check for missing prerequisite headers?" >&2;}
{ echo "$as_me:$LINENO: WARNING: openr2.h: see the Autoconf documentation" >&5
echo "$as_me: WARNING: openr2.h: see the Autoconf documentation" >&2;}
{ echo "$as_me:$LINENO: WARNING: openr2.h: section \"Present But Cannot Be Compiled\"" >&5
echo "$as_me: WARNING: openr2.h: section \"Present But Cannot Be Compiled\"" >&2;}
{ echo "$as_me:$LINENO: WARNING: openr2.h: proceeding with the preprocessor's result" >&5
echo "$as_me: WARNING: openr2.h: proceeding with the preprocessor's result" >&2;}
{ echo "$as_me:$LINENO: WARNING: openr2.h: in the future, the compiler will take precedence" >&5
echo "$as_me: WARNING: openr2.h: in the future, the compiler will take precedence" >&2;}
( cat <<\_ASBOX
## ------------------------------- ##
## Report this to www.asterisk.org ##
## ------------------------------- ##
_ASBOX
) | sed "s/^/$as_me: WARNING: /" >&2
;;
esac
{ echo "$as_me:$LINENO: checking for openr2.h" >&5
echo $ECHO_N "checking for openr2.h... $ECHO_C" >&6; }
if test "${ac_cv_header_openr2_h+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_cv_header_openr2_h=$ac_header_preproc
fi
{ echo "$as_me:$LINENO: result: $ac_cv_header_openr2_h" >&5
echo "${ECHO_T}$ac_cv_header_openr2_h" >&6; }
fi
if test $ac_cv_header_openr2_h = yes; then
OPENR2_HEADER_FOUND=1
else
OPENR2_HEADER_FOUND=0
fi
CPPFLAGS="${saved_cppflags}"
fi
if test "x${OPENR2_HEADER_FOUND}" = "x0" ; then
OPENR2_LIB=""
OPENR2_INCLUDE=""
else
if test "x${pbxfuncname}" = "x" ; then # only checking headers -> no library
OPENR2_LIB=""
fi
PBX_OPENR2=1
# XXX don't know how to evaluate the description (third argument) in AC_DEFINE_UNQUOTED
cat >>confdefs.h <<_ACEOF
#define HAVE_OPENR2 1
_ACEOF
cat >>confdefs.h <<_ACEOF
#define HAVE_OPENR2_VERSION
_ACEOF
fi
fi
fi
if test "${USE_PWLIB}" != "no"; then
if test -n "${PWLIB_DIR}"; then
PWLIBDIR="${PWLIB_DIR}"
@@ -54018,6 +54316,10 @@ SS7_LIB!$SS7_LIB$ac_delim
SS7_INCLUDE!$SS7_INCLUDE$ac_delim
SS7_DIR!$SS7_DIR$ac_delim
PBX_SS7!$PBX_SS7$ac_delim
OPENR2_LIB!$OPENR2_LIB$ac_delim
OPENR2_INCLUDE!$OPENR2_INCLUDE$ac_delim
OPENR2_DIR!$OPENR2_DIR$ac_delim
PBX_OPENR2!$PBX_OPENR2$ac_delim
PWLIB_LIB!$PWLIB_LIB$ac_delim
PWLIB_INCLUDE!$PWLIB_INCLUDE$ac_delim
PWLIB_DIR!$PWLIB_DIR$ac_delim
@@ -54045,10 +54347,6 @@ PBX_OPENAIS!$PBX_OPENAIS$ac_delim
SPEEX_LIB!$SPEEX_LIB$ac_delim
SPEEX_INCLUDE!$SPEEX_INCLUDE$ac_delim
SPEEX_DIR!$SPEEX_DIR$ac_delim
PBX_SPEEX!$PBX_SPEEX$ac_delim
SPEEX_PREPROCESS_LIB!$SPEEX_PREPROCESS_LIB$ac_delim
SPEEX_PREPROCESS_INCLUDE!$SPEEX_PREPROCESS_INCLUDE$ac_delim
SPEEX_PREPROCESS_DIR!$SPEEX_PREPROCESS_DIR$ac_delim
_ACEOF
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
@@ -54090,6 +54388,10 @@ _ACEOF
ac_delim='%!_!# '
for ac_last_try in false false false false false :; do
cat >conf$$subs.sed <<_ACEOF
PBX_SPEEX!$PBX_SPEEX$ac_delim
SPEEX_PREPROCESS_LIB!$SPEEX_PREPROCESS_LIB$ac_delim
SPEEX_PREPROCESS_INCLUDE!$SPEEX_PREPROCESS_INCLUDE$ac_delim
SPEEX_PREPROCESS_DIR!$SPEEX_PREPROCESS_DIR$ac_delim
PBX_SPEEX_PREPROCESS!$PBX_SPEEX_PREPROCESS$ac_delim
SPEEXDSP_LIB!$SPEEXDSP_LIB$ac_delim
SPEEXDSP_INCLUDE!$SPEEXDSP_INCLUDE$ac_delim
@@ -54183,10 +54485,6 @@ PWLIB_INCDIR!$PWLIB_INCDIR$ac_delim
PWLIB_LIBDIR!$PWLIB_LIBDIR$ac_delim
PWLIB_PLATFORM!$PWLIB_PLATFORM$ac_delim
OPENH323DIR!$OPENH323DIR$ac_delim
OPENH323_INCDIR!$OPENH323_INCDIR$ac_delim
OPENH323_LIBDIR!$OPENH323_LIBDIR$ac_delim
OPENH323_SUFFIX!$OPENH323_SUFFIX$ac_delim
OPENH323_BUILD!$OPENH323_BUILD$ac_delim
_ACEOF
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
@@ -54228,6 +54526,10 @@ _ACEOF
ac_delim='%!_!# '
for ac_last_try in false false false false false :; do
cat >conf$$subs.sed <<_ACEOF
OPENH323_INCDIR!$OPENH323_INCDIR$ac_delim
OPENH323_LIBDIR!$OPENH323_LIBDIR$ac_delim
OPENH323_SUFFIX!$OPENH323_SUFFIX$ac_delim
OPENH323_BUILD!$OPENH323_BUILD$ac_delim
PBX_AIS!$PBX_AIS$ac_delim
AIS_INCLUDE!$AIS_INCLUDE$ac_delim
AIS_LIB!$AIS_LIB$ac_delim
@@ -54245,7 +54547,7 @@ PBX_GENERIC_ODBC!$PBX_GENERIC_ODBC$ac_delim
LTLIBOBJS!$LTLIBOBJS$ac_delim
_ACEOF
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 15; then
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 19; then
break
elif $ac_last_try; then
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5