zabsalahid / serialport-gsm

SerialPort-GSM is a simplified plugin for communicating with gsm modems. (Primarily for sms) (Focused in PDU mode)
MIT License
91 stars 48 forks source link

Discussion: GSM Modems with multiple USB ports ... #32

Closed Apollon77 closed 5 years ago

Apollon77 commented 5 years ago

Hey, an issue for exchange @zabsalahid @karianpour ...

I was wondering why I never found RING/+CLIP and +CMTI data on new messages and now I found them ;-) My Modem is providing 3 USB ports ... ttyUSB0 for the AT commands, ttyUSB1 for data and ttyUSB2 is only sending such special infos like +CLIP, RING, ^CEND, ...

How are your modems?

Did you had such a case? Is there any chance to "forward" the infos to the first port?

Modem Write: AT^GETPORTMODE
Modem Received: AT^GETPORTMODE
Activate Message Processing for: AT^GETPORTMODE
Modem Received: 
Modem Received: ^GETPORTMODE:TYPE:WCDMA:Qualcomm ,MDM:0 ,DIAG:1,PCUI:2
Modem Received: 
Modem Received: OK

What is this showing for your modems?

karianpour commented 5 years ago

My modem has only one usbtty0, I send the commands and receive the answer on the same port. I have a problem that sometimes it hangs and does not respond. So I have to switch it off and on or disconnect from the usb abd connect again to have it working. I guess that it caused when I try to write to the port while some data is coming from the other side. So I guess that it is a good idea ti have them seperated.

Apollon77 commented 5 years ago

Normally Serial logic should handle this, so I do not think that this is a problem. Serial connections have separated TX and RX lines ... (at least "as I know")

I got a bit further... ttyUSB2 port for me also supports sending of AT commands, so I can completely use this and get both ;-) Very interesting in any case

Apollon77 commented 5 years ago

PS: What the GETPORTMODE command is returning for your modem?

zabsalahid commented 5 years ago

PS: What the GETPORTMODE command is returning for your modem?

I receive an error. Is that command for huawei modems only?

Apollon77 commented 5 years ago

No, I also getan error :-) But found in the web --- so works for some modems I think ... If you have a better "multiline return" command we could replace it :-)

Marty56 commented 5 years ago

I have an Aldi Talk modem which seems to provide 4 serial ports which has a SIM from Telefonica inserted. I am using the example script within the context of iobroker and have installed the module via the javascript Modul.

dmesg | grep tty shows: [ 221.979014] usb 1-1.4: GSM modem (1-port) converter now attached to ttyUSB0 [ 221.979975] usb 1-1.4: GSM modem (1-port) converter now attached to ttyUSB1 [ 221.980863] usb 1-1.4: GSM modem (1-port) converter now attached to ttyUSB2 [ 221.981836] usb 1-1.4: GSM modem (1-port) converter now attached to ttyUSB3

I have used the example file, modified the parameters accordingly and have tried to receive and send an SMS

  1. Sending an SMS was working.
  2. Reading the SMS storage was working and newly received SMS were shown correctly.
  3. Event generation when receiving an SMS was not working.
  4. I have also a placed a voice call to the modem which did not create an event.
  5. Closing the modem seems to work. The related event was created.

Log file:

`

2019-05-06 14:40:30.342 - info: javascript.0 script.js.common.GSM_Modem: Modem Sucessfully Opened 2019-05-06 14:40:30.343 - info: javascript.0 script.js.common.GSM_Modem: Hallo Martin 2 2019-05-06 14:40:30.350 - info: javascript.0 script.js.common.GSM_Modem: InitModemResponse: {"status":"success","request":"modemInitialized","data":"Modem Successfully Initialized"} 2019-05-06 14:40:30.350 - info: javascript.0 script.js.common.GSM_Modem: Configuring Modem for Mode: PDU 2019-05-06 14:40:30.359 - info: javascript.0 script.js.common.GSM_Modem: Set Mode: {"status":"success","request":"modemMode","data":"PDU_Mode"} 2019-05-06 14:40:30.396 - info: javascript.0 script.js.common.GSM_Modem: Sim Memory Result: {"status":"success","request":"checkSimMemory","data":{"used":5,"total":null}} 2019-05-06 14:40:30.402 - info: javascript.0 script.js.common.GSM_Modem: Signal Strength: {"status":"success","request":"modemMode","data":"PDU_Mode"} 2019-05-06 14:40:30.407 - info: javascript.0 script.js.common.GSM_Modem: Modem Serial: {"status":"success","request":"getModemSerial","data":{"modemSerial":"866349020714402"}} 2019-05-06 14:40:30.422 - info: javascript.0 script.js.common.GSM_Modem: Own number: {"status":"success","request":"getOwnNumber","data":{"name":"","number":"49176xxxxxxx"}} 2019-05-06 14:41:30.424 - info: javascript.0 script.js.common.GSM_Modem: Error - Error: timeout: {"domain":null,"_events":{},"_eventsCount":1,"_maxListeners":100,"command":"AT^GETPORTMODE","add_time":"2019-05-06T12:40:30.360Z","id":14,"timeout":60000,"execute_time":"2019-05-06T12:40:30.420Z"} 2019-05-06 14:41:30.430 - info: javascript.0 script.js.common.GSM_Modem: Result {"status":"ERROR","request":"executeCommand","data":"Execute Command returned Error: +CME ERROR: 100"} 2019-05-06 14:41:30.516 - info: javascript.0 script.js.common.GSM_Modem: Sim Inbox Result: {"status":"success","request":"getSimInbox","data":[{"sender":"Fehlerinfo","message":"Die Kurzwahl 49 ist nicht vergeben.","index":1,"dateTimeSent":"2019-05-06T11:56:23.000Z","header":{"encoding":"7bit","smsc":"491760000443","smscType":"INTERNATIONAL","smscPlan":"ISDN"}},{"sender":"49176410xxxx","message":"Hallo ","index":2,"dateTimeSent":"2019-05-06T11:56:54.000Z","header":{"encoding":"7bit","smsc":"491760000491","smscType":"INTERNATIONAL","smscPlan":"ISDN"}},{"sender":"49176410xxxx","message":" Hi","index":3,"dateTimeSent":"2019-05-06T12:17:16.000Z","header":{"encoding":"7bit","smsc":"491760000491","smscType":"INTERNATIONAL","smscPlan":"ISDN"}},{"sender":"49176410xxxx","message":"Hi","index":4,"dateTimeSent":"2019-05-06T12:19:28.000Z","header":{"encoding":"7bit","smsc":"491760000491","smscType":"INTERNATIONAL","smscPlan":"ISDN"}},{"sender":"49176410xxxx","message":"Haha","index":5,"dateTimeSent":"2019-05-06T12:22:12.000Z","header":{"encoding":"7bit","smsc":"491760000491","smscType":"INTERNATIONAL","smscPlan":"ISDN"}}]} 2019-05-06 14:41:30.531 - info: javascript.0 script.js.common.GSM_Modem: Callback Send: Message ID: CMxrV01dioWsGyJArH5B7LNQp,Successfully Sent to Message Queue To: undefined {"status":"success","request":"sendSMS","data":{"messageId":"CMxrV01dioWsGyJArH5B7LNQp","response":"Successfully Sent to Message Queue"}} 2019-05-06 14:41:32.105 - info: javascript.0 script.js.common.GSM_Modem: Event Sending Message: {"status":"Sending SMS","request":"sendingSMS","data":{"messageId":"CMxrV01dioWsGyJArH5B7LNQp","message":"Hallo Carina. Danke! My-Name, Senden schein zu gehen","recipient":"+49176410xxxx","response":"Message Currently Sending"}} 2019-05-06 14:41:32.106 - info: javascript.0 script.js.common.GSM_Modem: Callback Send: Message ID: CMxrV01dioWsGyJArH5B7LNQp,Message Successfully Sent To: +49176410xxxx {"status":"success","request":"SendSMS","data":{"messageId":"CMxrV01dioWsGyJArH5B7LNQp","message":"Hallo Carina. Danke! My-Name, Senden schein zu gehen","recipient":"+49176410xxxx","response":"Message Successfully Sent"}} 2019-05-06 14:55:30.343 - info: javascript.0 script.js.common.GSM_Modem: Event Close: {"modem":"/dev/ttyUSB0","status":"Offline"}

`

Apollon77 commented 5 years ago

What is the result of command AT^GETPORTMODE

?

My modem has 3 ports and only the third one was delivering the events on new message and call. This was listed as PCUI port in the result of above call. So check it ... or try through all the ports ...

Marty56 commented 5 years ago

I will check the ports but it will take awhile because I am travelling.

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.