Home
About Me!
Projects
Research
Links
Gallery
Travel
   
Random Header Image
Disable Enable
More Info



Asterisk PBX

Overview:
Install and setup of Asterisk VoIP PBX with Sipura 3000.

Asterisk Install (on P3 gentoo):

Create /etc/portage/package.keywords and add the lines:
net-misc/asterisk ~x86
net-misc/zaptel ~x86

resync portage (emerge --sync)

The zaptel drivers are needed even if there are no digium cards installed so they can provide dummy timers for certain functionality such as conferencing and music on hold. From looking at the ebuild it appears that the ztdummy is enabled in the make file (# is removed) automatically.

Perform "emerge -pv asterisk" to check USE flags. Check the purpose of each flag here. I added the following line to
/etc/portage/package.use :
net-misc/asterisk zaptel doc mmx postgres resperl speex vmdbpostgres

emerge postgresql if not already present. actually you probably do not have to do this since it is included in the dependancies (I missed that fact at first) not sure if need to do this:... I didn't.
/var/db/pkg/dev-db/postgresql-8.0.1-r3/postgresql-8.0.1-r3.ebuild config

emerge asterisk

need to rebuild perl and libperl with ithreads use-flag enabled for emebedded perl in extensions.conf to work. Add the following to /etc/portage/package.use:
dev-lang/perl ithreads
sys-devel/libperl ithreads

emerge perl
emerge libperl

modprobe ztdummy (also runs zaptel module)

emerge asterisk

The build for asterisk failed, i noticed it said somewhere in the mass of error messages that a new version of libpri was needed. I added the following line to /etc/portage/package.keywords:
net-libs/libpri ~x86

emerge libpri

emerge asterisk

Noticed a message saying I have the wrong version of mpg123, "you need version .59r". According to "equery list mpg123" I have version .59s-r9. Not sure if this matters.

When running asterisk (asterisk -vvvvvc) I get an error that dboption has not been setup in voicemail.conf. According to this page, it is only the user voicemail settings such as username and password which are stored in the database, which I am not that bothered about. So I have changed /etc/portage/package.use so there is a -vmdbpostgres use-flag.

emerge asterisk

Since I do not have a soundcard in the machine I changed the /etc/asterisk/modules.conf to the following:
noload => chan_alsa.so
noload => chan_oss.so

asterisk -vvvvvc

added the following to /etc/asterisk/sip.conf:
[1234]
type=friend
auth=md5
username=1234
secret=chooseapassword
callerid="First Extension" <1234>
host=dynamic
canreinvite=no
disallow=all
allow=gsm
allow=ulaw
allow=alaw

reload (in running asterisk console)

I logged in from SJphone softphone! I could call 1000 for the demo, 500 for the IAX connection to digium, 600 for echo test and 8500 for the voicemail system, excellent.

I added ztdummy to /etc/modules.autoload.d/kernel-2.6 so that the ztdummy driver module loads on startup.

Sipura Config:

To get flash hook to work:
Regional Settings - Control Timer Values (sec) - Hook Flash Timer Min: 0.06 Max 0.2

Regional Settings - Miscellaneous:
FXS impedence settings:
600 for the US
370+620||310nF for the UK
Caller ID Method: ETSI FSK With PR(UK)

PSTN Line - International Control
FXO Port Impedance WAS 600 NOW 370+620||310nF
Ring Indication Delay: WAS 512ms NOW 256ms
On-hook speed WAS less than 0.5ms NOW 3ms
Ring Indication Delay: WAS 512ms NOW 256ms
Ring Timeout: WAS 640 NOW 128ms

PSTN Line - PSTN Disconnect Detection
Disconnect Tone: WAS 480@-30,620@-30;4(.25/.25/1+2)
NOW 400@-30;20(*/0/1)
Min CPC Duration: WAS 0.2 NOW 0.085
Detect Polarity Reversal WAS yes NOW no

Incoming PSTN line config:
Failed to authenticate user caller id problem on incoming call, forum post1, post2.
Fixed by putting insecure=very into [pstn1-out] not the friend entry for the pstn! weird. (Make sure you put the IP address of the asterisk server into the Sipura access list as I do not think authentication is performed when insecure=very is set.

Increase gain slightly on both FXO and FXS as was a little quiet:
Regional - Misc
FXS Port Input Gain WAS -3 NOW 0
FXS Port Output Gain WAS -3 NOW 0
PSTN Line - International Control
SPA to PSTN Gain WAS 0 NOW 5
PSTN to SPA Gain WAS 0 NOW 5

 

Related Links:
voip-info.org Asterisk on Gentoo
gentoo-wiki Asterisk HOWTO
Getting started with Asterisk

Applications/Commands:
MeetMe
MeetMe2 - Includes web interface for control
Monitor

Call and Pickup Groups:
PickDown
PickUpChan
Steal
ChanSpy

Sip.conf
Extensions.conf

Asterisk Codecs

g729 information and free implementation

Sipura Conifgs
forum
Sipura SPA Users Group

Setup guide - including IAX and SIP providers

UK BT Regional settings

Mailing Lists/Forums:
Asterisk Users - Digium Mailing List

Notes:

Put calls incoming/outgoing on PSTN channel into callgroup 1
Put calls outgoing on VoIP service (e.g 1899, 18866) into callgroup 2

can ChanSpy to listen on a particular callgroup, or use Steal to steall a call, (e.g. from PSTN).
But how do I join an already connected call?

Apparently it is possible to get asterisk to initiate outgoing calls by placing a call file here: /var/spool/asterisk/outgoing/ An example file is included in the source: (/usr/src/asterisk/sample.call)

Problems:

When canreinvite=no (so using asterisk media bridge) the outgoing audio from an SJphone (softphone) to the Sipura 3000 line has a weird digitised noise which can be heard through the phone connected to the Sipura 3000. Audio from the phone to the SJphone is however fine. I have tried forcing many different combinations of codecs on each UA yet still experience the same problem on every test. Calls from one SJPhone to another SJPhone work perfectly, as do calls from either SJPhone or the Sipura to an IAX connected PSTN gateway (as far as I can tell). Also calls direct to the Sipura FXO port (when canreinvite=yes on both) are fine. So it is only when the audio passes through the asterisk media bridge that there are problems with SJphone. Perhaps a slight incompatability with the codecs?

I have tried using X-Lite and there are no problems at all with this client. The audio is very clear and of good quality when calling a number through the Sipura PSTN line or the phone connected to the Sipura FXS port. I am using exactly the same settings on the asterisk server as I was for SJphone, i.e. canreinvite=no so all audio is being passed through asterisk. X-Lite's conference or transfer functions do not seem to function which is a great shame. I guess it's because it is the free version. The 3 multiple lines work however.

When using meetme conferencing and I use SJphone's conference function to connect the person I am speaking to also to the conference, the audio is choppy for them (but not for me).

IAX connection to either call1899 or call18866 somtimes does not connect calls and responds with "No one is available to answer at this time" in the asterisk console. UPDATE: This may be due to incompatible codecs. Define codecs explicitily.

Crackling noise when calling out from SJphone through Sipura PSTN.

Buzzing noise when the other person is not talking using Sipura FXO to IAX 18866 using gsm codec (from * to 18866).

Useful Commands:

Use these commands at the Asterisk console.

SIP:

sip show peers show defined SIP peers
sip show users show defined SIP users
sip show registry show SIP registration status
sip reload reload sip.conf

MeetMe:

meetme list 1234 list users of conference room 1234
meetme kick 1234 2 kick user 2 of conference 1234
meetme lock 1234 lock conference room 1234
meetme unlock 1234 unlock conference room 1234

Channels:

sip show channels shows current sip channels and codecs in use
iax2 show channels shows current sip channels and codecs in use