Asterisk - the open source soft PBX (MIPSel)

From NAS-Central Buffalo - The Linkstation Wiki
Jump to: navigation, search
Originally by Scotty from

Building/Running Asterisk on Linkstation

This article describes how I built and installed Asterisk - the open source soft PBX - on a Linkstation. I am a Linux newbie - so please forgive me. I have a MIPS LSII and I've installed the 052b Openlink firmware as described elsewhere. Previously I have installed MySQL/Apache and PHP as described on this site. If you've done that - then the somewhat terse description below will make perfect sense. As a disclaimer, this little lot took me over a day to figure out - and I haven't been back and retraced my steps - so I appologise if some of the following contains errors - but if nothing else, it'll save you some time.


Create a symbolic link in /usr/bin to /bin/awk (because the Asterisk build system expects it there - although I guess you could also change the build system instead)

cd /usr/bin
ln -s /bin/awk awk


Download and build the libcurl libraries (Asterisk will use them)

* Download the tar.gz from

* Unpack it somewhere sensible

* Do the usual configure/make/make install (I used the same scheme proposed in the Apache and MySQL articles and installed it into /mnt/hda/opt/libcurl using the --prefix parameter on ./configure)

* Once built, create a symbolic link to curl-config in /bin

* cd /bin

* ln -s /mnt/hda/opt/libcurl/bin/curl-config curl-config

* Copy the headers and libraries to the 'proper' place

* copy the /mnt/hda/opt/libcurl/include/curl directory to /usr/include (resulting in /usr/include/curl)

* copy the contents of /mnt/hda/opt/libcurl/lib to /usr/lib

* NB: Don't know if there isn't a more elegant way to add the curl include/lib directories to the 'path' for compilation (in Windows you would simply update the INCLUDE and LIB environment vars!)


Download the Asterisk source (1.4.2 at time of writing) from

* No need for Zaptel and Libpri stuff (you'll not fit a telephony card into a Linkstation ;-)

* Unpack it somewhere sensible (/mnt/hda/share/asterisk)

* Next there are a couple of modules that I just couldn't get to build - loads of assembler stuff - so don't build them - this results in some limitations detailed at the end - basically we are just not building the GSM and LPC10 codecs. Edit the code makefile (/mnt/hda/share/asterisk/codec/makefile) and comment out the following (add # to start of line)

#	$(MAKE) -C gsm lib/libgsm.a
#	$(MAKE) -C lpc10 all codec_gsm.o $(LIBGSMT) 
#	$(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB} $(LIBGSM) codec_lpc10.o $(LIBLPC10)
#	$(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB} $(LIBLPC10) -lm

* Now just hit make and wait for an hour...(notice how we don't need configure)

* cd /mnt/hda/share/asterisk

* make

* Assuming it builds ok - you then need to install it

* make install

Configuring Asterisk

Now it's all built, you can configure it up for a couple of SIP phones. You are now entering the realm of Asterisk config - so I recommend you take a look at a few of the following links when you get into trouble.

Anyway, we need to create 3 config files in /etc/asterisk as follows:







exten => _[1-9].,1,Dial(SIP/${EXTEN})



load => ; Call Parking Resource
load => ; Indications Configuration
load => ; Music On Hold Resource
load => ; Text Extension Configuration Requires N/A
load => ; Builtin dialplan functions - Requires N/A
load => ; Loopback Dialplan Switch - Requires N/A
load => ; Realtime Dialplan Switch - Requires N/A
load => ; Outgoing Spool Support Requires - N/A
load => ; Gets or sets Caller*ID data on the channel. - Requires ?
load => ; ENUMLOOKUP and TXTCIDNAME functions - Requres ?
load => ; URI encode/decode functions - Requires ?
load => ; Provides summary information on feature channels- Requires N/A
load => ; Show status of local channels- Requires N/A
load => ; Session Initiation Protocol (SIP) - Requires
load => ; A-law Coder/Decoder - Requires N/A
load => ; Raw aLaw 8khz PCM Audio support - Requires N/A
load => ; Dialing Application - Requires,
load => ; Hangs up the requested channel - Requires N/A

Now you can run it...just type:

/usr/sbin/asterisk -cvvvvvvv

...there you have it - Asterisk is now running and configured for 2 SIP extensions 1000 and 1001 that can dial each other. Now you need some SIP phones to register with it and off you go - I'll let you find those. To do some of the more advanced stuff in Asterisk, you will need to specifically load the necessary modules in modules.conf - I have deliberately only loaded those 'important' (to me!) ones.

You should be able to hook up your Linkstation PBX to an internet telephony provider and use it like a 'proper' PBX - it's got voicemail and IVR functionality etc. That's for another article.

Oh and those limitations - well I couldn't figure out how to build the GSM codec (see - so that causes problems when you try to get Asterisk to play any IVR type prompts to the caller. This is not a show stopper, and I think you can rerecord the prompts in PCM (ALAW) and it should work - although I haven't tried it. It's a bit of a shame, cos Asterisk comes with a load of prompts out the box...oh well.