This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
wiki:sms [2019/01/31 09:34] hch |
— (current) | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== SMS ====== | ||
| - | ===== Use of integrated SMS commands ===== | ||
| - | |||
| - | Wirnet iBTS and Wirnet iFemtoCell can be configured using SMS commands. Most features available from the web interface and the REST API can be used o SMS. | ||
| - | |||
| - | ==== Command syntax ==== | ||
| - | |||
| - | All SMS command will follow the same syntax: | ||
| - | <code bash> | ||
| - | [login:password] [sms_command_id] sms_command sms_field sms_value | ||
| - | </code> | ||
| - | * ''login'': The login used for the board configuration. This value is always **''admin''**. | ||
| - | * ''password'': The password is the same as the web interface password (''pwd4admin'' by default) | ||
| - | * ''sms_command_id'': ID defined by the customer to identify the SMS command. There is no default value. This ID is mandatory and must be **6 characters** long. | ||
| - | * ''sms_command'': The command to be executed with ''/'' separated fields. | ||
| - | * ''sms_field'': The configuration field to be set/get (Optional). | ||
| - | * ''sms_value'': The value that as to be set to a configuration field (Optional). | ||
| - | |||
| - | ==== SMS response syntax ==== | ||
| - | |||
| - | All SMS reponses use the same syntax: | ||
| - | |||
| - | <code bash> | ||
| - | [sms_command_id:sms_command_status] sms_error_info | ||
| - | </code> | ||
| - | |||
| - | *''sms_command_id'': The value of this field is equal to the value of the ''sms_command_id'' field used in the command. The purpose of this field is to match the command with the reponse. | ||
| - | *''sms_command_status'': ''ok'' or ''error''. | ||
| - | *''sms_error_info'': SMS error information (Optional). | ||
| - | |||
| - | ==== System command ==== | ||
| - | |||
| - | ^System command ^ Description ^ ''sms_command'' ^''sms_field'' ^''sms_value'' ^ | ||
| - | |Halt | Halt the board | system/halt | N/A | N/A | | ||
| - | |Reboot | Reboot the board | system/reboot | N/A | N/A | | ||
| - | |Update | Request a board update | system/update | N/A | N/A | | ||
| - | |Restore Backup | Request a backup restore | system/restore/backup | N/A | N/A | | ||
| - | |Restore Stock | Request a stock restore | system/restore/stock | N/A | N/A | | ||
| - | |||
| - | |||
| - | <note important> | ||
| - | Sending ''update'', ''restore stock'' and ''restore backup'' SMS commands will only set up a flag used to record the request. \\ | ||
| - | The action will only be triggered only __after a board reboot__. Reboot the board manually or by sending a ''reboot'' SMS command. | ||
| - | </note> | ||
| - | |||
| - | __Examples:__ | ||
| - | |||
| - | Reboot command: | ||
| - | <code bash> | ||
| - | #SMS sent to the gateway | ||
| - | [admin:pwd4admin] [reboot] system/reboot | ||
| - | </code> | ||
| - | |||
| - | <code bash> | ||
| - | #SMS response from the gateway | ||
| - | [reboot:ok] | ||
| - | </code> | ||
| - | |||
| - | Restore stock command with wrong password: | ||
| - | |||
| - | <code bash> | ||
| - | #SMS sent to the gateway | ||
| - | [admin:badpassword] [rstock] system/restore/stock | ||
| - | </code> | ||
| - | |||
| - | <code bash> | ||
| - | #SMS response from the gateway | ||
| - | [rstock:error] login/password | ||
| - | </code> | ||
| - | |||
| - | ==== Configuration commands ==== | ||
| - | |||
| - | There are two kinds of configuration commands: ''get_value'' commands and ''set_value'' commands. | ||
| - | |||
| - | === Get commands === | ||
| - | |||
| - | ^Command Description ^ ''sms_command'' ^''sms_field'' ^''sms_value'' ^ | ||
| - | | Get CPU usage | configuration/get_value | statm.cpu |N/A| | ||
| - | | Get RAM usage | configuration/get_value | statm.ram |N/A| | ||
| - | | Get userdisk usage | configuration/get_value | statm.userdisk |N/A| | ||
| - | | Get board temperature | configuration/get_value | statm.temperature |N/A| | ||
| - | | Get ethernet connectivity state | configuration/get_value | statm.lan.state |N/A| | ||
| - | | Get ethernet hardware address | configuration/get_value | statm.lan.hardware.address |N/A| | ||
| - | | Get ethernet IP address | configuration/get_value | statm.lan.address |N/A| | ||
| - | | Get ethernet broadcast IP address | configuration/get_value | statm.lan.broadcast |N/A| | ||
| - | | Get ethernet netmask | configuration/get_value | statm.lan.netmask |N/A| | ||
| - | | Get GSM connectivity state | configuration/get_value | statm.gsm.state |N/A| | ||
| - | | Get GSM IP address | configuration/get_value | statm.gsm.address |N/A| | ||
| - | | Get GSM netmask | configuration/get_value | statm.gsm.netmask |N/A| | ||
| - | | Get CPU board serial number | configuration/get_value | statm.serialnumber |N/A| | ||
| - | | Get Keros firmware version | configuration/get_value | statm.version |N/A| | ||
| - | | Get board platform type (''ibts'' or ''ifemto'') | configuration/get_value | statm.platform |N/A| | ||
| - | | Get ethernet connectivity state | configuration/get_value | sysma.lan.enable |N/A| | ||
| - | | Get ethernet connectivity mode: ''off'',''dhcp'' or ''static address_ip netmask gateway_ip dns_ip1,dns_ip2'' (dns optionnal) | configuration/get_value | sysma.lan.ipv4 |N/A| | ||
| - | | Get ethernet IP address (only for static connectivity mode) | configuration/get_value | sysma.lan.ipv4_address |N/A| | ||
| - | | Get ethernet netmask (only for static connectivity mode) | configuration/get_value | sysma.lan.ipv4_netmask |N/A| | ||
| - | | Get ethernet gateway IP (only for static connectivity mode) | configuration/get_value | sysma.lan.ipv4_gateway |N/A| | ||
| - | | Get list of ethernet DNS IP (only for static connectivity mode) | configuration/get_value | sysma.lan.ipv4_dns |N/A| | ||
| - | | Get GSM connectivity state (''true'' or ''false'') | configuration/get_value | sysma.gsm.enable |N/A| | ||
| - | | Get GSM operator list (MNC,MCC,APN,login,user) | configuration/get_value | sysma.gsm.operators |N/A| | ||
| - | | Get time synchronization mode (auto or manual) | configuration/get_value | timem.mode |N/A| | ||
| - | | Get list of NTP address | configuration/get_value | timem.ntp |N/A| | ||
| - | | Get timezone use on the board | configuration/get_value | timem.timezone |N/A| | ||
| - | | Get current date (yyyymmddHHMMSS) | configuration/get_value | timem.date |N/A| | ||
| - | |||
| - | __Example:__ | ||
| - | |||
| - | Get GSM IP address: | ||
| - | <code bash> | ||
| - | #SMS sent to the gateway | ||
| - | [admin:pwd4admin] [getgsm] configuration/get_value statm.gsm.address | ||
| - | </code> | ||
| - | |||
| - | <code bash> | ||
| - | #SMS response from the gateway | ||
| - | [getgsm:ok] "10.172.108.48" | ||
| - | </code> | ||
| - | |||
| - | === Set commands === | ||
| - | |||
| - | ^Command Description ^ ''sms_command'' ^''sms_field'' ^''sms_value'' ^ | ||
| - | | Set admin user password | configuration/set_value | sysma.password | New password. ex:''"mynewpassword"''| | ||
| - | | Set ethernet connectivity state | configuration/set_value | sysma.lan.enable | ''true'' or ''false''| | ||
| - | | Set ethernet connectivity mode | configuration/set_value | sysma.lan.ipv4 |''"off"'',''"dhcp"'' or ''"static address_ip netmask gateway_ip dns_ip1,dns_ip2"'' (dns optionnal)| | ||
| - | | Set ethernet IP address | configuration/set_value | sysma.lan.ipv4_address | IP address. ex:''"192.168.4.10"''| | ||
| - | | Set ethernet netmask | configuration/set_value | sysma.lan.ipv4_netmask | Mask value. ex:''"255.255.254.0"''| | ||
| - | | Set ethernet gateway IP | configuration/set_value | sysma.lan.ipv4_gateway | IP address. ex:''"192.168.4.1"''| | ||
| - | | Set list of ethernet DNS IP | configuration/set_value | sysma.lan.ipv4_dns | IP addresses. ex:''"192.168.1.1,192.168.1.2"''| | ||
| - | | Set GSM connectivity state | configuration/set_value | sysma.gsm.enable | ''true'' or ''false''| | ||
| - | | Add a GSM operator | configuration/set_value | sysma.gsm.add_operator | MNC,MCC,APN,login,user. ex:''"124,10,myapn,user,pass"'' or ''"123,10,,,"''| | ||
| - | | Remove a GSM operator | configuration/set_value | sysma.gsm.remove_operator | MNC,MCC. ex:''"124,10"''| | ||
| - | | Update a GSM operator | configuration/set_value | sysma.gsm.update_operator | MNC,MCC,APN,login,user. ex:''"124,10,myapn2,,"''| | ||
| - | | Time synchronization mode | configuration/set_value | timem.mode |''"auto"'' or ''"manual"''| | ||
| - | | Set List of NTP address | configuration/set_value | timem.ntp | List of NTP address. ex:''"0.pool.ntp.org,1.pool.ntp.org"''| | ||
| - | | Set Timezone use on the board | configuration/set_value | timem.timezone | Timezone. ex:''"Europe/Paris"''| | ||
| - | | Set a date (yyyymmddHHMMSS) | configuration/set_value | timem.date | Date. ex:''"20180710192000"''| | ||
| - | |||
| - | __Examples:__ | ||
| - | |||
| - | |||
| - | Set admin user password: | ||
| - | <code bash> | ||
| - | #SMS sent to the gateway | ||
| - | [admin:pwd4admin] [newpwd] configuration/set_value sysma.password "mynewpassword" | ||
| - | </code> | ||
| - | |||
| - | <code bash> | ||
| - | #SMS response from the gateway | ||
| - | [newpwd:ok] | ||
| - | </code> | ||
| - | |||
| - | ===== Use of customs SMS ===== | ||
| - | |||
| - | Wirnet iBTS and Wirnet iFemtoCell are able to send and receive SMS if the mobile network is properly configured. Modems are identified by ''manufacturer_X'' where ''X'' is a number. This number can vary when a Wirnet iBTS embeds a dual-SIM board. It always is 0 for Wirnet iFemtoCell. The manufacturer is always ''sierra'' for Wirnet iBTS. | ||
| - | |||
| - | To retrieve the identifier, use the ''gsmdiag.py'' command. | ||
| - | |||
| - | Here is an output of ''/tmp/gsmdiag.txt''. Two modems are displayed, and only one has a SIM card present. Its identifier is ''/sierra_0''. | ||
| - | |||
| - | ++++ | ||
| - | Content - gsmdiag.py output | | ||
| - | <code bash> | ||
| - | root@klk-lpbs-060434:~ # gsmdiag.py | ||
| - | Diagnostic written in /tmp/gsmdiag.txt | ||
| - | root@klk-lpbs-060434:~ # cat /tmp/gsmdiag.txt | ||
| - | Number of modems: 2 | ||
| - | [Modem:/sierra_1] | ||
| - | Syspath:/sys/devices/soc0/soc/2100000.aips-bus/2184200.usb/ci_hdrc.1/usb2/2-1/2-1.3 | ||
| - | HardwarePosition:1,1 | ||
| - | Powered:1 | ||
| - | Online:0 | ||
| - | Manufacturer:Sierra Wireless, Incorporated | ||
| - | Model:MC7304 | ||
| - | Revision:SWI9X15C_05.05.58.00 r27038 carmd-fwbuild1 2015/03/04 21:30:23 | ||
| - | [SimProps] | ||
| - | Present:0 | ||
| - | Error: no SIM in modem | ||
| - | [Modem:/sierra_0] | ||
| - | Powered:1 | ||
| - | Online:1 | ||
| - | Manufacturer:Sierra Wireless, Incorporated | ||
| - | Model:MC7354 | ||
| - | Revision:SWI9X15C_05.05.58.00 r27038 carmd-fwbuild1 2015/03/04 21:30:23 | ||
| - | [SimProps] | ||
| - | Present:1 | ||
| - | CardIdentifier:895XXXXXXXXXXXX1015 | ||
| - | SubscriberIdentity:3XXXXXXXXXXXXX3 | ||
| - | LockedPins:dbus.Array([], signature=dbus.Signature('s'), variant_level=1) | ||
| - | PinRequired:none | ||
| - | [NetworkRegistrationProps] | ||
| - | Status:registered | ||
| - | MobileCountryCode:XXX | ||
| - | MobileNetworkCode:YY | ||
| - | Name:ABCD | ||
| - | Strength:80 | ||
| - | [ConnectionContexts] | ||
| - | [/sierra_0/context1] | ||
| - | Name:Internet | ||
| - | Active:1 | ||
| - | Type:internet | ||
| - | Protocol:ip | ||
| - | AccessPointName:apname | ||
| - | Username:uname | ||
| - | Password:pass | ||
| - | AuthenticationMethod:chap | ||
| - | </code> | ||
| - | ++++ | ||
| - | |||
| - | ==== Send ==== | ||
| - | |||
| - | To send an SMS using the modem ''/sierra_0'' (Wirnet iBTS): | ||
| - | |||
| - | <code bash> | ||
| - | dbus-send --system --print-reply --dest=org.ofono /sierra_0 org.ofono.MessageManager.SendMessage string:"+33XXXXXXXXXX" string:"test sms" | ||
| - | </code> | ||
| - | |||
| - | |||
| - | To send an SMS using the modem ''/huawei_0'' (Wirnet iFemtoCell): | ||
| - | |||
| - | <code bash> | ||
| - | dbus-send --system --print-reply --dest=org.ofono /huawei_0 org.ofono.MessageManager.SendMessage string:"+33XXXXXXXXXX" string:"test sms" | ||
| - | </code> | ||
| - | |||
| - | ==== Receive ==== | ||
| - | |||
| - | Receive an SMS using a python test script : | ||
| - | |||
| - | ++++ | ||
| - | File - receive SMS python script | | ||
| - | <code bash receive-sms> | ||
| - | #!/usr/bin/python2 | ||
| - | |||
| - | from gi.repository import GLib | ||
| - | |||
| - | import dbus | ||
| - | import dbus.mainloop.glib | ||
| - | |||
| - | def chunkstring(string, length): | ||
| - | return (string[0+i:length+i] for i in range(0, len(string), length)) | ||
| - | |||
| - | def incoming_message(message, details, path, interface): | ||
| - | message_txt = str(message.encode('utf-8')) | ||
| - | print("Size of message: %d" % len(message_txt)) | ||
| - | print("%s" % (message_txt)) | ||
| - | for line in chunkstring(message_txt, 40): | ||
| - | print("%s" % line) | ||
| - | |||
| - | for key in details: | ||
| - | val = details[key] | ||
| - | print(" %s = %s" % (key, val)) | ||
| - | print(" %s = %s" % ('path',path)) | ||
| - | print(" %s = %s" % ('interface', interface)) | ||
| - | |||
| - | if __name__ == '__main__': | ||
| - | dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) | ||
| - | |||
| - | bus = dbus.SystemBus() | ||
| - | |||
| - | bus.add_signal_receiver(incoming_message, | ||
| - | bus_name="org.ofono", | ||
| - | signal_name = "ImmediateMessage", | ||
| - | path_keyword="path", | ||
| - | interface_keyword="interface") | ||
| - | |||
| - | bus.add_signal_receiver(incoming_message, | ||
| - | bus_name="org.ofono", | ||
| - | signal_name = "IncomingMessage", | ||
| - | path_keyword="path", | ||
| - | interface_keyword="interface") | ||
| - | |||
| - | mainloop = GLib.MainLoop() | ||
| - | mainloop.run() | ||
| - | </code> | ||
| - | ++++ | ||