Was this page helpful?

asterisk-chan-dongle

    asterisk-chan-dongle 是整合 Huawei 3G USB Modem 與 Asterisk 的模組。

    官方網站:http://code.google.com/p/asterisk-chan-dongle/
    教學網站:http://wiki.e1550.mobi/doku.php

    系統環境

    • Ubuntu 9.10 karmic
    • Asterisk 1.8.7.1
    • FreePBX 2.9.0.7
    • Vodafone 3G Modem K3520
    • chan_dogle-1.1.r10

    注意:此次的實作,在撥出電話後,會出現掛不斷情形,請參閱 Issue

    安裝步驟

    硬體驅動
    1. 插上 3G USB Modem(可先不插上 SIM Card)
    2. 檢查目錄 /dev/ttyUSB* 是否存在,如果存在,表示驅動正常。
       

    硬體驅動正常時:

    >lsusb
    Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
    Bus 001 Device 007: ID 12d1:1001 Huawei Technologies Co., Ltd. E620 USB Modem
    Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
    
    >ls -l /dev/ttyUSB*
    crw-rw---- 1 root asterisk 188, 0 2011-11-22 11:04 /dev/ttyUSB0
    crw-rw---- 1 root asterisk 188, 1 2011-11-22 11:04 /dev/ttyUSB1
    crw-rw---- 1 root asterisk 188, 2 2011-11-22 11:04 /dev/ttyUSB2
    

    如果 ttyUSB 的群組權限不是 asterisk,請繼續下面的步驟:

    新增 /etc/udev/rules.d/dongle.rules

    KERNEL=="tty[A-Z]*", NAME="%k", GROUP="asterisk", MODE="0660"
    

    重啟 udev 服務

    >service udev stop
    >service udev start 
    

    重插 USB Modem。

    安裝 chan_dongle

    // 下載原始檔
    http://code.google.com/p/asterisk-ch...downloads/list

    // 編譯安裝

    cd /usr/src
    tar xzf chan_dongle-1.1.r10.tgz
    cd chan_dongle-1.1.r10/
    ./configure --enable-debug
    make
    make install 
    

    TIPs:

    第一次安裝可以加上 --enable-debug,方便除錯用。

    Asterisk 模組

    複製設定檔 dongle.conf
    >cd /usr/src/chan_dongle-1.1.r10
    >cp etc/dongle.conf /etc/asterisk/
    >chown asterisk:asterisk /etc/asterisk/dongle.conf
    
    重啟 asterisk
    >amportal stop
    >amportal start
    
    檢查模組載入 chan_dongle
    >asterisk -rx "module show like dongle"
    Module                         Description                              Use Count
    chan_dongle.so                 Huawei 3G Dongle Channel Driver          0
    1 modules loaded 
    
    檢查 dongle 指令
    >asterisk -rx "help" | grep dongle
                dongle callwaiting Enable/Disable Call-Waiting on the dongle
                        dongle cmd Send commands to port for debugging
                  dongle discovery Discovery devices and create config
                        dongle pdu Send PDU of SMS from the dongle
                     dongle reload Reload dongle
                     dongle remove Remove dongle
                      dongle reset Reset dongle now
                    dongle restart Restart dongle
       dongle show device settings Show Dongle device settings
          dongle show device state Show Dongle device state
     dongle show device statistics Show Dongle device statistics
               dongle show devices Show Dongle devices state
               dongle show version Show module version
                        dongle sms Send SMS from the dongle
                      dongle start Start dongle
                       dongle stop Stop dongle
                       dongle ussd Send USSD commands to the dongle
    

    設定 dongle.conf

    /etc/asterisk/dongle.conf:

    [general]
    ...
    [defaults]
    ...
    context=from-trunk
    ...
    ;exten=+1234567890
    ...
    dtmf=inband 
    ...
    [dongle0]
    audio=/dev/ttyUSB1              ; tty port for audio connection;        no default value
    data=/dev/ttyUSB2               ; tty port for AT commands;             no default value
    ;
    ;imei=123456789012345     ; 註解預設值
    ;imsi=123456789012345      ; 註解預設值 
    

    查詢 IMEI & IMSI

    1. 插上 SIM card
    2. 執行指令 CLI>dongle show devices
       
    CLI> dongle show devices
    ID           Group State      RSSI Mode Submode Provider Name  Model      Firmware          IMEI             IMSI             Number
    dongle0      0     Free       18   0    0       805A015BF696FB K3520      11.314.17.31.00   353436038000000  466890000000000  0973200000
    

    將 IMEI & IMSI 設定在 dongle.conf

    dongle.conf:

    [dongle0]
    ...
    ...
    ;K3520
    imei=353436038000000
    imsi=466890000000000
    exten=0973200000

    載入新設定

    CLI>dongle reload now
    

     

    Was this page helpful?
    標籤 (Edit tags)
    • No tags
    您必須 登入 才能發佈評論。
    Powered by MindTouch Core