Recompile Asterisk

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
experience!
Any information about this will be very welcome.
Thanks! Regards,
LL

6 Responses to “Recompile Asterisk”

  1. Doug Lytle said:

    Dec 30, 11 at 10:21 am

    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?

    Doug

  2. LL said:

    Dec 30, 11 at 1:11 pm

    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
    2.9.0.7 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
    http://web.archive.org/web/20090322060930/http://sip.fontventa.com/content/view/15/44/,
    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,

  3. "Danny Nicholas" said:

    Dec 30, 11 at 3:55 pm

    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.

  4. LL said:

    Dec 31, 11 at 4:16 am

    The “*show version*” command returns : *Asterisk 1.4.25.1 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 ->
    http://asteriskvideo.svn.sourceforge.net/)
    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 -
    /usr/local/asterisk/modules/*.so
    6 – copy the newest compile modules from the *vm asterisk* to the
    *master asterisk*

    Questions:
    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!
    LL

  5. Tzafrir Cohen said:

    Dec 31, 11 at 6:03 am

    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.so app_mp4.c -lmp4 -lmp4v2

    Where CFLAGS would typically be -O2 and such.

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

    unload => app_mp4.so

    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 app_mp4.so

    Check if it actually works.

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

  6. LL said:

    Dec 31, 11 at 6:09 am

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

    LL