Posts Tagged ‘voip’

acmepacket: import/export HMR

Tuesday, February 9th, 2016
conf t -> session-router -> sip-manipulation

Select some HMR and then do:

export %filename%

After that a %filename%.gz will appear under /code/imports/ directory. And you can download it via FTP/SFTP.

It is also possible to import sip-manipulation rules. Put your .gz file with the same structure to /code/imports/ , then go to conf t -> session-router -> sip-manipulation and do:

import %filename%.gz

Linphone: command line interface

Tuesday, November 24th, 2015

Wanna be a real VoIP nerd? :-) Let’s use Linphone from a command line!

1. ‘linphonec’ – enter the CLI.
2. ‘help’ – list available commands. Now it’s time to create a profile and connect to PBX
3. ‘help proxy’ – show help.
3.1. ‘proxy add’ – and press Enter. Answer to the appeared questions (just look at kisting below):

linphonec> proxy add
Adding new proxy setup. Hit ^D to abort.
Enter proxy sip address:
Your identity for this proxy: sip:1301@
Do you want to register on this proxy (yes/no): yes
Specify register expiration time in seconds (default is 600): 
Expiration: 0 seconds
Specify route if needed: 
No route specified.
sip address: 
identity: sip:1301@
register: yes
expires: 0
registered: no
Accept the above proxy configuration (yes/no) ?: yes
Proxy added.
Password for 1301 on "": MeGaSeCuRePaSs

linphonec> Unregistration on sip: done.

Yes, the message ‘Unregistration on sip: done.’ seems strange, but tcpdump shows that everything is OK.

3.2. Now we may list our proxies:

linphonec> proxy list
****** Proxy 0 - this is the default one - *******
sip address: 
identity: sip:1301@
register: yes
expires: 0
registered: no

4. Let’s call via default proxy:

linphonec> call 79991234567
Establishing call id to <sip:79991234567@>, assigned id 1
Contacting <sip:79991234567@>
linphonec> Call 1 to <sip:79991234567@> in progress.
linphonec> Remote ringing.
linphonec> Early media.
linphonec> Call 1 with <sip:79991234567@> early media.
Call 1 with <sip:79991234567@> connected.
Call answered by <sip:79991234567@>.
linphonec> Media streams established with <sip:79991234567@> for call 1 (audio).</sip:79991234567@></sip:79991234567@></sip:79991234567@></sip:79991234567@></sip:79991234567@></sip:79991234567@></sip:79991234567@>

We may look active calls with ‘calls’ command.
This is how it looks like while ringing:

linphonec> calls
Call states
Id |            Destination              |      State      |    Flags   |
2  | sip:79991234567@          | OutgoingEarlyMedia | 

And this is how it looks like during an established call:

linphonec> calls
Call states
Id |            Destination              |      State      |    Flags   |
2  | sip:79991234567@          | StreamsRunning  | 

If you want to terminate a call, just type ‘terminate’ and press Enter.

If you have some troubles with sound and your PC is behind NAT, play with following parameters: ‘firewall’ and ‘nat’. Maybe you need ‘firewall none’ (it helped me at previous linphonec setup with one-way sound).

5. You may quit linphonec with ‘quit’ command. And these are history log, call log and configuration file in your home directory:

lexus@lexus:~$ ls -lh .linph*
-rw------- 1 lexus lexus  162 нояб. 24 15:10 .linphonec_history
-rw------- 1 lexus lexus 2,5K нояб. 24 15:10 .linphonerc

6. Read the documentation for more information.

Digium Certified Asterisk Administrator (dCAA)

Wednesday, July 10th, 2013

Now I am a Digium Certified Asterisk Administrator (dCAA).

Switching from analog telephony to IP

Friday, May 24th, 2013

Few days ago we successfully implemented the switching from analog to IP telephony in one company, the name of which we keep in secret due to the privacy policy.
The ‘uplink’ still remains analog, consisting of 15 PSTN lines (the client’s requirement). All 40 office phones now are SIP ones.
Eltex TAU-32M.IP VoIP gateway was used in conjunction with AsteriskNOW (client’s requirement, they wanted to have some web-interface at least to look for the system, what is happening inside) on the HP ProLiant DL160 Gen8 server.
SIP phones are Fanvil C56, Gigaset C610A IP and top Digium’s model – D70.

Asterisk & IPtables

Tuesday, January 22nd, 2013

A good starting place is a set of rules similar to this one:

iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
iptables -A INPUT -p udp --dport 5060 -j ACCEPT
iptables -A INPUT -p udp --dport 10000:20000 -j ACCEPT
iptables -A INPUT -i lo -j ACCEPT
iptables -P FORWARD DROP
iptables -P INPUT DROP

Asterisk modules

Tuesday, January 22nd, 2013

My practice of manual loading of needed modules only.
Change ‘autoload=yes‘ to ‘autoload=no‘ in /etc/asterisk/modules.conf .
Restart Asterisk – Asterisk CLI> core restart now (remember that it will cancel all active calls).

Login into Asterisk console (root# asterisk -rvvvvvvv). Then load modules manually:
Asterisk CLI> module load
Asterisk CLI> module load
Asterisk CLI> module load
Asterisk CLI> module load
Asterisk CLI> module load
Asterisk CLI> module load
Asterisk CLI> module load
Asterisk CLI> module load
Asterisk CLI> module load
Asterisk CLI> module load
Asterisk CLI> module load
Asterisk CLI> module load
Asterisk CLI> module load

A nice help for modules being used is ‘Asterisk CLI> module show‘ . This is mine:

Asterisk CLI> module show 
Module                         Description                              Use Count             Music On Hold Resource                   0                    Dialing Application                      0                Sound File Playback Application          0                    Session Initiation Protocol (SIP)        0                  A-law Coder/Decoder                      0                   GSM Coder/Decoder                        0            Asterisk RTP Stack                       0               Dialplan Context/Extension/Priority Chec 0                  Text Extension Configuration             0                  Raw Signed Linear Audio support (SLN)    0                  Trivial Record Application               0                  Microsoft WAV/WAV16 format (8kHz/16kHz S 0                  Raw GSM data                             0         
13 modules loaded
Asterisk CLI> 

If you need AEL, you have to load 2 modules (in shown sequence):

Asterisk CLI> module load
Asterisk CLI> module load

The best practice is to configure /etc/asterisk/modules.conf according to its syntax, to prevent manual loading of modules each time your Asterisk PBX starts.

Your installation may need other modules as well.

Asterisk: запись продиктованного в телефон

Friday, January 11th, 2013

Добавляем в диалплан

exten => *98,1,Answer()
exten => *98,n,Wait(2)
exten => *98,n,Record(/tmp/myrecord%d:wav)
exten => *98,n,Wait(1)
exten => *98,n,Playback(${RECORDED_FILE})
exten => *98,n,Wait(1)
exten => *98,n,Hangup()

Начинаем надиктовывать после сигнала (услышите его, набрав *98), когда сказали всё, что хотели, нажимаем # , после чего через секунду нам проиграют надиктованный голос.

Asterisk: конвертируем файлы для MOH

Monday, August 20th, 2012

Вариантов много, подробности тут

Я сначала конвертировал .mp3 в .wav, но Asterisk ругался, поэтому пришлось .wav конвертировать в .sln, он очень хорош для Asterisk’a.

mpg123 -w foo-out.wav foo-in.mp3
sox foo-in.wav -t raw -r 8000 -s -2 -c 1 foo-out.sln

По ссылке выше написано, что можно сразу из .mp3 в .sln, но у меня не получилось.

Asterisk: Provide Music on Hold to the calling party until the called channel answers

Friday, August 17th, 2012

В Интернете много пишут про MusicOnHold, т.е. музыка при удержании звонка. Но когда мы хотим слышать музыку, пока на том конце не успели поднять трубку, MusicOnHold – не совсем то, что нам нужно. Следует использовать параметр ‘m‘ для приложения Dial.

exten => _XXXX,1,Dial(SIP/${EXTEN},15,m)
exten => {EXTEN},n,Hangup()

Обратите внимание, что сначала указывается, как долго дозваниваться, прежде чем звонок будет завершен (15 секунд), а только потом параметр музыки (m). Если поменять местами, музыка играть не будет.

Файл musiconhold.conf тоже должен быть отредактирован.
В минимальной конфигурации этого будет вполне достаточно:



Asterisk-1.8 на Debian 6.0.5 Squeeze

Friday, July 27th, 2012
  1. Устанавливаем Debian
  2. Устанавливаем пакет python-software-properties:
    sudo apt-get install python-software-properties
  3. Импортируем public-key:
    sudo apt-key adv --keyserver --recv-keys 175E41DF
    Если будут проблемы с импортированием, можно попробовать вот так:wget -O - | sudo apt-key add -
  4. Добавляем в /etc/apt/sources.list репозиторий:
    deb squeeze maindeb-src squeeze main
  5. Опциональнодобавляем репозиторий ветви Proposed:deb squeeze-proposed main
    deb squeeze-proposed main
  6. Устанавливаем:sudo apt-get update && sudo apt-get install asterisk-1.8

Чуть подробнее и по-английски – на официальном сайте: