38
Asterisk: dongled ! Francesco PRIOR | @priorfra Photo used with permission of Joel Escalona.

Asterisk: dongled !

Embed Size (px)

DESCRIPTION

Slides from the talk I gave at ASTRICON 2012.

Citation preview

Page 1: Asterisk: dongled !

Asterisk: dongled !Francesco PRIOR | @priorfra

Photo used with permission of Joel Escalona.

Page 2: Asterisk: dongled !

Who Am I• Francesco Prior• Software Developer• I’m from “through” Italy, Angola, Argentina

2009 2010 2011 2012Trixbox

Pure AsteriskdCap + Astricon

irVoice

2

[email protected]

Page 3: Asterisk: dongled !

History of Implementations

Old Nokia Mobile Phone+ AT Commands+Visual Basic Application+USB to Serial cable

We needed new features:• Increasing SMS channels• Using them for voice• Managing broadcast• Interface with Asterisk…spending little

3

[email protected]

Page 4: Asterisk: dongled !

$$$

Whishes

4

[email protected]

Page 5: Asterisk: dongled !

Or…

Solution

5

[email protected]

Page 6: Asterisk: dongled !

a DONGLE !

Solution

6

[email protected]

Page 7: Asterisk: dongled !

SummaryRequirements

HowTo install dongle and configure with *

Usage

Demo Live – Case Study

7

[email protected]

Page 8: Asterisk: dongled !

*CLI> Requirements

*CLI> Premises

*CLI> Installation and configuration

*CLI> Usage

*CLI> Case Study

8

Page 9: Asterisk: dongled !

Requirements

Search for a Dongle [around 30 USD at eBay]

Only HUAWEI modem supported

not all HUAWEI models are supported

Power specs and USB hubs5V/500mA ? 2.5 W

OK

9

[email protected]

Page 10: Asterisk: dongled !

*CLI> Installation and Configuration

*CLI> Requirements

*CLI> Usage

*CLI> Premises

*CLI> Case Study

10

Page 11: Asterisk: dongled !

Installation and configuration

[233064.783557] usb 2-2.1: new full speed USB device using uhci_hcd and address 4[233065.096342] usb 2-2.1: New USB device found, idVendor=12d1, idProduct=1001[233065.096382] usb 2-2.1: New USB device strings: Mfr=1, Product=2, SerialNumber=1[233065.096432] usb 2-2.1: Product: HUAWEI Mobile[233065.096458] usb 2-2.1: Manufacturer: ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ[233065.096475] usb 2-2.1: SerialNumber: ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ[233065.909669] usb 2-2.1: configuration #1 chosen from 1 choice[233067.328939] Initializing USB Mass Storage driver...[233067.394668] usbcore: registered new interface driver usb-storage[233067.402786] USB Mass Storage support registered.[233067.419107] usbcore: registered new interface driver usbserial[233067.419393] USB Serial support registered for generic[233067.419582] usbcore: registered new interface driver usbserial_generic[233067.419619] usbserial: USB Serial Driver core[233067.439255] USB Serial support registered for GSM modem (1-port)[233067.447136] option 2-2.1:1.0: GSM modem (1-port) converter detected[233067.466022] usb 2-2.1: GSM modem (1-port) converter now attached to ttyUSB0[233067.466112] option 2-2.1:1.1: GSM modem (1-port) converter detected[233067.476046] usb 2-2.1: GSM modem (1-port) converter now attached to ttyUSB1[233067.476070] option 2-2.1:1.2: GSM modem (1-port) converter detected[233067.479013] usb 2-2.1: GSM modem (1-port) converter now attached to ttyUSB2[233067.479087] usbcore: registered new interface driver option[233067.479124] option: v0.7.2:USB Driver for GSM modems

root@debian002:~# dmesg

Plug the device

11

[email protected]

Page 12: Asterisk: dongled !

root@debian002:~# apt-get install minicom

root@debian002:~# minicom -c on -D /dev/ttyUSB0

-c is for colouring -D is for open specified port

Installation and configuration

Welcome to minicom 2.4

OPTIONS: I18nCompiled on Sep 5 2010, 09:23:03.Port /dev/ttyUSB14

Press CTRL-A Z for help on special keys

ATOK --> Check the connectionATI --> get device informationManufacturer: huaweiModel: E1552Revision: 11.608.13.02.00IMEI: 359638019133911AT+CGSN353143037121812 --> International Mobile Equipment Identity [IMEI]AT+CIMI722310501570940 --> International Mobile Subscriber Identity [IMSI]AT^CVOICE=?^CVOICE:(0) --> Voice is enabled !AT^U2DIAG=0OK --> switch the device in modem mode only

12

[email protected]

Page 13: Asterisk: dongled !

wget http://asterisk-chan-dongle.googlecode.com/files/chan_dongle-1.1.r10.tgztar -xzvf chan_dongle-1.1.r10.tgzcd chan_dongle-1.1.r10./configuremakemake installcp etc/dongle.conf /etc/asterisk/dongle.conf

[dongle1];audio=/dev/ttyUSB1 ; tty port for audio connection;;data=/dev/ttyUSB2 ; tty port for AT commands;

imei=123456789012345imsi=123456789012345context=dongle-incoming

Installation of chan_dongle module:

edit dongle.conf

Installation and configuration

*CLI> dongle reload now

reload dongle.conf

13

[email protected]

Page 14: Asterisk: dongled !

Installation and configuration

*CLI> help 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

14

[email protected]

Page 15: Asterisk: dongled !

*CLI> dongle show devices

ID Group State RSSI Mode Submode Provider Name Model Firmware IMEI IMSI dongle1 0 Free 31 3 3 AT&T E169 11.314.13 359658016133911 724310501530940 debian003*CLI> dongle show device

*CLI> dongle show version

chan_dongle: Huawei 3G Dongle Channel Driver, Version 1.1, Revision 10Project Home: http://code.google.com/p/asterisk-chan-dongleBug Reporting: http://code.google.com/p/asterisk-chan-dongle/issues/list

Installation and configuration

*CLI> help dongle restartUsage: dongle restart < now | gracefully | when convenient > <device> Restart dongle <device>

*CLI> help dongle reloadUsage: dongle reload < now | gracefully | when convenient > Reloads the chan_dongle configuration

15

[email protected]

Page 16: Asterisk: dongled !

TroubleshootingProblem Solution

Modem cannot register into GSM network: Select Any band: AT^SYSCFG=2,2,3fffffff,0,2

“Error checking subscriber phone number”“Dongle needs to be reinitialized. The SIM card is not ready yet”“Error initializing Dongle”AT+CNUM ERROR

Modem Locked:

Unlock the modem using free calculators, then AT^CARDLOCK=”< code >”

Modem with Voice NOT Enabled DC-Unlocker could help for a few dollars to enable voice feature [normally disabled]

Linux recognizes the device as storage memory.

AT^U2DIAG=0switch the device is only Modem

16

[email protected]

Page 17: Asterisk: dongled !

*CLI> Usage

*CLI> Installation and configuration

*CLI> Case Study

*CLI> Premises

*CLI> Requirements

17

Page 18: Asterisk: dongled !

Call and receive

[internal]exten => 74,1,Dial(DONGLE/dongle1/6785574445)

[dongle_incoming] ;same as defined in dongle.confexten => s,1,NoOp(Incoming CALL from ${CALLERID(all)} to ${EXTEN}) same => n,Dial(SIP/26) same => n,Hangup()

edit extensions.conf

18

[email protected]

Page 19: Asterisk: dongled !

Send SMS from CLI

Using CLI and plain text:

*CLI> dongle sms dongle1 6785574445 This is an OUTGOING message from CLI[dongle1] SMS queued for send with id 0x993efd0 -- [dongle1] Successfully sent SMS message 0x993efd0[Aug 15 18:03:14] NOTICE[16262] at_response.c:257 at_response_ok: [dongle1] Successfully sent SMS message 0x993efd0debian003*CLI>

Three ways to send messages1. Asterisk Console2. DialPlan3. Asterisk Manager Interface

19

[email protected]

Page 20: Asterisk: dongled !

Send SMS with DialPlan

Using dialplan

-- Executing [78@internal:1] DongleSendSMS("SIP/26-00000011", "dongle1,6785574445,'This is an OUTGOING sms sended via DialPlan.'") in new stack -- Auto fallthrough, channel 'SIP/26-00000011' status is 'UNKNOWN' -- [dongle1] Successfully sent SMS message 0x993efd0[Aug 15 18:19:25] NOTICE[16262] at_response.c: at_response_ok: [dongle1] Successfully sent SMS message 0x993efd0

[internal]exten => 74,1,Dial(DONGLE/dongle1/6785574445)

exten => 78,1,DongleSendSMS(dongle1,6785574445, ’This is an OUTGOING sms sended via DialPlan.')

[dongle_incoming] ;same as defined in dongle.confexten => s,1,NoOp(Incoming CALL from ${CALLERID(all)} to ${EXTEN}) same => n,Hangup()

exten => sms,1,NoOp(Incoming SMS into ${DONGLENAME}) same => n,NoOp( From ${CALLERID(num)}) same => n,NoOp( Message: ${BASE64_DECODE(${SMS_BASE64})}) same => n,Hangup()

edit extensions.conf

20

[email protected]

Page 21: Asterisk: dongled !

[internal]exten => 74,1,Dial(DONGLE/dongle1/6785574445)

exten => 78,1,DongleSendSMS(dongle1,6785574445, ’This is an OUTGOING sms sended thru DialPlan.')

[dongle_incoming] ;same as defined in dongle.confexten => s,1,NoOp(Incoming CALL from ${CALLERID(all)} to ${EXTEN}) same => n,Hangup()

exten => sms,1,NoOp(Incoming SMS into ${DONGLENAME}) same => n,NoOp( From ${CALLERID(num)}) same => n,NoOp( Message: ${BASE64_DECODE(${SMS_BASE64})}) same => n,Hangup()

Receive SMS

edit extensions.conf

[dongle1] Got SMS from 6785574445: ‘This is an INCOMING message thru dongle1.' -- Executing [sms@dongle_incoming:1] NoOp("Local/sms@dongle_incoming-1f32;1", "Incoming SMS into dongle1") in new stack -- Executing [sms@dongle_incoming:2] NoOp("Local/sms@dongle_incoming-1f32;1", " From 6785574445") in new stack -- Executing [sms@dongle_incoming:3] NoOp("Local/sms@dongle_incoming-1f32;1", " This is an OUTGOING sms sended thru DialPlan. ") in new stack

-- Executing [sms@dongle_incoming:4] Hangup("Local/sms@dongle_incoming-1f32;1", "") in new stack == Spawn extension (dongle_incoming,sms,4) exited non-zero on 'Local/sms@dongle_incoming-1f32;1'

Incoming SMS

21

[email protected]

Page 22: Asterisk: dongled !

Wiki: http://wiki.e1550.mobi/doku.phpCode: http://code.google.com/p/asterisk-chan-dongle/Forum: http://groups.google.com/group/chan_dongle/about

References

http://groups.google.com/group/chan_dongle/about

Forum Activity:

22

[email protected]

Page 23: Asterisk: dongled !

Time Out for questions.

…or continue with Case Study.

Page 24: Asterisk: dongled !

*CLI> Case Study

*CLI> Usage

*CLI> Requirements

*CLI> Premises

*CLI> Install and configure

Page 25: Asterisk: dongled !

Our Case Study

6 GSM dongle1 powered HUB D-Linkmore than 1500 sms/day

BEFORE

25

[email protected]

Page 26: Asterisk: dongled !

Our Case Study

26

[email protected]

Page 27: Asterisk: dongled !

Statistics

27www.irvoice.com.ar

[email protected]

Page 28: Asterisk: dongled !

Case Study

28www.irvoice.com.ar

[email protected]

Page 29: Asterisk: dongled !

Case Study

29www.irvoice.com.ar

[email protected]

Page 30: Asterisk: dongled !

Case Study

30www.irvoice.com.ar

[email protected]

Page 31: Asterisk: dongled !

Case Study

31www.irvoice.com.ar

[email protected]

Page 32: Asterisk: dongled !

Case Study

32www.irvoice.com.ar

[email protected]

Page 33: Asterisk: dongled !

Case Study

DEMO

33www.irvoice.com.ar

[email protected]

Page 34: Asterisk: dongled !

Case Study

DEMO

34www.irvoice.com.ar

[email protected]

Page 35: Asterisk: dongled !

Time Out for questions.

…or continue with Conclusions.

Page 36: Asterisk: dongled !

• Simple, economic , scalable• Save a lot of money redirecting mobile calls across

mobile networks.• SMS Integration, suitable for countless applications:

sending failure alertnotify customers about due date and promotionsmedical appointment reminders, etc.

• customized SMS with dynamic data: e.g. “Dear $CUSTOMER, your credit will expires on $DATE”

• Fast: 6 SMS/min = 360 message / hour aprox. 3200 sms/day EACH CHANNEL ! [ for 30 U$/dongle !]

Conclusions

36

[email protected]

Page 37: Asterisk: dongled !

37

Conclusions

Future Plans:

• Study C and learn more about Asterisk Code• have the opportunity to push irVoice into the market• …. return to the AstriCon next year !

[email protected]

Page 38: Asterisk: dongled !

[email protected]

Contact Information

…happy to share with you a time during the event !

@priorfra

Francesco Prior

38

[email protected]