9
Huawei/Vodafone 3G USB Modem on Asterisk-datacard ????? 3G USB Modem ?? Asterisk ? GSM gateway? ???? ???? Vodafone_3G_Modem_k3520.jpg PIAF 1.7.5.5, BRONZE Linux 2.6.18-194.26 Asterisk 1.6.2.17.2 Asterisk-addons 1.6.2.3 Vodafone 3G Modem K3520 ???????????? ???? ????????Linux ?? USB 3G Modem ???? root@pbx:~ $ lsusb Bus 001 Device 012: ID 12d1:1001 Huawei Technologies Co., Ltd. E620 USB M Bus 001 Device 001: ID 0000:0000 Bus 002 Device 001: ID 0000:0000 root@pbx:~ $ dmesg ... ... usb 1-1: new full speed USB device using uhci_hcd and address 12 usb 1-1: configuration #1 chosen from 1 choice usb-storage: probe of 1-1:1.0 failed with error -5 usb-storage: probe of 1-1:1.1 failed with error -5 usb-storage: probe of 1-1:1.2 failed with error -5 scsi27 : SCSI emulation for USB Mass Storage devices usb-storage: device found at 12 usb-storage: waiting for device to settle before scanning Vendor: HUAWEI Model: Mass Storage Rev: 2.31 Type: CD-ROM ANSI SCSI revision: 02 sr0: scsi-1 drive sr 27:0:0:0: Attached scsi CD-ROM sr0 sr 27:0:0:0: Attached scsi generic sg0 type 5

Huawei/Vodafone 3G USB Modem on Asterisk-datacard

Embed Size (px)

DESCRIPTION

Huawei/Vodafone 3G USB Modem onAsterisk-datacard

Citation preview

Page 1: Huawei/Vodafone 3G USB Modem on  Asterisk-datacard

Huawei/Vodafone 3G USB Modem onAsterisk-datacard????? 3G USB Modem ?? Asterisk ? GSM gateway?

????

????

• Vodafone_3G_Modem_k3520.jpgPIAF 1.7.5.5, BRONZE• Linux 2.6.18-194.26• Asterisk 1.6.2.17.2• Asterisk-addons 1.6.2.3• Vodafone 3G Modem K3520

????????????

????

????????Linux ?? USB 3G Modem ????

root@pbx:~ $ lsusbBus 001 Device 012: ID 12d1:1001 Huawei Technologies Co., Ltd. E620 USB Modem <<<Bus 001 Device 001: ID 0000:0000Bus 002 Device 001: ID 0000:0000

root@pbx:~ $ dmesg......usb 1-1: new full speed USB device using uhci_hcd and address 12usb 1-1: configuration #1 chosen from 1 choiceusb-storage: probe of 1-1:1.0 failed with error -5usb-storage: probe of 1-1:1.1 failed with error -5usb-storage: probe of 1-1:1.2 failed with error -5scsi27 : SCSI emulation for USB Mass Storage devicesusb-storage: device found at 12usb-storage: waiting for device to settle before scanning

Vendor: HUAWEI Model: Mass Storage Rev: 2.31Type: CD-ROM ANSI SCSI revision: 02

sr0: scsi-1 drivesr 27:0:0:0: Attached scsi CD-ROM sr0sr 27:0:0:0: Attached scsi generic sg0 type 5

www.princexml.com
Prince - Personal Edition
This document was created with Prince, a great way of getting web content onto paper.
Page 2: Huawei/Vodafone 3G USB Modem on  Asterisk-datacard

Vendor: HUAWEI Model: SD Storage Rev: 2.31Type: Direct-Access ANSI SCSI revision: 02

sd 27:0:0:1: Attached scsi removable disk sdasd 27:0:0:1: Attached scsi generic sg1 type 0usb-storage: device scan complete

Tips:

???? /dev/ttyUSB* ?????? modem ?????

??????

????????? CentOS Linux ?????? USB modem ????????????????????? CentOS 5.5 Linux?????????? USB modem?

??????

root@pbx:~/temp $ lsusbBus 001 Device 004: ID 12d1:1001 Huawei Technologies Co., Ltd. E620 USB ModemBus 001 Device 001: ID 0000:0000Bus 002 Device 001: ID 0000:0000

root@pbx:~/temp $ ls -l /dev/ttyUSB*crw-rw---- 1 root asterisk 188, 0 May 9 17:56 /dev/ttyUSB0crw-rw---- 1 root asterisk 188, 1 May 9 17:56 /dev/ttyUSB1crw-rw---- 1 root asterisk 188, 2 May 9 18:12 /dev/ttyUSB2

?????? ttyUSB* ?????? Asterisk???? F.A.Q?

?? Dongle ??

?????https://code.google.com/p/asterisk-chan-dongle/downloads/list

???? Asterisk 11 ????????????? patch(?????????????) https://github.com/jstasiak/asterisk...asterisk11.zip

cd /usr/srctar xzf chan_dongle-1.1.r14.tgzcd chan_dongle-1.1.r14/./configuremakemake installamportal stopamportal start

Page 3: Huawei/Vodafone 3G USB Modem on  Asterisk-datacard

????? make ?????????? make ??

?? dongle ??

# asterisk -rx "module show like dongle"Module Description Use Countchan_dongle.so dongle Channel Driver 01 modules loaded

????? /etc/asterisk/dongle.conf

[general]

interval=15 ; Number of seconds between trying to connect to devices

;------------------------------ JITTER BUFFER CONFIGURATION --------------------------;jbenable = yes ; Enables the use of a jitterbuffer on the receiving side of a

; Dongle channel. Defaults to "no". An enabled jitterbuffer will; be used only if the sending side can create and the receiving; side can not accept jitter. The Dongle channel can't accept jitter,; thus an enabled jitterbuffer on the receive Dongle side will always; be used if the sending side can create jitter.

;jbforce = no ; Forces the use of a jitterbuffer on the receive side of a Dongle; channel. Defaults to "no".

;jbmaxsize = 200 ; Max length of the jitterbuffer in milliseconds.

;jbresyncthreshold = 1000 ; Jump in the frame timestamps over which the jitterbuffer is; resynchronized. Useful to improve the quality of the voice, with; big jumps in/broken timestamps, usually sent from exotic devices; and programs. Defaults to 1000.

;jbimpl = fixed ; Jitterbuffer implementation, used on the receiving side of a Dongle; channel. Two implementations are currently available - "fixed"; (with size always equals to jbmaxsize) and "adaptive" (with; variable size, actually the new jb of IAX2). Defaults to fixed.

;jbtargetextra = 40 ; This option only affects the jb when 'jbimpl = adaptive' is set.; The option represents the number of milliseconds by which the new jitter buffer; will pad its size. the default is 40, so without modification, the new; jitter buffer will set its size to the jitter value plus 40 milliseconds.; increasing this value may help if your network normally has low jitter,; but occasionally has spikes.

Page 4: Huawei/Vodafone 3G USB Modem on  Asterisk-datacard

;jblog = no ; Enables jitterbuffer frame logging. Defaults to "no".;-----------------------------------------------------------------------------------

[defaults]; now you can set here any not required device settings as template; sure you can overwrite in any [device] section this default values

context=from-trunk ; context for incoming calls, SMS and USSDgroup=0 ; calling grouprxgain=0 ; increase the incoming volume; may be negativetxgain=0 ; increase the outgoint volume; may be negativeautodeletesms=yes ; auto delete incoming smsresetdongle=yes ; reset dongle during initialization with ATZ commandu2diag=-1 ; set ^U2DIAG parameter on device (0 = disable everything except modem function)

; -1 not use ^U2DIAG commandusecallingpres=yes ; use the caller ID presentation or notcallingpres=allowed_passed_screen ; set caller ID presentation. By default use default network settings

; see http://www.the-asterisk-book.com/unstable/applikationen-setcallerpres.htmldisablesms=no ; disable of SMS reading from device when received. Enable this option to disable

; sms reception. Use smsaspdu=yes to avoid problem when SMS is too long in TEXT mode.smsaspdu=yes ; if 'yes' send SMS in PDU mode.language=en ; set channel default languagemindtmfgap=45 ; minimal interval from end of previews DTMF from begining of next in msmindtmfduration=80 ; minimal DTMF tone duration in msmindtmfinterval=200 ; minimal interval between ends of DTMF of same digits in ms

callwaiting=auto ; if 'yes' allow incoming calls waiting; by default use network settings; if 'no' waiting calls just ignored

disable=no ; if 'yes' no load this device and just ignore this sectionexten=+1234567890 ; exten for start incoming calls, only in case of Subscriber Number not available!,

; also set to CALLERID(dnid)

dtmf=relax ; control of incoming DTMF detection, possible values:; off - off DTMF tone detection, voice data passed to asterisk unaltered; use this value for gateways or if you do not use IVR in diaplan; inband - do DTMF tones detection; relax - like inband but with relaxdtmf option; default is 'relax' for backward compatibility

; dongle required settings[dongle0]audio=/dev/ttyUSB1 ; tty port for audio connection;

Page 5: Huawei/Vodafone 3G USB Modem on  Asterisk-datacard

data=/dev/ttyUSB2 ; tty port for AT commands;

; or you can omit both audio and data parameters and use imei=123456789012345 and/or imsi=612849384756451; imei and imsi must contain exactly 15 digits !

; imei/imsi discovery is available on Linux only

imei=123456789012345imsi=612849384756451

; if you set audio and data parameter together with imei and/or imsi, audio and data is used.; you can use both imei and imsi together. In this case exact match by imei and imsi is required.

chown asterisk:asterisk /etc/asterisk/dongle.confchmod 664 /etc/asterisk/dongle.conf

??????????

# asterisk -rx "help dongle"dongle callwaiting Enable/Disable Call-Waiting on the dongle

dongle cmd Send commands to port for debuggingdongle discovery Discovery devices and create config

dongle pdu Send PDU of SMS from the dongledongle reload Reload dongledongle remove Remove dongledongle reset Reset dongle now

dongle restart Restart dongledongle show device settings Show Dongle device settings

dongle show device state Show Dongle device statedongle show device statistics Show Dongle device statistics

dongle show devices Show Dongle devices statedongle show version Show module version

dongle sms Send SMS from the dongledongle start Start dongledongle stop Stop dongledongle ussd Send USSD commands to the dongle

?? IMEI & IMSI?

pbx*CLI> dongle show devicesID Group State RSSI Mode Submode Provider Name Model Firmware IMEI IMSI Numberdongle 0 Free 19 0 0 805A015BF696FB K3520 11.314.17.31.00 353436038000000 466890000000000 0973000000

Tips:

?? dongle ??????? modem ????? SIM card?

Page 6: Huawei/Vodafone 3G USB Modem on  Asterisk-datacard

?? /etc/asterisk/dongle.conf?

; K3520imei=3534360385000000imsi=466890000000000

dongle ?????

pbx*CLI> dongle show device statistics dongle0-------------- Statistics -------------

Device : dongle0Queue tasks : 13Queue commands : 34Responses : 53Bytes of readed responces : 657Bytes of wrote commands : 268Bytes of readed audio : 0Bytes of wrote audio : 0Readed frames : 0Readed short frames : 0Wrote frames : 0Wrote short frames : 0Wrote silence frames : 0Write buffer overflow bytes : 0Write buffer overflow times : 0Incoming calls : 0Waiting calls : 0Handled input calls : 0Fails to PBX run : 0Attempts to outgoing calls : 0Answered outgoing calls : 0Answered incoming calls : 0Seconds of outgoing calls : 0Seconds of incoming calls : 0ACD for incoming calls : -1ACD for outgoing calls : -1ASR for incoming calls : -1ASR for outgoing calls : -1

pbx*CLI> dongle show device settings dongle0------------- Settings ------------

Device : dongle0Audio : /dev/ttyUSB1Data : /dev/ttyUSB2IMEI : 123456789012345IMSI : 612849384756451

Page 7: Huawei/Vodafone 3G USB Modem on  Asterisk-datacard

Channel Language : UTF-8Context : dongle-incomingExten : +85267896789Group : 0RX gain : 3TX gain : -3U2Diag : -1Use CallingPres : YesDefault CallingPres : Presentation Allowed, Passed ScreenAuto delete SMS : YesDisable SMS : NoReset Dongle : YesSMS PDU : YesCall Waiting : autoDTMF : inbandMinimal DTMF Gap : 45Minimal DTMF Duration : 80Minimal DTMF Interval : 200Initial device state : start

FreePBX/Asterisk ????

Inbound ??

1. ?? dongle.conf ??????◦ [defaults] > context=from-trunk◦ [dongle0] > exten=<SIM ??????>

2. FreePBX > Inbound Routes > Add Inbound Roue◦ DID Number: <SIM ????>◦ Set Destination: <whatever you wanted>

Outbound ??

1. ?? Custom TrunkFreePBX > Trunks > Add Custom Trunk

• Trunk Description: 3G Modem• Outbound Caller ID: <????>• Custom Dial String: Dongle/dongle0/$OUTNUM$

??dongle0 ??? dongle.conf ??????

2. ?? Outbound RouteFreePBX > Outbound Routes > Add Roue

Page 8: Huawei/Vodafone 3G USB Modem on  Asterisk-datacard

• Route Name: 3GModem• Dial Patterns: 009|.• Trunk Sequence: Dongle/dongle0/$OUTNUM$

????

3G Modem ???Vodafone K3520

???? ?? ??Linux ??-CentOS 5.5 PASS???? PASS???? PASS??? DTMF ?? (SJphone -> 3G Modem -> Vibo ?? PASS

??? DTMF ?? (?? -> 3G Modem ->Asterisk IVR -> SIP ??) PASS

????SMS PASS????SMS PASS

F.A.Q

?????

chan_dongle.c: -- [dongle0] Trying to connect on /dev/ttyUSB2...chan_dongle.c: unable to open /dev/ttyUSB2: No such file or directory

Ans:

chown asterisk:asterisk /dev/ttyUSB1chown asterisk:asterisk /dev/ttyUSB2

?????

-- [dongle0] Trying to connect on /dev/ttyUSB2...-- [dongle0] Dongle has connected, initializing...-- [dongle0] Dongle needs to be reinitialized. The SIM card is not ready yet-- [dongle0] Error initializing Dongle-- [dongle0] Dongle has disconnected

Ans: ?? 3G Modem ???????? SIM card???????

Page 9: Huawei/Vodafone 3G USB Modem on  Asterisk-datacard

?? /dev/ttyUSB1, ttyUSB2 ?????? USB modem ???????? root?

Ans: ?? /etc/udev/rules.d/50-udev.rules

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

??????? udev?????http://benjr.tw/node/407?

????? IVR ???????? DTMF ????????

Ans: ??? /etc/asterisk/dongle.conf ?????

• dtmf=inband• mindtmfgap=45• mindtmfduration=20, ???????????? 80 ?? 20 ??????????• mindtmfinterval=200

???? USB modem ???????

Ans:

cat /proc/bus/usb/devices

????

• http://www.telecom-cafe.com/forum/vi...555&highlight=• http://www.elastix.org/en/component/...-dongle.html• http://forge.asterisk.org/gf/project...se&forum_id=74• http://www.elastix.org/en/component/...bi-odicha.html• Ubuntu ?? 3G ????• Howto use 3G dongle Huawei E1750 in OpenWrt• [Raspberry Pi] GSM VoIP Gateway with Chan_dongle