Search in sources :

Example 16 with MAPException

use of org.mobicents.protocols.ss7.map.api.MAPException in project smscgateway by RestComm.

the class MoSbb method onDialogDelimiter.

public void onDialogDelimiter(DialogDelimiter evt, ActivityContextInterface aci) {
    super.onDialogDelimiter(evt, aci);
    if (this.getProcessingState() == MoProcessingState.OnlyRequestRecieved) {
        this.setProcessingState(null);
        if (this.logger.isFineEnabled())
            this.logger.fine("MoSBB: onDialogDelimiter - sending empty TC-CONTINUE for " + evt);
        evt.getMAPDialog();
        MAPDialog dialog = evt.getMAPDialog();
        try {
            dialog.send();
        } catch (MAPException e) {
            logger.severe("Error while sending Continue", e);
        }
    }
}
Also used : MAPException(org.restcomm.protocols.ss7.map.api.MAPException) MAPDialog(org.restcomm.protocols.ss7.map.api.MAPDialog)

Example 17 with MAPException

use of org.mobicents.protocols.ss7.map.api.MAPException in project smscgateway by RestComm.

the class MoSbb method createSmsEvent.

private Sms createSmsEvent(SmsDeliverTpdu smsDeliverTpdu, TargetAddress ta, PersistenceRAInterface store, CorrelationIdValue civ, int networkId, String originatorSccpAddress) throws SmscProcessingException {
    UserData userData = smsDeliverTpdu.getUserData();
    try {
        userData.decode();
    } catch (MAPException e) {
        throw new SmscProcessingException("MT MAPException when decoding user data", SmppConstants.STATUS_SYSERR, MAPErrorCode.unexpectedDataValue, SmscProcessingException.HTTP_ERROR_CODE_NOT_SET, null);
    }
    Sms sms = new Sms();
    sms.setDbId(UUID.randomUUID());
    sms.setOriginationType(OriginationType.SS7_HR);
    AddressField callingPartyAddress = smsDeliverTpdu.getOriginatingAddress();
    // checking parameters first
    if (callingPartyAddress == null || callingPartyAddress.getAddressValue() == null || callingPartyAddress.getAddressValue().isEmpty()) {
        throw new SmscProcessingException("Home routing: TPDU OriginatingAddress digits are absent", SmppConstants.STATUS_SYSERR, MAPErrorCode.unexpectedDataValue, SmscProcessingException.HTTP_ERROR_CODE_NOT_SET, null);
    }
    if (callingPartyAddress.getTypeOfNumber() == null) {
        throw new SmscProcessingException("Home routing: TPDU OriginatingAddress TypeOfNumber is absent", SmppConstants.STATUS_SYSERR, MAPErrorCode.unexpectedDataValue, SmscProcessingException.HTTP_ERROR_CODE_NOT_SET, null);
    }
    if (callingPartyAddress.getNumberingPlanIdentification() == null) {
        throw new SmscProcessingException("Home routing: TPDU OriginatingAddress NumberingPlanIdentification is absent", SmppConstants.STATUS_SYSERR, MAPErrorCode.unexpectedDataValue, SmscProcessingException.HTTP_ERROR_CODE_NOT_SET, null);
    }
    sms.setSourceAddr(callingPartyAddress.getAddressValue());
    sms.setOriginatorSccpAddress(originatorSccpAddress);
    if (callingPartyAddress.getTypeOfNumber() == TypeOfNumber.Alphanumeric) {
        sms.setSourceAddrTon(TypeOfNumber.Alphanumeric.getCode());
        sms.setSourceAddrNpi(NumberingPlanIdentification.Unknown.getCode());
    } else {
        sms.setSourceAddrTon(callingPartyAddress.getTypeOfNumber().getCode());
        sms.setSourceAddrNpi(callingPartyAddress.getNumberingPlanIdentification().getCode());
    }
    sms.setOrigNetworkId(networkId);
    sms.setSubmitDate(new Timestamp(System.currentTimeMillis()));
    int messageingMode = (smscPropertiesManagement.getHrDefaultMessagingMode() & 0x03);
    sms.setEsmClass(messageingMode | (smsDeliverTpdu.getUserDataHeaderIndicator() ? SmppConstants.ESM_CLASS_UDHI_MASK : 0) | (smsDeliverTpdu.getReplyPathExists() ? SmppConstants.ESM_CLASS_REPLY_PATH_MASK : 0));
    sms.setProtocolId(smsDeliverTpdu.getProtocolIdentifier().getCode());
    sms.setPriority(0);
    // TODO: do we need somehow care with RegisteredDelivery ?
    sms.setReplaceIfPresent(0);
    // TODO: care with smsSubmitTpdu.getStatusReportRequest() parameter
    // sending back SMS_STATUS_REPORT tpdu ?
    DataCodingScheme dataCodingScheme = smsDeliverTpdu.getDataCodingScheme();
    int dcs = dataCodingScheme.getCode();
    String err = MessageUtil.checkDataCodingSchemeSupport(dcs);
    if (err != null) {
        throw new SmscProcessingException("Home routing: DataCoding scheme does not supported: " + dcs + " - " + err, SmppConstants.STATUS_SYSERR, MAPErrorCode.unexpectedDataValue, SmscProcessingException.HTTP_ERROR_CODE_NOT_SET, null);
    }
    sms.setDataCoding(dcs);
    sms.setShortMessageText(userData.getDecodedMessage());
    UserDataHeader udh = userData.getDecodedUserDataHeader();
    if (udh != null) {
        sms.setShortMessageBin(udh.getEncodedData());
    }
    // ValidityPeriod processing
    MessageUtil.applyValidityPeriod(sms, null, false, smscPropertiesManagement.getMaxValidityPeriodHours(), smscPropertiesManagement.getDefaultValidityPeriodHours());
    SmsSet smsSet;
    smsSet = new SmsSet();
    smsSet.setDestAddr(ta.getAddr());
    smsSet.setDestAddrNpi(ta.getAddrNpi());
    smsSet.setDestAddrTon(ta.getAddrTon());
    smsSet.setNetworkId(networkId);
    smsSet.setCorrelationId(civ.getCorrelationID());
    smsSet.setImsi(civ.getImsi());
    smsSet.setLocationInfoWithLMSI(civ.getLocationInfoWithLMSI());
    smsSet.addSms(sms);
    sms.setSmsSet(smsSet);
    long messageId = store.c2_getNextMessageId();
    SmscStatProvider.getInstance().setCurrentMessageId(messageId);
    sms.setMessageId(messageId);
    return sms;
}
Also used : AddressField(org.restcomm.protocols.ss7.map.api.smstpdu.AddressField) DataCodingScheme(org.restcomm.protocols.ss7.map.api.smstpdu.DataCodingScheme) UserData(org.restcomm.protocols.ss7.map.api.smstpdu.UserData) MAPException(org.restcomm.protocols.ss7.map.api.MAPException) MAPDialogSms(org.restcomm.protocols.ss7.map.api.service.sms.MAPDialogSms) ISDNAddressString(org.restcomm.protocols.ss7.map.api.primitives.ISDNAddressString) AddressString(org.restcomm.protocols.ss7.map.api.primitives.AddressString) Timestamp(java.sql.Timestamp) UserDataHeader(org.restcomm.protocols.ss7.map.api.smstpdu.UserDataHeader)

Example 18 with MAPException

use of org.mobicents.protocols.ss7.map.api.MAPException in project smscgateway by RestComm.

the class MtSbb method onDialogDelimiter.

@Override
public void onDialogDelimiter(DialogDelimiter evt, ActivityContextInterface aci) {
    super.onDialogDelimiter(evt, aci);
    SmsSet smsSet = getSmsSet();
    if (smsSet == null) {
        logger.severe("MtSbb.onDialogDelimiter(): CMP smsSet is missed");
        markDeliveringIsEnded(true);
        return;
    }
    try {
        if (this.getTcEmptySent() != 0) {
            // Empty TC-BEGIN has been sent
            // We are sending MtForwardSM
            this.setTcEmptySent(0);
            SmsSignalInfo[] segments = this.getSegments();
            int messageSegmentNumber = this.getMessageSegmentNumber();
            if (messageSegmentNumber >= 0 && segments != null && messageSegmentNumber < segments.length) {
                SmsSignalInfo si = segments[messageSegmentNumber];
                if (si != null) {
                    try {
                        MAPDialogSms mapDialogSms = (MAPDialogSms) evt.getMAPDialog();
                        SM_RP_DA sm_RP_DA = this.getSmRpDa();
                        SM_RP_OA sm_RP_OA = this.getSmRpOa();
                        boolean moreMessagesToSend = false;
                        if (messageSegmentNumber < segments.length - 1) {
                            moreMessagesToSend = true;
                        }
                        try {
                            if (this.getTotalUnsentMessageCount() > 1) {
                                moreMessagesToSend = true;
                            }
                        } catch (Throwable e) {
                        }
                        switch(mapDialogSms.getApplicationContext().getApplicationContextVersion()) {
                            case version3:
                                mapDialogSms.addMtForwardShortMessageRequest(sm_RP_DA, sm_RP_OA, si, moreMessagesToSend, null);
                                if (this.logger.isInfoEnabled()) {
                                    this.logger.info("Sending: MtForwardShortMessageRequest: sm_RP_DA=" + sm_RP_DA + ", sm_RP_OA=" + sm_RP_OA + ", si=" + si + ", moreMessagesToSend=" + moreMessagesToSend);
                                }
                                break;
                            case version2:
                            case version1:
                                mapDialogSms.addForwardShortMessageRequest(sm_RP_DA, sm_RP_OA, si, moreMessagesToSend);
                                if (this.logger.isInfoEnabled()) {
                                    this.logger.info("Sending: ForwardShortMessageRequest: sm_RP_DA=" + sm_RP_DA + ", sm_RP_OA=" + sm_RP_OA + ", si=" + si + ", moreMessagesToSend=" + moreMessagesToSend);
                                }
                                break;
                            default:
                                break;
                        }
                        mapDialogSms.send();
                    } catch (MAPException e) {
                        logger.severe("Error while trying to send MtForwardShortMessageRequest", e);
                    }
                }
            }
        } else if (this.getResponseReceived() == 1) {
            this.setResponseReceived(0);
            this.handleSmsResponse((MAPDialogSms) evt.getMAPDialog(), true);
        }
    } catch (Throwable e1) {
        String s = "Exception in MtSbb.onDialogDelimiter() when fetching records and issuing events: " + e1.getMessage();
        logger.severe(s, e1);
        markDeliveringIsEnded(true);
    // this.onDeliveryError(smsSet, ErrorAction.temporaryFailure, ErrorCode.SC_SYSTEM_ERROR, s, true, null, false);
    }
}
Also used : SmsSignalInfo(org.restcomm.protocols.ss7.map.api.service.sms.SmsSignalInfo) MAPDialogSms(org.restcomm.protocols.ss7.map.api.service.sms.MAPDialogSms) MAPException(org.restcomm.protocols.ss7.map.api.MAPException) SM_RP_OA(org.restcomm.protocols.ss7.map.api.service.sms.SM_RP_OA) ISDNAddressString(org.restcomm.protocols.ss7.map.api.primitives.ISDNAddressString) AddressString(org.restcomm.protocols.ss7.map.api.primitives.AddressString) SmsSet(org.mobicents.smsc.library.SmsSet) SM_RP_DA(org.restcomm.protocols.ss7.map.api.service.sms.SM_RP_DA)

Example 19 with MAPException

use of org.mobicents.protocols.ss7.map.api.MAPException in project smscgateway by RestComm.

the class HrSriServerSbb method onSriHrByPass.

@Override
public void onSriHrByPass(CorrelationIdValue correlationIdValue) {
    MAPDialogSms dlg = this.getActivity();
    if (dlg == null) {
        this.logger.severe("Home routing: can not get MAPDialog for sending SRI hrByPass Response");
        return;
    }
    smscStatAggregator.updateMsgInHrSriHrByPass();
    StringBuilder sb = new StringBuilder();
    sb.append("Home routing: bypassing of Home routing: procedure: transaction: ");
    sb.append(correlationIdValue);
    if (this.logger.isInfoEnabled())
        this.logger.info(sb.toString());
    // sending original SRI response
    try {
        SendRoutingInfoForSMResponse sendRoutingInfoForSMResponse = correlationIdValue.getSendRoutingInfoForSMResponse();
        this.doSendResponse(correlationIdValue, dlg, sendRoutingInfoForSMResponse.getIMSI().getData(), sendRoutingInfoForSMResponse.getLocationInfoWithLMSI());
    } catch (MAPException e) {
        if (dlg != null) {
            dlg.release();
        }
        String reason = "Home routing: MAPException when sending SRI bypassing of Home routing: " + e.toString();
        this.logger.severe(reason, e);
    }
}
Also used : MAPDialogSms(org.restcomm.protocols.ss7.map.api.service.sms.MAPDialogSms) MAPException(org.restcomm.protocols.ss7.map.api.MAPException) ISDNAddressString(org.restcomm.protocols.ss7.map.api.primitives.ISDNAddressString) AddressString(org.restcomm.protocols.ss7.map.api.primitives.AddressString) SendRoutingInfoForSMResponse(org.restcomm.protocols.ss7.map.api.service.sms.SendRoutingInfoForSMResponse)

Example 20 with MAPException

use of org.mobicents.protocols.ss7.map.api.MAPException in project smscgateway by RestComm.

the class MAPListener method onSendRoutingInfoForSMRequest.

@Override
public void onSendRoutingInfoForSMRequest(SendRoutingInfoForSMRequest event) {
    if (logger.isInfoEnabled()) {
        logger.info("Rx : SendRoutingInfoForSMRequestIndication=" + event);
    }
    IMSI imsi = new IMSIImpl("410035001692061");
    ISDNAddressString nnn = new ISDNAddressStringImpl(AddressNature.international_number, NumberingPlan.ISDN, "923330052001");
    LocationInfoWithLMSI li = new LocationInfoWithLMSIImpl(nnn, null, null, false, null);
    MAPDialogSms mapDialogSms = event.getMAPDialog();
    try {
        mapDialogSms.addSendRoutingInfoForSMResponse(event.getInvokeId(), imsi, li, null, null, null);
    // mapDialogSms.close(false);
    } catch (MAPException e) {
        e.printStackTrace();
    }
    mapDialogSms.setUserObject(true);
}
Also used : LocationInfoWithLMSI(org.restcomm.protocols.ss7.map.api.service.sms.LocationInfoWithLMSI) ISDNAddressStringImpl(org.restcomm.protocols.ss7.map.primitives.ISDNAddressStringImpl) IMSIImpl(org.restcomm.protocols.ss7.map.primitives.IMSIImpl) MAPDialogSms(org.restcomm.protocols.ss7.map.api.service.sms.MAPDialogSms) MAPException(org.restcomm.protocols.ss7.map.api.MAPException) IMSI(org.restcomm.protocols.ss7.map.api.primitives.IMSI) ISDNAddressString(org.restcomm.protocols.ss7.map.api.primitives.ISDNAddressString) LocationInfoWithLMSIImpl(org.restcomm.protocols.ss7.map.service.sms.LocationInfoWithLMSIImpl)

Aggregations

MAPException (org.restcomm.protocols.ss7.map.api.MAPException)22 MAPDialogSms (org.restcomm.protocols.ss7.map.api.service.sms.MAPDialogSms)19 ISDNAddressString (org.restcomm.protocols.ss7.map.api.primitives.ISDNAddressString)14 AddressString (org.restcomm.protocols.ss7.map.api.primitives.AddressString)12 ActivityContextInterface (javax.slee.ActivityContextInterface)4 Sms (org.mobicents.smsc.library.Sms)4 SmsSet (org.mobicents.smsc.library.SmsSet)4 SmsSignalInfo (org.restcomm.protocols.ss7.map.api.service.sms.SmsSignalInfo)4 MAPErrorMessage (org.restcomm.protocols.ss7.map.api.errors.MAPErrorMessage)3 MAPErrorMessageSubscriberBusyForMtSms (org.restcomm.protocols.ss7.map.api.errors.MAPErrorMessageSubscriberBusyForMtSms)3 SM_RP_DA (org.restcomm.protocols.ss7.map.api.service.sms.SM_RP_DA)3 SmsTpdu (org.restcomm.protocols.ss7.map.api.smstpdu.SmsTpdu)3 UserData (org.restcomm.protocols.ss7.map.api.smstpdu.UserData)3 Timestamp (java.sql.Timestamp)2 ArrayList (java.util.ArrayList)2 Date (java.util.Date)2 SmscProcessingException (org.mobicents.smsc.library.SmscProcessingException)2 TargetAddress (org.mobicents.smsc.library.TargetAddress)2 MAPErrorMessageSMDeliveryFailure (org.restcomm.protocols.ss7.map.api.errors.MAPErrorMessageSMDeliveryFailure)2 IMSI (org.restcomm.protocols.ss7.map.api.primitives.IMSI)2