Create a constant for max USSD message length and make continuation string configurable.
This commit is contained in:
parent
b39dc1bc78
commit
7f5fbdb906
|
@ -670,12 +670,13 @@ unsigned USSDHandler::waitUSSDData(Control::USSDData::USSDMessageType* messageTy
|
|||
|
||||
void USSDHandler::postUSSDData(Control::USSDData::USSDMessageType messageType, std::string USSDString)
|
||||
{
|
||||
if (USSDString.length()>183)
|
||||
if (USSDString.length()>USSD_MAX_CHARS_7BIT)
|
||||
{
|
||||
mString = USSDString;
|
||||
mString.erase(mString.begin(), mString.begin()+181);
|
||||
USSDString.erase(USSDString.begin()+181, USSDString.end());
|
||||
USSDString+=">";
|
||||
int contLen = mContinueStr.length();
|
||||
mString = USSDString.substr(USSD_MAX_CHARS_7BIT-contLen,
|
||||
USSDString.length()-USSD_MAX_CHARS_7BIT-contLen);
|
||||
USSDString.erase(USSDString.begin()+USSD_MAX_CHARS_7BIT-contLen, USSDString.end());
|
||||
USSDString += mContinueStr;
|
||||
}
|
||||
else mString = "";
|
||||
TransactionEntry transaction;
|
||||
|
|
|
@ -61,6 +61,9 @@ class L3IMSIDetachIndication;
|
|||
class L3PagingResponse;
|
||||
};
|
||||
|
||||
// Reference to a global config table, used all over the system.
|
||||
extern ConfigurationTable gConfig;
|
||||
|
||||
|
||||
/**@namespace Control This namepace is for use by the control layer. */
|
||||
namespace Control {
|
||||
|
@ -920,24 +923,32 @@ class USSDHandler {
|
|||
trywait = 0,
|
||||
infinitely = 120000
|
||||
};
|
||||
enum
|
||||
{
|
||||
USSD_MAX_CHARS_7BIT = 182 ///< See GSM 03.38 5 Cell Broadcast Data Coding Scheme
|
||||
};
|
||||
|
||||
private:
|
||||
unsigned mTransactionID;
|
||||
|
||||
protected:
|
||||
std::string mString;
|
||||
std::string mContinueStr;
|
||||
|
||||
public:
|
||||
/** This form is used for MO USSD */
|
||||
USSDHandler(unsigned wTransactionID)
|
||||
:mTransactionID(wTransactionID),
|
||||
mString("")
|
||||
mContinueStr(gConfig.getStr("USSD.ContinueStr"))
|
||||
{}
|
||||
|
||||
/** This form is used for MT USSD */
|
||||
USSDHandler(GSM::L3MobileIdentity &mobileIdentity, unsigned TIFlag, unsigned TIValue, Control::USSDData::USSDMessageType messageType, std::string ussdString)
|
||||
:mString("")
|
||||
:mContinueStr(gConfig.getStr("USSD.ContinueStr"))
|
||||
{
|
||||
mTransactionID = USSDDispatcher(mobileIdentity, TIFlag, TIValue, messageType, ussdString, false);
|
||||
}
|
||||
|
||||
/** Wait USSD data from MS. Return: 0 - successful, 1 - clear transaction, 2 - error or timeout */
|
||||
unsigned waitUSSDData(Control::USSDData::USSDMessageType* messageType, std::string* USSDString, unsigned timeout);
|
||||
/** Post USSD data and update transaction with new USSDData (messageType and USSDString)*/
|
||||
|
|
|
@ -192,6 +192,9 @@ USSD.HTTP.Gateway api.clickatell.com
|
|||
# IF USSD.HTTP.Gateway IS DEFINED, USSD.HTTP.AccessString MUST ALSO BE DEFINED.
|
||||
USSD.HTTP.AccessString sendmsg?user=xxxx&password=xxxx&api_id=xxxx
|
||||
|
||||
# We split long messages into few screens. This string is appended
|
||||
# to the end of each screen to notify user that text is to be continued.
|
||||
USSD.ContinueStr ...1>
|
||||
|
||||
|
||||
# Things to query during registration updates.
|
||||
|
|
Reference in New Issue