use of org.restcomm.protocols.ss7.map.api.errors.MAPErrorMessage 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);
}
}
use of org.restcomm.protocols.ss7.map.api.errors.MAPErrorMessage in project smscgateway by RestComm.
the class MtSbb method onErrorComponent.
// *********
// MAP Component events
@Override
public void onErrorComponent(ErrorComponent event, ActivityContextInterface aci) {
try {
super.onErrorComponent(event, aci);
SmsSet smsSet = getSmsSet();
if (smsSet == null) {
logger.severe("MtSbb.onErrorComponent(): CMP smsSet is missed");
return;
}
MAPErrorMessage mapErrorMessage = event.getMAPErrorMessage();
if (mapErrorMessage.isEmSubscriberBusyForMtSms()) {
MAPErrorMessageSubscriberBusyForMtSms subscriberBusyForMtSms = mapErrorMessage.getEmSubscriberBusyForMtSms();
this.onDeliveryError(smsSet, ErrorAction.subscriberBusy, ErrorCode.USER_BUSY, "Error subscriberBusyForMtSms after MtForwardSM Request: " + subscriberBusyForMtSms.toString(), true, mapErrorMessage, false, ProcessingType.SS7_MT);
} else if (mapErrorMessage.isEmAbsentSubscriber()) {
MAPErrorMessageAbsentSubscriber absentSubscriber = mapErrorMessage.getEmAbsentSubscriber();
this.onDeliveryError(smsSet, ErrorAction.mobileNotReachableFlag, ErrorCode.ABSENT_SUBSCRIBER, "Error absentSubscriber after MtForwardSM Request: " + absentSubscriber.toString(), true, mapErrorMessage, false, ProcessingType.SS7_MT);
} else if (mapErrorMessage.isEmAbsentSubscriberSM()) {
MAPErrorMessageAbsentSubscriberSM absentSubscriber = mapErrorMessage.getEmAbsentSubscriberSM();
this.onDeliveryError(smsSet, ErrorAction.mobileNotReachableFlag, ErrorCode.ABSENT_SUBSCRIBER, "Error absentSubscriberSM after MtForwardSM Request: " + absentSubscriber.toString(), true, mapErrorMessage, false, ProcessingType.SS7_MT);
} else if (mapErrorMessage.isEmSMDeliveryFailure()) {
MAPErrorMessageSMDeliveryFailure smDeliveryFailure = mapErrorMessage.getEmSMDeliveryFailure();
SmsDeliverReportTpdu tpdu = null;
try {
tpdu = smDeliveryFailure.getSmsDeliverReportTpdu();
} catch (MAPException e) {
// we skip any possible Exception here
}
ErrorAction errAction;
// checking firstly a case of FailureCause existence in tpdu
if (tpdu != null && tpdu.getFailureCause() != null) {
int tpduCauseCode = tpdu.getFailureCause().getCode();
PermanentTemporaryFailure tpFailureCauseStatus = SmscPropertiesManagement.getInstance().getSmDeliveryFailureTpCause(tpduCauseCode);
if (tpFailureCauseStatus == PermanentTemporaryFailure.temporary) {
errAction = ErrorAction.temporaryFailure;
} else {
errAction = ErrorAction.permanentFailure;
}
this.onDeliveryError(smsSet, errAction, ErrorCode.SENDING_SM_FAILED, "Error smDeliveryFailure after MtForwardSM Request: " + smDeliveryFailure.toString(), true, mapErrorMessage, false, ProcessingType.SS7_MT);
} else {
// no FailureCause existence in tpdu - then checking DeliveryFailureCause code
PermanentTemporaryFailure smDlrStatus = SmscPropertiesManagement.getInstance().getSmDeliveryFailure(smDeliveryFailure.getSMEnumeratedDeliveryFailureCause().getCode());
if (smDeliveryFailure.getSMEnumeratedDeliveryFailureCause() == SMEnumeratedDeliveryFailureCause.memoryCapacityExceeded) {
if (smDlrStatus == PermanentTemporaryFailure.permanent)
errAction = ErrorAction.permanentFailure;
else
errAction = ErrorAction.memoryCapacityExceededFlag;
this.onDeliveryError(smsSet, errAction, ErrorCode.MESSAGE_QUEUE_FULL, "Error smDeliveryFailure after MtForwardSM Request: " + smDeliveryFailure.toString(), true, mapErrorMessage, false, ProcessingType.SS7_MT);
} else {
if (smDlrStatus == PermanentTemporaryFailure.temporary)
errAction = ErrorAction.temporaryFailure;
else
errAction = ErrorAction.permanentFailure;
this.onDeliveryError(smsSet, errAction, ErrorCode.SENDING_SM_FAILED, "Error smDeliveryFailure after MtForwardSM Request: " + smDeliveryFailure.toString(), true, mapErrorMessage, false, ProcessingType.SS7_MT);
}
}
} else if (mapErrorMessage.isEmSystemFailure()) {
// TODO: may be it is not a permanent case ???
MAPErrorMessageSystemFailure systemFailure = mapErrorMessage.getEmSystemFailure();
this.onDeliveryError(smsSet, ErrorAction.temporaryFailure, ErrorCode.SYSTEM_FAILURE, "Error systemFailure after MtForwardSM Request: " + systemFailure.toString(), true, mapErrorMessage, false, ProcessingType.SS7_MT);
} else if (mapErrorMessage.isEmFacilityNotSup()) {
MAPErrorMessageFacilityNotSup facilityNotSup = mapErrorMessage.getEmFacilityNotSup();
this.onDeliveryError(smsSet, ErrorAction.permanentFailure, ErrorCode.FACILITY_NOT_SUPPORTED, "Error facilityNotSup after MtForwardSM Request: " + facilityNotSup.toString(), true, mapErrorMessage, false, ProcessingType.SS7_MT);
} else if (mapErrorMessage.isEmExtensionContainer()) {
MAPErrorMessageExtensionContainer extensionContainer = mapErrorMessage.getEmExtensionContainer();
switch((int) (long) extensionContainer.getErrorCode()) {
case MAPErrorCode.dataMissing:
this.onDeliveryError(smsSet, ErrorAction.permanentFailure, ErrorCode.DATA_MISSING, "Error dataMissing after MtForwardSM Request: " + extensionContainer.toString(), true, mapErrorMessage, false, ProcessingType.SS7_MT);
break;
case MAPErrorCode.unexpectedDataValue:
this.onDeliveryError(smsSet, ErrorAction.permanentFailure, ErrorCode.UNEXPECTED_DATA, "Error unexpectedDataValue after MtForwardSM Request: " + extensionContainer.toString(), true, mapErrorMessage, false, ProcessingType.SS7_MT);
break;
// break;
case MAPErrorCode.unidentifiedSubscriber:
this.onDeliveryError(smsSet, ErrorAction.permanentFailure, ErrorCode.UNDEFINED_SUBSCRIBER, "Error unidentifiedSubscriber after MtForwardSM Request: " + extensionContainer.toString(), true, mapErrorMessage, false, ProcessingType.SS7_MT);
break;
case MAPErrorCode.illegalSubscriber:
this.onDeliveryError(smsSet, ErrorAction.permanentFailure, ErrorCode.ILLEGAL_SUBSCRIBER, "Error illegalSubscriber after MtForwardSM Request: " + extensionContainer.toString(), true, mapErrorMessage, false, ProcessingType.SS7_MT);
break;
case MAPErrorCode.illegalEquipment:
this.onDeliveryError(smsSet, ErrorAction.permanentFailure, ErrorCode.ILLEGAL_EQUIPMENT, "Error illegalEquipment after MtForwardSM Request: " + extensionContainer.toString(), true, mapErrorMessage, false, ProcessingType.SS7_MT);
break;
default:
this.onDeliveryError(smsSet, ErrorAction.permanentFailure, ErrorCode.SYSTEM_FAILURE, "Error after MtForwardSM Request: " + extensionContainer.toString(), true, mapErrorMessage, false, ProcessingType.SS7_MT);
break;
}
} else {
this.onDeliveryError(smsSet, ErrorAction.permanentFailure, ErrorCode.SYSTEM_FAILURE, "Error after MtForwardSM Request: " + mapErrorMessage, true, mapErrorMessage, false, ProcessingType.SS7_MT);
}
} catch (Throwable e1) {
logger.severe("Exception in MtSbb.onErrorComponent() when fetching records and issuing events: " + e1.getMessage(), e1);
markDeliveringIsEnded(true);
}
}
use of org.restcomm.protocols.ss7.map.api.errors.MAPErrorMessage in project smscgateway by RestComm.
the class SriSbb method onSriFullResponse.
private void onSriFullResponse() {
SendRoutingInfoForSMResponse sendRoutingInfoForSMResponse = this.getSendRoutingInfoForSMResponse();
MAPErrorMessage errorMessage = this.getErrorResponse();
SmsSet smsSet = getSmsSet();
if (smsSet == null) {
logger.severe("SriSbb.onSriFullResponse(): CMP smsSet is missed");
markDeliveringIsEnded(true);
return;
}
if (sendRoutingInfoForSMResponse != null) {
// we have positive response to SRI request -
// we will try to send messages
// storing SRI response results into a cache firstly
SriResponseValue sriResponseValue = new SriResponseValue(smsSet.getTargetId(), smsSet.getNetworkId(), smsSet.getDestAddr(), smsSet.getDestAddrTon(), smsSet.getDestAddrNpi(), sendRoutingInfoForSMResponse.getLocationInfoWithLMSI(), sendRoutingInfoForSMResponse.getIMSI().getData());
try {
SmsSetCache.getInstance().putSriResponseValue(sriResponseValue, smscPropertiesManagement.getSriResponseLiveTime());
} catch (Exception e1) {
// no actions in failure
}
executeForwardSM(smsSet, sendRoutingInfoForSMResponse.getLocationInfoWithLMSI(), sendRoutingInfoForSMResponse.getIMSI().getData(), smsSet.getNetworkId());
return;
}
if (errorMessage != null) {
// we have a negative response
if (errorMessage.isEmAbsentSubscriber()) {
this.onDeliveryError(smsSet, ErrorAction.mobileNotReachableFlag, ErrorCode.ABSENT_SUBSCRIBER, "AbsentSubscriber response from HLR: " + errorMessage.toString(), true, errorMessage, false, ProcessingType.SS7_SRI);
} else if (errorMessage.isEmAbsentSubscriberSM()) {
this.onDeliveryError(smsSet, ErrorAction.mobileNotReachableFlag, ErrorCode.ABSENT_SUBSCRIBER, "AbsentSubscriberSM response from HLR: " + errorMessage.toString(), true, errorMessage, false, ProcessingType.SS7_SRI);
} else if (errorMessage.isEmCallBarred()) {
this.onDeliveryError(smsSet, ErrorAction.permanentFailure, ErrorCode.CALL_BARRED, "CallBarred response from HLR: " + errorMessage.toString(), true, errorMessage, false, ProcessingType.SS7_SRI);
} else if (errorMessage.isEmFacilityNotSup()) {
this.onDeliveryError(smsSet, ErrorAction.permanentFailure, ErrorCode.FACILITY_NOT_SUPPORTED, "FacilityNotSuppored response from HLR: " + errorMessage.toString(), true, errorMessage, false, ProcessingType.SS7_SRI);
} else if (errorMessage.isEmSystemFailure()) {
// TODO: may be systemFailure is not a permanent error case ?
this.onDeliveryError(smsSet, ErrorAction.temporaryFailure, ErrorCode.SYSTEM_FAILURE, "SystemFailure response from HLR: " + errorMessage.toString(), true, errorMessage, false, ProcessingType.SS7_SRI);
} else if (errorMessage.isEmUnknownSubscriber()) {
this.onDeliveryError(smsSet, ErrorAction.permanentFailure, ErrorCode.UNKNOWN_SUBSCRIBER, "UnknownSubscriber response from HLR: " + errorMessage.toString(), true, errorMessage, false, ProcessingType.SS7_SRI);
} else if (errorMessage.isEmExtensionContainer()) {
if (errorMessage.getEmExtensionContainer().getErrorCode() == MAPErrorCode.dataMissing) {
this.onDeliveryError(smsSet, ErrorAction.permanentFailure, ErrorCode.DATA_MISSING, "DataMissing response from HLR", true, errorMessage, false, ProcessingType.SS7_SRI);
} else if (errorMessage.getEmExtensionContainer().getErrorCode() == MAPErrorCode.unexpectedDataValue) {
this.onDeliveryError(smsSet, ErrorAction.permanentFailure, ErrorCode.UNEXPECTED_DATA, "UnexpectedDataValue response from HLR", true, errorMessage, false, ProcessingType.SS7_SRI);
} else if (errorMessage.getEmExtensionContainer().getErrorCode() == MAPErrorCode.teleserviceNotProvisioned) {
this.onDeliveryError(smsSet, ErrorAction.permanentFailure, ErrorCode.TELESERVICE_NOT_PROVISIONED, "TeleserviceNotProvisioned response from HLR", true, errorMessage, false, ProcessingType.SS7_SRI);
} else {
this.onDeliveryError(smsSet, ErrorAction.permanentFailure, ErrorCode.UNEXPECTED_DATA_FROM_HLR, "Error response from HLR: " + errorMessage.toString(), true, errorMessage, false, ProcessingType.SS7_SRI);
}
} else {
this.onDeliveryError(smsSet, ErrorAction.permanentFailure, ErrorCode.UNEXPECTED_DATA_FROM_HLR, "Error response from HLR: " + errorMessage.toString(), true, errorMessage, false, ProcessingType.SS7_SRI);
}
} else {
// we have no responses - this is an error behaviour
this.onDeliveryError(smsSet, ErrorAction.permanentFailure, ErrorCode.HLR_REJECT_AFTER_ROUTING_INFO, "Empty response after SRI Request", false, null, false, ProcessingType.SS7_SRI);
}
}
use of org.restcomm.protocols.ss7.map.api.errors.MAPErrorMessage in project smscgateway by RestComm.
the class MoSbb method onMtForwardShortMessageRequest.
/**
* @param evt
* @param aci
*/
public void onMtForwardShortMessageRequest(MtForwardShortMessageRequest evt, ActivityContextInterface aci) {
if (this.logger.isFineEnabled()) {
this.logger.fine("Received MT_FORWARD_SHORT_MESSAGE_REQUEST = " + evt);
}
this.setProcessingState(MoProcessingState.OtherDataRecieved);
MAPDialogSms dialog = evt.getMAPDialog();
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("Sent ErrorComponent = " + errorMessage);
}
if (smscPropertiesManagement.isGenerateRejectionCdr()) {
generateCDR(dialog.getNetworkId(), null, dialog.getLocalAddress(), CdrGenerator.CDR_SUBMIT_FAILED_HR, 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.processMtMessage(evt.getSM_RP_OA(), evt.getSM_RP_DA(), evt.getSM_RP_UI(), dialog.getNetworkId(), originatorSccpAddress, false, evt.getMAPDialog(), evt, evt.getInvokeId());
if (sms != null) {
this.processSms(sms, persistence, smscPropertiesManagement.getHrCharging(), false, dialog, evt, evt.getInvokeId());
}
} catch (SmscProcessingException e1) {
this.logger.severe(e1.getMessage(), e1);
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_HR, e1.getMessage(), false, true);
} else {
generateCDR(dialog.getNetworkId(), null, dialog.getLocalAddress(), CdrGenerator.CDR_SUBMIT_FAILED_HR, 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);
try {
MAPErrorMessage errorMessage = this.mapProvider.getMAPErrorMessageFactory().createMAPErrorMessageSystemFailure(dialog.getApplicationContext().getApplicationContextVersion().getVersion(), null, null, null);
dialog.sendErrorComponent(evt.getInvokeId(), errorMessage);
dialog.close(false);
if (smscPropertiesManagement.isGenerateRejectionCdr()) {
generateCDR(dialog.getNetworkId(), null, dialog.getLocalAddress(), CdrGenerator.CDR_SUBMIT_FAILED_HR, errorMessage.toString(), true);
}
} catch (Throwable e) {
logger.severe("Error while sending Error message", e);
return;
}
return;
}
if (sms == null || sms.getMessageDeliveryResultResponse() == null) {
try {
dialog.addMtForwardShortMessageResponse(evt.getInvokeId(), null, null);
if (this.logger.isFineEnabled()) {
this.logger.fine("Sent MtForwardShortMessageResponse = " + evt);
}
dialog.close(false);
} catch (Throwable e) {
logger.severe("Error while sending MoForwardShortMessageResponse ", e);
}
}
}
use of org.restcomm.protocols.ss7.map.api.errors.MAPErrorMessage in project smscgateway by RestComm.
the class MessageDeliveryResultResponseMo method responseDeliveryFailure.
@Override
public void responseDeliveryFailure(DeliveryFailureReason reason, MAPErrorMessage errMessage) {
try {
MAPErrorMessage errorMessage;
if (errMessage != null && errMessage.isEmSMDeliveryFailure()) {
MAPErrorMessageSMDeliveryFailure smDeliveryFailure = errMessage.getEmSMDeliveryFailure();
errorMessage = this.provider.getMAPErrorMessageFactory().createMAPErrorMessageSMDeliveryFailure(dialog.getApplicationContext().getApplicationContextVersion().getVersion(), smDeliveryFailure.getSMEnumeratedDeliveryFailureCause(), null, null);
} else {
switch(reason) {
case destinationUnavalable:
errorMessage = this.provider.getMAPErrorMessageFactory().createMAPErrorMessageSystemFailure(dialog.getApplicationContext().getApplicationContextVersion().getVersion(), NetworkResource.vlr, null, null);
break;
case invalidDestinationAddress:
errorMessage = this.provider.getMAPErrorMessageFactory().createMAPErrorMessageSMDeliveryFailure(dialog.getApplicationContext().getApplicationContextVersion().getVersion(), SMEnumeratedDeliveryFailureCause.subscriberNotSCSubscriber, null, null);
break;
case permanentNetworkError:
errorMessage = this.provider.getMAPErrorMessageFactory().createMAPErrorMessageSystemFailure(dialog.getApplicationContext().getApplicationContextVersion().getVersion(), NetworkResource.vlr, null, null);
break;
case temporaryNetworkError:
errorMessage = this.provider.getMAPErrorMessageFactory().createMAPErrorMessageSystemFailure(dialog.getApplicationContext().getApplicationContextVersion().getVersion(), NetworkResource.vlr, null, null);
break;
default:
errorMessage = this.provider.getMAPErrorMessageFactory().createMAPErrorMessageSystemFailure(dialog.getApplicationContext().getApplicationContextVersion().getVersion(), NetworkResource.vlr, null, null);
break;
}
}
dialog.sendErrorComponent(evt.getInvokeId(), errorMessage);
if (this.logger.isInfoEnabled()) {
this.logger.info("Sent ErrorComponent = " + errorMessage);
}
dialog.close(false);
} catch (Throwable e) {
logger.severe("Error while sending Error message", e);
return;
}
}
Aggregations