1

我目前正在使用map-api-2.1.0.jarmap-impl-2.1.0.jar来处理来自手机的 USSD 字符串。这工作正常,用户正在接收 USSD 响应。

地图处理类

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();
 }

}

ss7.request.UnstructuredSSRequest 类

   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 代码时从用户那里获取输入,而不是向他发送响应并关闭会话。 请帮助我如何为用户维护会话并听取他的意见。

4

1 回答 1

1

我相信您正在使用Mobicents jSS7项目,上面的代码是通过 SIGTRAN 或 E1 连接到 HLR/MSC 的服务器端。

如果是,您可以在https://code.google.com/p/jss7/source/browse/map/load/src/main/java/org/mobicents/protocols/ss7/map看到服务器端的示例代码/load/Server.java

于 2015-01-05T09:01:38.087 回答