Search in sources :

Example 1 with MAPApplicationContext

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

the class AlertSbb method onAlertServiceCentreRequest.

public void onAlertServiceCentreRequest(AlertServiceCentreRequest evt, ActivityContextInterface aci) {
    if (this.logger.isFineEnabled()) {
        this.logger.fine("Received onAlertServiceCentreRequest= " + evt);
    }
    try {
        MAPDialogSms mapDialogSms = evt.getMAPDialog();
        MAPApplicationContext mapApplicationContext = mapDialogSms.getApplicationContext();
        if (mapApplicationContext.getApplicationContextVersion() == MAPApplicationContextVersion.version2) {
            // Send back response only for V2
            mapDialogSms.addAlertServiceCentreResponse(evt.getInvokeId());
            if (this.logger.isFineEnabled()) {
                this.logger.fine("Sending AlertServiceCentreResponse");
            }
            mapDialogSms.close(false);
        } else {
            mapDialogSms.release();
        }
        this.setupAlert(evt.getMsisdn(), evt.getServiceCentreAddress(), mapDialogSms.getNetworkId());
    } catch (MAPException e) {
        logger.severe("Exception while trying to send back AlertServiceCentreResponse", e);
    }
}
Also used : MAPDialogSms(org.restcomm.protocols.ss7.map.api.service.sms.MAPDialogSms) MAPException(org.restcomm.protocols.ss7.map.api.MAPException) MAPApplicationContext(org.restcomm.protocols.ss7.map.api.MAPApplicationContext)

Example 2 with MAPApplicationContext

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

the class MoSbbTest method testMo4_Gsm8.

@Test(groups = { "Mo" })
public void testMo4_Gsm8() throws Exception {
    if (!this.cassandraDbInited)
        return;
    // SmppSessionsProxy smppServerSessions = new SmppSessionsProxy();
    // this.sbb.setSmppServerSessions(smppServerSessions);
    AddressString serviceCentreAddressDA = new AddressStringImpl(AddressNature.international_number, NumberingPlan.ISDN, "1111");
    SM_RP_DA sm_RP_DA = new SM_RP_DAImpl(serviceCentreAddressDA);
    ISDNAddressString msisdn = new ISDNAddressStringImpl(AddressNature.international_number, NumberingPlan.ISDN, "4444");
    SM_RP_OAImpl sm_RP_OA = new SM_RP_OAImpl();
    sm_RP_OA.setMsisdn(msisdn);
    AddressField destinationAddress = new AddressFieldImpl(TypeOfNumber.InternationalNumber, NumberingPlanIdentification.ISDNTelephoneNumberingPlan, "5555");
    ProtocolIdentifier protocolIdentifier = new ProtocolIdentifierImpl(12);
    DataCodingScheme dataCodingScheme = new DataCodingSchemeImpl(4);
    UserDataHeader decodedUserDataHeader = new UserDataHeaderImpl();
    UserDataHeaderElement informationElement = new ConcatenatedShortMessagesIdentifierImpl(false, 55, 3, 1);
    decodedUserDataHeader.addInformationElement(informationElement);
    UserData userData = new UserDataImpl("abc 01234567890", dataCodingScheme, decodedUserDataHeader, isoCharset);
    SmsTpdu tpdu = new SmsSubmitTpduImpl(false, false, false, 150, destinationAddress, protocolIdentifier, null, userData);
    // isoCharset
    SmsSignalInfo sm_RP_UI_0 = new SmsSignalInfoImpl(tpdu, null);
    ForwardShortMessageRequestImpl event0 = new ForwardShortMessageRequestImpl(sm_RP_DA, sm_RP_OA, sm_RP_UI_0, false);
    AsnOutputStream aos = new AsnOutputStream();
    event0.encodeAll(aos);
    ForwardShortMessageRequestImpl event = new ForwardShortMessageRequestImpl();
    AsnInputStream ais = new AsnInputStream(aos.toByteArray());
    ais.readTag();
    event.decodeAll(ais);
    long dueSlot = this.pers.c2_getDueSlotForTime(new Date());
    PreparedStatementCollection psc = this.pers.getStatementCollection(new Date());
    int b1 = this.pers.checkSmsExists(dueSlot, ta1.getTargetId());
    long b2 = this.pers.c2_getDueSlotForTargetId(psc, ta1.getTargetId());
    assertEquals(b1, 0);
    assertEquals(b2, 0L);
    MAPProviderProxy proxy = new MAPProviderProxy();
    MAPDialogSmsProxy dialog = new MAPDialogSmsProxy(new MAPServiceSmsProxy(proxy), null, null, null);
    event.setMAPDialog(dialog);
    Date curDate = new Date();
    MAPApplicationContext act = MAPApplicationContext.getInstance(MAPApplicationContextName.shortMsgMORelayContext, MAPApplicationContextVersion.version2);
    dialog.setApplicationContext(act);
    this.sbb.onForwardShortMessageRequest(event, null);
    b2 = this.pers.c2_getDueSlotForTargetId(psc, ta1.getTargetId());
    dueSlot = b2;
    b1 = this.pers.checkSmsExists(dueSlot, ta1.getTargetId());
    assertEquals(b1, 1);
    assertEquals(b2, dueSlot);
    assertEquals(dialog.getResponseCount(), 1);
    assertEquals(dialog.getErrorList().size(), 0);
    SmsSet smsSet = this.pers.c2_getRecordListForTargeId(dueSlot, ta1.getTargetId());
    assertEquals(smsSet.getDestAddr(), "5555");
    assertEquals(smsSet.getDestAddrTon(), SmppConstants.TON_INTERNATIONAL);
    assertEquals(smsSet.getDestAddrNpi(), SmppConstants.NPI_E164);
    assertEquals(smsSet.getInSystem(), 0);
    assertEquals(smsSet.getDueDelay(), 0);
    assertNull(smsSet.getStatus());
    assertFalse(smsSet.isAlertingSupported());
    Sms sms = smsSet.getSms(0);
    assertNotNull(sms);
    assertEquals(sms.getSourceAddr(), "4444");
    assertEquals(sms.getSourceAddrTon(), SmppConstants.TON_INTERNATIONAL);
    assertEquals(sms.getSourceAddrNpi(), SmppConstants.NPI_E164);
    assertEquals(sms.getMessageId(), DBOperations.MESSAGE_ID_LAG + 1);
    assertEquals(sms.getMoMessageRef(), 150);
    assertEquals(sms.getDataCoding(), 4);
    assertNull(sms.getOrigEsmeName());
    assertNull(sms.getOrigSystemId());
    assertNull(sms.getServiceType());
    assertEquals(sms.getEsmClass() & 0xFF, 67);
    assertEquals(sms.getRegisteredDelivery(), 0);
    assertEquals(sms.getProtocolId(), 12);
    assertEquals(sms.getPriority(), 0);
    assertEquals(sms.getReplaceIfPresent(), 0);
    assertEquals(sms.getDefaultMsgId(), 0);
    assertEquals(sms.getTlvSet().getOptionalParameterCount(), 0);
    assertNull(sms.getScheduleDeliveryTime());
    assertDateEq(sms.getValidityPeriod(), MessageUtil.addHours(curDate, 24 * 3));
    assertEquals(sms.getDeliveryCount(), 0);
    assertEquals(sms.getShortMessageText(), "abc 01234567890");
    assertEquals(sms.getShortMessageBin(), decodedUserDataHeader.getEncodedData());
}
Also used : DataCodingScheme(org.restcomm.protocols.ss7.map.api.smstpdu.DataCodingScheme) UserDataHeaderImpl(org.restcomm.protocols.ss7.map.smstpdu.UserDataHeaderImpl) AsnInputStream(org.mobicents.protocols.asn.AsnInputStream) MAPServiceSmsProxy(org.mobicents.smsc.slee.resources.persistence.MAPServiceSmsProxy) ISDNAddressString(org.restcomm.protocols.ss7.map.api.primitives.ISDNAddressString) AddressString(org.restcomm.protocols.ss7.map.api.primitives.AddressString) UserData(org.restcomm.protocols.ss7.map.api.smstpdu.UserData) SmsTpdu(org.restcomm.protocols.ss7.map.api.smstpdu.SmsTpdu) ISDNAddressString(org.restcomm.protocols.ss7.map.api.primitives.ISDNAddressString) SmsSignalInfoImpl(org.restcomm.protocols.ss7.map.service.sms.SmsSignalInfoImpl) DataCodingSchemeImpl(org.restcomm.protocols.ss7.map.smstpdu.DataCodingSchemeImpl) ProtocolIdentifierImpl(org.restcomm.protocols.ss7.map.smstpdu.ProtocolIdentifierImpl) SmsSignalInfo(org.restcomm.protocols.ss7.map.api.service.sms.SmsSignalInfo) UserDataHeaderElement(org.restcomm.protocols.ss7.map.api.smstpdu.UserDataHeaderElement) UserDataImpl(org.restcomm.protocols.ss7.map.smstpdu.UserDataImpl) MAPProviderProxy(org.mobicents.smsc.slee.resources.persistence.MAPProviderProxy) ProtocolIdentifier(org.restcomm.protocols.ss7.map.api.smstpdu.ProtocolIdentifier) UserDataHeader(org.restcomm.protocols.ss7.map.api.smstpdu.UserDataHeader) ISDNAddressStringImpl(org.restcomm.protocols.ss7.map.primitives.ISDNAddressStringImpl) AddressStringImpl(org.restcomm.protocols.ss7.map.primitives.AddressStringImpl) AddressField(org.restcomm.protocols.ss7.map.api.smstpdu.AddressField) ConcatenatedShortMessagesIdentifierImpl(org.restcomm.protocols.ss7.map.smstpdu.ConcatenatedShortMessagesIdentifierImpl) ForwardShortMessageRequestImpl(org.restcomm.protocols.ss7.map.service.sms.ForwardShortMessageRequestImpl) MoForwardShortMessageRequestImpl(org.restcomm.protocols.ss7.map.service.sms.MoForwardShortMessageRequestImpl) SM_RP_DAImpl(org.restcomm.protocols.ss7.map.service.sms.SM_RP_DAImpl) AddressFieldImpl(org.restcomm.protocols.ss7.map.smstpdu.AddressFieldImpl) SM_RP_OAImpl(org.restcomm.protocols.ss7.map.service.sms.SM_RP_OAImpl) Date(java.util.Date) PreparedStatementCollection(org.mobicents.smsc.cassandra.PreparedStatementCollection) MAPDialogSmsProxy(org.mobicents.smsc.slee.resources.persistence.MAPDialogSmsProxy) ISDNAddressStringImpl(org.restcomm.protocols.ss7.map.primitives.ISDNAddressStringImpl) AsnOutputStream(org.mobicents.protocols.asn.AsnOutputStream) Sms(org.mobicents.smsc.library.Sms) SM_RP_DA(org.restcomm.protocols.ss7.map.api.service.sms.SM_RP_DA) MAPApplicationContext(org.restcomm.protocols.ss7.map.api.MAPApplicationContext) SmsSet(org.mobicents.smsc.library.SmsSet) SmsSubmitTpduImpl(org.restcomm.protocols.ss7.map.smstpdu.SmsSubmitTpduImpl) Test(org.testng.annotations.Test)

Example 3 with MAPApplicationContext

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

the class HrSriClientSbb method sendSRI.

private void sendSRI(String destinationAddress, int ton, int npi, MAPApplicationContext mapApplicationContext, CorrelationIdValue correlationIdValue) {
    // Send out SRI
    MAPDialogSms mapDialogSms = null;
    try {
        // 1. Create Dialog first and add the SRI request to it
        mapDialogSms = this.setupRoutingInfoForSMRequestIndication(destinationAddress, ton, npi, mapApplicationContext, correlationIdValue.getNetworkId());
        // 2. Create the ACI and attach this SBB
        ActivityContextInterface sriDialogACI = this.mapAcif.getActivityContextInterface(mapDialogSms);
        sriDialogACI.attach(this.sbbContext.getSbbLocalObject());
        // 3. Finally send the request
        mapDialogSms.send();
    } catch (MAPException e) {
        if (mapDialogSms != null) {
            mapDialogSms.release();
        }
        String reason = "Home routing: HrSriClientSbb: MAPException when sending SRI from sendSRI(): " + e.toString();
        this.logger.severe(reason, e);
        this.returnSriFailure(correlationIdValue, null, reason);
    }
}
Also used : MAPDialogSms(org.restcomm.protocols.ss7.map.api.service.sms.MAPDialogSms) ActivityContextInterface(javax.slee.ActivityContextInterface) 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)

Example 4 with MAPApplicationContext

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

the class MtSbb method sendMtSms.

private void sendMtSms(MAPApplicationContext mapApplicationContext, MessageProcessingState messageProcessingState, MAPDialogSms mapDialogSms, int networkId) throws SmscProcessingException {
    SmsSet smsSet = getSmsSet();
    if (smsSet == null) {
        throw new SmscProcessingException("CMP smsSet is missed", -1, -1, SmscProcessingException.HTTP_ERROR_CODE_NOT_SET, null);
    }
    Sms sms = this.getMessageInSendingPool(0);
    if (sms == null) {
        throw new SmscProcessingException("sms is missed in CMP", -1, -1, SmscProcessingException.HTTP_ERROR_CODE_NOT_SET, null);
    }
    boolean moreMessagesToSend = false;
    try {
        if (this.getTotalUnsentMessageCount() > 1) {
            moreMessagesToSend = true;
        }
    } catch (Throwable e) {
    }
    try {
        boolean newDialog = false;
        if (mapDialogSms == null) {
            newDialog = true;
            String mtLocalSccpGt = sms.getMtLocalSccpGt();
            SccpAddress originSccpAddress;
            if (mtLocalSccpGt != null) {
                originSccpAddress = this.getServiceCenterSccpAddress(mtLocalSccpGt, networkId);
            } else {
                originSccpAddress = this.getServiceCenterSccpAddress(networkId);
            }
            mapDialogSms = this.mapProvider.getMAPServiceSms().createNewDialog(mapApplicationContext, originSccpAddress, null, this.getNetworkNode(), null);
            mapDialogSms.setNetworkId(networkId);
            ActivityContextInterface mtFOSmsDialogACI = this.mapAcif.getActivityContextInterface(mapDialogSms);
            mtFOSmsDialogACI.attach(this.sbbContext.getSbbLocalObject());
        }
        // setting TON / NPI to unknown for unsupported source TON / NPI
        int sourceAddrTon = sms.getSourceAddrTon();
        if (sourceAddrTon < 0 || sourceAddrTon > 6)
            sourceAddrTon = 0;
        int sourceAddrNpi = sms.getSourceAddrNpi();
        if (sourceAddrTon == SmppConstants.TON_ALPHANUMERIC) {
            sourceAddrNpi = SmppConstants.NPI_UNKNOWN;
        } else {
            if (sourceAddrNpi >= 0 && sourceAddrNpi <= 1 || sourceAddrNpi >= 3 && sourceAddrNpi <= 9 || sourceAddrNpi >= 10 && sourceAddrNpi <= 1 || sourceAddrNpi == 18) {
            } else {
                sourceAddrNpi = SmppConstants.NPI_UNKNOWN;
            }
        }
        SM_RP_DA sm_RP_DA = this.getSmRpDa();
        SM_RP_OA sm_RP_OA = this.getSmRpOa();
        SmsSignalInfo smsSignalInfo;
        if (messageProcessingState == MessageProcessingState.firstMessageSending) {
            int dcs = sms.getDataCoding();
            Tlv dest_addr_subunit = sms.getTlvSet().getOptionalParameter(SmppConstants.TAG_DEST_ADDR_SUBUNIT);
            if (dest_addr_subunit != null) {
                try {
                    int mclass = dest_addr_subunit.getValueAsByte();
                    if (mclass >= 1 && mclass <= 4) {
                        dcs |= (0x10 + (mclass - 1));
                    }
                } catch (TlvConvertException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
            DataCodingScheme dataCodingScheme = this.mapSmsTpduParameterFactory.createDataCodingScheme(dcs);
            Tlv sarMsgRefNum = sms.getTlvSet().getOptionalParameter(SmppConstants.TAG_SAR_MSG_REF_NUM);
            Tlv sarTotalSegments = sms.getTlvSet().getOptionalParameter(SmppConstants.TAG_SAR_TOTAL_SEGMENTS);
            Tlv sarSegmentSeqnum = sms.getTlvSet().getOptionalParameter(SmppConstants.TAG_SAR_SEGMENT_SEQNUM);
            SmsSignalInfo[] segments;
            SmsDeliveryReportData smsDeliveryReportData = SmsDeliveryReportData.decodeFromString(sms.getShortMessageText());
            if (smsDeliveryReportData != null) {
                // this is SMS-STATUS-REPORT
                segments = new SmsSignalInfo[1];
                segments[0] = this.createSignalInfoStatusReport(sms, moreMessagesToSend, smsDeliveryReportData);
            } else if ((sms.getEsmClass() & SmppConstants.ESM_CLASS_UDHI_MASK) != 0) {
                // message already contains UDH - we can not slice it
                segments = new SmsSignalInfo[1];
                segments[0] = this.createSignalInfo(sms, sms.getShortMessageText(), sms.getShortMessageBin(), moreMessagesToSend, 0, 1, 1, dataCodingScheme, 0, 0, sourceAddrTon, sourceAddrNpi);
            } else if (sarMsgRefNum != null && sarTotalSegments != null && sarSegmentSeqnum != null) {
                // we have tlv's that define message count/number/reference
                int messageSegmentCount = sarTotalSegments.getValueAsUnsignedByte();
                int messageSegmentNumber = sarSegmentSeqnum.getValueAsUnsignedByte();
                int messageReferenceNumber = sarMsgRefNum.getValueAsUnsignedShort();
                segments = new SmsSignalInfo[1];
                segments[0] = this.createSignalInfo(sms, sms.getShortMessageText(), null, moreMessagesToSend, messageReferenceNumber, messageSegmentCount, messageSegmentNumber, dataCodingScheme, sms.getNationalLanguageLockingShift(), sms.getNationalLanguageSingleShift(), sourceAddrTon, sourceAddrNpi);
            } else {
                // possible a big message and segmentation
                String[] segmentsByte;
                segmentsByte = MessageUtil.sliceMessage(sms.getShortMessageText(), dataCodingScheme, sms.getNationalLanguageLockingShift(), sms.getNationalLanguageSingleShift());
                segments = new SmsSignalInfo[segmentsByte.length];
                // TODO messageReferenceNumber should be generated
                // int messageReferenceNumber = (int) (this.getCurrentMsgNumValue() + 1);
                int messageReferenceNumber = (int) (this.getCurrentMsgNumValue());
                for (int i1 = 0; i1 < segmentsByte.length; i1++) {
                    segments[i1] = this.createSignalInfo(sms, segmentsByte[i1], null, (i1 < segmentsByte.length - 1 ? true : moreMessagesToSend), messageReferenceNumber, segmentsByte.length, i1 + 1, dataCodingScheme, sms.getNationalLanguageLockingShift(), sms.getNationalLanguageSingleShift(), sourceAddrTon, sourceAddrNpi);
                }
            }
            this.setSegments(segments);
            smsSignalInfo = segments[0];
            this.setMessageSegmentNumber(0);
            if (segments.length > 1)
                moreMessagesToSend = true;
        } else {
            int messageSegmentNumber = this.getMessageSegmentNumber();
            SmsSignalInfo[] segments = this.getSegments();
            smsSignalInfo = segments[messageSegmentNumber];
            if (messageSegmentNumber < segments.length - 1)
                moreMessagesToSend = true;
        }
        long invokeId = 0;
        switch(mapDialogSms.getApplicationContext().getApplicationContextVersion()) {
            case version3:
                invokeId = mapDialogSms.addMtForwardShortMessageRequest(sm_RP_DA, sm_RP_OA, smsSignalInfo, moreMessagesToSend, null);
                if (this.logger.isInfoEnabled()) {
                    this.logger.info("Sending: MtForwardShortMessageRequest: sm_RP_DA=" + sm_RP_DA + ", sm_RP_OA=" + sm_RP_OA + ", si=" + smsSignalInfo + ", moreMessagesToSend=" + moreMessagesToSend);
                }
                break;
            case version2:
            case version1:
                invokeId = mapDialogSms.addForwardShortMessageRequest(sm_RP_DA, sm_RP_OA, smsSignalInfo, moreMessagesToSend);
                if (this.logger.isInfoEnabled()) {
                    this.logger.info("Sending: ForwardShortMessageRequest: sm_RP_DA=" + sm_RP_DA + ", sm_RP_OA=" + sm_RP_OA + ", si=" + smsSignalInfo + ", moreMessagesToSend=" + moreMessagesToSend);
                }
                break;
            default:
                break;
        }
        int messageUserDataLengthOnSend = mapDialogSms.getMessageUserDataLengthOnSend();
        int maxUserDataLength = mapDialogSms.getMaxUserDataLength();
        if (mapDialogSms.getApplicationContext().getApplicationContextVersion() != MAPApplicationContextVersion.version1 && newDialog && messageUserDataLengthOnSend >= maxUserDataLength - SmscPropertiesManagement.getInstance().getMaxMessageLengthReducer()) {
            mapDialogSms.cancelInvocation(invokeId);
            this.setTcEmptySent(1);
        } else {
            this.setTcEmptySent(0);
        }
        mapDialogSms.send();
        sms.putMsgPartDeliveryTime(getMessageSegmentNumber(), System.currentTimeMillis());
    } catch (MAPException e) {
        if (mapDialogSms != null)
            mapDialogSms.release();
        throw new SmscProcessingException("MAPException when sending MtForwardSM. Sms=" + sms, -1, -1, SmscProcessingException.HTTP_ERROR_CODE_NOT_SET, null, e);
    } catch (TlvConvertException e) {
        if (mapDialogSms != null)
            mapDialogSms.release();
        throw new SmscProcessingException("TlvConvertException when sending MtForwardSM", -1, -1, SmscProcessingException.HTTP_ERROR_CODE_NOT_SET, null, e);
    }
}
Also used : SccpAddress(org.restcomm.protocols.ss7.sccp.parameter.SccpAddress) TlvConvertException(com.cloudhopper.smpp.tlv.TlvConvertException) ActivityContextInterface(javax.slee.ActivityContextInterface) MAPException(org.restcomm.protocols.ss7.map.api.MAPException) SmscProcessingException(org.mobicents.smsc.library.SmscProcessingException) 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) SmsDeliveryReportData(org.mobicents.smsc.library.SmsDeliveryReportData) SmsSignalInfo(org.restcomm.protocols.ss7.map.api.service.sms.SmsSignalInfo) MAPDialogSms(org.restcomm.protocols.ss7.map.api.service.sms.MAPDialogSms) MAPErrorMessageSubscriberBusyForMtSms(org.restcomm.protocols.ss7.map.api.errors.MAPErrorMessageSubscriberBusyForMtSms) Sms(org.mobicents.smsc.library.Sms) SmsSet(org.mobicents.smsc.library.SmsSet) SM_RP_DA(org.restcomm.protocols.ss7.map.api.service.sms.SM_RP_DA) Tlv(com.cloudhopper.smpp.tlv.Tlv)

Example 5 with MAPApplicationContext

use of org.restcomm.protocols.ss7.map.api.MAPApplicationContext 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)

Aggregations

MAPApplicationContext (org.restcomm.protocols.ss7.map.api.MAPApplicationContext)12 AddressString (org.restcomm.protocols.ss7.map.api.primitives.AddressString)12 ISDNAddressString (org.restcomm.protocols.ss7.map.api.primitives.ISDNAddressString)12 SmsSet (org.mobicents.smsc.library.SmsSet)8 MAPDialogSms (org.restcomm.protocols.ss7.map.api.service.sms.MAPDialogSms)8 Sms (org.mobicents.smsc.library.Sms)7 Date (java.util.Date)5 MAPDialogSmsProxy (org.mobicents.smsc.slee.resources.persistence.MAPDialogSmsProxy)5 MAPProviderProxy (org.mobicents.smsc.slee.resources.persistence.MAPProviderProxy)5 MAPServiceSmsProxy (org.mobicents.smsc.slee.resources.persistence.MAPServiceSmsProxy)5 SM_RP_DA (org.restcomm.protocols.ss7.map.api.service.sms.SM_RP_DA)5 SmsSignalInfo (org.restcomm.protocols.ss7.map.api.service.sms.SmsSignalInfo)5 AddressStringImpl (org.restcomm.protocols.ss7.map.primitives.AddressStringImpl)5 ISDNAddressStringImpl (org.restcomm.protocols.ss7.map.primitives.ISDNAddressStringImpl)5 SccpAddress (org.restcomm.protocols.ss7.sccp.parameter.SccpAddress)5 ActivityContextInterface (javax.slee.ActivityContextInterface)4 PreparedStatementCollection (org.mobicents.smsc.cassandra.PreparedStatementCollection)4 MAPException (org.restcomm.protocols.ss7.map.api.MAPException)4 AddressField (org.restcomm.protocols.ss7.map.api.smstpdu.AddressField)4 DataCodingScheme (org.restcomm.protocols.ss7.map.api.smstpdu.DataCodingScheme)4