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

voip_nerd
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 listing below):

linphonec> proxy add
Adding new proxy setup. Hit ^D to abort.
Enter proxy sip address: 10.1.51.13
Your identity for this proxy: sip:1301@10.1.51.13
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: 
route: 
identity: sip:1301@10.1.51.13
register: yes
expires: 0
registered: no
--------------------------------------------
Accept the above proxy configuration (yes/no) ?: yes
Proxy added.
linphonec> 
Password for 1301 on "pbx.secretcompany.com": MeGaSeCuRePaSs

linphonec> Unregistration on sip:10.1.51.13 done.
linphonec>

Yes, the message ‘Unregistration on sip:10.1.51.13 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: 
route: 
identity: sip:1301@10.1.51.13
register: yes
expires: 0
registered: no
linphonec>

4. Let’s call via default proxy:

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

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@10.1.51.13          | OutgoingEarlyMedia | 

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

linphonec> calls
Call states
Id |            Destination              |      State      |    Flags   |
------------------------------------------------------------------------
2  | sip:79991234567@10.1.51.13          | 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).
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.
tau32m_ip
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 OUTPUT ACCEPT
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 app_dial.so
Asterisk CLI> module load app_playback.so
Asterisk CLI> module load chan_sip.so
Asterisk CLI> module load codec_alaw.so
Asterisk CLI> module load codec_gsm.so
Asterisk CLI> module load res_rtp_asterisk.so
Asterisk CLI> module load res_musiconhold.so
Asterisk CLI> module load func_dialplan.so
Asterisk CLI> module load pbx_config.so
Asterisk CLI> module load format_sln.so
Asterisk CLI> module load format_wav.so
Asterisk CLI> module load format_gsm.so
Asterisk CLI> module load app_record.so

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

Asterisk CLI> module show 
Module                         Description                              Use Count 
res_musiconhold.so             Music On Hold Resource                   0         
app_dial.so                    Dialing Application                      0         
app_playback.so                Sound File Playback Application          0         
chan_sip.so                    Session Initiation Protocol (SIP)        0         
codec_alaw.so                  A-law Coder/Decoder                      0         
codec_gsm.so                   GSM Coder/Decoder                        0         
res_rtp_asterisk.so            Asterisk RTP Stack                       0         
func_dialplan.so               Dialplan Context/Extension/Priority Chec 0         
pbx_config.so                  Text Extension Configuration             0         
format_sln.so                  Raw Signed Linear Audio support (SLN)    0         
app_record.so                  Trivial Record Application               0         
format_wav.so                  Microsoft WAV/WAV16 format (8kHz/16kHz S 0         
format_gsm.so                  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 res_ael_share.so
Asterisk CLI> module load pbx_ael.so

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

Вариантов много, подробности тут http://www.voip-info.org/wiki/view/Convert+WAV+audio+files+for+use+in+Asterisk

Я сначала конвертировал .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 тоже должен быть отредактирован.
В минимальной конфигурации этого будет вполне достаточно:


[general]

[default]
mode=files
directory=moh
random=yes

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 pgp.mit.edu --recv-keys 175E41DF
    Если будут проблемы с импортированием, можно попробовать вот так:wget http://packages.asterisk.org/keys/175E41DF.pub -O - | sudo apt-key add -
  4. Добавляем в /etc/apt/sources.list репозиторий:
    deb http://packages.asterisk.org/deb squeeze maindeb-src http://packages.asterisk.org/deb squeeze main
  5. Опциональнодобавляем репозиторий ветви Proposed:deb http://packages.asterisk.org/deb squeeze-proposed main
    deb http://packages.asterisk.org/deb squeeze-proposed main
  6. Устанавливаем:sudo apt-get update && sudo apt-get install asterisk-1.8

Чуть подробнее и по-английски – на официальном сайте: https://wiki.asterisk.org/wiki/display/AST/Asterisk+Packages