chan_ss7 работает с сигнализацией напрямую, поэтому в zaptel.conf под b-каналы нужно отдавать все таймслоты. Пример zaptel.conf:
{noformat}
span=1,1,0,ccs,hdb3 - got this working!
span=1,0,0,ccs,hdb3
bchan=1-31
span=2,0,0,ccs,hdb3
bchan=32-62
{noformat}
Обратите внимение на отсутствующие декларации dchan\!
h3. Ядро
Часто современные Linux дистрибутивы поставляются с активированными режимами вытесняющей многозадачности (preemption), предназанченными для desktop систем для улучшенной интерактивности. Ядро должно быть пересобрано со следующими настройками:
{noformat}
Processor type and features --->
...
Preemption Model (No Forced Preemption (Server)) --->
[ ] Preempt The Big Kernel Lock
...
Timer frequency (100 HZ) --->
{noformat}
h2. Конфигурационный файл chan_ss7
Конфигурационный файл для канала chan_ss7 называется ss7.conf и должен находится в папке с остальными конфигурационными файлами Астериск (обычно /etc/asterisk).
Конфигурационный файл содержит несколько секций.
* linkset-имя \- параметры набора линков (linkset).
* link-имя \- параметры линков.
* host-имя \- в данной секции определяются хосты (это позволяет иметь единый файл конфигурации для разных серверов, каждый будет использовать свои настройки).
* cluster \- определяет настройки кластера.
h3. Секция Linkset
* *hunting_policy*. Алгоритм выбора каналов для исходящих звонков. Желательно выбирать подходящий алгоритм с обих сторон ОКС7 линка для минимизации риска коллизий (когда обе стороны пытаются сделать исходящий звонок по тому же самому каналу одновременно). Возможные варинты:
* *odd_lru*
\\
\- осуществлять исходящие звонки по нечетным CICs, по каждой группе выбирать последний использованный (odd least reacently used);
* *even_mru*
\\
\- алгоритм по умолчанию. Использовать четные CICs и выбирать последний использованный в каждой группе (even least recently used);
* *seq_lth*
\\
\- последовательный перебор CICs снизу вверх (sequential low-to-high);
* *seq_htl*
\\
\- последовательный перебор CICs вверху внизу (sequential high-to-low).
* *enable_st*. Использовать end-of-pulsing (ST) для определения полноты номера (завершенности).
* *use_connect*. Отвечать на входящий звонок сообщением CON вместо ACM и ANM.
* *context*. Название контекста для входящих звонков. По умолчанию default.
* *language*. Язык астериск для входящих звонков из данного линксета. По умолчанию пустая строка.
h3. Секция Link
* *linkset*. The linkset that this link belongs to
* *channels*.The speech/audio circuit channels on this link.
* *schannel*. The signalling channel
* *firstcic*. The first CIC on this link
h3. Секция Host
chan_ss7 auto-configures by matching the machines host name with the host-<name>
section in the configuration file. The same configuration file can thus be used on several hosts.
* *default_linkset*. This sets the SS7 linkset that receives outgoing calll where no linkset is defined in the Dial command'.
* *opc*. The point code for this SS7 signalling point
* *dpc*. A list of linkset:point-code pairs that specifies the point code to use for the linkset.
* *links*. A list of link:connector-no pains that specifies which links are on which connectors.
h2. Пример конфигурационного файла ss7.conf для Digium TE207P
В данном примере используются следующие настройки ОКС7:
* 2 потока E1 по карте Digium TE120P.
* Сигнализация на первом таймслоте на обоих потоках.
* firstcic=1
* opc=1, dpc=5003 (decimal)
{noformat}
[linkset-siuc]
enabled => yes
enable_st => no
use_connect => no
hunting_policy => even_mru
context => ss7-in
language => en
subservice => auto
[link-l1]
linkset => siuc
channels => 2-31
schannel => 1
firstcic => 1
enabled => yes
[link-l2]
linkset => siuc
channels => 2-31
schannel => 1
firstcic => 33
enabled => yes
[host-ivr]
enabled => yes
if-1 => 192.168.0.2
opc => 1
dpc => siuc:5003
links => l1:1,l2:2
{noformat}
h2. Часто задаваемые вопросы
*Может ли один Asterisk сервер поддерживать несколько ОКС7 линков, т.е. иметь несколько OPC?*
Нет, в текущей реализации chan_ss7 не может. В настройках ss7.conf возможно указать только один OPC. Таким образом, даже если у вас 4-х портовая карта и провайдер может подать на нее два логических ОКС7 линка, это невозможно.
*Возможно ли иметь только один сигнальный таймслот на несколько потоков?*
Да, возможно. Для этого не надо указывать значения для schannel. Например:
{noformat}
[link-l1]
linkset => A
channels => 2-31
schannel => 1
firstcic => 1
enabled => yes
[link-l2]
linkset => A
channels => 1-31
schannel =>
firstcic => 33
enabled => yes
{noformat}
В вышепреведенном примере 2 E1 потока, напервом потоке сигнализация на первом канале, на втором потоке сигнализации нет, все таймслоты (31) отданы под голосовые каналы.
*Можно ли подключить один Asterisk сервер к нескольким ОКС7 логическим линкам?*
Да, можно. chan_ss7 допускает конфигурирование нескольких DPC. В приведенном ниже конфигурационном файле используется 4-х портовая карта Digium TE405P, и потоки сгруппированы по два на каждый SS7 линк (станция HUAWEI на другой стороне не умеет использовать 16 таймслот для голосового канала, по словам специалиста со станции...)
{noformat}
[linkset-A]
enabled => yes
enable_st => no
use_connect => no
hunting_policy => even_mru
subservice => auto
language => en
context => default
[linkset-B]
enabled => yes
enable_st => no
use_connect => no
hunting_policy => even_mru
subservice => auto
language => en
context => default
[link-l1]
linkset => A
channels => 1-15,17-31
schannel => 16
firstcic => 1
enabled => yes
[link-l2]
linkset => A
channels => 1-15,17-31
schannel =>
firstcic => 33
enabled => yes
[link-l3]
linkset => B
channels => 1-15,17-31
schannel => 16
firstcic => 1
enabled => yes
[link-l4]
linkset => B
channels => 1-15,17-31
schannel =>
firstcic => 33
enabled => yes
[host-ivr]
enabled => yes
opc => 1
default_linkset => A
dpc => A:1037,B:1038
links => l1:1,l2:2,l3:3,l4:4
{noformat}
В диалплане Asterisk выбор линка для исходящего звонка осуществляется при помощи названия линксета, например Dial(SS7/A/$\{EXTEN}).
*Можно ли строить отказоустойчивые SS7 системы на базе chan_ss7*?
Можно. Для этих целей chan_ss7 поддерживает режим cluster, в котором два сервера делять один логический ОКС7 линк. Оба сервера работают под единым OPC, разделяемым между ними, и с одним сигнальным линком, подключенным к одному из серверов. Сервера между собой соеденены по локальной сети. Схема подключения такая:
{noformat}
Astreisk_1 \--> SS7 Signalining \--> Telco
;
Astreisk_2--/ \---> Bearer Channel \--> Telco
{noformat}
Ниже представлены конфигурационные файлы серверов.
{noformat}
Asterisk_1
===========
*CLI> ss7 cluster status
receiver Asterisk_1 if 1, addr 192.168.10.17, c:connected, p:, last try 154
msec, 23 fails, 0 forwards
*CLI>
Asterisk_2
===========
*CLI> ss7 cluster status
receiver Asterisk_2 if 1, addr 192.168.10.16, c:connected, p:, last try 399
msec, 0 fails, 0 forwards
*CLI>
Here is below my config file for both the box ...
Asterisk_1 [IP:192.168.10.16]
=======================
[linkset-siuc]
enabled => yes
enable_st => no
use_connect => yes
hunting_policy => even_mru
subservice => auto
[link-l1]
linkset => siuc
channels => 1-15,17-31
schannel => 16
firstcic => 1
enabled => yes
[host-Asterisk_1]
enabled => yes
default_linkset => siuc
opc => 0x2
dpc => siuc:0x1
if-1 => 192.168.10.17
links => l1:1
[cluster]
port => 5040
l1 => Asterisk_2#if-1
Asterisk_2 [IP:192.168.10.17]
======================
[linkset-siuc]
enabled => yes
enable_st => no
use_connect => no
hunting_policy => even_mru
subservice => auto
[link-l2]
linkset => siuc
channels => 1-31
schannel =>
firstcic => 32
enabled => yes
[host-Asterisk_2]
enabled => yes
default_linkset => siuc
opc => 0x2
dpc => siuc:0x1
if-1 => 192.168.10.16
links => l2:1
[cluster]
port => 5040
l2 => Asterisk_1#if-1
{noformat}
h2. Проблемы
h3. Excessive poll delay
{noformat}
[Sep 19 22:30:49] NOTICE[25524] mtp.c: Excessive poll delay 5985!
[Sep 19 22:40:49] NOTICE[25524] mtp.c: Excessive poll delay 5355!
{noformat}
Это мистическая проблема, которую пытаются отловить наверняка. Один из авторов chan_ss7 Anders Baekgaard (ab at sifira.dk) попросил высылать ему письмо с темой "chan_ss7 statistics". Anders попросил каждого, независимо от его опыта, помочь решить данную проблему и выслать ему содержимое команд:
{noformat}
uname -a
/sbin/lspci
cat /proc/cpuinfo
cat /proc/meminfo
cat /proc/interrupts
grep "Excessive poll delay" /var/log/asterisk/messages | tail -10
{noformat}
*Write buffer full on CIC=4 (wrote only 0 of 160), audio lost.*
{noformat}
[19 18:41:08|Sep] NOTICE[10930] l4isup.c: Write buffer full on CIC=4 (wrote only 0 of 160), audio lost.
[19 18:41:08|Sep] NOTICE[10930] l4isup.c: Write buffer full on CIC=4 (wrote only 0 of 160), audio lost.
[19 18:41:08|Sep] NOTICE[10930] l4isup.c: Write buffer full on CIC=4 (wrote only 0 of 160), audio lost.
{noformat}
Actually, the "Write buffer" is a kind of jitter-buffer. It is inside the zaptel driver and is initialized by chan_ss7 to 4 * 160 bytes (80ms). You can increase it to some other multiple of 160, but it requires a recompile, and will also increase the audio-delay.
The "write-buffer full" problem often occur because of jitter on the IP-net.
In IP-networks, there is allways a time-delay from the time a packet is sent to it get received at another host. This delay is unfortunately not allways the same. Sometimes, the packets will arrive too slow, and sometimes they will arrive too fast. When they arrive too fast, the send-buffer is filled, chan_ss7 writes the "Write buffer full" and then drop the packets.
This problem does not occur in the conventional circuit-switched telephone network, since it is completely synchronous and a dedicated (logical) circuit is reserved between the sender and receiver.
To get around this problem, you can setup trafic-shaping on the network, insert a bigger buffer in chan_ss7 (which will cause more delay), to even-out the difference in time-delay. Maybe it will helpl to configure the routers to "chop up" big packets in order to get the small RTP packets going smoothly.
*Limit exceeded when trying to adjust numbufs*
{noformat}
[19 18:41:08|Sep] WARNING[10930] l4isup.c: Limit exceeded when trying to adjust numbufs to 8, for circuit 4.
[19 18:41:08|Sep] WARNING[10930] l4isup.c: Limit exceeded when trying to adjust numbufs to 8, for circuit 4.
[19 18:41:08|Sep] WARNING[10930] l4isup.c: Limit exceeded when trying to adjust numbufs to 8, for circuit 4.
{noformat}
Check your ulimit settings. If you get something like this:
{noformat}
ivr:~/ss7 # ulimit \-a
core file size (blocks, \-c) 0
data seg size (kbytes, \-d) unlimited
file size (blocks, \-f) unlimited
pending signals (-i) 38911
max locked memory (kbytes, \-l) 32
max memory size (kbytes, \-m) 3440460
open files (-n) 1024
pipe size (512 bytes, \-p) 8
POSIX message queues (bytes, \-q) 819200
stack size (kbytes, \-s) 8192
cpu time (seconds, \-t) unlimited
max user processes (-u) 38911
virtual memory (kbytes, \-v) 6618160
file locks (-x) unlimited
{noformat}
The most probable cause is too low open files value - 1024. Set it to unlimited or at least to a reasonable big value like 524288 :-)
{noformat}
ivr:~/ss7 # ulimit \-n 524288
ivr:~/ss7 # ulimit \-a
core file size (blocks, \-c) 0
data seg size (kbytes, \-d) unlimited
file size (blocks, \-f) unlimited
pending signals (-i) 38911
max locked memory (kbytes, \-l) 32
max memory size (kbytes, \-m) 3440460
open files (-n) 524288
pipe size (512 bytes, \-p) 8
POSIX message queues (bytes, \-q) 819200
stack size (kbytes, \-s) 8192
cpu time (seconds, \-t) unlimited
max user processes (-u) 38911
virtual memory (kbytes, \-v) 6618160
file locks (-x) unlimited
ivr:~/ss7 # ulimit \-n
524288
{noformat}
h2. Комментарии
h4. Comment by litnimax on Thu Sep 13 09:58:33 2007
undestand the mapping.
The next 4 lines shows the cic's on 4 E1's. (The lines are long, so your
mail-reader will
probably ruin the alignment. To help you re-align, the pipe-chars '\|' should
be vertically alligned.)
{noformat}
0 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
32 |33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
64 |65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
96 |97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
{noformat}
The first column are the timeslot where a sync. signal is present.
The 'firstcic' directive should be the number in the second column (right
after the '\|') 1, 33, 65 and 97.
Signalling timeslots are the column where the first '16' is in (16, 48, 80
and 112).
Usually you will only use 16 for signalling and then 48, 80 and 112 for
audio.
Now comes the tricky part.. The "channels" and "schannels" directive refers
to cic's at the
particular E1 so they should be less than or equal to 31 and more than or
equal to 1.
In contrary, the 'firstcic' directive refers to all the E1's so it should
typically be 1, 33, 65 or 97.
h4. Comment by litnimax on Thu Sep 13 10:02:17 2007
{noformat}
Because the CIC mapping on the EWSD side starts
from CIC = 0 & remains the same for the whole trunk group i.e. E1, and for
the next trunkGroup/E1 there is another CIC, they represent it like this:
CIC=0-1