Occasionally the output of the Asterisk CLI command
CLI> gsm show span n
is corrupt. For instance, this is an actual output;
CLI> gsm show span 14
D-channel: 28
Status: Power on, Provisioned, Up, Active, Standard
Type: CPE
Manufacturer: Revision: MTK 0828
Model Name: Quectel_M20
Model IMEI: 861111003869669
Revision: M20R06A03N32
Network Name: T-Mobile
Network Status: Registered (Roaming)
Signal Quality (0,31): 15
SIM IMSI: 234330422931997
SIM SMS Center Number: +447973100973
Last event: D-Channel Up
State: READY
Last send AT: ▒\r\n
Last receive AT: \r\n+CSQN: 15, 0\r\n
Which is good. But then we have this;
CLI> gsm show span 15
D-channel: 30
Status: Power on, Provisioned, Up, Active, Standard
Type: CPE
Manufacturer: Quectel_M20
Model Name: Quectel_M20
Model IMEI: Revision: M20R06A03N32
Revision: MTK 0828
Network Name: ORANGE
Network Status: Registered (Home network)
Signal Quality (0,31): 7
SIM IMSI: +CPIN: READY
SIM SMS Center Number: +447973100973
Last event: D-Channel Up
State: READY
Last send AT: ▒\r\n
Last receive AT: \r\n+CSQN: 7, 0\r\n
As you can see, the IMSI here has been replaced by another message "+CPIN: READY".
I can obtain the IMSI from within the Asterisk CLI using
CLI> gsm send at 15 AT+CIMI
but I need to be able to run this from within a script, and
# asterisk -rx 'gsm send at 15 AT+CIMI'
does not return the response from the command.
Do you know if there is some way of either (1) restoring the correct information in the output of `gsm show span n` or (2) capturing the result returned by a `gsm send at` command issued within a script?
OS is Debian 7.1 "Wheezy" (similar to Ubuntu). Kernel is 3.2.0-4-amd64.
Asterisk version is 1.8.22.0.
Dahdi version is 2.7.0+2.7.0.
Chan_extra version is 2.0.7.
This is Rick,so sorry to reply you delay.
You need to redirect the output stream,so that you can capturing the result via script.
For example:
#! /bin/bash
asterisk -rx 'gsm show spans'>test.txt
cat test.txt|while read line
do
echo $line
done
I guess you want write a program send AT,please give me your e-mail.I can give you some document.
My contaxt info be shown as below:
Gtalk: This email address is being protected from spambots. You need JavaScript enabled to view it.
Skype: rick.zhu3
e-mail: This email address is being protected from spambots. You need JavaScript enabled to view it.
the file was empty; there seemed to have been no response from the AT command, exactly as if I had left the output to STDOUT. So redirecting the output to a file seems not to be enough, by itself, to capture the AT command output.
To make it absolutely clear, it's the IMSI (serial number of the SIM) that I am really interested in -- the intention is that a bunch of SIMs will be rotated through the machine, with each one being used until its message allowance is used up. I want the IMSI so I can keep track of how many messages have been sent using each SIM, irrespective of which slot on the card it was inserted. The corrupt `gsm show span n` output probably is a separate issue.
I am unable to use Skype due to company policy against closed source software. However, I can be reached on Google Talk as This email address is being protected from spambots. You need JavaScript enabled to view it. . I can also be contacted by e-mail at the address I originally used to register with the forum.