Skip to content

Commit

Permalink
chan_sccp: Fix compilation on Asterisk 21+.
Browse files Browse the repository at this point in the history
The upstream chan_sccp code does not compile with
Asterisk's HEAD anymore since it still uses macro
functions; apply an umerged patch to remove macros
if needed.
  • Loading branch information
InterLinked1 committed Apr 2, 2024
1 parent e1737c5 commit 3f87130
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 8 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ jobs:
sudo wget https://raw.githubusercontent.com/InterLinked1/phreakscript/master/phreaknet.sh
sudo chmod +x phreaknet.sh
sudo ./phreaknet.sh make
sudo phreaknet install -d -s -t
sudo phreaknet runtests
sudo phreaknet install -d -s --devmode
# Skip tests on Ubuntu, since it takes the longest, and runtime doesn't vary by platform
debian-stable-asterisk-lts:
runs-on: ubuntu-latest
container: debian:12
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ PhreakScript installs:
- Message Send Protocol send support
- AGI `RECORD FILE` option to require noise before silence detection
- Optional build enhancements
- `chan_sccp` (improved community Skinny/SCCP channel driver)
- `chan_sccp` (improved community Skinny/SCCP channel driver), with compilation fixes
- Cisco Call Manager support for `chan_sip`
- Restored and enhanced [`chan_sip`](https://github.com/InterLinked1/chan_sip) for master / versions 21+ (removed by Sangoma)
- Adds the following applications:
Expand Down
34 changes: 29 additions & 5 deletions phreaknet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,7 @@ Options:
--cisco install: Add full support for Cisco Call Manager phones (chan_sip only)
--sccp install: Install chan_sccp channel driver (Cisco Skinny)
--drivers install: Also install DAHDI drivers removed in 2018
--generic install: Use generic kernel headers that do not match the installed kernel version
--extcodecs install: Specify this if any external codecs are being or will be installed
--freepbx install: Install FreePBX GUI (not recommended)
--manselect install: Manually run menuselect yourself
Expand Down Expand Up @@ -784,6 +785,13 @@ install_prereq() {
apt-get -y autoremove
elif [ "$PAC_MAN" = "yum" ]; then
yum install -y git patch
# Stop on RHEL systems without an active subscription
if ! which git > /dev/null; then
if [ -f /etc/redhat-release ]; then
echoerr "Subscription required to use RHEL package manager"
fi
die "Git does not appear to be installed"
fi
# Rocky Linux seems to be missing libedit-devel, and this package is "missing"
if [ "$OS_DIST_INFO" = "Rocky Linux release 8.9 (Green Obsidian)" ]; then
dnf --enablerepo=devel install -y libedit-devel
Expand Down Expand Up @@ -1354,8 +1362,10 @@ install_dahdi() {
apt-get install -y pkg-config m4 libtool automake autoconf git
linux_headers_install_apt
elif [ "$PAC_MAN" = "yum" ]; then
dnf install -y m4 libtool automake autoconf kernel-devel kernel-headers-$(uname -r)
dnf install -y m4 libtool automake autoconf kernel-devel kernel-headers
#dnf install -y kernel-headers-$(uname -r)
dnf list installed | grep kernel-headers
rpm -qa | grep kernel
else
echoerr "Unable to install potential DAHDI prerequisites"
sleep 2
Expand Down Expand Up @@ -1413,13 +1423,18 @@ install_dahdi() {
exit 2
fi

# DAHDI Linux (generally recommended to install DAHDI Linux and DAHDI Tools separately, as oppose to bundled)
# DAHDI Linux (generally recommended to install DAHDI Linux and DAHDI Tools separately, as opposed to bundled)
cd $AST_SOURCE_PARENT_DIR/$DAHDI_LIN_SRC_DIR

DAHDI_CFLAGS=""
if [ "$GENERIC_HEADERS" = "1" ]; then
ls -la /lib/modules/
hdrver=`ls /lib/modules`
if [ -f /etc/redhat-release ]; then
ls /usr/src/kernels
hdrver=`ls /usr/src/kernels`
else
ls -la /lib/modules/
hdrver=`ls /lib/modules`
fi
DAHDI_CFLAGS="KVERS=$hdrver" # overwrite from exact match with uname -r to whatever we happen to have
printf "We do NOT have an exact kernel match: %s\n" "$hdrver"
else
Expand Down Expand Up @@ -2411,6 +2426,9 @@ get_source() {
ENHANCED_CHAN_SIP=1 # chan_sip isn't present anymore, we need to readd it ourselves (if we're going to build chan_sip at all)
fi
if [ "$SIP_CISCO" = "1" ]; then # ASTERISK-13145 (https://issues.asterisk.org/jira/browse/ASTERISK-13145)
if [ ! -f channels/chan_sip.c ]; then
die "chan_sip is not present in this source, please add the --sip option"
fi
# https://usecallmanager.nz/patching-asterisk.html and https://github.com/usecallmanagernz/patches
wget -q "https://raw.githubusercontent.com/usecallmanagernz/patches/master/asterisk/$CISCO_CM_SIP.patch" -O /tmp/$CISCO_CM_SIP.patch
patch --strip=1 < /tmp/$CISCO_CM_SIP.patch
Expand Down Expand Up @@ -2446,7 +2464,7 @@ else
fi

FLAG_TEST=0
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,sccp,clli:,debug:,devmode,disa:,drivers,experimental,extcodecs,fast,freepbx,lightweight,api-key:,rotate,audit,boilerplate,upstream:,manselect,minimal,vanilla,wanpipe -- "$@")
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,sccp,clli:,debug:,devmode,disa:,drivers,experimental,extcodecs,fast,freepbx,generic,lightweight,api-key:,rotate,audit,boilerplate,upstream:,manselect,minimal,vanilla,wanpipe -- "$@")
VALID_ARGUMENTS=$?
if [ "$VALID_ARGUMENTS" != "0" ]; then
usage
Expand Down Expand Up @@ -2490,6 +2508,7 @@ while true; do
--extcodecs ) EXTERNAL_CODECS=1; shift ;;
--fast ) FAST_COMPILE=1; shift ;;
--freepbx ) FREEPBX_GUI=1; shift ;;
--generic ) GENERIC_HEADERS=1; shift ;;
--lightweight ) LIGHTWEIGHT=1; shift ;;
--api-key ) INTERLINKED_APIKEY=$2; shift 2;;
--rotate ) ASTKEYGEN=1; shift ;;
Expand Down Expand Up @@ -3045,6 +3064,11 @@ elif [ "$cmd" = "install" ]; then
if [ $? -eq 0 ]; then
git fetch
git pull
if [ $AST_MAJOR_VER -ge 21 ]; then
# Remove macros, or it won't even compile
$WGET "https://github.com/chan-sccp/chan-sccp/commit/3c90b6447b17639c52b47ed61cfb154b15ee84ec.patch"
git apply "3c90b6447b17639c52b47ed61cfb154b15ee84ec.patch"
fi
./configure --enable-conference --enable-advanced-functions --with-asterisk=../$AST_SRC_DIR
make -j$(nproc) && make install && make reload
if [ $? -ne 0 ]; then
Expand Down

0 comments on commit 3f87130

Please sign in to comment.