Adding a SIP client to FreePBX

To add a SIP client to FreePBX, open the menu “Applications” – “Extensions“, choose for example “Generic CHAN SIP Device” and we indicate the main parameters:

User Extension: 6000 (SIP number)
Display Name: Operator (any name to display)
Secret: PASSWORD
and click “Submit“.

Done, SIP is added, it can already be registered at the specified number and password.

How to add SIP in the configuration file I described in this article – Adding SIP clients to Asterisk

Installing the Digium Asterisk GUI

Digium Asterisk GUI – web-management interface Asterisk.

Today I’ll sculpt it to Asterisk 11 on Ubuntu Server 14.04 LTS.
Switch directly to the root user:

sudo -i

Download it:

apt-get install subversion
mkdir -p ~/asterisk-gui
cd ~/asterisk-gui
svn checkout http://svn.digium.com/svn/asterisk-gui/branches/2.0/

We compile and install:

cd 2.0
./configure
make
make install

Just in case, we’ll make a copy of the Asterisk configuration files:

cp -r /etc/asterisk /etc/asterisk.original

Open the configuration file manager.conf for example in the editor nano (Ctrl+X to exit the editor, y/n to save or cancel changes):

nano /etc/asterisk/manager.conf

The main parameters that must be configured in the manager.conf configuration file are:

[general]
enabled = yes
webenabled = yes
bindaddr = 0.0.0.0
[USERNAME]
secret = PASSWORD
read = system,call,log,verbose,command,agent,user,config
write = system,call,log,verbose,command,agent,user,config

At the very end of the file, replace the symbol # with; otherwise you can not enter under the login and password specified above.

Now edit http.conf:

nano /etc/asterisk/http.conf

In it we will specify the following parameters of the web server:

enabled=yes
enablestatic=yes
bindaddr=0.0.0.0
prefix=asterisk

Let’s check the settings:

make checkconfig

Delete the empty folder and specify a link to the real one with the files of the web server:

rmdir /usr/share/asterisk/static-http/
ln -s /var/lib/asterisk/static-http/ /usr/share/asterisk/

Restarting Asterisk:

/etc/init.d/asterisk restart

Now Digium Asterisk GUI should open by link http://192.168.56.102:8088/asterisk/static/config/index.html, where 192.168.56.102 this is the IP or Server domain with Asterisk.

To log in, we’ll specify the username and password you wrote earlier in the manager.conf file

Done.

Asterisk Error Solution “Context ‘local’ tries to include nonexistent context ‘parkedcalls'”

I screwed the DAHDI board somehow and noticed the following error when I dialed the call from the analog line:

WARNING[7238]: pbx.c:12314 ast_context_verify_includes: Context ‘local’ tries to include nonexistent context ‘parkedcalls’

The error occurred because the res_parking module was not loaded to load it, open the asterisk console and execute the command:

sudo asterisk -vvr
module load res_parking

To automatically load it when starting Asterisk, in the file /etc/asterisk/modules.conf, in the [modules] block, add the line:

load => res_parking.so

The solution of the error “Unable to create channel of type ‘SIP’ (cause 20 – Subscriber absent)”

I noticed one time when I received a call from the Asterisk console:

dial_exec_full: Unable to create channel of type ‘SIP’ (cause 20 – Subscriber absent)

In the context of the dialplan, I make a call simultaneously to two phones:

exten => s,5,DIAL(SIP/204&SIP/203,19)

Sometimes one of the IP phones is turned off, which is why this error occurs, informing that there is no subscriber.
To solve it, you just need to turn on the IP phone.

You can see information about SIP in the Asterisk console:

asterisk -rvv
sip show peers
sip show peer NUMBER
quit

If the client’s IP address is null and expire is -1, the SIP client is not online:

Expire: -1
Addr->IP: (null)

Solving the error in Asterisk “File vm-newn does not exist in any format”

When I called a voicemail number, I noticed the following errors in the Asterisk console:

[Apr 10 17:08:01] WARNING[19135][C-00001cf4]: file.c:701 ast_openstream_full: File digits/1n does not exist in any format
[Apr 10 17:08:01] WARNING[19135][C-00001cf4]: file.c:1017 ast_streamfile: Unable to open digits/1n (format (ulaw)): No such file or directory
[Apr 10 17:08:01] WARNING[19135][C-00001cf4]: file.c:701 ast_openstream_full: File vm-newn does not exist in any format
[Apr 10 17:08:01] WARNING[19135][C-00001cf4]: file.c:1017 ast_streamfile: Unable to open vm-newn (format (ulaw)): No such file or directory

Errors are caused by the lack of sound files, for example, in my case in the voice mail one message and when I try to say “you have one (1n.ulaw) new (vm-newn) message, an error occurs and the handset lies down.

Archive with a set of necessary files is enough to simply download from the official site http://downloads.asterisk.org/pub/telephony/sounds/releases/ and unpack to the directory /usr/share/asterisk/sounds
After this, the error should not be.

How to remove “New User” in Asterisk CallerID

I noticed once that when incoming calls from the Goip4 gateway on SIP phones, not only the caller’s number is displayed, but the name “New User” flashes alternately with the phone number, which is obviously superfluous and hinders.

After viewing the Asterisk configuration files, I noticed some standard values in the /etc/asterisk/users.conf file in the general section, namely:

[general]
fullname = New User

Which need to comment out:

;fullname = New User

And restart Asterisk to apply the changes:

sudo service asterisk restart

Done, now with incoming calls only the phone number will be displayed.

How to convert audio files to ulaw, alaw, gsm, g722, etc. for Asterisk

After ordering the voice acting from a professional announcer and cutting in the sound editor, it was necessary to save the sounds in different formats, the original was in wav, so I’ll give an example of converting through sox (it already was in the system with Asterisk):

sox -V vm-intro.wav -r 8000 -c 1 -t ul vm-intro.ulaw
sox -V vm-intro.wav -r 8000 -c 1 -t al vm-intro.alaw
sox -V vm-intro.wav -r 8000 -c 1 -t gsm vm-intro.gsm

The codec g722 does not seem to support it, at least in man sox did not find it, so it installed ffmpeg (on the Ubuntu Server system):

sudo apt-get install ffmpeg

And performed the conversion:

ffmpeg -i vm-intro.wav -ar 16000 -acodec g722 vm-intro.g722

Standard directory with Asterisk sounds – /usr/share/asterisk/sounds