Категорії
Linux PBX (telephony)

Прикручиваем USB модем Huawei e160 к Elastix

Тестовый стенд: CentOS 5.10 (kernel 3.2.55-1.el5.elrepo), Asterisk 11.7.0, 2 модема Huawei e160

# yum install libtool.x86_64 autoconf.noarch automake.noarch
# cd /usr/src/
# wget https://github.com/jstasiak/asterisk-chan-dongle/archive/asterisk11.zip

Можно попробовать зеркало http://кушеев.рф/wp-content/uploads/asterisk-chan-dongle-asterisk11.zip  (puny код для wget’a “http://xn--b1afas9b4a.xn--p1ai/wp-content/uploads/asterisk-chan-dongle-asterisk11.zip”)

# unzip asterisk-chan-dongle-asterisk11.zip && cd asterisk-chan-dongle-asterisk11
# aclocal && autoconf && automake -a

Если вылезут ошибки, просто проигнорируйте их

configure.in:10: warning: AC_ARG_PROGRAM was called before AC_CANONICAL_TARGET
../../lib/autoconf/general.m4:1795: AC_CANONICAL_TARGET is expanded from...
../../lib/autoconf/general.m4:1819: AC_CANONICAL_SYSTEM is expanded from...
configure.in:10: the top level
automake: no `Makefile.am' found for any configure output

# ./configure
configure: error: cannot run /bin/sh ./config.sub

Лечим так:

# ln -s /usr/share/automake-1.9/config.sub config.sub
# ln -s /usr/share/automake-1.9/config.guess config.guess
# ./configure && make
# cp chan_dongle.so /usr/lib64/asterisk/modules/
# cp etc/dongle.conf /etc/asterisk

Что бы не получать сообщений

chan_dongle.c: unable to open /dev/ttyUSB1: Permission denied

меняем права на устойства модемов:

# chmod 0666 /dev/ttyUSB*

А что бы при вынимании/вставлянии они не слетали, напишем udev-правило:

# cat 92-dongle.rules
KERNEL=="ttyUSB*", MODE="0666", OWNER="asterisk", GROUP="uucp"

и перечитаем:

# udevcontrol reload_rules

В файле /etc/asterisk/dongle.conf меняем только следующее:

[dongle0]
audio=/dev/ttyUSB1
data=/dev/ttyUSB2
[dongle1]
audio=/dev/ttyUSB4
data=/dev/ttyUSB5

Делаем рестарт астериска и смотрим наши устройства:

# /etc/init.d/asterisk restart
# asterisk -vr
...
Connected to Asterisk 11.7.0 currently running on host (pid = 3272)
host*CLI> dongle show devices
ID           Group State      RSSI Mode Submode Provider Name  Model      Firmware          IMEI     IMSI             Number        
dongle0      0     Free       14   0    0       Telecom        E160       11.609.10.02.432  XXXXXX   257027510612884  Unknown       
dongle1      0     Free       11   0    0       Telecom        E160G      11.609.10.02.432  XXXXXX   257027510844684  Unknown

Так же хочу сказать об одном нюансе при составлении dialplan’a: почему-то модем определяет свой номер как +1234567890 (именно с “плюсом”). Возможно это глюк с этими модемами, но с 2-мя сразу? Этот номер будет использоваться при входящих звонках. Именно так и писать dialplan:

exten => +1234567890,1,Set(CALLERID(all)=${CALLERID(num)})
exten => +1234567890,n,Set(CALLERID(num)=${CALLERID(num):1})
exten => +1234567890,n,Dial(SIP/25,120)
exten => +1234567890,n,HangUp()

А для исходящих лучше использовать такую конструкцию:

exten => _.,1,Dial(dongle/i:XXXXXXXXXXXXX/${EXTEN})
exten => _.,n,HangUp()

то есть привязываться к imei модема, так как бывали случаи, когда модемы менялись местами и звонки шли не с того модема.

Эту ситуацию можно исправить, задав принудительно номер модему

# asterisk -r
host*CLI>dongle cmd dongle0 AT+CPBS=\"ON\"
host*CLI>dongle cmd dongle0 AT+CPBW=1,\"+7922181****\",145

Но после рестарта asterisk’a он почему-то слетает, поэтому пришлось оставить dialplan, как есть.

9 коментарів “Прикручиваем USB модем Huawei e160 к Elastix”

Подскажите пожалуйста, так куда все же писать диалплан, в extensions_custom.conf, или в extensions.conf? Сколько ни смотрю, везде по разному!

extensions.conf – главный файл, в него можно подключать другие, в том числе и extensions_custom.conf.

“привязываться к imei модема” лучше не в диалплане, а в dongle.conf. Для этого вместо

[dongle0]
audio=/dev/ttyUSB1
data=/dev/ttyUSB2

пишем красивое

[dongle0]
imei=IMEI_этого_модема

После “лечения” все равно выскакивает ошибка configure: error: cannot run /bin/sh ./config.sub

Asterisk 11.13.0

Приведите больше вывода, а то неясно на что ругается.

Характеристики Asterisk — chan_dongle — Modem E173
Входящие проходят нормально, при исходящем звонке на моб (пример 89123456789) выходит ошибка:
[2016-11-05 11:45:05] ERROR[1894][C-00000000]: channel.c:7910 ast_channel_start_silence_generator: Could not set write format to SLINEAR
[2016-11-05 11:45:06] ERROR[1894][C-00000000]: channel.c:5424 set_format: Unable to set format because channel Local/FMGL-89123456789#@from-internal-00000001;2 supports no formats

Настройки проверил, норм, возможно причина в прошивке модема? Прошивка 11.126.85.00.209

При выполнении ./configure && make выдает:
[root@localhost chan_dongle-1.1.r14]# ./configure && make
checking build system type… i686-pc-linux-gnu
checking host system type… i686-pc-linux-gnu
checking target system type… i686-pc-linux-gnu
checking for a BSD-compatible install… /usr/bin/install -c
checking whether build environment is sane… yes
checking for a thread-safe mkdir -p… /bin/mkdir -p
checking for gawk… gawk
checking whether make sets $(MAKE)… yes
checking target system type… (cached) i686-pc-linux-gnu
checking host system type… (cached) i686-pc-linux-gnu
checking for gcc… gcc
checking for C compiler default output file name… a.out
checking whether the C compiler works… yes
checking whether we are cross compiling… no
checking for suffix of executables…
checking for suffix of object files… o
checking whether we are using the GNU C compiler… yes
checking whether gcc accepts -g… yes
checking for gcc option to accept ISO C89… none needed
checking for style of include used by make… GNU
checking dependency style of gcc… none
checking how to run the C preprocessor… gcc -E
checking for a BSD-compatible install… /usr/bin/install -c
checking for strip… strip
checking for rm… rm
checking for library containing iconv… none required
checking for grep that handles long lines and -e… /bin/grep
checking for egrep… /bin/grep -E
checking for ANSI C header files… yes
checking for sys/types.h… yes
checking for sys/stat.h… yes
checking for stdlib.h… yes
checking for string.h… yes
checking for memory.h… yes
checking for strings.h… yes
checking for inttypes.h… yes
checking for stdint.h… yes
checking for unistd.h… yes
checking fcntl.h usability… yes
checking fcntl.h presence… yes
checking for fcntl.h… yes
checking for stdlib.h… (cached) yes
checking for string.h… (cached) yes
checking sys/time.h usability… yes
checking sys/time.h presence… yes
checking for sys/time.h… yes
checking termios.h usability… yes
checking termios.h presence… yes
checking for termios.h… yes
checking whether asterisk.h in ../include… no
checking whether asterisk.h in /usr/include… no
checking whether asterisk.h in /usr/local/include… no
checking whether asterisk.h in /opt/local/include… no
configure: error: Can’t find “asterisk.h”
Как быть?

Залишити коментар до skeletor Скасувати коментар

Ваша e-mail адреса не оприлюднюватиметься. Обов’язкові поля позначені *

Домашняя страничка Andy
Записки молодого админа
Самостоятельная подготовка к Cisco CCNA
Самостоятельная подготовка к Cisco CCNP
Powered by Muff