[asterisk-dev] About chan_mobile

Odicha odicha at hotmail.com
Tue Aug 11 15:26:46 CDT 2009


Yes, Tzafrir.
Perl or something like that.
What I need is devices exposed like in /proc/tty/driver/usbserial

Something like this
usbserinfo:1.0 driver:2.0
0: module:option name:"GSM modem (1-port)" vendor:12d1 product:1001 
num_ports:1 port:1 path:usb-0000:00:1d.3-1
1: module:option name:"GSM modem (1-port)" vendor:12d1 product:1001 
num_ports:1 port:1 path:usb-0000:00:1d.3-1
2: module:option name:"GSM modem (1-port)" vendor:12d1 product:1001 
num_ports:1 port:1 path:usb-0000:00:1d.3-1
3: module:option name:"GSM modem (1-port)" vendor:12d1 product:1001 
num_ports:1 port:1 path:usb-0000:00:1d.0-1
4: module:option name:"GSM modem (1-port)" vendor:12d1 product:1001 
num_ports:1 port:1 path:usb-0000:00:1d.0-1
5: module:option name:"GSM modem (1-port)" vendor:12d1 product:1001 
num_ports:1 port:1 path:usb-0000:00:1d.0-1
[root at pruebas ~]#

....but non root users can't access this file because tty folder permissions 
are only root. Instead usbserial file permissions are 0444. Perhaps 
symlinking to asterisk folder? If this is readable for asterisk, the 
detection part can be done in a very easy way
What I do now is walk on /sys/bus/usb/devices. It works, but it's a big 
dirty thing...

ToDo... Round Robin... (for having a pool of modems with some time bonus 
agreement....for example)
Network coverage in sebi show devices.... (easy... only time to write it..)
Modem detection
Cleaning all code... I think there are some lines with more than 200 hundred 
characters....

More things to do for it working fine ....
ttyUSB ports by default are 0660, so if we run Asterisk in non root account 
we must before create a rule in udev for changing them to 0666 (it's an 
example of override this)or chmod 0666 usbTTY* at console or give asterisk 
user permission on uucp group (I'm not sure if this is right from Linux 
point of view... uucp is a strange group...)
Ideas are always welcome

Some samples
Sebi_devices.conf (asterisk detection)

[root at pruebas ~]# cat /etc/asterisk/sebi_devices.conf
[5-1]
voice = /dev/ttyUSB1
data = /dev/ttyUSB2
imei = 353284026023xxx
[2-1]
voice = /dev/ttyUSB4
data = /dev/ttyUSB5
imei = 353284029799xxx
[root at pruebas ~]#

sebi.conf (config file)

[root at pruebas ~]# cat /etc/asterisk/sebi.conf
[huawei1]
imei=353284026023xxx            ; imei of modem
;pin=1234                       ; pin (use only if sim card has pin request 
enabled)
csca=+34607003110               ; SMS centre number (Vodafone ES - example)
sms=yes                         ; Enable sms send/receive
voice=yes                       ; Enable voice for calls
context=from-pstn               ; dialplan context for incoming calls
group=1                         ; this phone is in channel group 1
volume=5                        ; Modem Volume (1-5)
language=es                     ; Channel language
;nocallsetup=yes                ; set this only if you want override call 
status notifications
hidecid=#31#                    ; if you want outbound calls without caller 
id
;noincomingcalls=yes            ; Reject all voice incoming calls

[huawei2]
imei=353284029799xxx
csca=+34607003110
sms=yes
voice=yes
context=from-pstn
group=1
volume=5
language=es
hidecid=#31#

And sebi show devices from asterisk console

pruebas*CLI> sebi show devices
ID              IMEI              Group           Provider        Connected 
State Voice SMS
huawei2         353284029799xxx   1               vodafone ES     Yes 
Free  Yes   Yes
huawei1         353284026023xxx   1               vodafone ES     Yes 
Free  Yes   Yes


I think a big part of work is done...
It will work on 1.6.x branch with minor modifications... (logs, ast channel 
structs... a few lines...)

For sms sending and receiving it has same structure than chan_mobile...

Any idea will be welcome

----- Original Message ----- 
From: "Tzafrir Cohen" <tzafrir.cohen at xorcom.com>
To: <asterisk-dev at lists.digium.com>
Sent: Tuesday, August 11, 2009 8:54 PM
Subject: Re: [asterisk-dev] About chan_mobile


> On Tue, Aug 11, 2009 at 08:30:01PM +0100, Odicha wrote:
>> If anyone has another hardware that could work and /or any question about
>> how it works I'll be pleased to help.
>>
>> what it does at now...
>>
>> Huawei audio modems have three ttyUSB ports. So they use une port for
>> GPRs/3G data connection ( subdevice 0), next port for audio (only audio
>> slinear stream.. passtrough directly to asterisk when voice is enabled) 
>> and
>> next port for AT communication (some no standard AT commands for enabling
>> voice streaming on other port, and all rest of standard stuff)
>>
>> So It mainly uses AT commands and some routines for enabling/disabling 
>> audio
>> stream. Not complex at all.
>>
>> The "worst part" in module is about modem detection. It might be 
>> rewritten.
>> It searches for device strings in /sys/bus/usb/devices/ . It might work 
>> with
>> some fs library I think
>
> Care for some perl code to do that? ;-)
>
> Anyway, this sounds linux-specific.
>
>>
>> How it starts.
>> First of all It does the "dirty search" of modems. It will write into
>> asterisk one file
>> sebi_devices.conf
>> with data about modems their tty port and their IMEI
>> After that it loads sebi.conf. If Imei from modem config exists in
>> sebi_devices.conf (it's attached ..) it loads modem channel.
>
> Why not make use of udev (or HAL and higher level layers)? Oops, anybody
> mentioned "Linux specific?". Ahem.
>
> What happens when a new device is plugged while your code is already
> running?
>
> When a device is disconnected?
>
> -- 
>               Tzafrir Cohen
> icq#16849755              jabber:tzafrir.cohen at xorcom.com
> +972-50-7952406           mailto:tzafrir.cohen at xorcom.com
> http://www.xorcom.com  iax:guest at local.xorcom.com/tzafrir
>
> _______________________________________________
> --Bandwidth and Colocation Provided by http://www.api-digital.com--
>
> AstriCon 2009 - October 13 - 15 Phoenix, Arizona
> Register Now: http://www.astricon.net
>
> asterisk-dev mailing list
> To UNSUBSCRIBE or update options visit:
>   http://lists.digium.com/mailman/listinfo/asterisk-dev
> 




More information about the asterisk-dev mailing list