Asterisk – bri_net_ptmp

I recently needed to do some testing and required a bri_net_ptmp mode running on asterisk to connect another asterisk to. Needless to say, bumping into “How cool would it be if someone implemented this mode! For now, sucks for you.” is NOT fun.

Seeing that I’m not quite ready to move to asterisk 1.8.0 and the fact that most of this support is actually in libpri (1.4.11.3 onwards or something) and not in asterisk itself I figured it shouldn’t be too hard to backport this. So I did:

--- asterisk-1.6.2.11.orig/configure.ac	2010-09-16 07:39:57.845000303 +0200
+++ asterisk-1.6.2.11/configure.ac	2010-09-16 07:31:46.925000341 +0200
@@ -333,6 +333,7 @@
 AST_EXT_LIB_SETUP([PORTAUDIO], [PortAudio], [portaudio])
 AST_EXT_LIB_SETUP([PRI], [ISDN PRI], [pri])
 AST_EXT_LIB_SETUP_DEPENDENT([PRI_INBANDDISCONNECT], [ISDN PRI set_inbanddisconnect], [PRI], [pri])
+AST_EXT_LIB_SETUP_DEPENDENT([PRI_CALL_HOLD], [ISDN PRI call hold], [PRI], [pri])
 AST_EXT_LIB_SETUP([PWLIB], [PWlib], [pwlib])
 AST_EXT_LIB_SETUP([RADIUS], [Radius Client], [radius])
 AST_EXT_LIB_SETUP([RESAMPLE], [LIBRESAMPLE], [resample])
@@ -1489,6 +1490,7 @@
 AST_EXT_LIB_CHECK([PORTAUDIO], [portaudio], [Pa_GetDeviceCount], [portaudio.h])
 
 AST_EXT_LIB_CHECK([PRI], [pri], [pri_new_bri], [libpri.h])
+AST_EXT_LIB_CHECK([PRI_CALL_HOLD], [pri], [pri_hold_enable], [libpri.h])
 
 AST_EXT_LIB_CHECK([PRI_PROG_W_CAUSE], [pri], [pri_progress_with_cause], [libpri.h])
 
--- asterisk-1.6.2.11.orig/channels/chan_dahdi.c	2010-09-15 11:43:38.149000262 +0200
+++ asterisk-1.6.2.11/channels/chan_dahdi.c	2010-09-16 07:54:48.525000262 +0200
@@ -16621,7 +16621,12 @@
 					confp->chan.sig = SIG_BRI_PTMP;
 					confp->pri.nodetype = PRI_CPE;
 				} else if (!strcasecmp(v->value, "bri_net_ptmp")) {
+#if defined(HAVE_PRI_CALL_HOLD)
+					confp->chan.sig = SIG_BRI_PTMP;
+					confp->pri.nodetype = PRI_NETWORK;
+#else
 					ast_log(LOG_WARNING, "How cool would it be if someone implemented this mode!  For now, sucks for you. (line %d)\n", v->lineno);
+#endif
 				} else if (!strcasecmp(v->value, "gr303fxoks_net")) {
 					confp->chan.sig = SIG_GR303FXOKS;
 					confp->pri.nodetype = PRI_NETWORK;

The patch itself is simple enough and seems to work from rather basic testing (can initiate outbound calls, and receive inbound calls, using dahdi 2.4.0 and libpri 1.4.11.4). YMMV, please let me know if you experience problems.

Also, note that you’ll need to regenerate the configure script after applying the patch.

Leave a Reply

This blog is kept spam free by WP-SpamFree.