Asterisk is a software implementation of a telephone private branch exchange (PBX) originally created in 1999 by Mark Spencer of Digium. Like any PBX, it allows attached telephones to make calls to one another, and to connect to other telephone services including the public switched telephone network (PSTN) and Voice over Internet Protocol (VoIP) services. Its name comes from the asterisk symbol, "*".
- asterisk may be driven by a tcp interface (AMI) with a simple protocol
- the asterisk console combined with the alsa channel transform any alsa equiped hardware in a softphone
- we lack softphones with GUI usable on the Freerunner or other devices with tiny display
So it may be used as backend for Freerunner VoIP applications and a lot of other nice things!
In this page we are going to join forces to test if this may be really done, so please collaborate and report here your experience!
Asterisk has an issue in it's alsa_channel implementation, it works accessing pcm directly (plughw:0,0) with stuttered audio, while is not capable of sound output if using dmix/dsnoop. The last is needed both for let asterisk access alsa togheter with other applications and to have smooth audio without changing it deeply. There is a package with a quick workaround (just 2 lines of code changed) that you have to use while waiting for a full patch, warning it works only with dmix/dnsoop!
A good asound.conf with multiplex dmix/dsnoop configuration is available at www.koolu.org
wget http://www.koolu.org/asound.conf mv /etc/asound.conf asound.conf.old mv asound.conf /etc/
Asterisk SHR Testing Installation
To install the patched asterisk:
edit /etc/asterisk/alsa.conf and be sure to have:
and input_device/output_device be commented (so they will use the default multiplexed pcm), then edit /etc/asterisk/modules.conf and change it to load alsa instead of oss at startup, modifying last lines:
;noload => chan_alsa.so noload => chan_oss.so
install demo sounds (if you do not want to do tests you may skip this)
wget http://noko.sourceforge.net/common/asterisk-core-sounds-en-gsm-1.4.8.tar.gz gunzip < asterisk-core-sounds-en-gsm-1.4.8.tar.gz |tar -xvf - -C /var/lib/asterisk/sounds/
remove or move /etc/asterisk/extensions.ael
Quick asterisk test with stereoout
Be sure the current alsa scenario is stereoout:
mdbus -s org.freesmartphone.odeviced /org/freesmartphone/Device/Audio org.freesmartphone.Device.Audio.SetScenario stereoout
launch asterisk in console mode:
check your dialplan was load correctly:
make a "call" to the special "#" extension:
console dial #@demo
You should hear some greetings and after a bit the busy tone, to stop it type:
Asterisk echo test
Switch to voip-handset scenario:
mdbus -s org.freesmartphone.odeviced /org/freesmartphone/Device/Audio org.freesmartphone.Device.Audio.SetScenario voip-handset
launch alsamixer and bring to max "Speaker" control, then launch asterisk and type:
console dial 600@demo
follow instruction and do the demo test, all should work nicely.
I do not know if bringing up Speaker control is correct as other applications seems to work without it.
To enable AMI edit /etc/asterisk/manager.conf:
change your bindaddress to 127.0.0.1, or to 192.168.0.202 if you want to test it by your usb connected box, then create an asterisk manager account appending:
[manager] secret = changeme read = system,call,log,verbose,command,agent,user,config write = system,call,log,verbose,command,agent,user,config deny=0.0.0.0/0.0.0.0 permit=127.0.0.1/255.0.0.0
Finally it's the time to configure asterisk for your needs, good docs at www.voip-info.org, take care about security.
FIXME please fill this part with some stripped down configuration and any other setting useful on the freerunner
Asterisk writes a lot of files, we should avoid to write too many to flash or sd, and be sure they will not grow too much if we put them in tmpfs
Adding some sip users
You may use your freerunner as a sip provider and connect other hw/sw voip phones to it. To add a sip user, you have to modify /etc/asterisk/sip.conf.
Example to add the sip user ekiga:
[ekiga] type=friend host=dynamic secret=ekiga
Adding some sip peers
If you have a sip provider you may add it to asterisk to join VoIP or PSTN networks
To modify the dialplan you have to edit /etc/asterisk/extension.conf. This is a very simple example to place/receive calls between the above mentioned ekiga test account and the alsa console.
[general] [globals] [demo] exten => #,1,Playback(demo-thanks) ; "Thanks for trying the demo" exten => #,n,Hangup ; Hang them up. exten => 600,1,Playback(demo-echotest) ; Let them know what's going on exten => 600,n,Echo ; Do the echo test exten => 600,n,Playback(demo-echodone) ; Let them know it's over exten => 600,n,Hangup [default] exten => 1000,1,Dial(SIP/ekiga) exten => 1001,1,Dial(Console/alsa)
Start ekiga on your linuxbox connected to freerunner with usb, create a new sip account using 192.168.0.200 as registrar, ekiga for account name and password.
Place a call to 1001, your asterisk should begin to ring!
To place a call from the freerunner to ekiga use the Asterisk GUI dialer (when released) or open a ssh shell type asterisk -r to connect to asterisk daemon in console mode and type:
console dial 1000
A simple and quite rude GUI is coming, stay tuned!