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 2 and 3

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 2 Diff Revision 3
[20] 187 lines
[+20]
188
AC_CHECK_TOOL([SOXMIX], [soxmix], [:])
188
AC_CHECK_TOOL([SOXMIX], [soxmix], [:])
189
if test "${SOXMIX}" != ":" ; then
189
if test "${SOXMIX}" != ":" ; then
190
	AC_DEFINE([HAVE_SOXMIX], 1, [Define to 1 if your system has soxmix application.])
190
	AC_DEFINE([HAVE_SOXMIX], 1, [Define to 1 if your system has soxmix application.])
191
fi
191
fi
192

    
   
192

   

    
   
193
AC_CHECK_PROGS([MD5], [md5 md5sum gmd5sum digest])

    
   
194

   

    
   
195
if test "${MD5}" = "digest" ; then

    
   
196
   MD5="${MD5} -a md5"   

    
   
197
fi

    
   
198

   
193
ACX_PTHREAD
199
ACX_PTHREAD
194

    
   
200

   
195
AC_LANG(C)
201
AC_LANG(C)
196

    
   
202

   
197
AC_ARG_ENABLE([dev-mode],
203
AC_ARG_ENABLE([dev-mode],
[+20] [20] 63 lines
[+20]
261
AST_EXT_LIB_SETUP([RADIUS], [Radius Client], [radius])
267
AST_EXT_LIB_SETUP([RADIUS], [Radius Client], [radius])
262
AST_EXT_LIB_SETUP([SDL], [Sdl], [sdl])
268
AST_EXT_LIB_SETUP([SDL], [Sdl], [sdl])
263
AST_EXT_LIB_SETUP([SDL_IMAGE], [Sdl Image library], [SDL_image])
269
AST_EXT_LIB_SETUP([SDL_IMAGE], [Sdl Image library], [SDL_image])
264
AST_EXT_LIB_SETUP([OPENAIS], [OpenAIS], [openais])
270
AST_EXT_LIB_SETUP([OPENAIS], [OpenAIS], [openais])
265
AST_EXT_LIB_SETUP([SPEEX], [Speex], [speex])
271
AST_EXT_LIB_SETUP([SPEEX], [Speex], [speex])

    
   
272
AST_EXT_LIB_SETUP([SPEEX_PREPROCESS], [Speex preprocess routines], [speex])
266
AST_EXT_LIB_SETUP([SPEEXDSP], [Speexdsp], [speexdsp])
273
AST_EXT_LIB_SETUP([SPEEXDSP], [Speexdsp], [speexdsp])
267
AST_EXT_LIB_SETUP([SQLITE], [SQLite], [sqlite])
274
AST_EXT_LIB_SETUP([SQLITE], [SQLite], [sqlite])
268
AST_EXT_LIB_SETUP([SQLITE3], [SQLite], [sqlite3])
275
AST_EXT_LIB_SETUP([SQLITE3], [SQLite], [sqlite3])
269
AST_EXT_LIB_SETUP([SUPPSERV], [mISDN Supplemental Services], [suppserv])
276
AST_EXT_LIB_SETUP([SUPPSERV], [mISDN Supplemental Services], [suppserv])
270
AST_EXT_LIB_SETUP([OPENSSL], [OpenSSL Secure Sockets Layer support], [ssl])
277
AST_EXT_LIB_SETUP([OPENSSL], [OpenSSL Secure Sockets Layer support], [ssl])
[+20] [20] 5 lines
[+20]
276
AST_EXT_LIB_SETUP([USB], [usb], [usb])
283
AST_EXT_LIB_SETUP([USB], [usb], [usb])
277
AST_EXT_LIB_SETUP([VORBIS], [Vorbis], [vorbis])
284
AST_EXT_LIB_SETUP([VORBIS], [Vorbis], [vorbis])
278
AST_EXT_LIB_SETUP([VPB], [Voicetronix API], [vpb])
285
AST_EXT_LIB_SETUP([VPB], [Voicetronix API], [vpb])
279
AST_EXT_LIB_SETUP([X11], [X11 support], [x11])
286
AST_EXT_LIB_SETUP([X11], [X11 support], [x11])
280
AST_EXT_LIB_SETUP([ZLIB], [zlib], [z])
287
AST_EXT_LIB_SETUP([ZLIB], [zlib], [z])

    
   
288
AST_EXT_LIB_SETUP([TIMERFD], [timerfd], [timerfd])
281

    
   
289

   
282
# check for basic system features and functionality before
290
# check for basic system features and functionality before
283
# checking for package libraries
291
# checking for package libraries
284

    
   
292

   
285
AC_FUNC_ALLOCA
293
AC_FUNC_ALLOCA
286
AC_HEADER_DIRENT
294
AC_HEADER_DIRENT
287
AC_HEADER_STDC
295
AC_HEADER_STDC
288
AC_HEADER_SYS_WAIT
296
AC_HEADER_SYS_WAIT
289
AC_CHECK_HEADERS([arpa/inet.h fcntl.h inttypes.h libintl.h limits.h locale.h malloc.h netdb.h netinet/in.h stddef.h stdint.h stdlib.h string.h strings.h sys/file.h sys/ioctl.h sys/param.h sys/socket.h sys/time.h syslog.h termios.h unistd.h utime.h arpa/nameser.h])
297
AC_CHECK_HEADERS([arpa/inet.h fcntl.h inttypes.h libintl.h limits.h locale.h malloc.h netdb.h netinet/in.h stddef.h stdint.h stdlib.h string.h strings.h sys/file.h sys/ioctl.h sys/param.h sys/socket.h sys/time.h syslog.h termios.h unistd.h utime.h arpa/nameser.h sys/io.h])
290

    
   
298

   
291
AC_CHECK_HEADERS([winsock.h winsock2.h])
299
AC_CHECK_HEADERS([winsock.h winsock2.h])
292

    
   
300

   
293
AC_SYS_LARGEFILE
301
AC_SYS_LARGEFILE
294

    
   
302

   
[+20] [20] 33 lines
[+20]
328
AC_FUNC_STRFTIME
336
AC_FUNC_STRFTIME
329
AC_FUNC_STRNLEN
337
AC_FUNC_STRNLEN
330
AC_FUNC_STRTOD
338
AC_FUNC_STRTOD
331
AC_FUNC_UTIME_NULL
339
AC_FUNC_UTIME_NULL
332
AC_FUNC_VPRINTF
340
AC_FUNC_VPRINTF
333
AC_CHECK_FUNCS([asprintf atexit dup2 endpwent ftruncate getcwd gethostbyname gethostname getloadavg gettimeofday 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])
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])
334

    
   
342

   
335
AC_CHECK_FUNCS([glob])
343
AC_CHECK_FUNCS([glob])
336

    
   
344

   
337
AC_MSG_CHECKING(for timersub in time.h)
345
AC_MSG_CHECKING(for timersub in time.h)
338
AC_LINK_IFELSE(
346
AC_LINK_IFELSE(
[+20] [20] 133 lines
[+20]
472
AST_GCC_ATTRIBUTE(always_inline)
480
AST_GCC_ATTRIBUTE(always_inline)
473
AST_GCC_ATTRIBUTE(deprecated)
481
AST_GCC_ATTRIBUTE(deprecated)
474
AST_GCC_ATTRIBUTE(sentinel)
482
AST_GCC_ATTRIBUTE(sentinel)
475
AST_GCC_ATTRIBUTE(warn_unused_result)
483
AST_GCC_ATTRIBUTE(warn_unused_result)
476
AST_GCC_ATTRIBUTE(weak)
484
AST_GCC_ATTRIBUTE(weak)

    
   
485
AST_GCC_ATTRIBUTE(alias, [alias("foo")])
477

    
   
486

   
478
AC_MSG_CHECKING(for -ffunction-sections support)
487
AC_MSG_CHECKING(for -ffunction-sections support)
479
saved_CFLAGS="${CFLAGS}"
488
saved_CFLAGS="${CFLAGS}"
480
CFLAGS="${CFLAGS} -ffunction-sections"
489
CFLAGS="${CFLAGS} -ffunction-sections"
481
AC_COMPILE_IFELSE(
490
AC_COMPILE_IFELSE(
[+20] [20] 24 lines
[+20]
506
	AC_MSG_RESULT(no)
515
	AC_MSG_RESULT(no)
507
	AST_DECLARATION_AFTER_STATEMENT=
516
	AST_DECLARATION_AFTER_STATEMENT=
508
fi
517
fi
509
AC_SUBST(AST_DECLARATION_AFTER_STATEMENT)
518
AC_SUBST(AST_DECLARATION_AFTER_STATEMENT)
510

    
   
519

   

    
   
520
AC_MSG_CHECKING(for _FORTIFY_SOURCE support)

    
   
521
if $(${CC} -D_FORTIFY_SOURCE=2 -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then

    
   
522
	AC_MSG_RESULT(yes)

    
   
523
	AST_FORTIFY_SOURCE=-D_FORTIFY_SOURCE=2

    
   
524
else

    
   
525
	AC_MSG_RESULT(no)

    
   
526
	AST_FORTIFY_SOURCE=

    
   
527
fi

    
   
528
AC_SUBST(AST_FORTIFY_SOURCE)

    
   
529

   
511
AC_MSG_CHECKING(for -fno-strict-overflow)
530
AC_MSG_CHECKING(for -fno-strict-overflow)
512
if $(${CC} -O2 -fno-strict-overflow -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
531
if $(${CC} -O2 -fno-strict-overflow -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
513
	AC_MSG_RESULT(yes)
532
	AC_MSG_RESULT(yes)
514
	AST_NO_STRICT_OVERFLOW=-fno-strict-overflow
533
	AST_NO_STRICT_OVERFLOW=-fno-strict-overflow
515
else
534
else
[+20] [20] 79 lines
[+20]
595
  AST_EXT_LIB_CHECK([CAP], [cap], [cap_from_text], [sys/capability.h])
614
  AST_EXT_LIB_CHECK([CAP], [cap], [cap_from_text], [sys/capability.h])
596
fi
615
fi
597

    
   
616

   
598
AST_C_DEFINE_CHECK([DAHDI], [DAHDI_CODE], [dahdi/user.h])
617
AST_C_DEFINE_CHECK([DAHDI], [DAHDI_CODE], [dahdi/user.h])
599

    
   
618

   

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

    
   
620

   
600
# BSD might not have exp2, and/or log2
621
# BSD might not have exp2, and/or log2
601
AST_EXT_LIB_CHECK([EXP2L], [m], [exp2l])
622
AST_EXT_LIB_CHECK([EXP2L], [m], [exp2l])
602
AST_EXT_LIB_CHECK([LOG2L], [m], [log2l])
623
AST_EXT_LIB_CHECK([LOG2L], [m], [log2l])
603
AST_EXT_LIB_CHECK([EXP10L], [m], [exp10l])
624
AST_EXT_LIB_CHECK([EXP10L], [m], [exp10l])
604
AST_EXT_LIB_CHECK([LOG10L], [m], [log10l])
625
AST_EXT_LIB_CHECK([LOG10L], [m], [log10l])
[+20] [20] 39 lines
[+20]
644
AST_EXT_LIB_CHECK([STRTOD], [c], [strtod], [stdlib.h])
665
AST_EXT_LIB_CHECK([STRTOD], [c], [strtod], [stdlib.h])
645
AST_EXT_LIB_CHECK([FLOOR], [m], [floor])
666
AST_EXT_LIB_CHECK([FLOOR], [m], [floor])
646
AST_EXT_LIB_CHECK([CEIL], [m], [ceil])
667
AST_EXT_LIB_CHECK([CEIL], [m], [ceil])
647

    
   
668

   
648
AST_C_COMPILE_CHECK([GETIFADDRS], [struct ifaddrs *p; getifaddrs(&p)], [ifaddrs.h], , [getifaddrs() support])
669
AST_C_COMPILE_CHECK([GETIFADDRS], [struct ifaddrs *p; getifaddrs(&p)], [ifaddrs.h], , [getifaddrs() support])

    
   
670
AST_C_COMPILE_CHECK([TIMERFD], [timerfd_create(0,0); timerfd_settime(0,0,NULL,NULL);], [sys/timerfd.h], , [timerfd support])
649

    
   
671

   
650
GSM_INTERNAL="yes"
672
GSM_INTERNAL="yes"
651
AC_SUBST(GSM_INTERNAL)
673
AC_SUBST(GSM_INTERNAL)
652
GSM_SYSTEM="yes"
674
GSM_SYSTEM="yes"
653
if test "${USE_GSM}" != "no"; then
675
if test "${USE_GSM}" != "no"; then
[+20] [20] 731 lines
[+20]
1385
	# properly, and that libtiff is available
1407
	# properly, and that libtiff is available
1386
	PBX_SPANDSP=0
1408
	PBX_SPANDSP=0
1387
	AST_EXT_LIB_CHECK([SPANDSP], [spandsp], [span_set_message_handler], [spandsp.h], [-ltiff])
1409
	AST_EXT_LIB_CHECK([SPANDSP], [spandsp], [span_set_message_handler], [spandsp.h], [-ltiff])
1388
fi
1410
fi
1389

    
   
1411

   

    
   
1412
if test "x${PBX_SPANDSP}" = "x1" ; then

    
   
1413
	# We also need t38_terminal_init()

    
   
1414
	PBX_SPANDSP=0

    
   
1415
	AST_EXT_LIB_CHECK([SPANDSP], [spandsp], [t38_terminal_init], [spandsp.h], [-ltiff])

    
   
1416
fi

    
   
1417

   

    
   
1418
if test "x${PBX_SPANDSP}" = "x1" ; then

    
   
1419
	AC_CHECK_HEADER([spandsp/expose.h], [AC_DEFINE_UNQUOTED([HAVE_SPANDSP_EXPOSE_H], 1, [Define to 1 if spandsp/expose.h is available.])], [], [#include <spandsp.h>])

    
   
1420
fi

    
   
1421

   
1390
AST_EXT_LIB_CHECK([SS7], [ss7], [ss7_pollflags], [libss7.h])
1422
AST_EXT_LIB_CHECK([SS7], [ss7], [ss7_pollflags], [libss7.h])
1391

    
   
1423

   
1392
AST_EXT_LIB_CHECK([OPENR2], [openr2], [openr2_chan_new], [openr2.h])
1424
AST_EXT_LIB_CHECK([OPENR2], [openr2], [openr2_chan_new], [openr2.h])
1393

    
   
1425

   
1394
if test "${USE_PWLIB}" != "no"; then
1426
if test "${USE_PWLIB}" != "no"; then
[+20] [20] 101 lines
[+20]
1496

    
   
1528

   
1497
AST_EXT_LIB_CHECK([TERMCAP], [termcap], [tgetent], [])
1529
AST_EXT_LIB_CHECK([TERMCAP], [termcap], [tgetent], [])
1498

    
   
1530

   
1499
AST_EXT_LIB_CHECK([TINFO], [tinfo], [tgetent], [])
1531
AST_EXT_LIB_CHECK([TINFO], [tinfo], [tgetent], [])
1500

    
   
1532

   
1501
if test "${host_os}" != "linux-gnu" ; then
1533
AC_CHECK_LIB([tonezone], [tone_zone_find_by_num], tonezone_does_not_need_lm=yes, tonezone_does_not_need_lm=no)

    
   
1534

   

    
   
1535
if test "${tonezone_does_not_need_lm}" = "no" ; then
1502
  tonezone_extra="-lm"
1536
  tonezone_extra="-lm"
1503
fi
1537
fi
1504

    
   
1538

   
1505
AST_EXT_LIB_CHECK([TONEZONE], [tonezone], [tone_zone_find], [dahdi/tonezone.h], [${tonezone_extra} ${DAHDI_INCLUDE}])
1539
AST_EXT_LIB_CHECK([TONEZONE], [tonezone], [tone_zone_find], [dahdi/tonezone.h], [${tonezone_extra} ${DAHDI_INCLUDE}])
1506

    
   
1540

   
[+20] [20] 196 lines
/trunk/makeopts.in
Diff Revision 2 Diff Revision 3
 
/trunk/channels/chan_dahdi.c
Diff Revision 2 Diff Revision 3
 
/trunk/configs/chan_dahdi.conf.sample
Diff Revision 2 Diff Revision 3
 
  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.