USSD Operation Mode
Overview
USSD messaging (Unstructured Supplementary Service Data) is a protocol used by mobile networks to communicate with the service provider's computers. Unlike Short Message Service (SMS) messages, USSD messages create a real-time connection during a USSD session. The USSD session remains open during exchange of messages, allowing a two-way exchange of a sequence of data. This makes USSD more responsive than services that use SMS.
Initiating USSD Request
Initialization of USSD session usually requires setting of ussd_service_op
TLV field to a Request operation
code and passing of a "USSD" string as a ServiceType parameter:
string ep = "smpp.tlv.ussd_service_op=02";
// [...]
result = clientSMPP.SubmitMessageEx("48999123456", 1, 1,
"79123", 1, 1, smContent, EncodingEnum.et7BitText, "", 0,
DateTime.now, DateTime.now, "USSD", 0, ep, messageID);
Responding to USSD Request
When responding to a message which is a part of a USSD session, besides the above two, of course with appropriate ussd_service_op
,
you may have to extract the value of smpp.its_session_info
from the list of ExtendedParameters
and pass it to a message submitted in response:
private void clientSMPP_OnSmppMessageReceived(object sender,
SMSCclient.SMPP.smppMessageReceivedEventArgs e)
{
string ep;
uint SequenceNumber;
// [...]
ep = Array.Find(e.ExtendedParameters.Split(';'),
s => s.Contains("its_session_info"));
ep += ";smpp.tlv.ussd_service_op=11";
result = clientSMPP.SubmitMessageAsync("48999123456", 1, 1,
"79123", 1, 1, smContent, EncodingEnum.et7BitText, "", 0,
DateTime.now, DateTime.now, "USSD", 0, ep, SequenceNumber);
// [...]
}