Search in sources :

Example 6 with ForwardShortMessageRequest

use of org.restcomm.protocols.ss7.map.api.service.sms.ForwardShortMessageRequest 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 7 with ForwardShortMessageRequest

use of org.restcomm.protocols.ss7.map.api.service.sms.ForwardShortMessageRequest in project smscgateway by RestComm.

the class MAPListener method onForwardShortMessageRequest.

@Override
public void onForwardShortMessageRequest(ForwardShortMessageRequest event) {
    if (logger.isInfoEnabled()) {
        logger.info("Rx : onForwardShortMessageRequest=" + event);
    }
    // Lets first close the Dialog
    MAPDialogSms mapDialogSms = event.getMAPDialog();
    try {
        if (this.currentMapMessageCount % 7 == 0) {
            // Send back AbsentSubscriber for every 7th MtSMS
            MAPErrorMessage mapErrorMessage = mAPErrorMessageFactory.createMAPErrorMessageAbsentSubscriberSM(AbsentSubscriberDiagnosticSM.IMSIDetached, null, null);
            mapDialogSms.sendErrorComponent(event.getInvokeId(), mapErrorMessage);
        // mapDialogSms.close(false);
        } else {
            mapDialogSms.addForwardShortMessageResponse(event.getInvokeId());
        // mapDialogSms.close(false);
        }
    } catch (MAPException e) {
        logger.error("Error while sending MAPErrorMessageAbsentSubscriberSM ", e);
    }
    mapDialogSms.setUserObject(true);
}
Also used : MAPDialogSms(org.restcomm.protocols.ss7.map.api.service.sms.MAPDialogSms) MAPException(org.restcomm.protocols.ss7.map.api.MAPException) MAPErrorMessage(org.restcomm.protocols.ss7.map.api.errors.MAPErrorMessage)

Aggregations

AddressString (org.restcomm.protocols.ss7.map.api.primitives.AddressString)6 ISDNAddressString (org.restcomm.protocols.ss7.map.api.primitives.ISDNAddressString)6 SmsSet (org.mobicents.smsc.library.SmsSet)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 Sms (org.mobicents.smsc.library.Sms)4 MAPApplicationContext (org.restcomm.protocols.ss7.map.api.MAPApplicationContext)4 MAPDialogSms (org.restcomm.protocols.ss7.map.api.service.sms.MAPDialogSms)4 Date (java.util.Date)3 PreparedStatementCollection (org.mobicents.smsc.cassandra.PreparedStatementCollection)3 MAPDialogSmsProxy (org.mobicents.smsc.slee.resources.persistence.MAPDialogSmsProxy)3 MAPProviderProxy (org.mobicents.smsc.slee.resources.persistence.MAPProviderProxy)3 MAPServiceSmsProxy (org.mobicents.smsc.slee.resources.persistence.MAPServiceSmsProxy)3 MAPException (org.restcomm.protocols.ss7.map.api.MAPException)3 ForwardShortMessageRequest (org.restcomm.protocols.ss7.map.api.service.sms.ForwardShortMessageRequest)3 MoForwardShortMessageRequest (org.restcomm.protocols.ss7.map.api.service.sms.MoForwardShortMessageRequest)3 AddressField (org.restcomm.protocols.ss7.map.api.smstpdu.AddressField)3 DataCodingScheme (org.restcomm.protocols.ss7.map.api.smstpdu.DataCodingScheme)3 ProtocolIdentifier (org.restcomm.protocols.ss7.map.api.smstpdu.ProtocolIdentifier)3 SmsTpdu (org.restcomm.protocols.ss7.map.api.smstpdu.SmsTpdu)3