Search in sources :

Example 16 with MAPDialogSms

use of org.mobicents.protocols.ss7.map.api.service.sms.MAPDialogSms in project smscgateway by RestComm.

the class HrSriServerSbb method onSendRoutingInfoForSMRequest.

/**
 * MAP SMS Events
 */
/**
 * Received SRI request. But this is error, we should never receive this
 * request
 *
 * @param evt
 * @param aci
 */
public void onSendRoutingInfoForSMRequest(SendRoutingInfoForSMRequest evt, ActivityContextInterface aci) {
    if (this.logger.isInfoEnabled()) {
        this.logger.info("\nHome routing: HrSriServerSbb: Received SEND_ROUTING_INFO_FOR_SM_REQUEST = " + evt + " Dialog=" + evt.getMAPDialog());
    }
    this.setInvokeId(evt.getInvokeId());
    MAPDialogSms dialog = evt.getMAPDialog();
    // we are changing here SSN in CallingPartyAddress of a SRI response to HLR SSN
    // because it is possible that this address has been updated inside SCCP routing procedure
    // when a message came to SMSC
    // TODO: check if it is a proper solution ?
    SccpAddress locAddr = dialog.getLocalAddress();
    SccpAddress locAddr2 = sccpParameterFact.createSccpAddress(locAddr.getAddressIndicator().getRoutingIndicator(), locAddr.getGlobalTitle(), locAddr.getSignalingPointCode(), smscPropertiesManagement.getHlrSsn());
    dialog.setLocalAddress(locAddr2);
    if (smscPropertiesManagement.getHrCharging() == MoChargingType.reject) {
        try {
            MAPErrorMessage errorMessage = this.mapProvider.getMAPErrorMessageFactory().createMAPErrorMessageFacilityNotSup(null, null, null);
            dialog.sendErrorComponent(evt.getInvokeId(), errorMessage);
            if (this.logger.isInfoEnabled()) {
                this.logger.info("\nHome routing: Sent ErrorComponent = " + errorMessage);
            }
            if (smscPropertiesManagement.isGenerateRejectionCdr()) {
                generateCDR(dialog.getNetworkId(), CdrGenerator.CDR_SUBMIT_FAILED_HR, errorMessage.toString(), true);
            }
            dialog.close(false);
            return;
        } catch (Throwable e) {
            logger.severe("Home routing: Error while sending Error message", e);
            return;
        }
    }
    setupSriRequest(evt.getMsisdn(), evt.getServiceCentreAddress(), dialog.getNetworkId(), dialog.getRemoteAddress());
}
Also used : SccpAddress(org.mobicents.protocols.ss7.sccp.parameter.SccpAddress) MAPDialogSms(org.mobicents.protocols.ss7.map.api.service.sms.MAPDialogSms) MAPErrorMessage(org.mobicents.protocols.ss7.map.api.errors.MAPErrorMessage)

Example 17 with MAPDialogSms

use of org.mobicents.protocols.ss7.map.api.service.sms.MAPDialogSms in project smscgateway by RestComm.

the class HrSriClientSbb method setupRoutingInfoForSMRequestIndication.

private MAPDialogSms setupRoutingInfoForSMRequestIndication(String destinationAddress, int ton, int npi, MAPApplicationContext mapApplicationContext, int networkId) throws MAPException {
    // this.mapParameterFactory.creat
    String hlrAddress = destinationAddress;
    String hrHlrNumber = smscPropertiesManagement.getHrHlrNumber(networkId);
    if (hrHlrNumber != null && hrHlrNumber.length() > 0) {
        hlrAddress = hrHlrNumber;
    }
    SccpAddress destinationAddr = this.convertAddressFieldToSCCPAddress(hlrAddress, ton, npi);
    MAPDialogSms mapDialogSms = this.mapProvider.getMAPServiceSms().createNewDialog(mapApplicationContext, this.getServiceCenterSccpAddress(networkId), null, destinationAddr, null);
    mapDialogSms.setNetworkId(networkId);
    ISDNAddressString isdn = this.getCalledPartyISDNAddressString(destinationAddress, ton, npi);
    AddressString serviceCenterAddress = this.getServiceCenterAddressString(networkId);
    boolean sm_RP_PRI = true;
    mapDialogSms.addSendRoutingInfoForSMRequest(isdn, sm_RP_PRI, serviceCenterAddress, null, false, null, null, null);
    if (this.logger.isInfoEnabled())
        this.logger.info("\nHome routing: HrSriClientSbb: Sending: SendRoutingInfoForSMRequest: isdn=" + isdn + ", serviceCenterAddress=" + serviceCenterAddress + ", sm_RP_PRI=" + sm_RP_PRI);
    return mapDialogSms;
}
Also used : SccpAddress(org.mobicents.protocols.ss7.sccp.parameter.SccpAddress) ISDNAddressString(org.mobicents.protocols.ss7.map.api.primitives.ISDNAddressString) AddressString(org.mobicents.protocols.ss7.map.api.primitives.AddressString) MAPDialogSms(org.mobicents.protocols.ss7.map.api.service.sms.MAPDialogSms) ISDNAddressString(org.mobicents.protocols.ss7.map.api.primitives.ISDNAddressString) ISDNAddressString(org.mobicents.protocols.ss7.map.api.primitives.ISDNAddressString) AddressString(org.mobicents.protocols.ss7.map.api.primitives.AddressString)

Example 18 with MAPDialogSms

use of org.mobicents.protocols.ss7.map.api.service.sms.MAPDialogSms 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("\nSending: 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("\nSending: 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.mobicents.protocols.ss7.map.api.service.sms.SmsSignalInfo) MAPDialogSms(org.mobicents.protocols.ss7.map.api.service.sms.MAPDialogSms) MAPException(org.mobicents.protocols.ss7.map.api.MAPException) SM_RP_OA(org.mobicents.protocols.ss7.map.api.service.sms.SM_RP_OA) ISDNAddressString(org.mobicents.protocols.ss7.map.api.primitives.ISDNAddressString) AddressString(org.mobicents.protocols.ss7.map.api.primitives.AddressString) SmsSet(org.mobicents.smsc.library.SmsSet) SM_RP_DA(org.mobicents.protocols.ss7.map.api.service.sms.SM_RP_DA)

Example 19 with MAPDialogSms

use of org.mobicents.protocols.ss7.map.api.service.sms.MAPDialogSms in project smscgateway by RestComm.

the class RsdsSbb method setupReportSMDeliveryStatusRequest.

// *********
// Main service methods
public void setupReportSMDeliveryStatusRequest(ISDNAddressString msisdn, AddressString serviceCentreAddress, SMDeliveryOutcome smDeliveryOutcome, SccpAddress destAddress, MAPApplicationContext mapApplicationContext, String targetId, int networkId, String mtLocalSccpGt) {
    if (this.logger.isInfoEnabled()) {
        this.logger.info("\nReceived setupReportSMDeliveryStatus request msisdn= " + msisdn + ", serviceCentreAddress=" + serviceCentreAddress + ", sMDeliveryOutcome=" + smDeliveryOutcome + ", mapApplicationContext=" + mapApplicationContext);
    }
    this.setTargetId(targetId);
    this.setSmDeliveryOutcome(smDeliveryOutcome);
    MAPDialogSms mapDialogSms;
    try {
        SccpAddress originSccpAddress;
        if (mtLocalSccpGt != null) {
            originSccpAddress = this.getServiceCenterSccpAddress(mtLocalSccpGt, networkId);
        } else {
            originSccpAddress = this.getServiceCenterSccpAddress(networkId);
        }
        mapDialogSms = this.mapProvider.getMAPServiceSms().createNewDialog(mapApplicationContext, originSccpAddress, null, destAddress, null);
        mapDialogSms.setNetworkId(networkId);
        ActivityContextInterface mtFOSmsDialogACI = this.mapAcif.getActivityContextInterface(mapDialogSms);
        mtFOSmsDialogACI.attach(this.sbbContext.getSbbLocalObject());
        mapDialogSms.addReportSMDeliveryStatusRequest(msisdn, serviceCentreAddress, smDeliveryOutcome, null, null, false, false, null, null);
        if (this.logger.isInfoEnabled())
            this.logger.info("\nSending: ReportSMDeliveryStatusRequest: msisdn=" + msisdn + ", serviceCenterAddress=" + serviceCentreAddress + ", smDeliveryOutcome=" + smDeliveryOutcome);
        mapDialogSms.send();
    } catch (MAPException e) {
        this.logger.severe("MAPException when sending reportSMDeliveryStatusRequest: " + e.getMessage(), e);
    }
}
Also used : SccpAddress(org.mobicents.protocols.ss7.sccp.parameter.SccpAddress) MAPDialogSms(org.mobicents.protocols.ss7.map.api.service.sms.MAPDialogSms) ActivityContextInterface(javax.slee.ActivityContextInterface) MAPException(org.mobicents.protocols.ss7.map.api.MAPException)

Example 20 with MAPDialogSms

use of org.mobicents.protocols.ss7.map.api.service.sms.MAPDialogSms 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.mobicents.protocols.ss7.map.api.MAPException) SmsTpdu(org.mobicents.protocols.ss7.map.api.smstpdu.SmsTpdu) MAPDialogSms(org.mobicents.protocols.ss7.map.api.service.sms.MAPDialogSms) ISDNAddressString(org.mobicents.protocols.ss7.map.api.primitives.ISDNAddressString) ISDNAddressString(org.mobicents.protocols.ss7.map.api.primitives.ISDNAddressString) AddressString(org.mobicents.protocols.ss7.map.api.primitives.AddressString) SmsSubmitTpdu(org.mobicents.protocols.ss7.map.api.smstpdu.SmsSubmitTpdu) SmsDeliverReportTpdu(org.mobicents.protocols.ss7.map.api.smstpdu.SmsDeliverReportTpdu) SmsCommandTpdu(org.mobicents.protocols.ss7.map.api.smstpdu.SmsCommandTpdu)

Aggregations

MAPDialogSms (org.mobicents.protocols.ss7.map.api.service.sms.MAPDialogSms)25 MAPException (org.mobicents.protocols.ss7.map.api.MAPException)17 ISDNAddressString (org.mobicents.protocols.ss7.map.api.primitives.ISDNAddressString)16 AddressString (org.mobicents.protocols.ss7.map.api.primitives.AddressString)14 SccpAddress (org.mobicents.protocols.ss7.sccp.parameter.SccpAddress)8 MAPErrorMessage (org.mobicents.protocols.ss7.map.api.errors.MAPErrorMessage)6 ActivityContextInterface (javax.slee.ActivityContextInterface)4 SmsSignalInfo (org.mobicents.protocols.ss7.map.api.service.sms.SmsSignalInfo)4 IMSI (org.mobicents.protocols.ss7.map.api.primitives.IMSI)3 SM_RP_DA (org.mobicents.protocols.ss7.map.api.service.sms.SM_RP_DA)3 SmsTpdu (org.mobicents.protocols.ss7.map.api.smstpdu.SmsTpdu)3 GlobalTitle (org.mobicents.protocols.ss7.sccp.parameter.GlobalTitle)3 Sms (org.mobicents.smsc.library.Sms)3 SmsSet (org.mobicents.smsc.library.SmsSet)3 MAPApplicationContext (org.mobicents.protocols.ss7.map.api.MAPApplicationContext)2 MAPErrorMessageSubscriberBusyForMtSms (org.mobicents.protocols.ss7.map.api.errors.MAPErrorMessageSubscriberBusyForMtSms)2 LocationInfoWithLMSI (org.mobicents.protocols.ss7.map.api.service.sms.LocationInfoWithLMSI)2 SM_RP_OA (org.mobicents.protocols.ss7.map.api.service.sms.SM_RP_OA)2 SmsSubmitTpdu (org.mobicents.protocols.ss7.map.api.smstpdu.SmsSubmitTpdu)2 SmscProcessingException (org.mobicents.smsc.library.SmscProcessingException)2