nguyenbahuong / smslib

Automatically exported from code.google.com/p/smslib
0 stars 0 forks source link

GSM Network Auto-Registration disabled #503

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi people.

I'm pursuing to find an answer for my problem since two months ago. When I try 
to run the example ReadMessage.java, I get  the message:

org.smslib.GatewayException: GSM Network Auto-Registration disabled!

I'm using a ONDA Communication Modem, model MSA110UP. And I'm initializing  the 
SerialModemGateway as follows:

SerialModemGateway gateway = new SerialModemGateway("Modem-COM20",
                    "COM20",
                    921600,
                    "ONDA Corporation",
                    "MSA110UP");

Someone may help me?

Best regards

Fábio.

Original issue reported on code.google.com by flbeze...@gmail.com on 3 Sep 2012 at 2:01

GoogleCodeExporter commented 9 years ago
Can you post the log up to the point of the exception?

Original comment by admin@smslib.org on 4 Sep 2012 at 8:10

GoogleCodeExporter commented 9 years ago
Hi,

this is the log up to exception trace:

Example: Read messages from a serial gsm modem.
SMSLib: A Java API library for sending and receiving SMS via a GSM modem or 
other supported gateways.
This software is distributed under the terms of the Apache v2.0 License.
Web Site: http://smslib.org
Version: 3.5.2
log4j:WARN No appenders could be found for logger (smslib).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more 
info.
Stable Library
=========================================
Native lib Version = RXTX-2.1-7
Java lib Version   = RXTX-2.1-7
>>> Gateway Status change for Modem-COM20, OLD: STOPPED -> NEW: RESTART
>>> Gateway Status change for Modem-COM20, OLD: RESTART -> NEW: STOPPING
>>> Gateway Status change for Modem-COM20, OLD: STOPPING -> NEW: STOPPED
org.smslib.GatewayException: GSM Network Auto-Registration disabled!
    at org.smslib.modem.AModemDriver.waitForNetworkRegistration(AModemDriver.java:444)
    at org.smslib.modem.AModemDriver.connect(AModemDriver.java:168)
    at org.smslib.modem.ModemGateway.startGateway(ModemGateway.java:189)
    at org.smslib.Service$1Starter.run(Service.java:277)

Regards

Fábio

Original comment by flbeze...@gmail.com on 4 Sep 2012 at 11:07

GoogleCodeExporter commented 9 years ago
Hi,

You've not setup logging correctly.

==
log4j:WARN No appenders could be found for logger (smslib).
log4j:WARN Please initialize the log4j system properly.
==

Set it up corrently and you'll see a lot more logging lines.

Original comment by admin@smslib.org on 6 Sep 2012 at 12:35

GoogleCodeExporter commented 9 years ago
Thanks, 

after configuring te log4j.properties file I got the following output:

run:
Example: Read messages from a serial gsm modem.
SMSLib: A Java API library for sending and receiving SMS via a GSM modem or 
other supported gateways.
This software is distributed under the terms of the Apache v2.0 License.
Web Site: http://smslib.org
Version: 3.5.2
0    [main] INFO  smslib  - SMSLib: A Java API library for sending and 
receiving SMS via a GSM modem or other supported gateways.
This software is distributed under the terms of the Apache v2.0 License.
Web Site: http://smslib.org
 1    [main] INFO  smslib  - Version: 3.5.2
 1    [main] INFO  smslib  - JRE Version: 1.7.0_03
 1    [main] INFO  smslib  - JRE Impl Version: 22.1-b02
 1    [main] INFO  smslib  - O/S: Windows 7 / x86 / 6.1
 5    [main] INFO  smslib  - Queue directory not defined. Queued messages will not be saved to filesystem.
 6    [main] DEBUG smslib  - Initialized.
 6    [NotifyQueueManager] DEBUG smslib  - Running...
 6    [NotifyQueueManager] DEBUG smslib  - NotifyQueueManager running...
 7    [main] DEBUG smslib  - Initialized.
 7    [main] DEBUG smslib  - Initialized.
 8    [Thread-3] INFO  smslib  - GTW: Modem-COM20: Starting gateway, using Generic AT Handler.
 8    [Thread-3] INFO  smslib  - GTW: Modem-COM20: Opening: COM20 @921600
 9    [DelayQueueManager] DEBUG smslib  - Running...
 9    [DelayQueueManager] DEBUG smslib  - DelayQueueManager running...
 11   [WatchDog] DEBUG smslib  - Running...
 Stable Library
=========================================
Native lib Version = RXTX-2.1-7
Java lib Version   = RXTX-2.1-7
734  [Thread-3] DEBUG smslib  - Initialized.
 734  [Thread-3] DEBUG smslib  - Initialized.
 735  [Thread-3] DEBUG smslib  - GTW: Modem-COM20: ModemReader thread started.
 736  [KeepAlive [Modem-COM20]] DEBUG smslib  - Running...
 736  [Thread-3] DEBUG smslib  - GTW: Modem-COM20: AsyncNotifier thread started.
 737  [Thread-3] DEBUG smslib  - GTW: Modem-COM20: AsyncMessageProcessor thread started.
 737  [Thread-3] DEBUG smslib  - GTW: Modem-COM20: clearBuffer() called.
 738  [CNMIEmulatorProcessor [Modem-COM20]] DEBUG smslib  - ** disabled **
 1737 [Thread-3] DEBUG smslib  - GTW: Modem-COM20: SEND :(27)
 1941 [Thread-3] DEBUG smslib  - GTW: Modem-COM20: SEND :+++
 2144 [Thread-3] DEBUG smslib  - GTW: Modem-COM20: SEND :ATZ(cr)
 2345 [Thread-3] DEBUG smslib  - GTW: Modem-COM20: clearBuffer() called.
 3345 [Thread-3] DEBUG smslib  - GTW: Modem-COM20: SEND :ATZ(cr)
 3545 [Thread-3] DEBUG smslib  - GTW: Modem-COM20: SEND :ATE0(cr)
 3745 [Thread-3] DEBUG smslib  - GTW: Modem-COM20: clearBuffer() called.
 4745 [Thread-3] DEBUG smslib  - GTW: Modem-COM20: SEND :AT+CPIN?(cr)
 4785 [Thread-3] DEBUG smslib  - GTW: Modem-COM20: BUFFER: +CPIN: READY

 4786 [Thread-3] DEBUG smslib  - GTW: Modem-COM20: RECV :+CPIN: READY(cr)
 4786 [Thread-3] DEBUG smslib  - GTW: Modem-COM20: SEND :ATE0(cr)
 4986 [Thread-3] DEBUG smslib  - GTW: Modem-COM20: clearBuffer() called.
 5986 [Thread-3] DEBUG smslib  - GTW: Modem-COM20: SEND :AT+CLIP=1(cr)
 5988 [Thread-3] DEBUG smslib  - GTW: Modem-COM20: BUFFER: OK

 5988 [Thread-3] DEBUG smslib  - GTW: Modem-COM20: RECV :OK(cr)
 5988 [Thread-3] DEBUG smslib  - GTW: Modem-COM20: SEND :AT+COPS=0(cr)
 5997 [Thread-3] DEBUG smslib  - GTW: Modem-COM20: BUFFER: ERROR

 5997 [Thread-3] DEBUG smslib  - GTW: Modem-COM20: RECV :ERROR(cr)
 5997 [Thread-3] DEBUG smslib  - GTW: Modem-COM20: SEND :ATE0(cr)
 6198 [Thread-3] DEBUG smslib  - GTW: Modem-COM20: clearBuffer() called.
 7198 [Thread-3] DEBUG smslib  - GTW: Modem-COM20: SEND :AT+CREG=1(cr)
 7206 [Thread-3] DEBUG smslib  - GTW: Modem-COM20: BUFFER: OK

 7206 [Thread-3] DEBUG smslib  - GTW: Modem-COM20: RECV :OK(cr)
 7206 [Thread-3] DEBUG smslib  - GTW: Modem-COM20: SEND :AT+CREG?(cr)
 7209 [Thread-3] DEBUG smslib  - GTW: Modem-COM20: BUFFER: +CREG: 1,0
OK

 7209 [Thread-3] DEBUG smslib  - GTW: Modem-COM20: RECV :+CREG: 1,0(cr)OK(cr)
 7209 [Thread-3] ERROR smslib  - GTW: Modem-COM20: GSM: Auto-registration disabled!
 7209 [KeepAlive [Modem-COM20]] DEBUG smslib  - Stopped.
 7209 [CNMIEmulatorProcessor [Modem-COM20]] DEBUG smslib  - Stopped.
 7211 [SMSLib-AsyncNotifier : Modem-COM20] DEBUG smslib  - GTW: Modem-COM20: AsyncNotifier thread ended.
 7213 [SMSLib-AsyncMessageProcessor : Modem-COM20] DEBUG smslib  - GTW: Modem-COM20: AsyncMessageProcessor thread ended.
 7213 [SMSlib-ModemReader-Modem-COM20] DEBUG smslib  - GTW: Modem-COM20: ModemReader thread ended.
 7235 [Thread-3] INFO  smslib  - GTW: Modem-COM20: Closing: COM20 @921600
 >>> Gateway Status change for Modem-COM20, OLD: STOPPED -> NEW: RESTART
8008 [DelayQueueManager] DEBUG smslib  - DelayQueueManager end...
 8009 [NotifyQueueManager] DEBUG smslib  - NotifyQueueManager end...
 8109 [NotifyQueueManager] DEBUG smslib  - Running...
 8109 [NotifyQueueManager] DEBUG smslib  - NotifyQueueManager running...
 8209 [WatchDog] DEBUG smslib  - Stopped.
 8209 [main] INFO  smslib  - GTW: Modem-COM20: Stopping gateway...
 8209 [main] INFO  smslib  - GTW: Modem-COM20: Closing: COM20 @921600
 8209 [main] INFO  smslib  - GTW: Modem-COM20: Gateway stopped.
 >>> Gateway Status change for Modem-COM20, OLD: RESTART -> NEW: STOPPING
8209 [NotifyQueueManager] DEBUG smslib  - NotifyQueueManager end...
 8309 [NotifyQueueManager] DEBUG smslib  - Running...
 8309 [NotifyQueueManager] DEBUG smslib  - NotifyQueueManager running...
 >>> Gateway Status change for Modem-COM20, OLD: STOPPING -> NEW: STOPPED
8309 [NotifyQueueManager] DEBUG smslib  - NotifyQueueManager end...
 8409 [NotifyQueueManager] DEBUG smslib  - Running...
 8409 [NotifyQueueManager] DEBUG smslib  - NotifyQueueManager running...
 8411 [NotifyQueueManager] DEBUG smslib  - Stopped.
org.smslib.GatewayException: GSM Network Auto-Registration disabled!
 8416 [main] INFO  smslib  - GTW: Modem-COM20: Stopping gateway...
 8417 [main] INFO  smslib  - GTW: Modem-COM20: Closing: COM20 @921600
 8418 [main] INFO  smslib  - GTW: Modem-COM20: Gateway stopped.
    at org.smslib.modem.AModemDriver.waitForNetworkRegistration(AModemDriver.java:444)
    at org.smslib.modem.AModemDriver.connect(AModemDriver.java:168)
    at org.smslib.modem.ModemGateway.startGateway(ModemGateway.java:189)
    at org.smslib.Service$1Starter.run(Service.java:277)

Original comment by flbeze...@gmail.com on 8 Sep 2012 at 6:37

GoogleCodeExporter commented 9 years ago
Your modem probably needs some sort of initialization.
Could you try with "Huawei" as the manufacturer and "E220" as the model?

Original comment by admin@smslib.org on 12 Sep 2012 at 1:51

GoogleCodeExporter commented 9 years ago
Dear administrator.

Thank you so much. 
The problem was solved!

However I would like point out some interesting issues that I noticed:
1. First, I tried to initialize the modem. I done. It comes with a intern app, 
which I started before playing my application. It worked!
2. Also, I tried to set both manufactured and model, without starting the 
application that comes with the modem. It also worked even using parameters 
that do not conform with the modem that I am using.

Nevertheless, I can not receive messages using the "ReceiveMessages.java" 
example. I only can send messages with my modem. I noticed that the modem is 
not able to read messages if they are not saved in the GSM Sim Card.

For example, 
- using the approach 1 above, the application that comes with the modem handle 
the received messagem, while the java application only knows (it is notified) 
that the new message has been received, but it prints the messages that was 
already saved in the card.
- using the approach 2 above, just the java application is notified about the 
received message, but it not printed. The printed messages are only the ones 
that already was in the GSM sim card.

Could you help me?

Best regards!

Original comment by flbeze...@gmail.com on 13 Sep 2012 at 1:50

GoogleCodeExporter commented 9 years ago
Immediately after the gateway definition, add

gateway.getATHandler().setStorageLocations("SMMTME");

And check how your modem behaves. If you get duplicate messages, try again with

gateway.getATHandler().setStorageLocations("SMME");

and see if it gets any better

Original comment by admin@smslib.org on 18 Sep 2012 at 8:27

GoogleCodeExporter commented 9 years ago
Dear maintainers of the smslib project.

Thank you so much for your helping. Your tips worked!

It is the first time that I ad to ask your support, and it was very rewarding.

But let me give you some feedback about my experience:
1- I have to start the internal app that comes with the usb modem in order to 
start the port for serial communication (I use the device manager of windows 
system to know the serial port number)

2- Setting the modem (gateway in smslib) with ONDA manufacturer and model, the 
internal app need to be open for working or starting the modem by java app 

3- Setting the modem (gateway in smslib) with Huawei manufacturer and E220 
model it works (independently of internal app is open or not), even considering 
the the modem is ONDA (curious, isn't?)

4- Using gateway.getATHandler().setStorageLocations("SMMTME") I get duplicate 
messages, but using gateway.getATHandler().setStorageLocations("SMME"); I don't.

5- I have tried to test my java app with another modem (a LG phone), and using 
the followin definition, my modem got he message before my Java app
SerialModemGateway gateway = new SerialModemGateway("Modem-COM20",
                    "COM20",
                    921600,
                    "ONDA Corporation",
                    "LG-P350");

Even when I settled each alternative below:
gateway.getATHandler().setStorageLocations("SM");
OR
gateway.getATHandler().setStorageLocations("SMMTME");
OR
gateway.getATHandler().setStorageLocations("SMME");
OR
gateway.getATHandler().setStorageLocations("MESMSR");

Anyway, thank you so much. Now, my java app with smslib is working!

Best Regards.

Fábio.

Original comment by flbeze...@gmail.com on 20 Sep 2012 at 1:31

GoogleCodeExporter commented 9 years ago

Original comment by admin@smslib.org on 27 Sep 2012 at 9:48

GoogleCodeExporter commented 9 years ago
Dear Fábio
I m also struggling with same issue of "org.smslib.GatewayException: GSM 
Network Auto-Registration disabled".
i was able to send sms once and when i tried to sms again later i got struck in 
this error. 
my logs are same as u had posted on the  Sep 8, 2012. 
i tried to access the modem using putty. it was responding to the AT command 
with OK.
after closing the putty i tried to run the java application, i got same error 
of "Auto-Registration disabled" 
Can u plesee tell me how u were able to initialize the modem.
I m using Relience 3G CE1588 net setter card.

Original comment by Pramendr...@gmail.com on 25 Mar 2013 at 8:27

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Hey Fabio,
Stuck with the same problem as faced by you:
"org.smslib.GatewayException: Comm library exception: 
java.lang.RuntimeException: javax.comm.PortInUseException: Port currently owned 
by Unknown Windows Application
    at org.smslib.modem.SerialModemDriver.connectPort(SerialModemDriver.java:102)
    at org.smslib.modem.AModemDriver.connect(AModemDriver.java:114)
    at org.smslib.modem.ModemGateway.startGateway(ModemGateway.java:189)
    at org.smslib.Service$1Starter.run(Service.java:277)
" 
Exactly what do you mean by your point (1)in feedback:
"First, I tried to initialize the modem."

and the point (2) aswell:
"Setting the modem (gateway in smslib) with ONDA manufacturer and model"

I am using the USB enabled GSM/GPRS modem: G-388U.
Prompt Help From your end will be highly appreciated

Original comment by scoria....@gmail.com on 2 Apr 2013 at 11:15

GoogleCodeExporter commented 9 years ago
Hi people,

sorry for my late reply, but I was so busy with others stuffs that I could not 
reply earlier.

First of all, in order to appropriately define the modem settings on smslib I 
am used to see the properties on "device manager" on windows. There I confirm 
(or even discover) the com port, manufacturer e modem model. 

I can not remember exactly (it was long time ago that I code using smslib :) ), 
but "GSM Network Auto-Registration disabled" error only appears if your modem 
was not installed and loaded (for example, by an application that comes with 
it). Other problem may be the incorrect definitions of properties (for that 
reason I suggested to see the "device manager").

When I say "Initialize the modem" I mean to start the application the comes 
with the modem, which will initialize it, before running your java app using 
smslib. 
I BELIEVE that such an initialization start the appropriate drivers that allow 
your java app to connect and interact with the modem.

I hope to have been helpful.

Best regards

Original comment by flbeze...@gmail.com on 21 May 2013 at 2:56