Search in sources :

Example 1 with ApplicationContextName

use of org.restcomm.protocols.ss7.tcap.asn.ApplicationContextName in project smscgateway by RestComm.

the class SriSbb method onDialogReject.

// *********
// MAP Dialog events
@Override
public void onDialogReject(DialogReject evt, ActivityContextInterface aci) {
    try {
        MAPRefuseReason mapRefuseReason = evt.getRefuseReason();
        SmsSet smsSet = getSmsSet();
        if (smsSet == null) {
            logger.severe("SriSbb.onDialogReject(): CMP smsSet is missed");
            markDeliveringIsEnded(true);
            return;
        }
        if (mapRefuseReason == MAPRefuseReason.PotentialVersionIncompatibility && evt.getMAPDialog().getApplicationContext().getApplicationContextVersion() != MAPApplicationContextVersion.version1) {
            if (logger.isWarningEnabled()) {
                this.logger.warning("Rx : Sri onDialogReject / PotentialVersionIncompatibility=" + evt);
            }
            // possible a peer supports only MAP V1
            // Now send new SRI with supported ACN (MAP V1)
            this.sendSRI(smsSet, smsSet.getDestAddr(), smsSet.getDestAddrTon(), smsSet.getDestAddrNpi(), this.getSRIMAPApplicationContext(MAPApplicationContextVersion.version1));
            return;
        }
        // If ACN not supported, lets use the new one suggested
        if (mapRefuseReason == MAPRefuseReason.ApplicationContextNotSupported) {
            if (logger.isWarningEnabled()) {
                this.logger.warning("Rx : Sri onDialogReject / ApplicationContextNotSupported=" + evt);
            }
            // Now send new SRI with supported ACN
            ApplicationContextName tcapApplicationContextName = evt.getAlternativeApplicationContext();
            MAPApplicationContext supportedMAPApplicationContext = MAPApplicationContext.getInstance(tcapApplicationContextName.getOid());
            this.sendSRI(smsSet, smsSet.getDestAddr(), smsSet.getDestAddrTon(), smsSet.getDestAddrNpi(), this.getSRIMAPApplicationContext(supportedMAPApplicationContext.getApplicationContextVersion()));
            return;
        }
        super.onDialogReject(evt, aci);
        this.onDeliveryError(smsSet, ErrorAction.permanentFailure, ErrorCode.HLR_REJECT_AFTER_ROUTING_INFO, "onDialogReject after SRI Request: " + mapRefuseReason != null ? mapRefuseReason.toString() : "", true, null, false, ProcessingType.SS7_SRI);
    } catch (Throwable e1) {
        logger.severe("Exception in SriSbb.onDialogReject() when fetching records and issuing events: " + e1.getMessage(), e1);
        markDeliveringIsEnded(true);
    }
}
Also used : ApplicationContextName(org.restcomm.protocols.ss7.tcap.asn.ApplicationContextName) MAPRefuseReason(org.restcomm.protocols.ss7.map.api.dialog.MAPRefuseReason) SmsSet(org.mobicents.smsc.library.SmsSet) MAPApplicationContext(org.restcomm.protocols.ss7.map.api.MAPApplicationContext)

Example 2 with ApplicationContextName

use of org.restcomm.protocols.ss7.tcap.asn.ApplicationContextName in project smscgateway by RestComm.

the class MtSbb method onDialogReject.

@Override
public void onDialogReject(DialogReject evt, ActivityContextInterface aci) {
    try {
        SmsSet smsSet = getSmsSet();
        if (smsSet == null) {
            logger.severe("MtSbb.onDialogReject(): CMP smsSet is missed");
            markDeliveringIsEnded(true);
            return;
        }
        MAPRefuseReason mapRefuseReason = evt.getRefuseReason();
        if (mapRefuseReason == MAPRefuseReason.PotentialVersionIncompatibility && evt.getMAPDialog().getApplicationContext().getApplicationContextVersion() != MAPApplicationContextVersion.version1) {
            if (logger.isWarningEnabled()) {
                this.logger.warning("Rx : Mt onDialogReject / PotentialVersionIncompatibility=" + evt);
            }
            MAPApplicationContextVersion newMAPApplicationContextVersion = MAPApplicationContextVersion.version1;
            if (this.isMAPVersionTested(newMAPApplicationContextVersion)) {
                // If version1 already tried this is error
                String reason = "Error condition when invoking sendMtSms() from onDialogReject()." + newMAPApplicationContextVersion + " already tried and DialogReject again suggests Version1";
                this.logger.severe(reason);
                ErrorCode smStatus = ErrorCode.MAP_SERVER_VERSION_ERROR;
                this.onDeliveryError(smsSet, ErrorAction.permanentFailure, smStatus, reason, true, null, false, ProcessingType.SS7_MT);
                return;
            }
            this.setNegotiatedMapVersionUsing(false);
            this.setMAPVersionTested(newMAPApplicationContextVersion);
            mapVersionCache.setMAPApplicationContextVersion(this.getNetworkNode().getGlobalTitle().getDigits(), newMAPApplicationContextVersion);
            // Now send new ForwardSM with supported ACN (MAP V1)
            try {
                // Update cache
                this.sendMtSms(this.getMtFoSMSMAPApplicationContext(MAPApplicationContextVersion.version1), MessageProcessingState.resendAfterMapProtocolNegotiation, null, smsSet.getNetworkId());
                return;
            } catch (SmscProcessingException e) {
                String reason = "SmscPocessingException when invoking sendMtSms() from onDialogReject()-resendAfterMapProtocolNegotiation: " + e.toString();
                this.logger.severe(reason, e);
                ErrorCode smStatus = ErrorCode.SC_SYSTEM_ERROR;
                try {
                    smStatus = ErrorCode.fromInt(e.getSmppErrorCode());
                } catch (IllegalArgumentException e1) {
                }
                this.onDeliveryError(smsSet, ErrorAction.permanentFailure, smStatus, reason, true, null, false, ProcessingType.SS7_MT);
                return;
            } catch (Throwable e) {
                String reason = "Exception when invoking sendMtSms() from onDialogReject()-resendAfterMapProtocolNegotiation: " + e.toString();
                this.logger.severe(reason, e);
                ErrorCode smStatus = ErrorCode.SC_SYSTEM_ERROR;
                this.onDeliveryError(smsSet, ErrorAction.permanentFailure, smStatus, reason, true, null, false, ProcessingType.SS7_MT);
                return;
            }
        }
        // If ACN not supported, lets use the new one suggested
        if (mapRefuseReason == MAPRefuseReason.ApplicationContextNotSupported) {
            String nodeDigits = this.getNetworkNode().getGlobalTitle().getDigits();
            if (logger.isWarningEnabled()) {
                this.logger.warning("Rx : Mt onDialogReject / ApplicationContextNotSupported for node " + nodeDigits + " Event=" + evt);
            }
            // Now send new MtSMS with supported ACN
            ApplicationContextName tcapApplicationContextName = evt.getAlternativeApplicationContext();
            MAPApplicationContext supportedMAPApplicationContext = MAPApplicationContext.getInstance(tcapApplicationContextName.getOid());
            MAPApplicationContextVersion supportedMAPApplicationContextVersion = supportedMAPApplicationContext.getApplicationContextVersion();
            MAPApplicationContextVersion newMAPApplicationContextVersion = supportedMAPApplicationContextVersion;
            if (this.isMAPVersionTested(newMAPApplicationContextVersion)) {
                newMAPApplicationContextVersion = MAPApplicationContextVersion.version3;
                if (this.isMAPVersionTested(newMAPApplicationContextVersion)) {
                    newMAPApplicationContextVersion = MAPApplicationContextVersion.version2;
                    if (this.isMAPVersionTested(newMAPApplicationContextVersion)) {
                        newMAPApplicationContextVersion = MAPApplicationContextVersion.version1;
                        if (this.isMAPVersionTested(newMAPApplicationContextVersion)) {
                            // If all versions are already tried this is
                            // error
                            String reason = "Error condition when invoking sendMtSms() from onDialogReject()." + " all MAP versions are already tried and DialogReject again suggests Version1";
                            this.logger.severe(reason);
                            ErrorCode smStatus = ErrorCode.MAP_SERVER_VERSION_ERROR;
                            this.onDeliveryError(smsSet, ErrorAction.permanentFailure, smStatus, reason, true, null, false, ProcessingType.SS7_MT);
                            return;
                        }
                    }
                }
            }
            this.setNegotiatedMapVersionUsing(false);
            this.setMAPVersionTested(newMAPApplicationContextVersion);
            mapVersionCache.setMAPApplicationContextVersion(this.getNetworkNode().getGlobalTitle().getDigits(), newMAPApplicationContextVersion);
            try {
                this.sendMtSms(this.getMtFoSMSMAPApplicationContext(newMAPApplicationContextVersion), MessageProcessingState.resendAfterMapProtocolNegotiation, null, smsSet.getNetworkId());
                return;
            } catch (SmscProcessingException e) {
                String reason = "SmscPocessingException when invoking sendMtSms() from onDialogReject()-resendAfterMapProtocolNegotiation: " + e.toString();
                this.logger.severe(reason, e);
                ErrorCode smStatus = ErrorCode.SC_SYSTEM_ERROR;
                try {
                    smStatus = ErrorCode.fromInt(e.getSmppErrorCode());
                } catch (IllegalArgumentException e1) {
                }
                this.onDeliveryError(smsSet, ErrorAction.permanentFailure, smStatus, reason, true, null, false, ProcessingType.SS7_MT);
                return;
            } catch (Throwable e) {
                String reason = "Exception when invoking sendMtSms() from onDialogReject()-resendAfterMapProtocolNegotiation: " + e.toString();
                this.logger.severe(reason, e);
                ErrorCode smStatus = ErrorCode.SC_SYSTEM_ERROR;
                this.onDeliveryError(smsSet, ErrorAction.permanentFailure, smStatus, reason, true, null, false, ProcessingType.SS7_MT);
                return;
            }
        }
        super.onDialogReject(evt, aci);
        this.onDeliveryError(smsSet, ErrorAction.permanentFailure, ErrorCode.MSC_REFUSES_SM, "onDialogReject after MT Request: " + mapRefuseReason != null ? mapRefuseReason.toString() : "", true, null, false, ProcessingType.SS7_MT);
    } catch (Throwable e1) {
        logger.severe("Exception in MtSbb.onDialogReject() when fetching records and issuing events: " + e1.getMessage(), e1);
        markDeliveringIsEnded(true);
    }
}
Also used : MAPApplicationContextName(org.restcomm.protocols.ss7.map.api.MAPApplicationContextName) ApplicationContextName(org.restcomm.protocols.ss7.tcap.asn.ApplicationContextName) MAPRefuseReason(org.restcomm.protocols.ss7.map.api.dialog.MAPRefuseReason) SmscProcessingException(org.mobicents.smsc.library.SmscProcessingException) ISDNAddressString(org.restcomm.protocols.ss7.map.api.primitives.ISDNAddressString) AddressString(org.restcomm.protocols.ss7.map.api.primitives.AddressString) ErrorCode(org.mobicents.smsc.library.ErrorCode) MAPErrorCode(org.restcomm.protocols.ss7.map.api.errors.MAPErrorCode) SmsSet(org.mobicents.smsc.library.SmsSet) MAPApplicationContext(org.restcomm.protocols.ss7.map.api.MAPApplicationContext) MAPApplicationContextVersion(org.restcomm.protocols.ss7.map.api.MAPApplicationContextVersion)

Example 3 with ApplicationContextName

use of org.restcomm.protocols.ss7.tcap.asn.ApplicationContextName in project smscgateway by RestComm.

the class HrSriClientSbb method onDialogReject.

public void onDialogReject(DialogReject evt, ActivityContextInterface aci) {
    super.onDialogReject(evt, aci);
    try {
        MAPRefuseReason mapRefuseReason = evt.getRefuseReason();
        CorrelationIdValue correlationIdValue = this.getCorrelationIdValue();
        if (correlationIdValue == null) {
            this.logger.severe("HrSriClientSbb.onDialogReject(): CorrelationIdValue CMP missed");
            return;
        }
        if (mapRefuseReason == MAPRefuseReason.PotentialVersionIncompatibility && evt.getMAPDialog().getApplicationContext().getApplicationContextVersion() != MAPApplicationContextVersion.version1) {
            if (logger.isWarningEnabled()) {
                this.logger.warning("Home routing: Rx : Sri (home routing) onDialogReject / PotentialVersionIncompatibility=" + evt);
            }
            // possible a peer supports only MAP V1
            // Now send new SRI with supported ACN (MAP V1)
            this.sendSRI(correlationIdValue.getMsisdn().getAddress(), correlationIdValue.getMsisdn().getAddressNature().getIndicator(), correlationIdValue.getMsisdn().getNumberingPlan().getIndicator(), this.getSRIMAPApplicationContext(MAPApplicationContextVersion.version1), correlationIdValue);
            return;
        }
        // If ACN not supported, lets use the new one suggested
        if (mapRefuseReason == MAPRefuseReason.ApplicationContextNotSupported) {
            if (logger.isWarningEnabled()) {
                this.logger.warning("Home routing: Rx : Sri (home routing) onDialogReject / ApplicationContextNotSupported=" + evt);
            }
            // Now send new SRI with supported ACN
            ApplicationContextName tcapApplicationContextName = evt.getAlternativeApplicationContext();
            MAPApplicationContext supportedMAPApplicationContext = MAPApplicationContext.getInstance(tcapApplicationContextName.getOid());
            this.sendSRI(correlationIdValue.getMsisdn().getAddress(), correlationIdValue.getMsisdn().getAddressNature().getIndicator(), correlationIdValue.getMsisdn().getNumberingPlan().getIndicator(), this.getSRIMAPApplicationContext(supportedMAPApplicationContext.getApplicationContextVersion()), correlationIdValue);
            return;
        }
        this.returnSriFailure(correlationIdValue, null, "Home routing: onDialogReject after SRI Request: " + mapRefuseReason != null ? mapRefuseReason.toString() : "");
    } catch (Throwable e1) {
        logger.severe("Exception in SriSbb.onDialogReject() (home routing) when fetching records and issuing events: " + e1.getMessage(), e1);
    }
}
Also used : MAPApplicationContextName(org.restcomm.protocols.ss7.map.api.MAPApplicationContextName) ApplicationContextName(org.restcomm.protocols.ss7.tcap.asn.ApplicationContextName) MAPRefuseReason(org.restcomm.protocols.ss7.map.api.dialog.MAPRefuseReason) CorrelationIdValue(org.mobicents.smsc.library.CorrelationIdValue) MAPApplicationContext(org.restcomm.protocols.ss7.map.api.MAPApplicationContext)

Aggregations

MAPApplicationContext (org.restcomm.protocols.ss7.map.api.MAPApplicationContext)3 MAPRefuseReason (org.restcomm.protocols.ss7.map.api.dialog.MAPRefuseReason)3 ApplicationContextName (org.restcomm.protocols.ss7.tcap.asn.ApplicationContextName)3 SmsSet (org.mobicents.smsc.library.SmsSet)2 MAPApplicationContextName (org.restcomm.protocols.ss7.map.api.MAPApplicationContextName)2 CorrelationIdValue (org.mobicents.smsc.library.CorrelationIdValue)1 ErrorCode (org.mobicents.smsc.library.ErrorCode)1 SmscProcessingException (org.mobicents.smsc.library.SmscProcessingException)1 MAPApplicationContextVersion (org.restcomm.protocols.ss7.map.api.MAPApplicationContextVersion)1 MAPErrorCode (org.restcomm.protocols.ss7.map.api.errors.MAPErrorCode)1 AddressString (org.restcomm.protocols.ss7.map.api.primitives.AddressString)1 ISDNAddressString (org.restcomm.protocols.ss7.map.api.primitives.ISDNAddressString)1