Skip to content

Commit 10df4e7

Browse files
committed
install: Add ability to build/install G.729 codec module.
Add option and standalone command for G.729 support. G.723 is not currently supported due to the unavailability of the needed Intel IPP installers and lack of developer support.
1 parent 7c4caaf commit 10df4e7

File tree

2 files changed

+63
-4
lines changed

2 files changed

+63
-4
lines changed

phreaknet.1.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ the best Asterisk and DAHDI experience.
6969
**experimental**
7070
: Add experimental features to an existing Asterisk source
7171

72+
**g72x**
73+
: Add G.723.1/G.729 support to an existing installation
74+
7275
**dahdi**
7376
: Install or upgrade DAHDI (only). Generally this command does not need to be used. To install Asterisk with DAHDI, use the install command and provide the -d or --dahdi option instead.
7477

@@ -306,6 +309,9 @@ The following options may be used with the **install** command.
306309
**--experimental**
307310
: Install experimental features that may not be production ready
308311

312+
**--g72x**
313+
: Compile with support for G.723.1/G.729 codecs
314+
309315
**--extcodecs**
310316
: Specify this if any external codecs are being or will be installed. Failure to do so may result in a crash on startup.
311317

phreaknet.sh

Lines changed: 57 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,7 @@ IGNORE_FAILURES=0
259259
ENHANCED_INSTALL=1
260260
PREFER_RELEASE_CANDIDATES=1
261261
EXPERIMENTAL_FEATURES=0
262+
G72X_CODECS=0
262263
LIGHTWEIGHT=0
263264
FAST_COMPILE=0
264265
PKG_AUDIT=0
@@ -527,6 +528,7 @@ Commands:
527528
experimental Add experimental features to an existing Asterisk source
528529
dahdi Install or upgrade PhreakNet-enhanced DAHDI
529530
wanpipe Install wanpipe
531+
g72x Add G.723.1/G.729 support to an existing installation
530532
odbc Install ODBC (MariaDB)
531533
installts Install Asterisk Test Suite
532534
fail2ban Install Asterisk fail2ban configuration
@@ -624,6 +626,7 @@ Options:
624626
--audit install: Audit package installation
625627
--devmode install: Compile with devmode enabled
626628
--experimental install: Install experimental features that may not be production ready
629+
--g72x install: Compile with support for G.723.1/G.729 codecs
627630
--fast install: Compile as fast as possible
628631
--lightweight install: Only install basic, required modules for basic Asterisk functionality
629632
--alsa install: Ensure ALSA library detection exists in the build system. This does NOT readd the deprecated/removed chan_alsa module.
@@ -2482,6 +2485,35 @@ add_experimental() {
24822485
custom_module "res/res_pjsip_sca_body_generator.c" "https://code.phreaknet.org/asterisk/res_pjsip_sca_body_generator.c"
24832486
}
24842487

2488+
build_g72x() {
2489+
cd $AST_SOURCE_PARENT_DIR
2490+
2491+
echoerr "WARNING: G.723 is not currently supported, due to unavailability of compatible Intel IPP and lack of developer support. Only G.729 will be supported."
2492+
sleep 1
2493+
2494+
if [ "$OFFLINE_INSTALL" = "1" ]; then
2495+
cp -r $OFFLINE_DIR/bcg729 .
2496+
cp -r $OFFLINE_DIR/asterisk-g72x .
2497+
else
2498+
git clone --depth 1 https://github.com/BelledonneCommunications/bcg729.git
2499+
git clone --depth 1 https://github.com/arkadijs/asterisk-g72x.git
2500+
fi
2501+
2502+
cd bcg729
2503+
ensure_installed cmake
2504+
cmake .
2505+
$AST_MAKE && $AST_MAKE install
2506+
cd ..
2507+
2508+
cd asterisk-g72x
2509+
./autogen.sh
2510+
./configure --with-bcg729
2511+
$AST_MAKE && $AST_MAKE install
2512+
if [ ! -f /usr/lib/asterisk/modules/codec_g729.so ]; then
2513+
echoerr "Failed to build G.729 codec"
2514+
fi
2515+
}
2516+
24852517
# Instantiate an instance of the PhreakScript repository, if not already present
24862518
# This is necessary since this script file is designed to be able to be used standalone,
24872519
# without the rest of the repository necessarily being present.
@@ -3257,7 +3289,7 @@ else
32573289
fi
32583290

32593291
FLAG_TEST=0
3260-
PARSED_ARGUMENTS=$(getopt -n phreaknet -o bc:u:dfhostu:v:w -l backtraces,cc:,dahdi,force,flag-test,help,sip,testsuite,user:,version:,weaktls,alsa,cisco,rpt,sccp,clli:,debug:,devmode,disa:,drivers,experimental,extcodecs,fast,freepbx,generic,autokvers,lightweight,api-key:,rotate,audit,boilerplate,upstream:,manselect,minimal,vanilla,wanpipe,offline,noupdate -- "$@")
3292+
PARSED_ARGUMENTS=$(getopt -n phreaknet -o bc:u:dfhostu:v:w -l backtraces,cc:,dahdi,force,flag-test,help,sip,testsuite,user:,version:,weaktls,alsa,cisco,rpt,sccp,clli:,debug:,devmode,disa:,drivers,experimental,extcodecs,g72x,fast,freepbx,generic,autokvers,lightweight,api-key:,rotate,audit,boilerplate,upstream:,manselect,minimal,vanilla,wanpipe,offline,noupdate -- "$@")
32613293
VALID_ARGUMENTS=$?
32623294
if [ "$VALID_ARGUMENTS" != "0" ]; then
32633295
usage
@@ -3302,6 +3334,7 @@ while true; do
33023334
--extcodecs ) EXTERNAL_CODECS=1; shift ;;
33033335
--fast ) FAST_COMPILE=1; shift ;;
33043336
--freepbx ) FREEPBX_GUI=1; shift ;;
3337+
--g72x ) G72X_CODECS=1; shift ;;
33053338
--generic ) GENERIC_HEADERS=1; shift ;;
33063339
--autokvers ) AUTOSET_KVERS=1; shift ;;
33073340
--lightweight ) LIGHTWEIGHT=1; shift ;;
@@ -3536,6 +3569,18 @@ elif [ "$cmd" = "experimental" ]; then
35363569
else
35373570
echoerr "Your version of Asterisk is not eligible for experimental features"
35383571
fi
3572+
elif [ "$cmd" = "g72x" ]; then
3573+
assert_root
3574+
cd $AST_SOURCE_PARENT_DIR
3575+
AST_SRC_DIR=`get_newest_astdir`
3576+
printf "Installing G.72x support\n"
3577+
if [ ! -d /usr/include/asterisk ]; then
3578+
cd $AST_SRC_DIR
3579+
$AST_MAKE install-headers
3580+
cd ..
3581+
fi
3582+
build_g72x
3583+
$AST_MAKE
35393584
elif [ "$cmd" = "offline" ]; then
35403585
OFFLINE_PREP=1
35413586
AST_SOURCE_PARENT_DIR=$OFFLINE_DIR
@@ -3558,6 +3603,10 @@ elif [ "$cmd" = "offline" ]; then
35583603
$WGET http://downloads.asterisk.org/pub/telephony/libpri/releases/${LIBPRI_SOURCE_NAME}.tar.gz && mv ${LIBPRI_SOURCE_NAME}.tar.gz libpri.tar.gz
35593604
$WGET https://github.com/asterisk/libss7/archive/refs/tags/${LIBSS7_VERSION}.tar.gz && mv ${LIBSS7_VERSION}.tar.gz libss7.tar.gz
35603605
$WGET https://ftp.sangoma.com/linux/current_wanpipe/${WANPIPE_SOURCE_NAME}.tgz && mv ${WANPIPE_SOURCE_NAME}.tgz wanpipe.tgz
3606+
if [ "$G72X_CODECS" = "1" ]; then
3607+
git clone --depth 1 https://github.com/BelledonneCommunications/bcg729.git
3608+
git clone --depth 1 https://github.com/arkadijs/asterisk-g72x.git
3609+
fi
35613610
get_ast_source # end up with an asterisk-offline directory
35623611
echog "Offline installation source prepared in $AST_SOURCE_PARENT_DIR - copy this directory to target system for offline installation"
35633612
ls $AST_SOURCE_PARENT_DIR
@@ -3828,6 +3877,13 @@ elif [ "$cmd" = "install" ]; then
38283877
die "Compilation or doc validation failed"
38293878
fi
38303879

3880+
if [ "$DEVMODE" = "1" ] || [ "$G72X_CODECS" = "1" ]; then
3881+
$AST_MAKE install-headers # install development headers
3882+
fi
3883+
if [ "$G72X_CODECS" = "1" ]; then
3884+
build_g72x
3885+
fi
3886+
38313887
# Install Asterisk
38323888
if [ -d /usr/lib/asterisk/modules ]; then
38333889
rm -f /usr/lib/asterisk/modules/*.so
@@ -3860,9 +3916,6 @@ elif [ "$cmd" = "install" ]; then
38603916
exit 1
38613917
fi
38623918

3863-
if [ "$DEVMODE" = "1" ]; then
3864-
$AST_MAKE install-headers # install development headers
3865-
fi
38663919
install_samples
38673920
if [ "$OS_DIST_INFO" = "FreeBSD" ]; then
38683921
for FILE in $(find /usr/local/lib/asterisk/modules -name "*.so" ) ; do

0 commit comments

Comments
 (0)