Community discussions

MikroTik App
 
ginggs
just joined
Topic Author
Posts: 17
Joined: Thu Nov 04, 2010 11:53 am

Decode USSD on wAP LTE kit

Tue Jan 16, 2018 8:22 pm

As per https://wiki.mikrotik.com/wiki/Manual:Interface/LTE I am able to send AT commands to the built-in modem using the at-chat command, for example:
[admin@MikroTik] > /interface lte at-chat lte1 input="AT+CGMI" 
  output: +CGMI: "MikroTik"
  
[admin@MikroTik] > /interface lte at-chat lte1 input="AT+CGMR" 
  output: +CGMR: "MikroTik_CP_2.160.000_v001"

[admin@MikroTik] > /interface lte at-chat lte1 input="AT+CGMM" 
  output: +CGMM: "R11e-LTE"
I am able to send USSD commands and wait for a response (which can take some seconds) by adding the wait=yes parameter:
[admin@MikroTik] > /interface lte at-chat lte1 input="AT+CUSD=1,\"*101#\",15" wait=yes            
  output: OK +CREG: 1, 51, 25cd684, 2 +CGREG: 1,"0051","025cd684",6,10 +CEREG: 0 +CREG: 1, 51, 25cd684, 6 +CUSD: 0,
          "417661696c61626c652042616c616e63653a205220302e3030202e446174613a203132383632332e3334204d422e4d69646e6967687420446174613a2031323132372e3
          938204d422e20596f7520617265206f6e207468652045617379436861742074617269666620", 0
Is it possible to get the built-in modem to send the USSD response in plain text?

It is possible with other modems, sometimes by sending AT+CMGF=1 or AT+CSCS="IRA", and in the case of some Huawei modems, AT^USSDMODE=0.
 
Tedionius
just joined
Posts: 20
Joined: Sat Feb 16, 2019 8:29 pm

Re: Decode USSD on wAP LTE kit

Mon Apr 29, 2019 9:40 am

Apologies for resurrecting an old post but I am struggling with this exact same issue: viewtopic.php?f=2&t=147960

I also have received no replies to my post. Did you manage to work this out?
 
warwickchapman
just joined
Posts: 7
Joined: Sun Jan 12, 2020 7:48 am

Re: Decode USSD on wAP LTE kit

Sat Aug 07, 2021 11:02 pm

These are hex encoded responses. Use a hex to ASCII converter eg. https://www.binaryhexconverter.com/hex- ... -converter

The above encoded response converts to:
Available Balance: R 0.00 .Data: 128623.34 MB.Midnight Data: 12127.98 MB. You are on the EasyChat tariff 
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 12558
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Decode USSD on wAP LTE kit  [SOLVED]

Sun Aug 08, 2021 2:00 am

search tag # rextended hexstr2chrstr hexadecimal string to char string

I write now a function to convert directly on routerboard based on my hex2chr:
viewtopic.php?f=9&t=108127&p=871741#p871741

:global hexstr2chrstr do={
    :local hexstr $1
    :local hexlen [:len $hexstr]
    :local chk1 ""
    :local chk2 ""
    :local chrstr ""
    :local lowerarray {"a"="A";"b"="B";"c"="C";"d"="D";"e"="E";"f"="F"}
    :for x from=0 to=($hexlen - 2) step=2 do={
        :set chk1 [:pick $hexstr $x ($x + 1)]
        :set chk2 [:pick $hexstr ($x + 1) ($x + 2)]
        :if ($chk1~"[a-f]") do={ :set chk1 ($lowerarray->$chk1) }
        :if ($chk2~"[a-f]") do={ :set chk2 ($lowerarray->$chk2) }
        :if (($chk1~"[^0-9A-F]") || ($chk2~"[^0-9A-F]")) do={ :set chk1 "3"; :set chk2 "F" }
        :set chrstr "$chrstr$[[:parse "(\"\\$chk1$chk2\")"]]"
    }
    :return $chrstr
}

:put [$hexstr2chrstr "417661696c61626c652042616c616e63653a205220302e3333"]
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 12558
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Decode USSD on wAP LTE kit

Fri Mar 10, 2023 4:20 pm

A new version with some added error checks:
viewtopic.php?t=194152#p989289

Who is online

Users browsing this forum: buokhalid and 8 guests