Categories: Vicidial

How to – Patch Asterisk 16 or 18 for ViciDial

How to – Patch Asterisk 16 or 18 for ViciDial

In this article, I will go over how to patch newer versions of Asterisk that can be used with ViciDIal. Copy and paste the lines of code that have to do with the version of Asterisk you plan to use.

Step 1 – Download the needed files for Asterisk and the patches from ViciDial

cd /usr/src/asterisk
wget https://downloads.asterisk.org/pub/telephony/asterisk/old-releases/asterisk-16.30.0.tar.gz
wget https://downloads.asterisk.org/pub/telephony/asterisk/old-releases/asterisk-18.18.1.tar.gz
tar -xzvf asterisk-16.30.0.tar.gz
tar -xzvf asterisk-18.18.1.tar.gz

cd /usr/src/asterisk/asterisk-16.30.0
wget http://download.vicidial.com/asterisk-patches/Asterisk-16/amd_stats.patch
wget http://download.vicidial.com/asterisk-patches/Asterisk-16/iax2_peer_status.patch
wget http://download.vicidial.com/asterisk-patches/Asterisk-16/sip_logging_peer_status.patch
wget http://download.vicidial.com/asterisk-patches/Asterisk-16/timeout_reset_dial.patch
wget http://download.vicidial.com/asterisk-patches/Asterisk-16/timeout_reset_dial_app.patch
cd apps/
wget http://download.vicidial.com/asterisk-patches/Asterisk-16/enter.h
wget http://download.vicidial.com/asterisk-patches/Asterisk-16/leave.h
yes | cp -rf enter.h.1 enter.h
yes | cp -rf leave.h.1 leave.h

cd /usr/src/asterisk/asterisk-18.18.1/
wget http://download.vicidial.com/asterisk-patches/Asterisk-18/amd_stats-18.patch
wget http://download.vicidial.com/asterisk-patches/Asterisk-18/iax_peer_status-18.patch
wget http://download.vicidial.com/asterisk-patches/Asterisk-18/sip_peer_status-18.patch
wget http://download.vicidial.com/asterisk-patches/Asterisk-18/timeout_reset_dial_app-18.patch
wget http://download.vicidial.com/asterisk-patches/Asterisk-18/timeout_reset_dial_core-18.patch
cd apps/
wget http://download.vicidial.com/asterisk-patches/Asterisk-18/enter.h
wget http://download.vicidial.com/asterisk-patches/Asterisk-18/leave.h
yes | cp -rf enter.h.1 enter.h
yes | cp -rf leave.h.1 leave.h

Step 2 – Apply the patches to the version you chose to use

Now that we’ve got the files, lets begin patching them as shown below. After applying each patch, copy and paste the location shown below each patch line.

Asterisk 16 patches

patch < amd_stats.patch apps/app_amd.c
patch < iax2_peer_status.patch channels/chan_iax2.c
patch < sip_logging_peer_status.patch channels/chan_sip.c
patch < timeout_reset_dial_app.patch apps/app_dial.c
patch < timeout_reset_dial.patch main/dial.c

Asterisk 18 patches

patch < amd_stats-18.patch apps/app_amd.c
patch < iax_peer_status-18.patch channels/chan_iax2.c
patch < sip_peer_status-18.patch channels/chan_sip.c
patch < timeout_reset_dial_app-18.patch apps/app_dial.c
patch < timeout_reset_dial_core-18.patch main/dial.c

Step 3 – Compile Asterisk

Now to compile Asterisk after applying the necessary patches. Copy and paste the desired Asterisk version code.

Asterisk 16

cd /usr/src/asterisk/asterisk-16.30.0/
: ${JOBS:=$(( $(nproc) + $(nproc) / 2 ))}
./configure --libdir=/usr/lib64 --with-gsm=internal --enable-opus --enable-srtp --with-ssl --enable-asteriskssl --with-pjproject-bundled --with-jansson-bundled

make menuselect/menuselect menuselect-tree menuselect.makeopts
#enable app_meetme
menuselect/menuselect --enable app_meetme menuselect.makeopts
#enable res_http_websocket
menuselect/menuselect --enable res_http_websocket menuselect.makeopts
#enable res_srtp
menuselect/menuselect --enable res_srtp menuselect.makeopts
make -j ${JOBS} all
make install

Asterisk 18

cd /usr/src/asterisk/asterisk-18.18.1/
: ${JOBS:=$(( $(nproc) + $(nproc) / 2 ))}
./configure --libdir=/usr/lib64 --with-gsm=internal --enable-opus --enable-srtp --with-ssl --enable-asteriskssl --with-pjproject-bundled --with-jansson-bundled

make menuselect/menuselect menuselect-tree menuselect.makeopts
#enable app_meetme
menuselect/menuselect --enable app_meetme menuselect.makeopts
#enable res_http_websocket
menuselect/menuselect --enable res_http_websocket menuselect.makeopts
#enable res_srtp
menuselect/menuselect --enable res_srtp menuselect.makeopts
make -j ${JOBS} all
make install

That completes this article, make sure you restart asterisk if its running with “core restart now”

-Chris aka carpenox

carpenox

View Comments

  • Trying this with stock asterisk 16.30.0 and 16.30.1, all patches are applied except one hunk which fails same way for both versions:

    $patch < timeout_reset_dial_app.patch apps/app_dial.c
    patching file apps/app_dial.c
    Hunk #1 FAILED at 1222.
    Hunk #2 succeeded at 1554 (offset 42 lines).
    Hunk #3 succeeded at 1615 (offset 58 lines).
    1 out of 3 hunks FAILED -- saving rejects to file apps/app_dial.c.rej

    Looking at apps/app_dial.c compared to asterisk-16.17.0 there are indeed changes.
    The screenshots you posted from asterisk 18 patching also indicate most patches failed.

  • On a second read- the patches here named for asterisk 16.29.1 all work:
    https://download.opensuse.org/repositories/home:/vicidial:/asterisk-16/openSUSE_Leap_15.5/src/asterisk-16.30.0-lp155.4.75.src.rpm

    cp -vf enter.h apps/enter.h
    cp -vf leave.h apps/leave.h
    patch < amd_stats-16.patch apps/app_amd.c
    patch < iax2_peer_status-16.29.0.patch channels/chan_iax2.c
    patch < sip_logging_peer_status-16.29.0.patch channels/chan_sip.c
    patch < timeout_reset_dial_app-16.29.0.patch apps/app_dial.c
    patch < timeout_reset_dial.patch main/dial.c

Recent Posts

How to – Fix Apache not starting on ViciBox

How to - Fix Apache not starting on ViciBox There is a new issue with…

3 weeks ago

How to – Use the full functionality of the ViciDial installer by carpenox

How to - Use the full functionality of the ViciDial installer by carpenox Vicidial administrators, take note: the Carpenox Auto Installer is about to change the game. This tool transforms the usually complex setup of Vicidial into a smooth, hassle-free experience. Let…

2 months ago

How to – Decrease SDP(short duration percent) in ViciDial

How to - Decrease SDP(short duration percent) in ViciDial There is a new feature in…

2 months ago

August 2024 VICIdial Security Update

August 2024 VICIdial Security Update Please read this carefully as it contains important information regarding…

4 months ago

50% off by joining our discord!

50% off by joining our discord! Unlock 50% Off Any Item in Our Store by…

4 months ago

Empower Your Business with a White Labeled Dialer Solution from CyburDial

Empower Your Business with a White Labeled Dialer Solution from CyburDial In today's rapidly evolving…

8 months ago

This website uses cookies.