use of org.restcomm.protocols.ss7.map.api.errors.MAPErrorMessage in project smscgateway by RestComm.
the class MAPListener method onMtForwardShortMessageRequest.
@Override
public void onMtForwardShortMessageRequest(MtForwardShortMessageRequest event) {
if (logger.isInfoEnabled()) {
logger.info("Rx : onMtForwardShortMessageIndication=" + event);
}
// Lets first close the Dialog
MAPDialogSms mapDialogSms = event.getMAPDialog();
// boolean sendError = true;
try {
if (this.currentMapMessageCount % 7 == 0) {
// if (sendError) {
// 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.addMtForwardShortMessageResponse(event.getInvokeId(), null, null);
// mapDialogSms.close(false);
}
} catch (MAPException e) {
logger.error("Error while sending MAPErrorMessageAbsentSubscriberSM ", e);
}
mapDialogSms.setUserObject(true);
}
use of org.restcomm.protocols.ss7.map.api.errors.MAPErrorMessage in project smscgateway by RestComm.
the class MtTest method SuccessError3Test.
/**
* MAP V3, SRI error absentSubscriber -> RSDS -> new delivery attempt -> SRI error absentSubscriber -> RSDS
*/
@Test(groups = { "Mt" })
public void SuccessError3Test() throws Exception {
if (!this.cassandraDbInited)
return;
MAPServiceSmsProxy serviceSri = (MAPServiceSmsProxy) this.sriSbb.mapProvider.getMAPServiceSms();
MAPServiceSmsProxy serviceMt = (MAPServiceSmsProxy) this.mtSbb.mapProvider.getMAPServiceSms();
MAPServiceSmsProxy serviceRsds = (MAPServiceSmsProxy) this.rsdsSbb.mapProvider.getMAPServiceSms();
SmscPropertiesManagement smscPropertiesManagement = SmscPropertiesManagement.getInstance();
MProcManagement.getInstance("Test");
ArrayList<SmsDef> lst = new ArrayList<SmsDef>();
SmsDef sd1 = new SmsDef();
lst.add(sd1);
SmsSet smsSet = prepareDatabase(lst);
Sms sms1 = smsSet.getSms(0);
UUID smsId = sms1.getDbId();
SmsProxy smsx1 = this.pers.obtainArchiveSms(procDueSlot, smsSet.getDestAddr(), smsId);
assertNull(smsx1);
SmsSet smsSetX = SmsSetCache.getInstance().getProcessingSmsSet(procTargetId);
assertNotNull(smsSetX);
Sms smsX = this.pers.obtainLiveSms(procDueSlot, procTargetId, procId[0]);
assertEquals(smsX.getSmsSet().getInSystem(), 0);
assertEquals(SmsSetCache.getInstance().getProcessingSmsSetSize(), 1);
assertNull(smsSet.getStatus());
assertEquals(smsSet.getInSystem(), 0);
assertNull(smsSet.getInSystemDate());
assertEquals(smsSet.getDueDelay(), 0);
assertNull(smsSet.getDueDate());
assertFalse(smsSet.isAlertingSupported());
// initial onSms message
SmsSetEvent event = new SmsSetEvent();
event.setSmsSet(smsSet);
this.sriSbb.onSms(event, null, null);
MAPDialogSmsProxy dlg = serviceSri.getLastMAPDialogSms();
// SRI response
MAPErrorMessage mapErrorMessage = new MAPErrorMessageAbsentSubscriberSMImpl(null, null, null);
ErrorComponent evt2 = new ErrorComponent(dlg, 0L, mapErrorMessage);
this.sriSbb.onErrorComponent(evt2, null);
ISDNAddressStringImpl storedMSISDN = new ISDNAddressStringImpl(AddressNature.international_number, NumberingPlan.ISDN, msdnDig);
MWStatusImpl mwStatus = new MWStatusImpl(false, true, false, true);
InformServiceCentreRequestImpl evt4 = new InformServiceCentreRequestImpl(storedMSISDN, mwStatus, null, null, null);
evt4.setMAPDialog(dlg);
this.sriSbb.onDialogDelimiter(null, null);
PreparedStatementCollection[] pscc = this.pers.c2_getPscList();
long l1 = 0;
for (PreparedStatementCollection psc : pscc) {
l1 = this.pers.c2_getDueSlotForTargetId(psc, procTargetId);
if (l1 != 0)
break;
}
smsx1 = this.pers.obtainArchiveSms(l1, smsSet.getDestAddr(), smsId);
assertNull(smsx1);
smsSetX = SmsSetCache.getInstance().getProcessingSmsSet(procTargetId);
assertNull(smsSetX);
smsX = this.pers.obtainLiveSms(l1, procTargetId, procId[0]);
assertEquals(smsX.getSmsSet().getInSystem(), 0);
assertEquals(SmsSetCache.getInstance().getProcessingSmsSetSize(), 0);
assertEquals(smsSet.getStatus(), ErrorCode.ABSENT_SUBSCRIBER);
// assertEquals(smsSet.getInSystem(), 1);
// this.testDateEq(smsSet.getInSystemDate(), curDate);
assertEquals(smsSet.getDueDelay(), SmscPropertiesManagement.getInstance().getSecondDueDelay());
this.testDateEq(new Date(new Date().getTime() + SmscPropertiesManagement.getInstance().getSecondDueDelay() * 1000), smsSet.getDueDate());
assertFalse(smsSet.isAlertingSupported());
dlg = serviceRsds.getLastMAPDialogSms();
// rsds response 2
ReportSMDeliveryStatusResponseImpl evt7 = new ReportSMDeliveryStatusResponseImpl(2, null, null);
evt7.setMAPDialog(dlg);
this.rsdsSbb.onReportSMDeliveryStatusResponse(evt7, null);
DialogClose dcl = new DialogClose(dlg);
this.rsdsSbb.onDialogClose(dcl, null);
// second delivery attempt **********************
ArrayList<SmsSet> lst1 = this.pers.c2_getRecordList(l1);
ArrayList<SmsSet> lst2 = this.pers.c2_sortRecordList(lst1);
smsSet = lst2.get(0);
// initial onSms message
event = new SmsSetEvent();
event.setSmsSet(smsSet);
this.sriSbb.makeDlvIsNotInited();
this.sriSbb.onSms(event, null, null);
dlg = serviceSri.getLastMAPDialogSms();
// SRI response
mapErrorMessage = new MAPErrorMessageAbsentSubscriberSMImpl(null, null, null);
evt2 = new ErrorComponent(dlg, 0L, mapErrorMessage);
this.sriSbb.onErrorComponent(evt2, null);
storedMSISDN = new ISDNAddressStringImpl(AddressNature.international_number, NumberingPlan.ISDN, msdnDig);
mwStatus = new MWStatusImpl(false, true, false, true);
evt4 = new InformServiceCentreRequestImpl(storedMSISDN, mwStatus, null, null, null);
evt4.setMAPDialog(dlg);
this.sriSbb.onDialogDelimiter(null, null);
for (PreparedStatementCollection psc : pscc) {
l1 = this.pers.c2_getDueSlotForTargetId(psc, procTargetId);
if (l1 != 0)
break;
}
smsx1 = this.pers.obtainArchiveSms(l1, smsSet.getDestAddr(), smsId);
assertNull(smsx1);
smsSetX = SmsSetCache.getInstance().getProcessingSmsSet(procTargetId);
assertNull(smsSetX);
smsX = this.pers.obtainLiveSms(l1, procTargetId, procId[0]);
assertEquals(smsX.getSmsSet().getInSystem(), 0);
assertEquals(SmsSetCache.getInstance().getProcessingSmsSetSize(), 0);
assertEquals(smsSet.getDueDelay(), 600);
this.testDateEq(new Date(new Date().getTime() + 600 * 1000), smsSet.getDueDate());
for (PreparedStatementCollection psc : pscc) {
l1 = this.pers.c2_getDueSlotForTargetId(psc, taR.getTargetId());
if (l1 != 0)
break;
}
assertEquals(l1, 0);
// we do no test here rsds response 2 - it is the same
}
use of org.restcomm.protocols.ss7.map.api.errors.MAPErrorMessage in project smscgateway by RestComm.
the class HrSriClientSbb method onErrorComponent.
public void onErrorComponent(ErrorComponent event, ActivityContextInterface aci) {
super.onErrorComponent(event, aci);
try {
// we store error into CMP
MAPErrorMessage mapErrorMessage = event.getMAPErrorMessage();
this.setErrorResponse(mapErrorMessage);
if (mapErrorMessage.isEmAbsentSubscriber()) {
MAPErrorMessageAbsentSubscriber errAs = mapErrorMessage.getEmAbsentSubscriber();
Boolean mwdSet = errAs.getMwdSet();
if (mwdSet != null && mwdSet) {
MWStatus mwStatus = event.getMAPDialog().getService().getMAPProvider().getMAPParameterFactory().createMWStatus(false, true, false, false);
CorrelationIdValue correlationIdValue = this.getCorrelationIdValue();
if (correlationIdValue != null) {
correlationIdValue.setMwStatus(mwStatus);
this.setCorrelationIdValue(correlationIdValue);
}
}
}
} catch (Throwable e1) {
logger.severe("Exception in HrSriClientSbb.onErrorComponent when fetching records and issuing events: " + e1.getMessage(), e1);
}
}
use of org.restcomm.protocols.ss7.map.api.errors.MAPErrorMessage in project smscgateway by RestComm.
the class MtTest method testMProc_TempFail.
@Test(groups = { "Mt" })
public void testMProc_TempFail() throws Exception {
if (!this.cassandraDbInited)
return;
MProcManagement mProcManagement = MProcManagement.getInstance();
SmscManagement smscManagement = SmscManagement.getInstance("Test");
SmppManagement smppManagement = SmppManagement.getInstance("Test");
smscManagement.setSmppManagement(smppManagement);
mProcManagement.setSmscManagement(smscManagement);
smscManagement.registerRuleFactory(new MProcRuleFactoryDefault());
DBOperations.getInstance().stop();
smscManagement.start();
try {
mProcManagement.destroyMProcRule(1);
} catch (Exception e) {
}
try {
mProcManagement.destroyMProcRule(2);
} catch (Exception e) {
}
// mProcManagement.createMProcRule(1, MProcRuleFactoryDefault.RULE_CLASS_NAME,
// "networkidmask 0 newnetworkidaftertempfail 1");
mProcManagement.createMProcRule(1, MProcRuleFactoryDefault.RULE_CLASS_NAME, "networkidmask 0 newnetworkidafterpermfail 1");
MAPServiceSmsProxy serviceSri = (MAPServiceSmsProxy) this.sriSbb.mapProvider.getMAPServiceSms();
MAPServiceSmsProxy serviceMt = (MAPServiceSmsProxy) this.mtSbb.mapProvider.getMAPServiceSms();
MAPServiceSmsProxy serviceRsds = (MAPServiceSmsProxy) this.rsdsSbb.mapProvider.getMAPServiceSms();
SmscPropertiesManagement smscPropertiesManagement = SmscPropertiesManagement.getInstance();
MProcManagement.getInstance("Test");
ArrayList<SmsDef> lst = new ArrayList<SmsDef>();
SmsDef sd1 = new SmsDef();
lst.add(sd1);
SmsSet smsSet = prepareDatabase(lst);
Sms sms1 = smsSet.getSms(0);
// UUID smsId = sms1.getDbId();
// SmsProxy smsx1 = this.pers.obtainArchiveSms(procDueSlot, smsSet.getDestAddr(), smsId);
// assertNull(smsx1);
// SmsSet smsSetX = SmsSetCache.getInstance().getProcessingSmsSet(procTargetId);
// assertNotNull(smsSetX);
// Sms smsX = this.pers.obtainLiveSms(procDueSlot, procTargetId, procId[0]);
// assertEquals(smsX.getSmsSet().getInSystem(), 0);
// assertEquals(SmsSetCache.getInstance().getProcessingSmsSetSize(), 1);
// initial onSms message
SmsSetEvent event = new SmsSetEvent();
event.setSmsSet(smsSet);
this.sriSbb.onSms(event, null, null);
MAPDialogSmsProxy dlg = serviceSri.getLastMAPDialogSms();
// assertFalse(this.mtSbb.isMAPVersionTested(MAPApplicationContextVersion.version1));
// assertFalse(this.mtSbb.isMAPVersionTested(MAPApplicationContextVersion.version2));
// assertFalse(this.mtSbb.isMAPVersionTested(MAPApplicationContextVersion.version3));
// assertFalse(this.mtSbb.isNegotiatedMapVersionUsing());
// SRI response
IMSI imsi = new IMSIImpl(imsiDig);
ISDNAddressString networkNodeNumber = new ISDNAddressStringImpl(AddressNature.international_number, org.restcomm.protocols.ss7.map.api.primitives.NumberingPlan.ISDN, nnnDig);
LocationInfoWithLMSI locationInfoWithLMSI = new LocationInfoWithLMSIImpl(networkNodeNumber, null, null, false, null);
SendRoutingInfoForSMResponse evt1 = new SendRoutingInfoForSMResponseImpl(imsi, locationInfoWithLMSI, null, null, null);
evt1.setMAPDialog(dlg);
// MAPErrorMessage mapErrorMessage = new MAPErrorMessageAbsentSubscriberSMImpl(null, null, null);
// ErrorComponent evt2 = new ErrorComponent(dlg, 0L, mapErrorMessage);
MAPErrorMessage mapErrorMessage = new MAPErrorMessageUnknownSubscriberImpl(null, null);
ErrorComponent evt2 = new ErrorComponent(dlg, 0L, mapErrorMessage);
this.sriSbb.onErrorComponent(evt2, null);
this.sriSbb.onDialogDelimiter(null, null);
// ....................
// assertFalse(this.mtSbb.isMAPVersionTested(MAPApplicationContextVersion.version1));
// assertFalse(this.mtSbb.isMAPVersionTested(MAPApplicationContextVersion.version2));
// assertTrue(this.mtSbb.isMAPVersionTested(MAPApplicationContextVersion.version3));
// assertFalse(this.mtSbb.isNegotiatedMapVersionUsing());
dlg = serviceMt.getLastMAPDialogSms();
// MAPApplicationContextVersion vers = dlg.getApplicationContext().getApplicationContextVersion();
// assertEquals(vers, MAPApplicationContextVersion.version3);
}
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);
}
}
Aggregations