Recompile Asterisk

Home » Asterisk Users » Recompile Asterisk
Asterisk Users 6 Comments

I need to recompile asterisk to install some apps.
Does anyone has a good tutorial on how to do this ? I’ve asterisk
1.4.13 installed should I upgrade to 1.6 ? will I benifit from video
improvements if I upgrade ? Will I loose asterisk settings if I recompile ?
If you have previously recompiled asterisk please let me know your
Any information about this will be very welcome.
Thanks! Regards,

6 thoughts on - Recompile Asterisk

  • LL wrote:

    From the statement above, you’re giving conflicting information.

    You first sounded like the installation was compiled from source, but
    then you’re asking for a tutorial on how to compile.

    If the installation was installed by your distro’s package manager, then
    you won’t want to install from source.

    Can you tell us how it was installed?


  • I’m sorry if I gave conflicting information but I didn’t setup this
    specific freepbx/asterisk and I’m not sure if it was compiled from
    source, probably not, but I’ll have to double check it the person that
    installed it. I know that I currently running asterisk 1.4.13 + FreePBX on CentOS 5 x64.
    I need to compile app_mp4 and I’ve read that I need to compile asterisk
    from source in order to achieve this, does this make any sense ?
    I’m following a tutorial on how to compile app_mp4 at,
    but I’m afraid to go ahead and lose my current freepbx/asterisk settings.
    I’m pretty new to asterisk, based on this, some of my questions may not
    the the million dollar questions…, basically, what I need is to
    install the app_mp4 and several others apps and make sure the system
    config (extensions, trunks, etc) is preserved.
    any good advises ?

    Thank you all,

  • The “safest” (IMO) method for installing new settings would be to download
    1.4.13 (if you can find that old of an archive) and build it on another
    machine, then copy the needed .so modules to /usr/local/asterisk/modules on
    your running machine. You should be able to see if it was compiled or built
    from an rpm by doing “show version” from CLI.

  • The “*show version*” command returns : *Asterisk built by root @*
    (Danny) Your idea seems to be the safest one.

    This is what I’ll do :
    1 – setup a *new virtual machine* with the same OS and version as the
    *master server* where asterisk is installed.
    2 – *vm asterisk – *install the required libraries to compile asterisk
    and other custom apps
    3 – *vm asterisk – *compile custom apps (app_mp4 ->
    4 – *vm asterisk – *compile asterisk 1.4.25 (my version is 25 and not
    13) any good tutorial on this ?
    5 – *master asterisk – *backup **server modules –
    6 – copy the newest compile modules from the *vm asterisk* to the
    *master asterisk*

    1 – Do I need to backup any other files besides
    /usr/local/asterisk/modules/*.so ?
    2 – Will asterisk “assume” the new modules just by restarting it ?
    3 – if everything goes wrong can I restore asterisk by coping the backup
    modules ?

    Any help will be very welcome,
    Happy 2012!

  • Maybe. I believe that the headers of Asterisk (installed to
    /usr/include/asterisk ) include anything you need to build an external
    module. Though I wouldn’t be completely surprised if those were not
    complete in 1.4.13 .

    Furthermore, they instruct you to re-run configure, but then they don’t
    really rely on that and manually add the extra libraries to the build
    line. I don’t see why you’ll need to re-run configure if you already
    have the built source directory.

    Building it independently would be something along the lines of:

    gcc $CFLAGS -DAST_MODULE=”app_mp4″ -shared -o app_mp4.c -lmp4 -lmp4v2

    Where CFLAGS would typically be -O2 and such.

    This should hopefully build you . Next, make sure it does not
    load automatically until you verified it to work: in modules.conf:

    unload =>

    At this point you may crash Asterisk. So do it in the off-hours or on a
    different instance.

    Try loading it manually in the Asterisk CLI:

    module load

    Check if it actually works.

    If all goes well, disable the “unload” entry in modules.conf .

  • Thank you so much Tzafrir, it all make sense to me now.
    I’ll follow your tips and let you know if it works.