Community discussions

MikroTik App
 
samael
just joined
Topic Author
Posts: 9
Joined: Tue Jan 01, 2008 1:57 pm
Location: Italy

SMS data extraction problem

Sun Jan 02, 2011 5:06 pm

Hello,

I have a bunch of RB411U with different minor versions of ROS 4, equipped with a Sierra Wireless MC8775 (fw rev. H2_0_8_19MCAP G:/WS/FW/H2_0_8_19MCAP/MSM6280/SRC 2008/08/29 18:28:52).

Within my scripts I have to extract the number of the last received SMS in the inbox, but I almost always receive back an empty value:
[admin@b-fef-sanrossore] > /tool sms  inbox print
 # SRC             TIMESTAMP                      TEXT                                                                                                                                                                 
 0 +391234567890   Dec/28/2010 12:25:37 GMT +1    :cmd secret script disconnect                                                                                                                                         
 1 +391234567890   Dec/28/2010 12:25:45 GMT +1    :cmd secret script disconnect                                                                                                                                         
 2 +391234567890   Dec/28/2010 18:33:07 GMT +1    :cmd secret script status                                                                                                                                             
 3 +391234567890   Dec/28/2010 18:34:41 GMT +1    :cmd secret script connect                                                                                                                                            
 4 +391234567890   Dec/28/2010 18:42:20 GMT +1    :cmd secret script status                                                                                                                                             
 5 +391234567890   Dec/28/2010 19:28:49 GMT +1    :cmd secret script disconnect                                                                                                                                         
 6 Vodafon         Dec/30/2010 17:38:25 GMT +1    Internet Card sara' rinnovata il 02/01/2011 al costo di 5.0Euro.Verifica il traffico disponibile per il rinnovo.Per disattivare: 42071 o vodafone.it                 
 7 Vodafon         Jan/01/2011 17:52:19 GMT +1    Grazie per l'anno passato insieme. Auguri per un felice 2011 da tutti noi di Vodafone.                                                                               
 8 +391234567890   Jan/02/2011 12:50:19 GMT +1    :cmd secret script connect                                                                                                                                            
 9 +391234567890   Jan/02/2011 15:03:05 GMT +1    :cmd secret script status                                                                                                                                             
[admin@b-fef-sanrossore] > :put [/tool sms inbox get 3 text]  

[admin@b-fef-sanrossore] > :put [/tool sms inbox get 5 src]    

[admin@b-fef-sanrossore] > :put [/tool sms inbox get 7 timestamp ]

[admin@b-fef-sanrossore] > :foreach i in=[/tool sms inbox find] do={ :put [/tool sms inbox get $i text] }










[admin@b-fef-sanrossore] > :foreach i in=[/tool sms inbox find] do={ :put [/tool sms inbox get $i src] }










[admin@b-fef-sanrossore] > 
The above version is 4.16, but I also tested on 4.11 on different boards (but same model, RB411U) with no luck.
All other features seem to work flawlessly, even within scripts:
[admin@b-fef-sanrossore] > :put [/ip address  get 0 address]
10.10.0.1/24
[admin@b-fef-sanrossore] > :put [/ip route get 1 gateway]
ether1
[admin@b-fef-sanrossore] > 
Any suggestions?
Thank you in advance and happy new year.

--
samael
 
samael
just joined
Topic Author
Posts: 9
Joined: Tue Jan 01, 2008 1:57 pm
Location: Italy

Re: SMS data extraction problem

Tue Jan 04, 2011 6:45 pm

In addition to the previous info, I tried to develop this workaround to avoid that tedious result:
:global smsSender [/tool sms inbox get 9 src]

# ridiculous bug workaround
:if ($smsSender="") do={
# no src number was extracted from the last received SMS, so samuele's number is set.
    :set smsSender "+391234567890"
    :log info "Can't determine the last SMS src number, defaulting to +391234567890."
};
The code above is added in the preamble of the script, just before any reference of the $smsSender variable, to provide an acceptable fallback value of the number.
The :if has no effect as its code is never executed. I'm not a ROS scripting guru but I guess it's due to the $smsSender variable which is not yet initialized with a value, thus not even empty. Actually, adding an else={} instruction with a debugging output confirms this.

While waiting for some fixes or suggestions from Mikrotik, do you ROS gurus have any hints or workarounds in mind?
Thank you.

--
samael

Who is online

Users browsing this forum: No registered users and 2 guests