Review Board 1.7.16


MFC/R2 support for chan_dahdi

Review Request #40 - Created Nov. 7, 2008 and submitted

Moises Silva
team/moy/mfcr2
Reviewers
asterisk-dev
Asterisk
MFC/R2 support for chan_dahdi.

The code for tone detection (main/dsp.c) and generation (DAHDI MF support in chan_dahdi.c) is not actually being used now. In the early stages of development, spandsp was not LGPL and that's why applications can provide a MF interface to generate and detect the tones required for this signaling to work. Now that spandsp is LGPL, openr2 has embedded the R2 MF detector and generator and is the one currently being used. I had issues (tones either not being generated or not being detected properly) in some x86 64 bit, and the detection was 50% slower than the one in spandsp. Unless there is some important reason you can think of to switch back to DAHDI and main/dsp generator and detector, I suggest to get rid of that code, but I wanted to ask first. 

There is an issue with the way I currently handle how many monitor threads I launch. This code will launch as many monitor threads as group of channels are specified in the chan_dahdi.conf file.

channel=1-15,17-31

That would launch 2 monitor threads and use 2 r2link structures. There is maximum of NUM_SPANS r2link structures statically allocated when the module is loaded.

channel=1,2,3,4,5,6,7,8,9,10,11,12,13,14,15

That would launch 15 threads, 15 r2link structures would be used with only 1 channel each. If some user specify the channels this way, a single DAHDI span would consume all the available structures. Not a common scenario though, since most users would just specify 1-15 in such cases. Should I get rid of that mechanism for launching monitor threads?
Lots of users currently using this in 1.2, 1.4 and 1.6 in Brazil, México and Argentina. An unknown number of users (but at least 1) for each of the following countries: colombia, nepal, thailand, venezuela, perú and probably others. The code in chan_dahdi.c is independent of the variants though, which are handled by the OpenR2 library.

Changes between revision 3 and 4

1 2 3 4
1 2 3 4

  1. /trunk/configure.ac: Loading...
  2. /trunk/makeopts.in: Loading...
  3. /trunk/channels/chan_dahdi.c: Loading...
  4. /trunk/configs/chan_dahdi.conf.sample: Loading...
/trunk/configure.ac
Diff Revision 3 Diff Revision 4
[20] 171 lines
[+20]
172
AC_PATH_PROG([DIRNAME], [dirname], :)
172
AC_PATH_PROG([DIRNAME], [dirname], :)
173
AC_PATH_PROG([SHELL], [sh], :)
173
AC_PATH_PROG([SHELL], [sh], :)
174
AC_PATH_PROG([LN], [ln], :)
174
AC_PATH_PROG([LN], [ln], :)
175
AC_PATH_PROG([DOT], [dot], :)
175
AC_PATH_PROG([DOT], [dot], :)
176
AC_PATH_PROG([WGET], [wget], :)
176
AC_PATH_PROG([WGET], [wget], :)

    
   
177
AC_PATH_PROG([CURL], [curl], :)
177
AC_PATH_PROG([RUBBER], [rubber], :)
178
AC_PATH_PROG([RUBBER], [rubber], :)
178
AC_PATH_PROG([KPATHSEA], [kpsewhich], :)
179
AC_PATH_PROG([KPATHSEA], [kpsewhich], :)
179
AC_PATH_PROG([XMLSTARLET], [xmlstarlet], :)
180
AC_PATH_PROG([XMLSTARLET], [xmlstarlet], :)
180
if test "${WGET}" != ":" ; then
181
if test "${WGET}" != ":" ; then
181
  DOWNLOAD=${WGET}
182
  DOWNLOAD=${WGET}

    
   
183
else if test "${CURL}" != ":" ; then

    
   
184
  DOWNLOAD="${CURL} -O --progress-bar -w \"%{url_effective}\n\""
182
else
185
else
183
  AC_PATH_PROG([FETCH], [fetch], [:])
186
  AC_PATH_PROG([FETCH], [fetch], [:])
184
  DOWNLOAD=${FETCH}
187
  DOWNLOAD=${FETCH}
185
fi
188
fi

    
   
189
fi
186
AC_SUBST(DOWNLOAD)
190
AC_SUBST(DOWNLOAD)
187

    
   
191

   
188
AC_CHECK_TOOL([SOXMIX], [soxmix], [:])
192
AC_CHECK_TOOL([SOXMIX], [soxmix], [:])
189
if test "${SOXMIX}" != ":" ; then
193
if test "${SOXMIX}" != ":" ; then
190
	AC_DEFINE([HAVE_SOXMIX], 1, [Define to 1 if your system has soxmix application.])
194
	AC_DEFINE([HAVE_SOXMIX], 1, [Define to 1 if your system has soxmix application.])
[+20] [20] 145 lines
[+20]
336
AC_FUNC_STRFTIME
340
AC_FUNC_STRFTIME
337
AC_FUNC_STRNLEN
341
AC_FUNC_STRNLEN
338
AC_FUNC_STRTOD
342
AC_FUNC_STRTOD
339
AC_FUNC_UTIME_NULL
343
AC_FUNC_UTIME_NULL
340
AC_FUNC_VPRINTF
344
AC_FUNC_VPRINTF
341
AC_CHECK_FUNCS([asprintf atexit dup2 endpwent ftruncate getcwd gethostbyname gethostname getloadavg gettimeofday ioperm inet_ntoa isascii localtime_r memchr memmove memset mkdir munmap putenv re_comp regcomp select setenv socket strcasecmp strcasestr strchr strcspn strdup strerror strlcat strlcpy strncasecmp strndup strnlen strrchr strsep strspn strstr strtol strtoq unsetenv utime vasprintf getpeereid sysctl swapctl])
345
AC_CHECK_FUNCS([asprintf atexit closefrom dup2 endpwent ftruncate getcwd gethostbyname gethostname getloadavg gettimeofday ioperm inet_ntoa isascii localtime_r memchr memmove memset mkdir munmap putenv re_comp regcomp select setenv socket strcasecmp strcasestr strchr strcspn strdup strerror strlcat strlcpy strncasecmp strndup strnlen strrchr strsep strspn strstr strtol strtoq unsetenv utime vasprintf getpeereid sysctl swapctl])
342

    
   
346

   
343
AC_CHECK_FUNCS([glob])
347
AC_CHECK_FUNCS([glob])
344

    
   
348

   
345
AC_MSG_CHECKING(for timersub in time.h)
349
AC_MSG_CHECKING(for timersub in time.h)
346
AC_LINK_IFELSE(
350
AC_LINK_IFELSE(
[+20] [20] 133 lines
[+20]
480
AST_GCC_ATTRIBUTE(always_inline)
484
AST_GCC_ATTRIBUTE(always_inline)
481
AST_GCC_ATTRIBUTE(deprecated)
485
AST_GCC_ATTRIBUTE(deprecated)
482
AST_GCC_ATTRIBUTE(sentinel)
486
AST_GCC_ATTRIBUTE(sentinel)
483
AST_GCC_ATTRIBUTE(warn_unused_result)
487
AST_GCC_ATTRIBUTE(warn_unused_result)
484
AST_GCC_ATTRIBUTE(weak)
488
AST_GCC_ATTRIBUTE(weak)

    
   
489
AST_GCC_ATTRIBUTE(weak_import)
485
AST_GCC_ATTRIBUTE(alias, [alias("foo")])
490
AST_GCC_ATTRIBUTE(alias, [alias("foo")])
486

    
   
491

   
487
AC_MSG_CHECKING(for -ffunction-sections support)
492
AC_MSG_CHECKING(for -ffunction-sections support)
488
saved_CFLAGS="${CFLAGS}"
493
saved_CFLAGS="${CFLAGS}"
489
CFLAGS="${CFLAGS} -ffunction-sections"
494
CFLAGS="${CFLAGS} -ffunction-sections"
[+20] [20] 126 lines
[+20]
616

    
   
621

   
617
AST_C_DEFINE_CHECK([DAHDI], [DAHDI_CODE], [dahdi/user.h])
622
AST_C_DEFINE_CHECK([DAHDI], [DAHDI_CODE], [dahdi/user.h])
618

    
   
623

   
619
AST_C_DEFINE_CHECK([DAHDI_HALF_FULL], [DAHDI_POLICY_HALF_FULL], [dahdi/user.h])
624
AST_C_DEFINE_CHECK([DAHDI_HALF_FULL], [DAHDI_POLICY_HALF_FULL], [dahdi/user.h])
620

    
   
625

   

    
   
626
AST_C_COMPILE_CHECK([DAHDI_LINEREVERSE_VMWI], [struct dahdi_vmwi_info booger], [dahdi/user.h], , [enhanced dahdi vmwi support])

    
   
627

   
621
# BSD might not have exp2, and/or log2
628
# BSD might not have exp2, and/or log2
622
AST_EXT_LIB_CHECK([EXP2L], [m], [exp2l])
629
AST_EXT_LIB_CHECK([EXP2L], [m], [exp2l])
623
AST_EXT_LIB_CHECK([LOG2L], [m], [log2l])
630
AST_EXT_LIB_CHECK([LOG2L], [m], [log2l])
624
AST_EXT_LIB_CHECK([EXP10L], [m], [exp10l])
631
AST_EXT_LIB_CHECK([EXP10L], [m], [exp10l])
625
AST_EXT_LIB_CHECK([LOG10L], [m], [log10l])
632
AST_EXT_LIB_CHECK([LOG10L], [m], [log10l])
[+20] [20] 692 lines
[+20]
1318

    
   
1325

   
1319
AST_EXT_LIB_CHECK([NEWT], [newt], [newtBell], [newt.h])
1326
AST_EXT_LIB_CHECK([NEWT], [newt], [newtBell], [newt.h])
1320

    
   
1327

   
1321
AST_EXT_LIB_CHECK([UNIXODBC], [odbc], [SQLConnect], [sql.h], [])
1328
AST_EXT_LIB_CHECK([UNIXODBC], [odbc], [SQLConnect], [sql.h], [])
1322

    
   
1329

   
1323
PBX_ODBC=0

   
1324
if test "$PBX_IODBC" = "1" -o "$PBX_UNIXODBC" = "1"; then

   
1325
   PBX_ODBC=1

   
1326
fi

   
1327
AC_SUBST(PBX_ODBC)

   
1328

    
   

   
1329
AST_EXT_LIB_CHECK([OGG], [ogg], [ogg_sync_init], [])
1330
AST_EXT_LIB_CHECK([OGG], [ogg], [ogg_sync_init], [])
1330

    
   
1331

   
1331
# Non-glibc platforms require libexecinfo for backtrace support
1332
# Non-glibc platforms require libexecinfo for backtrace support
1332
AST_EXT_LIB_CHECK([BKTR], [execinfo], [backtrace], [execinfo.h])
1333
AST_EXT_LIB_CHECK([BKTR], [execinfo], [backtrace], [execinfo.h])
1333
# Linux, however, has backtrace directly in glibc
1334
# Linux, however, has backtrace directly in glibc
[+20] [20] 349 lines
[+20]
1683
         fi
1684
         fi
1684
      fi
1685
      fi
1685
   fi
1686
   fi
1686
fi
1687
fi
1687

    
   
1688

   

    
   
1689
# build a GENERIC_ODBC result based on the presence of either UnixODBC (preferred)

    
   
1690
# or iODBC

    
   
1691

   

    
   
1692
PBX_GENERIC_ODBC=0

    
   
1693

   

    
   
1694
if test "${PBX_UNIXODBC}" = 1; then

    
   
1695
   PBX_GENERIC_ODBC=1

    
   
1696
   GENERIC_ODBC_LIB="${UNIXODBC_LIB}"

    
   
1697
   GENERIC_ODBC_INCLUDE="${UNIXODBC_INCLUDE}"

    
   
1698
elif test "${PBX_IODBC}" = 1; then

    
   
1699
   PBX_GENERIC_ODBC=1

    
   
1700
   GENERIC_ODBC_LIB="${IODBC_LIB}"

    
   
1701
   GENERIC_ODBC_INCLUDE="${IODBC_INCLUDE}"

    
   
1702
fi

    
   
1703

   

    
   
1704
AC_SUBST([GENERIC_ODBC_LIB])

    
   
1705
AC_SUBST([GENERIC_ODBC_INCLUDE])

    
   
1706
AC_SUBST([PBX_GENERIC_ODBC])

    
   
1707

   
1688
AC_CONFIG_FILES([build_tools/menuselect-deps makeopts channels/h323/Makefile])
1708
AC_CONFIG_FILES([build_tools/menuselect-deps makeopts channels/h323/Makefile])
1689
AST_CHECK_MANDATORY
1709
AST_CHECK_MANDATORY
1690

    
   
1710

   
1691
if test -f build_tools/menuselect-deps; then
1711
if test -f build_tools/menuselect-deps; then
1692
    # extract old values of all PBX_ variables from menuselect-deps
1712
    # extract old values of all PBX_ variables from menuselect-deps
[+20] [20] 44 lines
/trunk/makeopts.in
Diff Revision 3 Diff Revision 4
 
/trunk/channels/chan_dahdi.c
Diff Revision 3 Diff Revision 4
 
/trunk/configs/chan_dahdi.conf.sample
Diff Revision 3 Diff Revision 4
 
  1. /trunk/configure.ac: Loading...
  2. /trunk/makeopts.in: Loading...
  3. /trunk/channels/chan_dahdi.c: Loading...
  4. /trunk/configs/chan_dahdi.conf.sample: Loading...

https://reviewboard.asterisk.org/ runs on a server provided by Digium, Inc. and uses bandwidth donated to the open source Asterisk community by API Digital Communications in Huntsville, AL USA.
Please report problems with this site to asteriskteam@digium.com.