IoT USSD API Developers Guide
IoT USSD API Developers Guide
Version 1.6
Table of Contents
1. Introduction 4
2. USSD Push API 5
2.1 Introduction 5
2.2 Description 5
2.3 Access control 6
Introduction 6
login 6
2.4 USSD Broker 8
Introduction 8
pushUssd 8
2.5 POST Request 10
Description 10
POST Request example 11
2.6 Response to POST Request 11
Description 11
Response example 12
2.7 POST Status 12
Description 12
POST Status example 13
2.8 PHP sample code 13
2.9 Java sample code 14
Generating the WSDL proxy 15
Source code: PushUssd.java 16
Compiling and executing 16
2.10 Use cases 17
2.11 USSD Push setup requirements 19
3. USSD Pull API 20
3.1 Introduction 20
3.2 Description 20
3.3 POST Request 21
Description 21
2
POST Request example 22
3.4 Response to POST Request 22
Description 22
response example 23
3.5 POST Status 23
Description 23
POST Status example 24
3.6 Use cases 24
3.7 USSD Pull setup requirements 26
4. USSD API Error Codes 27
3
1. Introduction
This document is the developer’s guide of the Sierra Wireless USSD API solution. It provides the
reader with details on:
Note:
Sierra Wireless reserves the right of applying a restriction of use through filters on the messages
content in case of offending terms being used. Furthermore, use of this service for spamming
purposes is forbidden in all its manifestations. As a consequence, Sierra Wireless may suspend the
access to the service at any time.
For further information, please contact the Sierra Wireless technical support at the following address:
[email protected]
4
2. USSD Push API
2.1 Introduction
The USSD Push refers to a USSD message being pushed from the network (customer service) to a
Sierra Wireless subscriber’s module / handset.
The USSD Push feature is made available to customers via the Sierra Wireless SOAP provisioning
API, which aims at offering an HTTP public programing interface exposed through the following URL:
https://api.mobiquithings.com/MBQTUssdApiOnlyService.wsdl
2.2 Description
Optionally:
3) POST status
USSD
4) 200 OK Service
Gateway
Or:
In the Push scenario, a customer service will invoke a SOAP request which will trigger a USSD
emission from the USSD Gateway to a subscriber’s module.
5
2.3 Access control
The user needs opening an authentication session before being able to issue any other command.
A successful login will provide the user with an authentication token, which will have to be passed to
all subsequent requests.
This token is called “sessionAuthId” in the rest of this document, and is defined as a string from 20 to
50 characters.
Sessions are limited in time in case of idle activity from the user:
Introduction
The following functions allow controlling the access to the web service:
Name Description
login
2.3.2.1 Description
This function allows the session to be opened.
2.3.2.2 Parameters
Name Description Type Required
6
2.3.2.3 Response elements
Name Description Type
2.3.2.4 Examples
Request sample
<SOAP-ENV:Envelope xmlns:SOAP-ENV=”http://schemas.xmlsoap.org/soap/envelope/”
xmlns:api=”https://api.mobiquithings.com/”>
<SOAP-ENV:Header/>
<SOAP-ENV:Body>
<api:login>
<userLogin>test_login</userLogin>
<userPwd>test_pwd</userPwd>
</api:login>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
7
Response sample
<SOAP-ENV:Envelope xmlns:SOAP-ENV=”http://schemas.xmlsoap.org/soap/envelope/”
xmlns:ns1=”https://api.mobiquithings.com/”>
<SOAP-ENV:Body>
<ns1:loginResponse>
<requestId>112704929</requestId>
<sessionAuthId>437571012</sessionAuthId>
</ns1:loginResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Introduction
The user can take advantage of the API to send USSD messages from his own service to the
subscriber’s module / handset.
This is commonly known as network initiated USSD, also called “USSD Push” by opposition to mobile
originated USSD, also called “USSD Pull”.
The subscription is then charged like any other subscription, and the CDR are integrated to the usual
flow.
Name Description
pushUssd
2.4.2.1 Description
This function allows sending a USSD message to a Sierra Wireless subscriber.
8
So as to be able to receive a response:
Note :
• The association between an application ID and an URL will have to be set up by the Sierra
Wireless support team before starting to use this service.
• The URL of the originating application will have to be HTTPS based, for security reasons.
• The application ID can be any number, e.g. 12345, provided it was agreed with the Sierra
Wireless support team.
2.4.2.2 Parameters
Name Description Type Required
68 8 bit encoding
9
17 UCS 2 encoding
2.4.2.4 Examples
Request sample
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:api="https://api.mobiquithings.com/">
<SOAP-ENV:Header/>
<SOAP-ENV:Body>
<api:pushUssd>
<sessionAuthId>437571012</sessionAuthId>
<toMsisdn>44649955679</toMsisdn>
<ussdString>Your request has been processed</ussdString>
<appId>774</appId>
<notification>false</notification>
<final>true</final>
<encoding>15</encoding>
</api:pushUssd>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Response sample
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns1="https://api.mobiquithings.com/">
<SOAP-ENV:Body>
<ns1:pushUssdResponse>
<requestId>112707536</requestId>
<sessionId>13708</sessionId>
</ns1:pushUssdResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Description
In case a response from the module is required by the push request, this response will be forwarded
to the customer service as a POST request.
A dialog may then establish between the subscriber’s module and the customer HTTPS service.
10
Note:
In order to be able to route the request to the customer service, the pushUssd() appId parameter will
have to be set, and mapped to a proper HTTPS URL.
Value Description
encoding
15 7 bit GSM encoding
68 8 bit encoding
17 UCS 2 encoding
POST https://customerserverurl
Content-Type: application/x-www-form-urlencoded
…
msisdn=+33641620872&ussdstring=*774#string1#&sessionid=13481608&ussdcode=774&encodi
ng=15
Description
The response expected from the customer service will have to use the following parameters:
11
Text to be received on the subscriber module / handset. string Yes
The string will have to be x-www-form-urlencoded / UTF8 if 7
ussdstring
bit GSM encoding is used (the default), or a hexadecimal
string if a binary encoding is chosen.
Value Description
encoding
15 7 bit GSM encoding
68 8 bit encoding
17 UCS 2 encoding
Response example
HTTP/1.1 200 OK
Content-Type: application/x-www-form-urlencoded
…
final=false¬ification=false&ussdstring=string2&sessionid=13481608
Description
A POST status request may be returned to the customer service when the dialog is terminated.
E.g.
Note: In order to be able to route the status to the customer service, the pushUssd() appId parameter
will have to be set, and mapped to a proper HTTPS URL.
12
The POST status will contain the following parameters:
POST https://customerserverurl
Content-Type: application/x-www-form-urlencoded
…
status=-39&final=true&msisdn=+33641620872&sessionid=13481608
The PHP example shown below is a scenario where the user wishes to push a USSD message
expecting a response to be sent back.
<?php
// ***********************************************************************
//
// Sierra Wireless
// Copyright 2013 All Rights Reserved.
//
// These computer program listings and specifications, herein,
// are the property of Sierra Wireless and shall not be
// reproduced or copied or used in whole or in part as the basis
// for manufacture or sale of items without written permission.
//
// @description Sierra Wireless Subscription SOAP API pushUssd sample.
//
// ***********************************************************************
In case the user did not expect a response from the destination, we could simply have used:
$result = $client->pushUssd($sessionAuthId,
'33641620872',
'Your request has been processed',
774);
array(2) {
["requestId"] => int(112707536)
["sessionId"] => int(13708)
}
This section illustrates the steps involved for sending a USSD message in Java using the command
line.
Pre-requisites:
This step will generate the Java artefacts inside a Java package named com.mobiquithings.api by
importing https://api.mobiquithings.com/MBQTUssdApiOnlyService.wsdl, and compile them.
<jaxws:bindings xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:jaxws="http://java.sun.com/xml/ns/jaxws"
wsdlLocation="https://api.mobiquithings.com/MBQTUssdApiOnlyService.wsdl">
<jaxws:bindings
node="wsdl:definitions/wsdl:portType[@name='MBQTUssdApiOnlyService']/wsdl:operation
[@name='pushUssd']">
<jaxws:parameter
part="wsdl:definitions/wsdl:message[@name='pushUssdRequest']/wsdl:part[@name='final
']"
childElementName="final" name="finalParam" />
</jaxws:bindings>
</jaxws:bindings>
Note:
The customization done through bindings.xml is required so as to work around the following error:
[ERROR] Invalid operation "pushUssd", can't generate java method. Parameter: part "final" in wsdl:message
"pushUssdRequest", is a java keyword. Use customization to change the parameter name or change the
wsdl:part name.
15
Source code: PushUssd.java
// ***********************************************************************
//
// Sierra Wireless
// Copyright 2015 All Rights Reserved.
//
// These computer program listings and specifications, herein,
// are the property of Sierra Wireless and shall not be
// reproduced or copied or used in whole or in part as the basis
// for manufacture or sale of items without written permission.
//
// @description Sierra Wireless Subscription SOAP API: PushUssd Java sample
//
// ***********************************************************************
import com.mobiquithings.api.MBQTUssdApiOnlyService;
import com.mobiquithings.api.MBQTUssdApiOnlyService_Service;
import java.math.BigInteger;
import javax.xml.ws.Holder;
This step reads the client source code and the proxy classes, and produces a .class bytecode.
16
java -classpath . PushUssd
sessionAuthId=4177454004
sessionId=13926487
1) pushUssd()
17
appId mapped to URL (e.g. USSD code) and response expected and sent back
1) pushUssd(notification=false)
2) string1 4) msisdn=+33641620872
&ussdstring=string2
USSD &sessionid=123
Gateway Service
3) string2
5) 200 OK
appId mapped to URL (e.g. USSD code) and response expected but not sent back
1) pushUssd(notification=false)
1) pushUssd(notification=false, final=false)
2) string1 4) msisdn=+33641620872
&ussdstring=string2
&sessionid=123
3) string2 USSD
Gateway Service
5) ussdstring=string3
6) string3 ¬ification=true
18
2.11 USSD Push setup requirements
• Provide some application identifiers to be mapped to an HTTPS URL in case a USSD dialog is
to be established during the push scenario.
19
3. USSD Pull API
3.1 Introduction
The USSD Pull refers to a USSD message being sent in from a Sierra Wireless subscriber’s module /
handset to a customer HTTPS service.
The USSD Pull feature is made available to customers via the availability of a USSD code mapped to
a remote HTTPS address.
3.2 Description
Optionally:
Or:
5) POST status
USSD
Service
Gateway 4) 200 OK
In the Pull scenario, a subscriber’s module will emit a USSD short string, e.g. *774#, which will trigger
an HTTPS POST request to a customer URL previously mapped to this USSD code.
20
The customer service will then reply in the body of the HTTPS POST response, which will be
transferred to the subscriber’s module by the USSD Gateway.
The dialog may then continue as long as parameters transmitted in the response require it.
Description
The first POST request that will be sent to the customer service will contain the following parameters:
Value Description
encoding
15 7 bit GSM encoding
68 8 bit encoding
17 UCS 2 encoding
The following POST requests if any will contain the following parameters:
21
Originator MSISDN (x-www-form-urlencoded/charset string +33641621425
msisdn
utf8 encoding)
POST https://customerserverurl
Content-Type: application/x-www-form-urlencoded
…
msisdn=+33641620872&ussdstring=*774#string1#&sessionid=13481608&ussdcode=774&encodi
ng=15
Description
The response expected from the customer service will have to use the following parameters:
Value Description
encoding
15 7 bit GSM encoding
68 8 bit encoding
17 UCS 2 encoding
22
Service example:
The PHP code shown below is a simplistic example of what can be executed when posting a request
to the customer HTTPS address.
<?php
// ***********************************************************************
//
// Sierra Wireless
// Copyright 2013 All Rights Reserved.
//
// These computer program listings and specifications, herein,
// are the property of Sierra Wireless and shall not be
// reproduced or copied or used in whole or in part as the basis
// for manufacture or sale of items without written permission.
//
// @description Sierra Wireless USSD API HTTP POST response sample.
//
// ***********************************************************************
response example
HTTP/1.1 200 OK
Content-Type: application/x-www-form-urlencoded
…
final=false¬ification=false&ussdstring=string2&sessionid=13481608
Description
A POST status request may be returned to the customer service when the dialog is terminated.
E.g. A response is expected from the module, but not sent (e.g. dialog cancelled by the module).
POST https://customerserverurl
Content-Type: application/x-www-form-urlencoded
…
status=-39&final=true&msisdn=+33641620872&sessionid=13481608
Simple dialog
2) msisdn=+33641620872
&ussdstring=*774#
&ussdcode=774
&sessionid=123
USSD &encoding=15
1) *774# Service
Gateway
4) string1
3) ussdstring=string1
24
2) msisdn=+33641620872
&ussdstring=*774#
&ussdcode=774
&sessionid=123
&encoding=15
1) *774#
3) ussdstring=string1
¬ification=false
4) string1 &final=false
USSD Service
Gateway
6) msisdn=+33641620872
&ussdstring=string2
5) string2 &sessionid=123
8) string3
7) ussdstring=string3
25
Response expected but not sent back
2) msisdn=+33641620872
&ussdstring=*774#
&ussdcode=774
&sessionid=123
&encoding=15
1) *774#
3) ussdstring=string1
¬ification=false
4) string1 &final=false
USSD Service
Gateway
5) status=-39
&sessionid=123
6) 200 OK
26
4. USSD API Error Codes
When an error occurs during a call to the USSD API, the status parameter will be negative and
provide the error code. The list of available errors is cited here for reference only in order to qualify
the error and provide more details explaining why the USSD is not yet processed.
4 Default error -
6 Bad Parameter Failed because a "malformed" information. This could be data with a
bad value or a DCS not supported by the module (eg UCS instead of 7
bit)
14 Unspecified - System Failed because issue on 'system failure' error on network or module
failure
20 Missing subscriber The destination subscriber is not registered into the network.
27 Missing parameter - Failed because a "missing parameter". Data not present in the
Data missing message.
27