Search in sources :

Example 1 with MAPDialog

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

the class HrSriServerSbb method onSriSuccess.

/**
 * HrSriResultInterface
 */
@Override
public void onSriSuccess(CorrelationIdValue correlationIdValue, boolean sriBypass) {
    MAPDialogSms dlg = this.getActivity();
    if (dlg == null) {
        this.logger.severe("Home routing: can not get MAPDialog for sending SRI positive Response");
        return;
    }
    if (!sriBypass) {
        smscStatAggregator.updateMsgInHrSriPosReq();
        StringBuilder sb = new StringBuilder();
        sb.append("Home routing: positive SRI response from HLR: transaction: ");
        sb.append(correlationIdValue);
        if (this.logger.isInfoEnabled())
            this.logger.info(sb.toString());
    }
    // storing correlationId into a cache
    try {
        SmsSetCache.getInstance().putCorrelationIdCacheElement(correlationIdValue, smscPropertiesManagement.getCorrelationIdLiveTime());
    } catch (Exception e1) {
        if (dlg != null) {
            dlg.release();
        }
        String reason = "Home routing: Exception when ImsiCacheElement : " + e1.toString();
        this.logger.severe(reason, e1);
        return;
    }
    // sending positive SRI response
    try {
        String smscAddressForCountryCode = this.getSmscAddressForCountryCode();
        ISDNAddressString networkNodeNumber;
        if (smscAddressForCountryCode != null) {
            networkNodeNumber = this.mapParameterFactory.createISDNAddressString(AddressNature.international_number, NumberingPlan.ISDN, smscAddressForCountryCode);
        } else {
            networkNodeNumber = getNetworkNodeNumber(correlationIdValue.getNetworkId());
        }
        LocationInfoWithLMSI li = this.mapParameterFactory.createLocationInfoWithLMSI(networkNodeNumber, null, null, false, null);
        this.doSendResponse(correlationIdValue, dlg, correlationIdValue.getCorrelationID(), li);
    } catch (MAPException e) {
        if (dlg != null) {
            dlg.release();
        }
        String reason = "Home routing: MAPException when sending SRI positive Response : " + e.toString();
        this.logger.severe(reason, e);
    }
}
Also used : LocationInfoWithLMSI(org.restcomm.protocols.ss7.map.api.service.sms.LocationInfoWithLMSI) MAPDialogSms(org.restcomm.protocols.ss7.map.api.service.sms.MAPDialogSms) MAPException(org.restcomm.protocols.ss7.map.api.MAPException) 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) MAPException(org.restcomm.protocols.ss7.map.api.MAPException)

Example 2 with MAPDialog

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

the class HrSriServerSbb method onSriFailure.

@Override
public void onSriFailure(CorrelationIdValue correlationIdValue, MAPErrorMessage errorResponse, String cause) {
    MAPDialogSms dlg = this.getActivity();
    if (dlg == null) {
        this.logger.severe("Home routing: can not get MAPDialog for sending SRI negative Response");
        return;
    }
    smscStatAggregator.updateMsgInHrSriNegReq();
    StringBuilder sb = new StringBuilder();
    sb.append("Home routing: negative SRI response from HLR: transaction: ");
    sb.append(correlationIdValue);
    sb.append(", cause=");
    sb.append(cause);
    if (this.logger.isInfoEnabled())
        this.logger.info(sb.toString());
    // sending negative SRI response
    try {
        // processing of error response
        if (errorResponse == null) {
            // no errorResponse obtained - we need to create SysteFailure
            errorResponse = this.mapErrorMessageFactory.createMAPErrorMessageSystemFailure(dlg.getApplicationContext().getApplicationContextVersion().getVersion(), NetworkResource.hlr, null, null);
        } else {
        // we have errorResponse from HLR
        // TODO: we need to update values depending on MAP protocol version
        // not all versions support all messages
        }
        long invokeId = this.getInvokeId();
        dlg.sendErrorComponent(invokeId, errorResponse);
        dlg.close(false);
    } catch (MAPException e) {
        if (dlg != null) {
            dlg.release();
        }
        String reason = "Home routing: MAPException when sending SRI negative Response: " + e.toString();
        this.logger.severe(reason, e);
    }
}
Also used : MAPDialogSms(org.restcomm.protocols.ss7.map.api.service.sms.MAPDialogSms) 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 3 with MAPDialog

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

the class MoSbb method onDialogDelimiter.

public void onDialogDelimiter(DialogDelimiter evt, ActivityContextInterface aci) {
    super.onDialogDelimiter(evt, aci);
    if (this.getProcessingState() == MoProcessingState.OnlyRequestRecieved) {
        this.setProcessingState(null);
        if (this.logger.isFineEnabled())
            this.logger.fine("MoSBB: onDialogDelimiter - sending empty TC-CONTINUE for " + evt);
        evt.getMAPDialog();
        MAPDialog dialog = evt.getMAPDialog();
        try {
            dialog.send();
        } catch (MAPException e) {
            logger.severe("Error while sending Continue", e);
        }
    }
}
Also used : MAPException(org.restcomm.protocols.ss7.map.api.MAPException) MAPDialog(org.restcomm.protocols.ss7.map.api.MAPDialog)

Example 4 with MAPDialog

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

the class HrSriServerSbb method onSriHrByPass.

@Override
public void onSriHrByPass(CorrelationIdValue correlationIdValue) {
    MAPDialogSms dlg = this.getActivity();
    if (dlg == null) {
        this.logger.severe("Home routing: can not get MAPDialog for sending SRI hrByPass Response");
        return;
    }
    smscStatAggregator.updateMsgInHrSriHrByPass();
    StringBuilder sb = new StringBuilder();
    sb.append("Home routing: bypassing of Home routing: procedure: transaction: ");
    sb.append(correlationIdValue);
    if (this.logger.isInfoEnabled())
        this.logger.info(sb.toString());
    // sending original SRI response
    try {
        SendRoutingInfoForSMResponse sendRoutingInfoForSMResponse = correlationIdValue.getSendRoutingInfoForSMResponse();
        this.doSendResponse(correlationIdValue, dlg, sendRoutingInfoForSMResponse.getIMSI().getData(), sendRoutingInfoForSMResponse.getLocationInfoWithLMSI());
    } catch (MAPException e) {
        if (dlg != null) {
            dlg.release();
        }
        String reason = "Home routing: MAPException when sending SRI bypassing of Home routing: " + e.toString();
        this.logger.severe(reason, e);
    }
}
Also used : MAPDialogSms(org.restcomm.protocols.ss7.map.api.service.sms.MAPDialogSms) 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) SendRoutingInfoForSMResponse(org.restcomm.protocols.ss7.map.api.service.sms.SendRoutingInfoForSMResponse)

Aggregations

MAPException (org.restcomm.protocols.ss7.map.api.MAPException)4 AddressString (org.restcomm.protocols.ss7.map.api.primitives.AddressString)3 ISDNAddressString (org.restcomm.protocols.ss7.map.api.primitives.ISDNAddressString)3 MAPDialogSms (org.restcomm.protocols.ss7.map.api.service.sms.MAPDialogSms)3 MAPDialog (org.restcomm.protocols.ss7.map.api.MAPDialog)1 LocationInfoWithLMSI (org.restcomm.protocols.ss7.map.api.service.sms.LocationInfoWithLMSI)1 SendRoutingInfoForSMResponse (org.restcomm.protocols.ss7.map.api.service.sms.SendRoutingInfoForSMResponse)1