วันเสาร์ที่ 15 พฤษภาคม พ.ศ. 2553

การ ติดต้้ง Mobigater GSM Gateway for Asterisk

ข้อมูลเบื้องต้นของ mobigater

อุปกรณ์ที่รองรับ Mobile/GSM Channel
Download Script ในการติดตั้ง Mobigater for Asterisk โดยอัตโนมัติ

สำหรับผู้ใช้งาน CentOS4.X ครับ

Download more information on Mobigater Website

การติดตั้งสำหรับ Mobigater/Celliax Channel สำหรับ CentOS/Trixbox

ขั่นตอนการตรวจสอบ

ขั่นตอนแรกเป็นการตรวจสอบว่ามี mobigater อยู่ในระบบหรือไม่

# lsusb
การมี อุปกรณ์ ติดตั้งอยู่ในระบบเป็นที่เรียบร้อย จะต้องมี message เช่นดังต่อไปนี้
[localdomain ~]# lsusb
Bus 001 Device 001: ID 0000:0000
Bus 001 Device 003: ID 058f:9254 Alcor Micro Corp. Hub
Bus 001 Device 006: ID 058f:9720 Alcor Micro Corp. USB-Serial Adapter
Bus 001 Device 004: ID 04d9:1400 Holtek Semiconductor, Inc.
Bus 001 Device 005: ID 0d8c:000c C-Media Electronics, Inc. Audio Adapter

ขั่นตอนการติดตั้ง

1. update software ในระบบ

[root@asterisk1 ~]# yum -y update

1.1 หากเป็น Trixbox จำเป็นต้องทำการ ติดตั้ง Development Tools ด้วย

[root@asterisk1 ~]# yum -y install kernel-devel gcc gcc-c++
หรือในกรณีที่เป็น SMP (ดูได้จาก uname -a หากมีคำว่า SMP จะเป็น kernel แบบ smp)
[root@asterisk1 ~]# yum -y install kernel-devel-smp gcc

2. ติดตั้ง software ที่จำเป็นต่างๆ

[root@asterisk1 ~]# yum -y install alsa-lib-devel xorg-x11-devel
[root@asterisk1 ~]# ldconfig

3. update ALSA software ให้เป็น version ใหม่

[root@asterisk1 ~]# cd
[root@asterisk1 ~]# mkdir alsarpm
[root@asterisk1 ~]# cd alsarpm
[root@asterisk1 alsarpm]# wget -c ftp://ftp.pbone.net/mirror/atrpms.net/el4-i386/atrpms/stable/libasound2-1.0.13-32.el4.at.i386.rpm
[root@asterisk1 alsarpm]# wget -c ftp://ftp.pbone.net/mirror/atrpms.net/el4-i386/atrpms/stable/alsa-utils-1.0.13-22.el4.at.i386.rpm
[root@asterisk1 alsarpm]# wget -c ftp://ftp.pbone.net/mirror/atrpms.net/el4-x86_64/atrpms/stable/alsa-lib-devel-1.0.13-32.el4.at.i386.rpm
[root@asterisk1 alsarpm]# wget -c ftp://ftp.pbone.net/mirror/atrpms.net/el4-i386/atrpms/stable/alsa-lib-1.0.13-32.el4.at.i386.rpm
[root@asterisk1 alsarpm]# rpm -U --nosignature *
[root@asterisk1 alsarpm]# reboot

4. download และ ติดตั้ง chan_celliax

[root@asterisk1 ~]# cd /usr/src
[root@asterisk1 src]# wget http://downloads.digium.com/pub/asterisk/releases/asterisk-1.4.18.1.tar.gz
[root@asterisk1 src]# tar zxf asterisk*
[root@asterisk1 asterisk]# cd asterisk*
[root@asterisk1 asterisk]# ./configure
[root@asterisk1 asterisk]# make
[root@asterisk1 asterisk]# cd ..
[root@asterisk1 src]# wget http://www.mobigater.com/downloads/asterisk/Astersk_and_MobiGater_EN.zip
[root@asterisk1 src]# wget -c http://www.celliax.org/celliax_stuff.tgz
[root@asterisk1 src]# tar xzf celliax_stuff.tgz
[root@asterisk1 src]# unzip Astersk_and_MobiGater_EN.zip
[root@asterisk1 src]# cp ./Astersk_and_MobiGater_EN/Makefile ./celliax_stuff/build/Makefile
[root@asterisk1 src]# cd ./celliax_stuff/build

[root@asterisk1 src]# หากเป็น asterisk 1.4 อาจแก้ Makefile ให้เป็นตามข้อมูลถัดไปได้ ทันที
**notes**
ข้อมูลที่ยกมาเป้นตัวอย่างอิงกับ asterisk version 1.4.18.1
#ASTERISK INCLUDE FILES
#The directory containing the Asterisk include files (eg: /usr/include or /usr/include/asterisk or /usr/src/asterisk/include or ...)
AST_INCLUDE_DIR=/opt/asterisk/include
#ASTERISK INCLUDE FILES
#The directory containing the Asterisk include files (eg: /usr/include or /usr/include/asterisk or /usr/src/asterisk/include or ...)
AST_INCLUDE_DIR=/usr/src/asterisk-1.4.18.1/include/
#ASTERISK VERSION 1.4.XX
#Uncomment the following line if you are compiling for Asterisk 1.4 series
#Comment out if you are compiling for Asterisk 1.2 series
CFLAGS+=-DASTERISK_VERSION_1_4
#ASTERISK VERSION 1.2.XX
#Uncomment the following line if you are compiling for Asterisk 1.2 series
#Comment out if you are compiling for Asterisk 1.4 series
#CFLAGS+=-DASTERISK_VERSION_1_2
#SKYPE SUPPORT
#Uncomment the following two lines if you DO NOT WANT SKYPE SUPPORT in Linux (so, no libX11 needed)
CFLAGS+=-DNO_SKYPE
SKYPE_LIB=
#Comment out the following line if you DO NOT WANT SKYPE SUPPORT in Linux (so, no libX11 needed)
#SKYPE_LIB=-L/usr/X11R6/lib -lX11


[root@asterisk1 build]# sed 's/.at_dial_post_number = \"S\\\"\",/.at_dial_post_number = \";\",/' < /usr/src/celliax_stuff/build/chan_celliax.c > /usr/src/celliax_stuff/build/chan_celliax.c.tmp
[root@asterisk1 build]# mv -f /usr/src/celliax_stuff/build/chan_celliax.c.tmp /usr/src/celliax_stuff/build/chan_celliax.c
[root@asterisk1 build]# make clean
[root@asterisk1 build]# make
[root@asterisk1 build]# cp chan_celliax.so /usr/lib/asterisk/modules/
[root@asterisk1 build]# chown root:asterisk /usr/lib/asterisk/modules/chan_celliax.so
[root@asterisk1 build]# chmod 640 /usr/lib/asterisk/modules/chan_celliax.so

5. ทำการ reboot เครื่อง server

[root@asterisk1 build]# reboot

ตัวอย่าง Configuration Files

1. /etc/asterisk/celliax.conf
ใช้ในการตั้งค่าของ Celliax

;;
; Celliax Asterisk Driver
;
; The first interface (mobigater1 )
[mobigater1]
language=en
context=Internal
extension=mobigater1
;
;debug_all=yes
debug_at=yes
;debug_fbus2=yes
debug_serial=yes
debug_pbx=yes
;debug_sound=yes
;debug_locks=yes
;debug_skype=yes
debug_call=yes
;debug_cvm=yes
skype=no
control_device_protocol=AT
control_device_speed=57600
control_device_name=/dev/ttyACM0 ; this is the first USB serial port in Linux
cvm_volume_level = 8 ; volume level control in CVM (0-9)
need_acoustic_ring=0
playback_boost=+15 ; for integrated mobo audio for motorola c650
capture_boost=0 ;for integrated mobo audio for motorola c650
alsa_period_size=32
alsa_periods_in_buffer=32
alsa_capture_device_name=plughw:0
alsa_playback_device_name=plughw:0
at_dial_pre_number=ATD
at_dial_expect=OK
at_hangup=ATH
at_hangup_expect=OK
at_answer=ATA
at_answer_expect=OK
at_initial_pause=500000
at_preinit_1=atciapa ; nonsense entry, just to show the preinit
at_preinit_1_expect=OK
at_after_preinit_pause=1000000
at_postinit_1=atcucu ; nonsense entry, just to show the postinit
at_postinit_1_expect=OK
at_postinit_2=AT+CKPD="EEE"
needed on c650***
at_postinit_2_expect=OK
at_query_signal=AT+CSQ
at_query_signal_expect=OK
at_indicator_noservice_string=+CIEV: 2,0
at_indicator_nosignal_string=+CIEV: 5,0
at_indicator_lowsignal_string=+CIEV: 5,1
at_indicator_nocallsetup_string=+CIEV: 6,0
at_call_idle=+MCST: 1
at_call_failed=+MCST: 65

2. /etc/asterisk/extensions.conf
สำหรับ Asterisk Dialplan ในการโทรออก

[Mobile]
exten => _08.,1,Answer()
exten => _08.,n,Dial(Celliax/mobigater1:${EXTEN})
exten => _08.,n,Hangup

3. /etc/asterisk/modules.conf

ต้องทำการเพิ่ม
noload => chan_alsa.so
noload => chan_oss.so

ปัญหาที่อาจพบได้

1. Files Permission หรือ ไม่สามารถ start asterisk
หากไม่สามารถ start asterisk (ในกรณีที่ไม่ได้ใช้ root เป็นผู้ run asterisk) ให้ลองเช็ค permission ของ "/dev" ที่เกี่ยวข้อง เช่น

/dev/ttyACM*
/dev/ttyS*
/dev/snd

ซึ่งอาจแก้ไขโดยการ run script ด้านล่างก่อน start asterisk

chown -R asterisk:asterisk /dev/snd*
chown -R asterisk:asterisk /dev/ttyACM*
chown -R asterisk:asterisk /dev/ttyUSB*
chown -R asterisk:asterisk /dev/ttyS*
chown -R asterisk:asterisk $ASTRUNDIR
chown -R asterisk:asterisk /etc/asterisk


2. celliax_call dialing failed:

ตรวจสอบค่าใน celliax.conf หรือ copy ค่าด้านบนไปใช้งาน

3. ไม่พบ /dev/ttyACM0

run "modprobe cdc-acm"

4. ไม่มีเสียง

ตรวจสอบความดังของเสียงโดย "alsamixer -c0" เพื่อตั้งค่าของ gain ต่างๆ
"alsactl store" เพื่อ save ค่า

ป้ายกำกับ: , ,

0 ความคิดเห็น:

แสดงความคิดเห็น

สมัครสมาชิก ส่งความคิดเห็น [Atom]

<< หน้าแรก