bg111 / asterisk-chan-dongle

Automatically exported from code.google.com/p/asterisk-chan-dongle

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Dongle crash every night

rlzmaxx opened this issue · comments

Hi,

I managed to configure and make incoming/ outgoing calls, however, I have a stability issue because of every day the dongle crash and the State: GSM not registered GSM Registration Status: Not registered, but searching. After doing a "dongle reset dongle0" the modem register fine to the network without a problem and remain connected up to 12 hours (office hours).

There is some way to check logs to see the reason why the dongle is crashing? Or any way to solve this issue?

Thanks!

raspbx*CLI> dongle show device state dongle0
-------------- Status -------------
Device : dongle0
State : GSM not registered
Audio : /dev/ttyUSB1
Data : /dev/ttyUSB2
Voice : Yes
SMS : Yes
Manufacturer : huawei
Model : E160
Firmware : 11.609.10.02.432
IMEI : 3547640311XXXXX
IMSI : 2142200033XXXXX
GSM Registration Status : Not registered, but searching
RSSI : 13, -87 dBm
Mode : WCDMA
Submode : WCDMA
Provider Name : NONE
Location area code : B33
Cell ID : 926A
Subscriber Number : +346420XXXXX
SMS Service Center : +346422XXXXX
Use UCS-2 encoding : Yes
USSD use 7 bit encoding : No
USSD use UCS-2 decoding : Yes
Tasks in queue : 0
Commands in queue : 0
Call Waiting : Disabled
Current device state : start
Desired device state : start
When change state : now
Calls/Channels : 0
Active : 0
Held : 0
Dialing : 0
Alerting : 0
Incoming : 0
Waiting : 0
Releasing : 0
Initializing : 0

After "dongle reset dongle0"

raspbx*CLI> dongle show device state dongle0
-------------- Status -------------
Device : dongle0
State : Free
Audio : /dev/ttyUSB1
Data : /dev/ttyUSB2
Voice : Yes
SMS : Yes
Manufacturer : huawei
Model : E160
Firmware : 11.609.10.02.432
IMEI : 3547640311XXXXX
IMSI : 2142200033XXXXX
GSM Registration Status : Registered, roaming
RSSI : 12, -89 dBm
Mode : WCDMA
Submode : WCDMA
Provider Name : movistar
Location area code : B33
Cell ID : E74B
Subscriber Number : +346420XXXXX
SMS Service Center : +346422XXXXX
Use UCS-2 encoding : Yes
USSD use 7 bit encoding : No
USSD use UCS-2 decoding : Yes
Tasks in queue : 0
Commands in queue : 0
Call Waiting : Disabled
Current device state : start
Desired device state : start
When change state : now
Calls/Channels : 0
Active : 0
Held : 0
Dialing : 0
Alerting : 0
Incoming : 0
Waiting : 0
Releasing : 0
Initializing : 0

commented

Its not crash.
This problems caused maybe by network maybe by SIM maybe by dongle itself.
I think you should monitor dongles for this state and reset with help of external scripts for example.
In public chan_dongle watchdog functons not implemented.

rlzmaxx, bg111 is right. There might be a whole bunch of factors making your dongle loose a network.
Try to check the network signal first. You may use AT+CSQ AT command and see what your dongle responses. It might be a bad sim card as well. If you have an option to test with a different one - it is definitely worth of checking. Your forlorn hope might be a script to check dongle state put on cron and triggered every 5-10 mins. In the event that your dongle lost a network you may want to use this https://gist.github.com/x2q/5124616 tool to reset it. This is what I have for those cases when my USB dongles become inaccessible due to the lack of power after some power spikes.
It goes like this:

You can reset USB bus via this C program. https://gist.github.com/x2q/5124616

Download C code from github

wget -c --no-check-certificate https://gist.githubusercontent.com/x2q/5124616/raw/3f6e5f144efab2bc8e9d02b95b8301e1e0eab669/usbreset.c -O usbreset.c
Compile C code as usbreset
cc usbreset.c -o usbreset
Give execute permission to program
chmod +x usbreset
List your USB devices via lsusb command
lsusb
You should see USB device entries in your output and check device you want to reset for.

Bus 002 Device 003: ID 0fe9:9010 DVICO

Run usbreset program with arguments

sudo ./usbreset /dev/bus/usb/002/003

Cheers.

commented

It is not USB issue

He said that reset was useful. Since it works why not giving it a try?

Ruben, Did you manage to implement any script that you could share here.
I have this script but I got issues getting to work, Can someone please fine tune this. Thanks

#!/bin/sh
#asterisk -rvx "dongle show devices" | grep -c "Free"
#asterisk -rvx "dongle show devices" | grep -c "NONE"
/usr/sbin/asterisk -rvx "dongle show device state dongle0" | grep -c "GSM not registered"
date >> /var/log/asterisk/dongle0-status.log
/usr/sbin/asterisk -rvx "dongle show device state dongle0" >> /var/log/asterisk/dongle0-status.log
if [ $? -eq 1 ]
#if [ $? == 0 ]
then
date >> /var/log/asterisk/dongle0-running.log
/usr/sbin/asterisk -rvx "dongle show device state dongle0" >> /var/log/asterisk/dongle0-running.log
exit 0
else
date >> /var/log/asterisk/dongle0-down.log
/usr/sbin/asterisk -rvx "dongle show device state dongle0" >> /var/log/asterisk/dongle0-down.log
date >> /var/log/asterisk/dongle0-reset.log
/usr/sbin/asterisk -rvx "dongle reset dongle0"
exit 1
fi

donaldf26: Corrected your script. It works now!

#!/bin/bash
if /usr/sbin/asterisk -rx "dongle show device state dongle0" | grep -c "GSM not registered" >> /dev/null
then
date >> /var/log/asterisk/dongle0-down.log
/usr/sbin/asterisk -rx "dongle show device state dongle0" >> /var/log/asterisk/dongle0-down.log
date >> /var/log/asterisk/dongle0-reset.log
/usr/sbin/asterisk -rx "dongle reset dongle0"
else
date >> /var/log/asterisk/dongle0-running.log
/usr/sbin/asterisk -rx "dongle show device state dongle0" >> /var/log/asterisk/dongle0-running.log
fi

Hi
Sorry from my english :-)

I have also a problem and not find in internet possible dongle state's...
My dongle can have state Free (is OK), GSM not registered and Active1.
Often dongle not work and have state Active... Surely in time no active calls in CLI :-)

And i change first string in your script:
if /usr/sbin/asterisk -rx "dongle show device state dongle0" | grep "State" |grep -cv "Free" >> /dev/null

It's good to add to cron daily rebooting of server with asterisk. This script don't always help me if server is running for more than 1 week.

commented

Hello everyone!
I've had a similar problem and here is how I solved it:
Ifno:
OS: Debian 10
Asterisk 13.28.1
Dongle: Huawei e1552
Firmware: 11.608.12.00.00

  1. Connect to modem via minicom
  2. Check the registration status of the device (AT+CGREG?) and got +CGREG: 0,5 (Registered, non-home network)

Results of network registration status commans,
0,0 – not registered, MT is not currently searching a new operator to register to
0,1 – Registered, home network
0,2 – Searching
0,3 – Registration denied
0,5 – Registered, non-home network

  1. Call from another phone to my modem
  2. Answer voice call using AT command ATA
  3. After 20-30 sec I hear noises and disconnect
  4. Check the registration status of the device and got 0,2 – Searching

So, Then I changed my mobile operator (with network status: 0,1 – Registered, home network) and the problem is gone.