Search in sources :

Example 6 with SccpAddress

use of org.mobicents.protocols.ss7.sccp.parameter.SccpAddress in project smscgateway by RestComm.

the class MoSbb method onMoForwardShortMessageRequest.

// *********
// SMS Event Handlers
/**
 * Received incoming SMS for ACN v3. Send back ack
 *
 * @param evt
 * @param aci
 */
public void onMoForwardShortMessageRequest(MoForwardShortMessageRequest evt, ActivityContextInterface aci) {
    if (this.logger.isFineEnabled()) {
        this.logger.fine("Received MO_FORWARD_SHORT_MESSAGE_REQUEST = " + evt);
    }
    this.setProcessingState(MoProcessingState.OtherDataRecieved);
    MAPDialogSms dialog = evt.getMAPDialog();
    if (smscPropertiesManagement.getMoCharging() == MoChargingType.reject) {
        try {
            MAPErrorMessage errorMessage = this.mapProvider.getMAPErrorMessageFactory().createMAPErrorMessageFacilityNotSup(null, null, null);
            dialog.sendErrorComponent(evt.getInvokeId(), errorMessage);
            if (this.logger.isInfoEnabled()) {
                this.logger.info("Sent ErrorComponent = " + errorMessage);
            }
            if (smscPropertiesManagement.isGenerateRejectionCdr()) {
                String imsiData = null;
                if (evt.getIMSI() != null) {
                    imsiData = evt.getIMSI().getData();
                }
                generateCDR(dialog.getNetworkId(), imsiData, dialog.getLocalAddress(), CdrGenerator.CDR_SUBMIT_FAILED_MO, errorMessage.toString(), true);
            }
            dialog.close(false);
            return;
        } catch (Throwable e) {
            logger.severe("Error while sending Error message", e);
            return;
        }
    }
    Sms sms = null;
    try {
        String originatorSccpAddress = null;
        SccpAddress sccpAddress = dialog.getRemoteAddress();
        if (sccpAddress != null) {
            GlobalTitle gt = sccpAddress.getGlobalTitle();
            if (gt != null)
                originatorSccpAddress = gt.getDigits();
        }
        sms = this.processMoMessage(evt.getSM_RP_OA(), evt.getSM_RP_DA(), evt.getSM_RP_UI(), dialog.getNetworkId(), originatorSccpAddress, true, evt.getMAPDialog(), evt, evt.getInvokeId());
        if (sms != null) {
            this.processSms(sms, persistence, smscPropertiesManagement.getMoCharging(), true, dialog, evt, evt.getInvokeId());
        }
    } catch (SmscProcessingException e1) {
        if (!e1.isSkipErrorLogging()) {
            if (e1.isIsWarning()) {
                this.logger.warning(e1.getMessage());
            } else {
                this.logger.severe(e1.getMessage(), e1);
            }
            smscStatAggregator.updateMsgInFailedAll();
        }
        try {
            MAPErrorMessage errorMessage;
            switch(e1.getMapErrorCode()) {
                case MAPErrorCode.unexpectedDataValue:
                    errorMessage = this.mapProvider.getMAPErrorMessageFactory().createMAPErrorMessageExtensionContainer((long) MAPErrorCode.unexpectedDataValue, null);
                    break;
                case MAPErrorCode.systemFailure:
                    errorMessage = this.mapProvider.getMAPErrorMessageFactory().createMAPErrorMessageSystemFailure(dialog.getApplicationContext().getApplicationContextVersion().getVersion(), null, null, null);
                    break;
                case MAPErrorCode.resourceLimitation:
                    errorMessage = this.mapProvider.getMAPErrorMessageFactory().createMAPErrorMessageExtensionContainer((long) MAPErrorCode.resourceLimitation, null);
                    break;
                case MAPErrorCode.facilityNotSupported:
                    errorMessage = this.mapProvider.getMAPErrorMessageFactory().createMAPErrorMessageFacilityNotSup(null, null, null);
                    break;
                default:
                    errorMessage = this.mapProvider.getMAPErrorMessageFactory().createMAPErrorMessageSystemFailure(dialog.getApplicationContext().getApplicationContextVersion().getVersion(), null, null, null);
                    break;
            }
            dialog.sendErrorComponent(evt.getInvokeId(), errorMessage);
            if (this.logger.isInfoEnabled()) {
                this.logger.info("Sent ErrorComponent = " + errorMessage);
            }
            if (smscPropertiesManagement.isGenerateRejectionCdr() && !e1.isMessageRejectCdrCreated()) {
                if (sms != null) {
                    generateCDR(sms, CdrGenerator.CDR_SUBMIT_FAILED_MO, e1.getMessage(), false, true);
                } else {
                    generateCDR(dialog.getNetworkId(), evt.getIMSI().getData(), dialog.getLocalAddress(), CdrGenerator.CDR_SUBMIT_FAILED_MO, errorMessage.toString(), true);
                }
            }
            dialog.close(false);
        } catch (Throwable e) {
            logger.severe("Error while sending Error message", e);
            return;
        }
        return;
    } catch (Throwable e1) {
        this.logger.severe("Exception while processing MO message: " + e1.getMessage(), e1);
        smscStatAggregator.updateMsgInFailedAll();
        try {
            MAPErrorMessage errorMessage = this.mapProvider.getMAPErrorMessageFactory().createMAPErrorMessageSystemFailure(dialog.getApplicationContext().getApplicationContextVersion().getVersion(), null, null, null);
            dialog.sendErrorComponent(evt.getInvokeId(), errorMessage);
            if (smscPropertiesManagement.isGenerateRejectionCdr()) {
                generateCDR(dialog.getNetworkId(), evt.getIMSI().getData(), dialog.getLocalAddress(), CdrGenerator.CDR_SUBMIT_FAILED_MO, errorMessage.toString(), true);
            }
            dialog.close(false);
        } catch (Throwable e) {
            logger.severe("Error while sending Error message", e);
            return;
        }
        return;
    }
    if (sms == null || sms.getMessageDeliveryResultResponse() == null) {
        try {
            dialog.addMoForwardShortMessageResponse(evt.getInvokeId(), null, null);
            if (this.logger.isFineEnabled()) {
                this.logger.fine("Sent MoForwardShortMessageResponse = " + evt);
            }
            dialog.close(false);
        } catch (Throwable e) {
            logger.severe("Error while sending MoForwardShortMessageResponse ", e);
        }
    }
}
Also used : SccpAddress(org.restcomm.protocols.ss7.sccp.parameter.SccpAddress) GlobalTitle(org.restcomm.protocols.ss7.sccp.parameter.GlobalTitle) MAPDialogSms(org.restcomm.protocols.ss7.map.api.service.sms.MAPDialogSms) 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) MAPErrorMessage(org.restcomm.protocols.ss7.map.api.errors.MAPErrorMessage)

Example 7 with SccpAddress

use of org.mobicents.protocols.ss7.sccp.parameter.SccpAddress 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("Received 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("Sending: 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.restcomm.protocols.ss7.sccp.parameter.SccpAddress) MAPDialogSms(org.restcomm.protocols.ss7.map.api.service.sms.MAPDialogSms) ActivityContextInterface(javax.slee.ActivityContextInterface) MAPException(org.restcomm.protocols.ss7.map.api.MAPException)

Example 8 with SccpAddress

use of org.mobicents.protocols.ss7.sccp.parameter.SccpAddress in project smscgateway by RestComm.

the class MtCommonSbb method setupReportSMDeliveryStatusRequest.

protected void setupReportSMDeliveryStatusRequest(String destinationAddress, int ton, int npi, SMDeliveryOutcome sMDeliveryOutcome, String targetId, int networkId, String mtLocalSccpGt, Integer mtRemoteSccpTt) {
    RsdsSbbLocalObject rsdsSbbLocalObject = this.getRsdsSbbObject();
    if (rsdsSbbLocalObject != null) {
        ActivityContextInterface schedulerActivityContextInterface = this.getSchedulerActivityContextInterface();
        schedulerActivityContextInterface.attach(rsdsSbbLocalObject);
        SendRsdsEvent event = new SendRsdsEvent();
        event.setMsisdn(this.getCalledPartyISDNAddressString(destinationAddress, ton, npi));
        event.setServiceCentreAddress(getServiceCenterAddressString(networkId));
        event.setSMDeliveryOutcome(sMDeliveryOutcome);
        SccpAddress destinationAddr = this.convertAddressFieldToSCCPAddress(destinationAddress, ton, npi, mtRemoteSccpTt);
        event.setDestAddress(destinationAddr);
        event.setMapApplicationContext(this.getSRIMAPApplicationContext(MAPApplicationContextVersion.getInstance(this.getSriMapVersion())));
        event.setTargetId(targetId);
        event.setNetworkId(networkId);
        event.setMtLocalSccpGt(mtLocalSccpGt);
        this.fireSendRsdsEvent(event, schedulerActivityContextInterface, null);
    }
}
Also used : SccpAddress(org.restcomm.protocols.ss7.sccp.parameter.SccpAddress) ActivityContextInterface(javax.slee.ActivityContextInterface) SendRsdsEvent(org.mobicents.smsc.slee.services.smpp.server.events.SendRsdsEvent)

Example 9 with SccpAddress

use of org.mobicents.protocols.ss7.sccp.parameter.SccpAddress 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, false, null, false, false, null, null);
    if (this.logger.isInfoEnabled())
        this.logger.info("Home routing: HrSriClientSbb: Sending: SendRoutingInfoForSMRequest: isdn=" + isdn + ", serviceCenterAddress=" + serviceCenterAddress + ", sm_RP_PRI=" + sm_RP_PRI);
    return mapDialogSms;
}
Also used : SccpAddress(org.restcomm.protocols.ss7.sccp.parameter.SccpAddress) ISDNAddressString(org.restcomm.protocols.ss7.map.api.primitives.ISDNAddressString) AddressString(org.restcomm.protocols.ss7.map.api.primitives.AddressString) MAPDialogSms(org.restcomm.protocols.ss7.map.api.service.sms.MAPDialogSms) ISDNAddressString(org.restcomm.protocols.ss7.map.api.primitives.ISDNAddressString) ISDNAddressString(org.restcomm.protocols.ss7.map.api.primitives.ISDNAddressString) AddressString(org.restcomm.protocols.ss7.map.api.primitives.AddressString)

Example 10 with SccpAddress

use of org.mobicents.protocols.ss7.sccp.parameter.SccpAddress 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("Home 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("Home 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.restcomm.protocols.ss7.sccp.parameter.SccpAddress) MAPDialogSms(org.restcomm.protocols.ss7.map.api.service.sms.MAPDialogSms) MAPErrorMessage(org.restcomm.protocols.ss7.map.api.errors.MAPErrorMessage)

Aggregations

SccpAddress (org.restcomm.protocols.ss7.sccp.parameter.SccpAddress)10 MAPDialogSms (org.restcomm.protocols.ss7.map.api.service.sms.MAPDialogSms)9 AddressString (org.restcomm.protocols.ss7.map.api.primitives.AddressString)7 ISDNAddressString (org.restcomm.protocols.ss7.map.api.primitives.ISDNAddressString)7 MAPErrorMessage (org.restcomm.protocols.ss7.map.api.errors.MAPErrorMessage)4 ActivityContextInterface (javax.slee.ActivityContextInterface)3 GlobalTitle (org.restcomm.protocols.ss7.sccp.parameter.GlobalTitle)3 Sms (org.mobicents.smsc.library.Sms)2 SmsSet (org.mobicents.smsc.library.SmsSet)2 SmscProcessingException (org.mobicents.smsc.library.SmscProcessingException)2 MAPException (org.restcomm.protocols.ss7.map.api.MAPException)2 MAPErrorMessageSubscriberBusyForMtSms (org.restcomm.protocols.ss7.map.api.errors.MAPErrorMessageSubscriberBusyForMtSms)2 SM_RP_DA (org.restcomm.protocols.ss7.map.api.service.sms.SM_RP_DA)2 SM_RP_OA (org.restcomm.protocols.ss7.map.api.service.sms.SM_RP_OA)2 Tlv (com.cloudhopper.smpp.tlv.Tlv)1 TlvConvertException (com.cloudhopper.smpp.tlv.TlvConvertException)1 ArrayList (java.util.ArrayList)1 MoChargingType (org.mobicents.smsc.domain.MoChargingType)1 ErrorCode (org.mobicents.smsc.library.ErrorCode)1 SmsDeliveryReportData (org.mobicents.smsc.library.SmsDeliveryReportData)1