我目前正在使用 map-api-2.1.0.jar 和 map-impl-2.1.0.jar 来处理来自手机的USSD字符串。这工作正常,用户正在收到USSD响应。
MapHandling Class
public class MapHandling implements MAPDialogListener,MAPServiceSmsListener,MAPServiceMobilityListener,MAPServiceCallHandlingListener,MAPSer viceSupplementaryListener{
@Override
public void onProcessUnstructuredSSRequest(ProcessUnstructuredSSRequest procUnstrReqInd)
{
try
{
logger.debug("dialogId: " +procUnstrReqInd.getMAPDialog().getLocalDialogId() + " USSD String:"+procUnstrReqInd.getUSSDString()+"MSISDN:"+procUnstrReqInd.getMAPDialog().getReceivedDestReference().getAddress());
} catch (Exception exp)
{
logger.error("USSD - error while loging ussd data ", exp);
}
ss7.request.UnstructuredSSRequest ussdRequest = new ss7.request.UnstructuredSSRequest(procUnstrReqInd);
Thread thr = new Thread(ussdRequest);
thr.start();
}
}
public class UnstructuredSSRequest extends SS7Operation implements Runnable {
ProcessUnstructuredSSRequest procUnstrReqInd;
public UnstructuredSSRequest(ProcessUnstructuredSSRequest procUnstrReqInd) {
this.procUnstrReqInd = procUnstrReqInd;
}
@Override
public void run() {
logger.debug("[" + refId + "] Sending USSD response");
sendUSSDResponse(validRequest);
}
private void sendUSSDResponse(boolean validRequest) {
MAPDialogSupplementary dialog = procUnstrReqInd.getMAPDialog();
USSDString ussdStrObj = MapProvider.getMAPParameterFactory().createUSSDString("Thank you for using CC service!");
dialog.addProcessUnstructuredSSResponse(procUnstrReqInd.getInvokeId(),procUnstrReqInd.getDataCodingScheme(), ussdStrObj);
dialog.close(false);
dialog.release();
}
}
以上代码运行正常,我收到“感谢您使用CC服务!”我从手机拨打USSD时的响应。 我想将其更改为交互式USSD处理程序,我想在用户拨打USSD代码时从用户那里获取输入,而不是向他发送响应并关闭会话。 请帮助我如何为用户维护会话并接受他的意见。