PDA

View Full Version : How to check bundle balance with USSD (gsm-ussd)



trids
29-09-2010, 03:42 PM
How can i check the balance remaining on my data bundle WITHOUT moving the SIM to a cellphone and running the USSD command *141#?

Using: MTN prepaid, Huawei E220 3G modem on Ubuntu/Kubuntu linux

I heard that minicom can do it, apparently it can execute USSD commands. So i downloaded it -- but i don't have a clue where to start with it.

Any help gratefully appreciated!

cbrunsdonza
29-09-2010, 04:34 PM
The only thing I've ever managed to get right with minicom is to freeze up the modem. Not a problem with a local PC but my intention was to use it on remote servers.

I also found the USSD response too random and was a hit 'n miss for me. Gave up.

But I'm interested in a solution as I'm looking at something to auto test USSD services we host for our clients.

milomak
01-10-2010, 10:07 PM
is there an SMS number you can send a text to to get the balance?

you could use the vodafone mobile connect software if there is - http://www.betavine.net/bvportal/resources/datacards/os/ubuntu

dabbler
02-10-2010, 10:21 AM
If you use the modem for browsing why not register at vodacom4me? Any reason NOT to?

ginggs
13-10-2010, 08:38 PM
How can i check the balance remaining on my data bundle WITHOUT moving the SIM to a cellphone and running the USSD command *141#?
Download gsm-ussd from here (http://linux.zum-quadrat.de/downloads/).
I have just tested in Ubuntu 10.10.

For anyone wanting to use this with a Cell C E1820 make the following changes installing (for version 0.3.3):

sudo nano /usr/bin/gsm-ussd
change line 45 to read:

my $modemport = '/dev/ttyUSB3';
change line 49 to read:

my @ussd_queries = ( '*101#' ); # Prepaid account query as default
insert the following at line 349 (important!):

'E1820',
then:

sudo nano /usr/bin/xussd
change line 297 to read:

USSD_QUERY='*101#'

cbrunsdonza
13-10-2010, 09:31 PM
Thanks. Trying it on 10.10 but no success with my E220 (but the modem is dodgy and I'm too lazy to throw it in the bin)

Will try tomorrow at work

cbrunsdonza
13-10-2010, 10:12 PM
OK, tried a different but no working in 10.10

ginggs
13-10-2010, 10:30 PM
OK, tried a different but no working in 10.10
Can you be more specific?

I should have mentioned, type 'gsm-ussd' for the CLI version and 'xussd' for the gui version.

Ockie
14-10-2010, 08:28 AM
If you use the modem for browsing why noy register at vodacom4me? Any reason NOT to?

Because these are hardened Linux geniuses. They like to take the road less traveled and challenge the Linux kernel gedoente. :-)

But yes, registering on the vodacom.co.za would be the easy way to do it. :-)

rudivs
21-11-2010, 03:59 PM
For anyone wanting to use this with a Cell C E1820 make the following changes installing (for version 0.3.3)

Anyone got this working with the Cell C E1752 yet? I've tried gsm-ussd on Ubuntu 10.04, and just changed line 349 to read 'E1752' instead of 'E1820'. With that line, it times out after 20 seconds without a reply "No answer for 20 seconds!", and if I leave it out, I get the error "Broken command".

rudivs
21-11-2010, 05:54 PM
Okay, I managed to get it working. It seems that my $modemport (line 45 in /usr/bin/gsm-ussd) keeps changing for some obscure reason (might be because I've inserted a faulty microSD card into the usb modem). Eventually I pinned it down to /dev/ttyUSB10 and could get a balance out of it, so I can confirm that gsm-ussd will work on the Cell-C Huawei E1752. Thanks for the instructions @ginggs!

carelvdm
02-12-2010, 08:48 PM
Hi there

I'm using the 7.2Mbps Cell C speedstick with Ubuntu 10.10 and it works lekker lekker. Only problem is, how do I check my usage? On Windows I can check it with the Cell C management software but can I get that on Ubuntu? Or does Cell C have a web interface for checking data usage?

rudivs
04-12-2010, 11:34 AM
@carelvdm:
Follow ginggs' post above (#5), but on line 349 where he inserts 'E1820', use 'E1752' instead. With the changes made to /usr/bin/gsm-ussd, the following works for me from the commandline:

gsm-ussd -m /dev/`dmesg | grep "usb 1-3" | tail -n 1 -c 8`

You could probably just use gsm-ussd without the stuff that follows, but for me it keeps switching to a different device, and I need to use the complicated command to keep track of it.

Ockie
21-12-2010, 04:46 PM
Wow....thanks ginggs....this works 100% for me. Have 1.3Gig left still. Eish...gonna have to find me some lekker downloads before end of the month it seems :-)

Bismuth
30-12-2010, 08:26 AM
hey, thanks ginggs, this works great! :)

B

carelvdm
14-04-2011, 10:24 AM
Thanks! Got it working! Fantastic!

Dean
12-06-2011, 08:14 PM
Download gsm-ussd from here (http://linux.zum-quadrat.de/downloads/).
I have just tested in Ubuntu 10.10.
.....

Howzit

I'm using an E1820 (I think... that's the Black 21mbps Cell C woosh speedstick right? :P) and Ubuntu 11.04, when I try to install the .deb through Software Centre, it tells me that it doesn't meet quality standards. Should I still go ahead with the install? If anyone has experience using this app or any similar one to track usage, please let me know.

TIA!

ginggs
16-06-2011, 10:02 AM
I'm using an E1820 (I think... that's the Black 21mbps Cell C woosh speedstick right? :P)
Cell-C have at least two different black speedsticks, the manufacturer and model should be printed on the modem itself.

...and Ubuntu 11.04, when I try to install the .deb through Software Centre, it tells me that it doesn't meet quality standards. Should I still go ahead with the install? If anyone has experience using this app or any similar one to track usage, please let me know.
Which version did you try and install; the latest stable release (0.3.3) or the development version (0.4.0)?

I installed 0.3.3, I can't recall whether I used dpkg or gdebi, but it wasn't Software Centre. I don't recall any 'quality standards' messages. That may just mean that the package doesn't come from the Ubuntu repository, so Canonical cannot vouch for it's quality.

Dean
16-06-2011, 12:24 PM
Thanks, just checked on the physical stick - it's the E1820.

Will install the app now and see what happens :P

Dean
16-06-2011, 02:19 PM
I installed 0.3.3, I can't recall whether I used dpkg or gdebi, but it wasn't Software Centre. I don't recall any 'quality standards' messages. That may just mean that the package doesn't come from the Ubuntu repository, so Canonical cannot vouch for it's quality.

Using version 0.3.3 and the E1820,

I tried a few times using Software Centre, and it wouldn't allow it at all - even when I told it to.

So using GDebi, it alerted me, but continued with the install after I said all is good and sudo'd up.

I made the changes as you specified - only one difference being that I had to make it look for USB2 instead of USB3.

Thanks thanks!

kilkraze
16-06-2011, 04:47 PM
Hi guys, I tried this with a vodafone Huawei K3765 stick, on Fedora 14. Problem is, I get the error that it cant lock the device, in my case ttyUSB0. It would make sense if the modem is in use, I suppose, but how would I go about using it then? I have version 0.40 of gsm-ussd and I am on a vodacom data bundle. I am not even sure if the vodacom ussd code, *100# will even give me the correct thing, but it is worth a try, if I can just get it going.

kilkraze
16-06-2011, 04:56 PM
Hi guys, I tried this with a vodafone Huawei K3765 stick, on Fedora 14. Problem is, I get the error that it cant lock the device, in my case ttyUSB0. It would make sense if the modem is in use, I suppose, but how would I go about using it then? I have version 0.40 of gsm-ussd and I am on a vodacom data bundle. I am not even sure if the vodacom ussd code, *100# will even give me the correct thing, but it is worth a try, if I can just get it going.

Ok, maybe I am going bout this the wrong way. Does it use different a different modemport to send the USSD command as the one it uses to connect? I got the ttyUSB0 from the connection info in my network manager.

cbrunsdonza
16-06-2011, 06:20 PM
Thanks guys. Tried this again tonight and got it working now. Issue I had is network manager screwing around with the modem. I've got UDEV rules I was playing around with that I updated to get network manager to ignore the modem and it also forcefully mounts the modem port to a /dev/ttyMODEM3G symlink.

Just checked my balance with *111*502#


[18:17:53] chrisb@compaq: ~ >
$ sudo gsm-ussd -m /dev/ttyModem3G
You have the following remaining balances:

110.67MB Data
[18:18:00] chrisb@compaq: ~ >
$

cbrunsdonza
16-06-2011, 06:24 PM
Cool, if you want to send more than one USSD command you can do it:


[18:22:55] chrisb@compaq: ~ >
$ sudo gsm-ussd -m /dev/ttyModem3G *111# 1 5
USSD session open, to cancel use "gsm-ussd -c".
1. Balances
2. Vodacom Airtime/Bundle Transfer
3. Device Setup
4. Passwords
5. WIG Download
6. Content Management
7. Reverse Charge
8. Email
USSD session open, to cancel use "gsm-ussd -c".
1. Account Balance
2. Free minute Balance
3. SMS Bundle Balance
4. MMS Bundle Balance
5. Data Bundle Balance
6. Vodacom Millionaires
7. My Minutes
110.67MB expires on 31/07/2011
[18:23:30] chrisb@compaq: ~ >

ginggs
17-06-2011, 11:03 AM
Does it use different a different modemport to send the USSD command as the one it uses to connect?
Yes, this is so you can check the signal strength and send USSD while you are online.

elf_lord_ZC5
18-06-2011, 07:30 AM
Thinking about getting the 2g+2g Vodacom deal.
How accurate is the information retrieved by gsm-ussd? - keeping the OOB Shark in mind.
Does the info retrieved indicate what is normal usage and what is night owl usage?

Or will one have to resort to scripted logfile parsing to determine accurate data usage?

kilkraze
19-06-2011, 12:39 PM
Have any of you gotten a "Broken Command" response? I just can't seem to get this working. Every time I try this thing I get different results.

cbrunsdonza
19-06-2011, 01:08 PM
Thinking about getting the 2g+2g Vodacom deal.
How accurate is the information retrieved by gsm-ussd? - keeping the OOB Shark in mind.
Does the info retrieved indicate what is normal usage and what is night owl usage?

Or will one have to resort to scripted logfile parsing to determine accurate data usage?

I usually use vnstat for 3G modems but the problem with this offer is you have time based caps and vnstat does not do that (would be nice for someone to update it to do that). What I did for my wife who was using my 300Mb VC contract was to set vnstat to update every minute and the poll the results every minute and if she hit the cap to set the iptables to block all traffic. I was able to even cater for rollover and this worked 100%.

elf_lord_ZC5
19-06-2011, 05:38 PM
I usually use vnstat for 3G modems but the problem with this offer is you have time based caps and vnstat does not do that (would be nice for someone to update it to do that). What I did for my wife who was using my 300Mb VC contract was to set vnstat to update every minute and the poll the results every minute and if she hit the cap to set the iptables to block all traffic. I was able to even cater for rollover and this worked 100%.

Does vnstat log to a text file one can parse, not that I know how, but I can put something together and let a friend or two look it, and help make it work better ...

Northender
22-07-2011, 05:54 PM
Greetings, I am a non-computer person switching to Ubuntu for the first time. I have a Cell C (cheap one) prepaid speedstick. I have downloaded the GSM program and can see it as a download in my "files and folders" from the tab on the toolbar. How do I get in to make the changes and launch it? And this is on a tangent here, but how the f* do I add shortcuts to my desktop?

michael.kyritsis
23-08-2011, 12:15 PM
from the command line (i.e. Applications / Accessories / Terminal)

gsm-ussd -d
Will give you debug output, including the model of the modem. If you can see data being sent and received it's also an indication that you have the right device (in my case I've edited the script to use /dev/ttyUSB3 - I have the Cell-C E1752)
So if you're struggling to get your balance via gsm-ussd the extra debug info might help you to spot a problem.

K3NS31
06-11-2012, 05:40 PM
snip...
change line 45 to read:

my $modemport = '/dev/ttyUSB3';
...snip

Just found this thread - very useful, except - what do I set this line to if I have an internal 3G modem?
I tried /dev/wwan0 (as reported by "Gnome modem manager", but that didn't work.
Desperately need to get USSD working on Ubuntu so I can use a prepaid SIM.

ginggs
06-11-2012, 05:55 PM
Just found this thread - very useful, except - what do I set this line to if I have an internal 3G modem?
I tried /dev/wwan0 (as reported by "Gnome modem manager", but that didn't work.
Desperately need to get USSD working on Ubuntu so I can use a prepaid SIM.
Try GNOME Prepaid Manager Applet (https://honk.sigxcpu.org/piki/projects/ppm/). It's in Ubuntu Precise and Quantal as package 'prepaid-manager-applet'.

K3NS31
06-11-2012, 06:34 PM
Thanks, will have a look. I tried a coupla other GUI's to "Modem Manager" (the aforementioned 'Gnome-modem-manager' as well as 'Modem-Manager-GUI', which is in the repos), and both could communicate with the modem, give me provider and network info etc., but sending USSD just wouldn't work.
So anyway, I'm not feeling too positive about this one but will give it a try when I get a chance, probably tomorrow.

K3NS31
08-11-2012, 05:25 PM
Try GNOME Prepaid Manager Applet (https://honk.sigxcpu.org/piki/projects/ppm/). It's in Ubuntu Precise and Quantal as package 'prepaid-manager-applet'.

So that didn't work. I've checked again and it seems that although my modem is internal it's still connected to the USB bus (shows as a USB device); so the question is, how do I check how the OS is addressing the modem? (Presumably /dev/something)
I assume if I put that info into the "Modemport..." line, I'll be good. Surprisingly difficult to find info about this online.

ginggs
10-11-2012, 01:29 AM
So that didn't work. I've checked again and it seems that although my modem is internal it's still connected to the USB bus (shows as a USB device); so the question is, how do I check how the OS is addressing the modem? (Presumably /dev/something)
I assume if I put that info into the "Modemport..." line, I'll be good. Surprisingly difficult to find info about this online.
What is the output of 'lsusb'? I get the following:

$ lsusb
Bus 001 Device 003: ID 12d1:14ac Huawei Technologies Co., Ltd.
Bus 002 Device 002: ID 2001:f103 D-Link Corp. DUB-H7 7-port USB 2.0 hub
Bus 004 Device 002: ID 045e:001e Microsoft Corp. IntelliMouse Explorer
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 004: ID 058f:6362 Alcor Micro Corp. Flash Card Reader/Writer
Now run 'dmesg | less' and scroll down until you see the 3G modem being detected. I get:

[ 620.248170] usb 1-4: new high-speed USB device number 3 using ehci_hcd
[ 620.382924] usb 1-4: New USB device found, idVendor=12d1, idProduct=14ac
[ 620.382935] usb 1-4: New USB device strings: Mfr=4, Product=3, SerialNumber=0
[ 620.382942] usb 1-4: Product: HUAWEI Mobile
[ 620.382948] usb 1-4: Manufacturer: Huawei Technologies
[ 620.388429] scsi11 : usb-storage 1-4:1.5
[ 620.388813] scsi12 : usb-storage 1-4:1.6
[ 620.426628] usbcore: registered new interface driver usbserial
[ 620.426640] usbcore: registered new interface driver usbserial_generic
[ 620.426649] USB Serial support registered for generic
[ 620.426652] usbserial: USB Serial Driver core
[ 620.429471] usbcore: registered new interface driver option
[ 620.429482] USB Serial support registered for GSM modem (1-port)
[ 620.429643] cdc_ether 1-4:1.1: wwan0: register 'cdc_ether' at usb-0000:00:02.1-4, Mobile Broadband Network Device, 02:50:f3:00:00:00
[ 620.429791] usbcore: registered new interface driver cdc_ether
[ 620.430696] option 1-4:1.0: GSM modem (1-port) converter detected
[ 620.430873] usb 1-4: GSM modem (1-port) converter now attached to ttyUSB0
[ 620.430905] option 1-4:1.3: GSM modem (1-port) converter detected
[ 620.430952] usb 1-4: GSM modem (1-port) converter now attached to ttyUSB1
[ 620.430960] option 1-4:1.4: GSM modem (1-port) converter detected
[ 620.430998] usb 1-4: GSM modem (1-port) converter now attached to ttyUSB2
[ 621.389870] scsi 11:0:0:0: CD-ROM HUAWEI Mass Storage 2.31 PQ: 0 ANSI: 2
[ 621.390096] scsi 12:0:0:0: Direct-Access HUAWEI TF CARD Storage PQ: 0 ANSI: 2
[ 621.396234] sr1: scsi-1 drive
[ 621.396513] sr 11:0:0:0: Attached scsi CD-ROM sr1
[ 621.398179] sr 11:0:0:0: Attached scsi generic sg7 type 5
[ 621.398749] sd 12:0:0:0: Attached scsi generic sg8 type 0
[ 621.406359] sd 12:0:0:0: [sdg] Attached SCSI removable disk
I've emphasized the USB VID/PIDs and serial devices.

K3NS31
12-11-2012, 10:31 AM
lsusb:

Bus 001 Device 002: ID 0bdb:1900 Ericsson Business Mobile Networks BV F3507g Mobile Broadband Module

And these seem to be the relevant lines in"dmesg":

[ 1.113629] usb 1-5: New USB device found, idVendor=0bdb, idProduct=1900
[ 1.113638] usb 1-5: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 1.113641] usb 1-5: Product: Ericsson F3507g Mobile Broadband Minicard Composite Device
[ 1.113644] usb 1-5: Manufacturer: Ericsson
[ 1.113646] usb 1-5: SerialNumber: 3541430240669870


Although these lines look important too?


[ 16.576859] cdc_acm 1-5:1.3: ttyACM1: USB ACM device
[ 16.588523] cdc_wdm 1-5:1.5: cdc-wdm0: USB WDM device
[ 16.588598] cdc_wdm 1-5:1.6: cdc-wdm1: USB WDM device
[ 16.588645] usbcore: registered new interface driver cdc_wdm
[ 16.589554] cdc_acm 1-5:1.9: ttyACM2: USB ACM device
[ 16.592649] usbcore: registered new interface driver cdc_acm
[ 16.592653] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters

ginggs
12-11-2012, 09:48 PM
Although these lines look important too?


[ 16.576859] cdc_acm 1-5:1.3: ttyACM1: USB ACM device
[ 16.588523] cdc_wdm 1-5:1.5: cdc-wdm0: USB WDM device
[ 16.588598] cdc_wdm 1-5:1.6: cdc-wdm1: USB WDM device
[ 16.588645] usbcore: registered new interface driver cdc_wdm
[ 16.589554] cdc_acm 1-5:1.9: ttyACM2: USB ACM device
[ 16.592649] usbcore: registered new interface driver cdc_acm
[ 16.592653] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters

Try setting the gsm-ussd's modem port to /dev/ttyACM1 and /dev/ttyACM2 and see if you get a response on either port.

K3NS31
13-11-2012, 10:19 AM
Try setting the gsm-ussd's modem port to /dev/ttyACM1 and /dev/ttyACM2 and see if you get a response on either port.

Yah, I figured you'd say that. Didn't work :(
Weird thing is those Modem Manager front-ends all see the modem and the network and so on, but can't send USSD's.
GSM-USSD just gives an error immediately, no matter what port I use.
(I also tried /dev/cdc-wdm0 and 1. And /dev/USB1-5)

ginggs
13-11-2012, 11:13 AM
Yah, I figured you'd say that. Didn't work :(
Weird thing is those Modem Manager front-ends all see the modem and the network and so on, but can't send USSD's.
GSM-USSD just gives an error immediately, no matter what port I use.
(I also tried /dev/cdc-wdm0 and 1. And /dev/USB1-5)
Maybe your built-in modem just cannot do USSD.

K3NS31
13-11-2012, 08:50 PM
Maybe your built-in modem just cannot do USSD.

Is that even possible?

ginggs
13-11-2012, 09:05 PM
Is that even possible?
Sadly, yes. USSD support varies from manufacturer to manufacturer and modem to modem, even from firmware revision to firmware revision. :cry:

K3NS31
14-11-2012, 10:34 AM
Damn. I'd better try to get hold of Ericsson support then.