Search in sources :

Example 1 with SmsCommandTpdu

use of org.restcomm.protocols.ss7.map.api.smstpdu.SmsCommandTpdu in project smscgateway by RestComm.

the class MoSbb method processMoMessage.

private Sms processMoMessage(SM_RP_OA smRPOA, SM_RP_DA smRPDA, SmsSignalInfo smsSignalInfo, int networkId, String originatorSccpAddress, boolean isMoOperation, MAPDialogSms dialog, SmsMessage evt, long invokeId) throws SmscProcessingException {
    // TODO: check if smRPDA contains local SMSC address and reject messages
    // if not equal ???
    Sms sms = null;
    smsSignalInfo.setGsm8Charset(isoCharset);
    ISDNAddressString callingPartyAddress = smRPOA.getMsisdn();
    if (callingPartyAddress == null) {
        throw new SmscProcessingException("MO callingPartyAddress is absent", SmppConstants.STATUS_SYSERR, MAPErrorCode.unexpectedDataValue, SmscProcessingException.HTTP_ERROR_CODE_NOT_SET, null);
    }
    SmsTpdu smsTpdu = null;
    String origMoServiceCentreAddressDA = null;
    if (smRPDA.getServiceCentreAddressDA() != null) {
        origMoServiceCentreAddressDA = smRPDA.getServiceCentreAddressDA().getAddress();
    }
    try {
        smsTpdu = smsSignalInfo.decodeTpdu(true);
        switch(smsTpdu.getSmsTpduType()) {
            case SMS_SUBMIT:
                SmsSubmitTpdu smsSubmitTpdu = (SmsSubmitTpdu) smsTpdu;
                if (this.logger.isInfoEnabled()) {
                    this.logger.info("Received SMS_SUBMIT = " + smsSubmitTpdu);
                }
                sms = this.handleSmsSubmitTpdu(smsSubmitTpdu, callingPartyAddress, networkId, originatorSccpAddress, isMoOperation, dialog, evt, invokeId, origMoServiceCentreAddressDA);
                break;
            case SMS_DELIVER_REPORT:
                SmsDeliverReportTpdu smsDeliverReportTpdu = (SmsDeliverReportTpdu) smsTpdu;
                if (this.logger.isInfoEnabled()) {
                    this.logger.info("Received SMS_DELIVER_REPORT = " + smsDeliverReportTpdu);
                    smscStatAggregator.updateMsgInFailedAll();
                }
                // callingPartyAddress);
                break;
            case SMS_COMMAND:
                SmsCommandTpdu smsCommandTpdu = (SmsCommandTpdu) smsTpdu;
                if (this.logger.isInfoEnabled()) {
                    this.logger.info("Received SMS_COMMAND = " + smsCommandTpdu);
                    smscStatAggregator.updateMsgInFailedAll();
                }
                // callingPartyAddress);
                break;
            // break;
            default:
                this.logger.severe("Received non SMS_SUBMIT or SMS_DELIVER_REPORT or SMS_COMMAND or SMS_DELIVER = " + smsTpdu);
                smscStatAggregator.updateMsgInFailedAll();
                break;
        }
    } catch (MAPException e1) {
        logger.severe("Error while decoding SmsSignalInfo ", e1);
    }
    return sms;
}
Also used : MAPException(org.restcomm.protocols.ss7.map.api.MAPException) SmsTpdu(org.restcomm.protocols.ss7.map.api.smstpdu.SmsTpdu) MAPDialogSms(org.restcomm.protocols.ss7.map.api.service.sms.MAPDialogSms) ISDNAddressString(org.restcomm.protocols.ss7.map.api.primitives.ISDNAddressString) ISDNAddressString(org.restcomm.protocols.ss7.map.api.primitives.ISDNAddressString) AddressString(org.restcomm.protocols.ss7.map.api.primitives.AddressString) SmsSubmitTpdu(org.restcomm.protocols.ss7.map.api.smstpdu.SmsSubmitTpdu) SmsDeliverReportTpdu(org.restcomm.protocols.ss7.map.api.smstpdu.SmsDeliverReportTpdu) SmsCommandTpdu(org.restcomm.protocols.ss7.map.api.smstpdu.SmsCommandTpdu)

Aggregations

MAPException (org.restcomm.protocols.ss7.map.api.MAPException)1 AddressString (org.restcomm.protocols.ss7.map.api.primitives.AddressString)1 ISDNAddressString (org.restcomm.protocols.ss7.map.api.primitives.ISDNAddressString)1 MAPDialogSms (org.restcomm.protocols.ss7.map.api.service.sms.MAPDialogSms)1 SmsCommandTpdu (org.restcomm.protocols.ss7.map.api.smstpdu.SmsCommandTpdu)1 SmsDeliverReportTpdu (org.restcomm.protocols.ss7.map.api.smstpdu.SmsDeliverReportTpdu)1 SmsSubmitTpdu (org.restcomm.protocols.ss7.map.api.smstpdu.SmsSubmitTpdu)1 SmsTpdu (org.restcomm.protocols.ss7.map.api.smstpdu.SmsTpdu)1