Open jthurner opened 9 years ago
Hi jthurner, When i call the modem.sendUssd() method. Below is the output.
DEBUG: write: AT+CUSD=1,*126#,15
DEBUG: response: ['OK']
DEBUG: notification: ['+CME ERROR: 261']
DEBUG: Unhandled unsolicited modem notification: ['+CME ERROR: 261']
CME ERROR: 261 ( ss not executed ) Any idea what's going on? Thanks.
When i test it on a phone. The USSD code seems to be working by returning the card balance.
The AT command should be AT+CUSD=1,"*126#",15
According to the GSM spec, USSD responses can have the following status codes:
I've never seen 0 or 3, but the 4s and 5s don't have any message text fields (e.g.
+CUSD: 4
). This response isn't matched by the cusd regex, which leads to a nullpointer exception in parseCusdResponse.Also, having access to the statuscodes would be nice, to be able to differentiate between a network timeout and unsopperted operation.
I've made a rough patch which changes the second regex group to optional (improvements welcome...), adds the statuscode as variable to USSD() and changes sessionActive to a property.
However, I am unsure how to adapt this if block. It looks to me like that is basically setting the message to the last CUSD indication with
statuscode !=2
. Is that really intended behaviour? Because in the "normal" case, statuscode 2 is what you get for succesfull "oneshot" USSD commands (e.g. checking credit).