Page 1 of 3 123 LastLast
Results 1 to 10 of 25

Thread: HOWTO: Compile Asterisk from scratch

  1. #1
    Join Date
    Feb 2005
    Location
    Windsor, California
    Beans
    292
    Distro
    Ubuntu 7.10 Gutsy Gibbon

    HOWTO: Compile Asterisk from scratch

    I took notes on what I did so I could do it later. Maybe someone else might find them useful. They might not be the most ideal - I'm not an expert but please feel free to comment and I'll update this message.

    0. Edit the /etc/apt/sources.list file to remove the # signs before the lines that begin with # deb http to activate them and then do apt-get update.

    1. Install Packages:
    apt-get install sendmail zlib1g-dev libssl-dev ncurses-dev libnewt-dev gcc-3.4 subversion openssh-server build-essential linux-source-2.6.12 (or whatever kernel you have)

    2. Prepare Linux kernel source
    cd /usr/src
    tar xvjf linux-source*
    (Extracts the files from the zip file)
    rm linux-source-2.6.12.tar.bz2 (Don't need the zip anymore)
    ln -s linux-source-2.6.12 linux (makes /usr/src/linux point to /usr/src/linux-source-2.6.12)
    cd linux
    cp /boot/config-2.6.whatever .config
    (copies the config file that was used to compile your kernel into the /usr/src/linux dir)
    make menuconfig then exit and save config
    uname -r
    (examine what comes after 2.6.12 For example, I had 2.6.12-9-386)
    vi /usr/src/linux/Makefile
    Go to the EXTRAVERSION line and make it like so:
    EXTRAVERSION=-9-386
    make modules_prepare
    ln -s /usr/src/linux /lib/modules/`uname -r`/build

    3. Get Asterisk Packages
    cd /usr/src
    svn checkout http://svn.digium.com/svn/asterisk/branches/1.2 asterisk-1.2
    svn checkout http://svn.digium.com/svn/zaptel/branches/1.2 zaptel-1.2
    svn checkout http://svn.digium.com/svn/libpri/branches/1.2 libpri-1.2
    svn checkout http://svn.digium.com/svn/asterisk-sounds/branches/1.0 asterisk-sounds-1.0


    4. Compile Stuff
    -=libpri=-
    cd /usr/src/libpri-1.2
    make clean
    make
    make install
    -=Zaptel Modules=- (If you're going to use zaptel hardware to connect to PSTN)
    cd /usr/src/zaptel-1.2
    Change anything in /usr/src/zaptel/zconfig.h if you need to (I didn't need to)
    make clean
    make linux26
    make zttool
    make install
    -=Asterisk=-
    cd /usr/src/asterisk-1.2
    make clean
    make mpg123

    note: This doesn't work for me as of 2-20-07. I had to go into the mpg123 directory myself and type:

    make CC=gcc LDFLAGS= OBJECTS='decode_i386.o dct64_i386.o decode_i586.o audio_oss.o term.o' CFLAGS='-DI386_ASSEM -DPENTIUM_OPT -DREAL_IS_FLOAT -DLINUX -DREAD_MMAP -DOSS -DTERM_CONTROL -Wall -O2 -m486 -fomit-frame-pointer -funroll-all-loops -finline-functions -ffast-math' mpg123-make

    make
    make install
    make samples
    (if you want sample config files put into /etc/asterisk)
    -=Asterisk-Sounds=-
    cd /usr/src/asterisk-sounds-1.0
    make install

    5. Edit udev
    vi /etc/udev/udev.rules

    Stick the paragraph below somewhere

    # Section for zaptel device
    KERNEL="zapctl", NAME="zap/ctl"
    KERNEL="zaptimer", NAME="zap/timer"
    KERNEL="zapchannel", NAME="zap/channel"
    KERNEL="zappseudo", NAME="zap/pseudo"
    KERNEL="zap[0-9]*", NAME="zap/%n"


    6. That's the installation part. Go ahead and reboot. Then, if you have some zaptel piece of hardware installed, try lsmod | grep zap and see if the two modules are already installed.

    7. Configure it!

    ================edit: removed extra steps to manually compile mpg123 that weren't necessary.
    edit2: removed tar extraction step since svn brings the files over untarred. (duh)
    edit3: Added some explanation notes.
    edit4: Added mpg123 compile note 2-20-07
    Last edited by fizgig; February 20th, 2007 at 11:49 PM.
    come on guys, it's all ball bearings nowadays

  2. #2
    Join Date
    Feb 2006
    Beans
    12

    Re: HOWTO: Compile Asterisk from scratch

    I'm having a problem that I'm guessing is udev related.

    I built the zaptel drivers successfully and rebooted using the directions found here:

    http://www.voip-info.org/wiki/index....l+Installation

    When I enter

    modprobe zaptel

    I receive:

    FATAL: Module zaptel not found.

    I am using Ubuntu 5.1, and I believe that is the nature of the problem.

    In the /etc/udev/rules.d folder, there was no file named 50-udev.rules. Instead, there was a symbolic link to ../udev.rules, and in the file ../udev.rules I found that the zaptel definitions had already been included, except that they used an "==" in the KERNEL statements rather than a single "=". I tried modifying them, adding new ones, etc., but nothing has worked.

    I did some googling and decided to copy the ../udev.rules to the /etc/udev/rules.d folder under the name 50-udev.rules. I rebooted and it still didn't work.

    So, I moved the file 50-udev.rules up to the parent directory and created a symbolic link to the new location named 50-udev.rules, but it still doesn't work.

    I have confirmed that the file /etc/modprobe.d/zaptel is the output from my zaptel build.

    Clearly, I'm missing a very simple point, but I just can't find it.

    Thanks in advance for any help.

  3. #3
    Join Date
    Feb 2005
    Location
    Windsor, California
    Beans
    292
    Distro
    Ubuntu 7.10 Gutsy Gibbon

    Re: HOWTO: Compile Asterisk from scratch

    Well, if you didn't do it my way I don't think I'm smart enough to help you.
    come on guys, it's all ball bearings nowadays

  4. #4
    Join Date
    Feb 2006
    Beans
    12

    Re: HOWTO: Compile Asterisk from scratch

    fizgig,

    You underestimate your abilities! By closely examining what you did and comparing to what I did, then doing some trial and error, I found my issue.

    In the other tutorial, it says:

    For a Linux 2.6 kernel you may need to:
    modify the EXTRAVERSION statement in Makefile so it matches what you see in: cat /proc/version

    To clarify that, if your cat/proc/version says (for example):

    Linux version 2.6.12-mytestbuild (root@agpcserver) (gcc version 3.4.5 20050 809 (prerelease) (Ubuntu 3.4.4-6ubuntu8.1)) #1 Wed Mar 8 18:01

    Then the line in your Makefile should be:

    EXTRAVERSION =-mytestbuild

    It was your example that saved me.

    Thanks!

  5. #5
    Join Date
    Feb 2005
    Location
    Windsor, California
    Beans
    292
    Distro
    Ubuntu 7.10 Gutsy Gibbon

    Re: HOWTO: Compile Asterisk from scratch

    sweet! So I helped someone!
    come on guys, it's all ball bearings nowadays

  6. #6
    Join Date
    Feb 2006
    Beans
    12

    I'm so CLOSE!

    I am sure I am missing something very easy.

    I have installed my TDM400 with 4 FXO ports to connect to loopstart lines.

    I've got the drivers loaded, the zttool tells me it sees the 4 channels, but asterisk is not recognizing them.

    One clue is that the output from my asterisk console never indicates that asterisk is attempting to parse /etc/asterisk/zapata.conf. If it never parses it, it will never see the channels.

    Any hints?



    From /etc/zaptel.conf:

    fxsls=1-4
    loadzone = us
    defaultzone=us

    From /etc/asterisk/zapata.conf:

    [trunkgroups]
    [channels]
    usercallerid=yes
    hidecallerid=no
    callwaiting=no
    threewaycalling=yes
    transfer=yes
    echocancel=yes
    echotraining=yes

    context=PublicNetworkRingin
    signalling=fxs_ls

    channel => 1
    channel => 2
    channel => 3
    channel => 4

    In the Asterisk console, if I type:

    show channels

    I get:

    Channel (Context Extension Pri ) State Appl. Data
    0 active channel(s)


    In the zttool, I do see the card:

    Alarms Span │
    │ OK Wildcard TDM400P REV I Board 1 ▒ │


    In the zttool, when I look at the channels, they seem to be there, but no amount of plugging in, unplugging, or ringing in seems to change the status;


    Current Alarms: No alarms. │ │
    │ │ Sync Source: Internally clocked │ ▒ │
    │ │ IRQ Misses: 0 │ ▒ │
    │ │ Bipolar Viol: 0 │ ▒ │
    │ │ Tx/Rx Levels: 0/ 0 │ ▒ │
    │ │ Total/Conf/Act: 4/ 4/ 1 │ ▒ │
    │ │ ┌──────┐ │ ▒ │
    │ │ 1234 │ Back │ │ ▒ │
    │ │ TxA ---- └──────┘ │ ▒ │
    │ │ TxB ---- │ ▒ │
    │ │ TxC ---- │ │
    │ │ TxD ---- │ │
    │ │ ┌──────┐ │ │
    │ │ RxA ---- │ Loop │ │ │
    │ │ RxB ---- └──────┘ │ │
    │ │ RxC ---- │ │
    │ │ RxD ----


    On the physical card, all four green LEDs are lit all of the time.

    If I ring in on any of the lines, Asterisk completely ignores the ringin.

    From /etc/asterisk/extensions.conf:

    [PublicNetworkRingin]
    exten => s,1,answer()
    exten => s,2,echo()

  7. #7
    Join Date
    Feb 2006
    Beans
    12

    Fizgig wins!

    OK Fizgig, you win.

    I see now that the asterisk I got from Ubuntu doesn't include chan_zap. It looks like I need to compile the thing myself.

    Ubuntu was my first try at Linux, and for all the nice things people say about it I think I'll probably try a different distro next time around.

    The feature I THOUGHT I would like best was the ability to simply grab packages and have them work ALMOST right out of the box. Instead, I've spent hours fixing things that would have probably worked the first time if I had just built them myself inside a more standard Linux.

    I guess that's the open source way. Read, try, cry, repeat.

  8. #8
    Join Date
    Feb 2005
    Location
    Windsor, California
    Beans
    292
    Distro
    Ubuntu 7.10 Gutsy Gibbon

    Re: HOWTO: Compile Asterisk from scratch

    Well, good luck in your linux adventure. I will say that I've tried a lot of distros (debian, mepis, xandros, mandrake, redhat) and I always keep coming back to Ubuntu.

    Anyhow, the zaptel modules need to be compiled against the specific kernel you have installed. While ubuntu does include a few custom modules to save you from compiling, I think zaptel modules are a little too out there for a regular distribution to supply.

    Besides, the zaptel code keeps changing so it's easier to use the subversioning system to update them directly from the source instead of waiting for the packager to make them. A compile takes about 15 seconds so I don't see it as a big deal.

    Each to his own I guess.

    p.s. you might want the line that reads fxsls=1-4 to be fxsks-1-4
    Last edited by fizgig; March 11th, 2006 at 04:57 AM.
    come on guys, it's all ball bearings nowadays

  9. #9
    Join Date
    Feb 2006
    Beans
    12

    Re: HOWTO: Compile Asterisk from scratch

    Thanks for the info.

    It's not the zaptel drivers that I'm having trouble with, it's that the asterisk that you get from Ubuntu using Synaptic Package Manager does not include the chan_zap module in the asterisk build. So, the drivers are running great, but asterisk never goes looking for the channels!

    In terms of using kewlstart instead of loopstart, I'm an old-school telephony guy, so I'm sticking with what I know until it is working, then I'll try the new stuff.

    Thanks again. I'm working my way through your tutorial now.

  10. #10
    Join Date
    Feb 2006
    Beans
    12

    Re: HOWTO: Compile Asterisk from scratch

    Hey fizgig,

    I'm trying it your way and have followed everything step-by-step three times now. Each time I try to do:

    make mpg123

    I get all of the following, and then nothing compiles correctly afterward. By the way, I actuall do "sudo make mpg123", but I wouldn't think that would be the difference.

    It appears to me that it is compiling and tryint to optimize for an Intel system (I have an AMD-64), so I'm guessing I need to do something like 'make mpg123 amd-64', but I don't see that option.

    Any hints?


    [ -f mpg123-0.59r.tar.gz ] || wget http://www.mpg123.de/mpg123/mpg123-0.59r.tar.gz
    [ -d mpg123-0.59r ] || tar xfz mpg123-0.59r.tar.gz
    make -C mpg123-0.59r linux
    make[1]: Entering directory `/usr/src/asterisk-1.2/mpg123-0.59r'
    make CC=gcc LDFLAGS= \
    OBJECTS='decode_i386.o dct64_i386.o decode_i586.o \
    audio_oss.o term.o' \
    CFLAGS='-DI386_ASSEM -DPENTIUM_OPT -DREAL_IS_FLOAT -DLINUX \
    -DREAD_MMAP -DOSS -DTERM_CONTROL\
    -Wall -O2 -m486 \
    -fomit-frame-pointer -funroll-all-loops \
    -finline-functions -ffast-math' \
    mpg123-make
    make[2]: Entering directory `/usr/src/asterisk-1.2/mpg123-0.59r'
    make[3]: Entering directory `/usr/src/asterisk-1.2/mpg123-0.59r'
    gcc -DI386_ASSEM -DPENTIUM_OPT -DREAL_IS_FLOAT -DLINUX -DREAD_MMAP -DOSS -DTERM_CONTROL -Wall -O2 -m486 -fomit-frame-pointer -funroll-all-loops -finline-functions -ffast-math -c -o mpg123.o mpg123.c
    mpg123.c: In function ‘shuffle_files’:
    mpg123.c:225: warning: implicit declaration of function ‘time’
    mpg123.c: At top level:
    mpg123.c:480: warning: initialization makes integer from pointer without a cast
    gcc -DI386_ASSEM -DPENTIUM_OPT -DREAL_IS_FLOAT -DLINUX -DREAD_MMAP -DOSS -DTERM_CONTROL -Wall -O2 -m486 -fomit-frame-pointer -funroll-all-loops -finline-functions -ffast-math -c -o common.o common.c
    gcc -DI386_ASSEM -DPENTIUM_OPT -DREAL_IS_FLOAT -DLINUX -DREAD_MMAP -DOSS -DTERM_CONTROL -Wall -O2 -m486 -fomit-frame-pointer -funroll-all-loops -finline-functions -ffast-math -c -o decode_i386.o decode_i386.c
    gcc -DI386_ASSEM -DPENTIUM_OPT -DREAL_IS_FLOAT -DLINUX -DREAD_MMAP -DOSS -DTERM_CONTROL -Wall -O2 -m486 -fomit-frame-pointer -funroll-all-loops -finline-functions -ffast-math -c -o dct64_i386.o dct64_i386.c
    as -o decode_i586.o decode_i586.s
    decode_i586.s: Assembler messages:
    decode_i586.s:44: Error: suffix or operands invalid for `push'
    decode_i586.s:45: Error: suffix or operands invalid for `push'
    decode_i586.s:46: Error: suffix or operands invalid for `push'
    decode_i586.s:47: Error: suffix or operands invalid for `push'
    decode_i586.s:67: Error: suffix or operands invalid for `push'
    decode_i586.s:70: Error: suffix or operands invalid for `push'
    decode_i586.s:81: Error: suffix or operands invalid for `push'
    decode_i586.s:83: Error: suffix or operands invalid for `push'
    decode_i586.s:86: Error: suffix or operands invalid for `push'
    decode_i586.s:161: Error: suffix or operands invalid for `pop'
    decode_i586.s:211: Error: suffix or operands invalid for `pop'
    decode_i586.s:296: Error: suffix or operands invalid for `pop'
    decode_i586.s:315: Error: suffix or operands invalid for `pop'
    decode_i586.s:316: Error: suffix or operands invalid for `pop'
    decode_i586.s:317: Error: suffix or operands invalid for `pop'
    decode_i586.s:318: Error: suffix or operands invalid for `pop'
    make[3]: *** [decode_i586.o] Error 1
    make[3]: Leaving directory `/usr/src/asterisk-1.2/mpg123-0.59r'
    make[2]: *** [mpg123-make] Error 2
    make[2]: Leaving directory `/usr/src/asterisk-1.2/mpg123-0.59r'
    make[1]: *** [linux] Error 2
    make[1]: Leaving directory `/usr/src/asterisk-1.2/mpg123-0.59r'
    make: *** [mpg123] Error 2
    Last edited by kennedymat; March 15th, 2006 at 02:25 AM.

Page 1 of 3 123 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •