use of org.mobicents.smsc.library.SmsSet in project smscgateway by RestComm.
the class MtTest method SuccessError1Test.
/**
* MAP V3, SRI error absentSubscriber + ISC -> RSDS
*/
@Test(groups = { "Mt" })
public void SuccessError1Test() 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());
// SmsSet smsSet2 = pers.obtainSmsSet(ta1);
SmsSet smsSet2 = smsX.getSmsSet();
assertEquals(smsSet2.getStatus(), ErrorCode.SUCCESS);
assertEquals(smsSet2.getInSystem(), 0);
// this.testDateEq(smsSet2.getInSystemDate(), curDate);
assertEquals(smsSet2.getDueDelay(), 0);
assertNull(smsSet2.getDueDate());
assertFalse(smsSet2.isAlertingSupported());
// initial onSms message
SmsSetEvent event = new SmsSetEvent();
event.setSmsSet(smsSet);
this.sriSbb.onSms(event, null, null);
MAPDialogSmsProxy dlg = serviceSri.getLastMAPDialogSms();
MAPApplicationContextVersion acv = dlg.getApplicationContext().getApplicationContextVersion();
assertEquals(acv, MAPApplicationContextVersion.version3);
ArrayList<MAPTestEvent> lstEvt = dlg.getEventList();
assertEquals(lstEvt.size(), 2);
assertNull(serviceMt.getLastMAPDialogSms());
lstEvt = dlg.getEventList();
assertEquals(lstEvt.size(), 2);
assertEquals(dlg.getLocalAddress().getGlobalTitle().getDigits(), smscPropertiesManagement.getServiceCenterGt());
assertEquals(dlg.getRemoteAddress().getGlobalTitle().getDigits(), msdnDig);
MAPTestEvent evt = lstEvt.get(0);
assertEquals(evt.testEventType, MAPTestEventType.componentAdded);
SendRoutingInfoForSMRequest sriReq = (SendRoutingInfoForSMRequest) evt.event;
assertEquals(sriReq.getMsisdn().getAddress(), msdnDig);
assertEquals(sriReq.getServiceCentreAddress().getAddress(), smscPropertiesManagement.getServiceCenterGt());
evt = lstEvt.get(1);
assertEquals(evt.testEventType, MAPTestEventType.send);
assertNull(serviceRsds.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.onInformServiceCentreRequest(evt4, null);
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;
}
smsX = this.pers.obtainLiveSms(l1, procTargetId, procId[0]);
smsSet2 = smsX.getSmsSet();
assertEquals(smsSet2.getStatus(), ErrorCode.ABSENT_SUBSCRIBER);
assertEquals(smsSet2.getInSystem(), 0);
// this.testDateEq(smsSet2.getInSystemDate(), curDate);
assertEquals(smsSet2.getDueDelay(), SmscPropertiesManagement.getInstance().getSecondDueDelay());
// this.testDateEq(new Date(new Date().getTime() + SmscPropertiesManagement.getInstance().getSecondDueDelay() * 1000), smsSet2.getDueDate());
assertFalse(smsSet2.isAlertingSupported());
smsId = sms1.getDbId();
smsx1 = this.pers.obtainArchiveSms(procDueSlot, smsSet.getDestAddr(), smsId);
assertNull(smsx1);
smsSetX = SmsSetCache.getInstance().getProcessingSmsSet(procTargetId);
assertNull(smsSetX);
smsX = this.pers.obtainLiveSms(procDueSlot, procTargetId, procId[0]);
assertNull(smsX);
smsX = this.pers.obtainLiveSms(l1, procTargetId, procId[0]);
assertNotNull(smsX);
assertEquals(SmsSetCache.getInstance().getProcessingSmsSetSize(), 0);
dlg = serviceRsds.getLastMAPDialogSms();
acv = dlg.getApplicationContext().getApplicationContextVersion();
assertEquals(acv, MAPApplicationContextVersion.version3);
assertEquals(dlg.getLocalAddress().getGlobalTitle().getDigits(), smscPropertiesManagement.getServiceCenterGt());
assertEquals(dlg.getRemoteAddress().getGlobalTitle().getDigits(), msdnDig);
lstEvt = dlg.getEventList();
assertEquals(lstEvt.size(), 2);
evt = lstEvt.get(0);
assertEquals(evt.testEventType, MAPTestEventType.componentAdded);
ReportSMDeliveryStatusRequestImpl rsdsReq = (ReportSMDeliveryStatusRequestImpl) evt.event;
assertEquals(rsdsReq.getServiceCentreAddress().getAddress(), smscPropertiesManagement.getServiceCenterGt());
assertEquals(rsdsReq.getMsisdn().getAddress(), msdnDig);
assertEquals(rsdsReq.getSMDeliveryOutcome(), SMDeliveryOutcome.absentSubscriber);
evt = lstEvt.get(1);
assertEquals(evt.testEventType, MAPTestEventType.send);
// 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);
smsX = this.pers.obtainLiveSms(l1, procTargetId, procId[0]);
smsSet2 = smsX.getSmsSet();
assertEquals(smsSet2.getStatus(), ErrorCode.ABSENT_SUBSCRIBER);
assertEquals(smsSet2.getInSystem(), 0);
assertEquals(smsSet2.getDueDelay(), SmscPropertiesManagement.getInstance().getSecondDueDelay());
// TODO: alertingSupport field is not now filled (It can be filled in: this.rsdsSbb.onReportSMDeliveryStatusResponse(evt7, null);)
// assertTrue(smsSet2.isAlertingSupported());
// TODO: ???? .........
// boolean b1 = this.pers.checkSmsSetExists(taR);
// TODO: ???? .........
// assertFalse(b1);
}
use of org.mobicents.smsc.library.SmsSet in project smscgateway by RestComm.
the class MtTest method createEmptySmsSet.
private SmsSet createEmptySmsSet(TargetAddress ta) {
SmsSet smsSet = new SmsSet();
smsSet.setDestAddr(ta1.getAddr());
smsSet.setDestAddrNpi(ta1.getAddrNpi());
smsSet.setDestAddrTon(ta1.getAddrTon());
smsSet.setType(SmType.SMS_FOR_SS7);
return smsSet;
}
use of org.mobicents.smsc.library.SmsSet in project smscgateway by RestComm.
the class MtTest method prepareDatabase.
private SmsSet prepareDatabase(ArrayList<SmsDef> lst) throws PersistenceException {
SmsSet smsSet = createEmptySmsSet(ta1);
int i1 = 1;
procDueSlot = -1;
for (SmsDef smsDef : lst) {
Sms sms = this.prepareSms(smsSet, i1, smsDef);
if (sms.getStored()) {
this.pers.c2_scheduleMessage_ReschedDueSlot(sms, false, true);
procDueSlot = sms.getDueSlot();
} else {
smsSet.addSms(sms);
}
i1++;
}
if (procDueSlot != -1) {
ArrayList<SmsSet> lst1 = this.pers.c2_getRecordList(procDueSlot);
ArrayList<SmsSet> lst2 = this.pers.c2_sortRecordList(lst1);
if (lst2.size() > 0) {
SmsSet res = lst2.get(0);
curDate = new Date();
procTargetId = res.getTargetId();
procId = new UUID[(int) res.getSmsCount()];
for (i1 = 0; i1 < res.getSmsCount(); i1++) {
procId[i1] = res.getSms(i1).getDbId();
}
return res;
} else {
return null;
}
} else {
procTargetId = smsSet.getTargetId();
procId = new UUID[(int) smsSet.getSmsCount()];
for (i1 = 0; i1 < smsSet.getSmsCount(); i1++) {
procId[i1] = smsSet.getSms(i1).getDbId();
}
return smsSet;
}
}
use of org.mobicents.smsc.library.SmsSet in project smscgateway by RestComm.
the class MtTest3 method ReportTest.
@Test(groups = { "Mt" })
public void ReportTest() throws Exception {
MtSbbProxy3 proxy = new MtSbbProxy3();
Date submitDate = new Date(2015, 1, 2, 12, 30);
Date deliveryDate = new Date(2015, 1, 2, 12, 40);
Sms sms = new Sms();
sms.setSourceAddr("111199990000");
sms.setSourceAddrNpi(1);
sms.setSourceAddrTon(1);
sms.setShortMessageText("Hello 111");
sms.setSubmitDate(submitDate);
sms.setMoMessageRef(34);
SmsSet smsSet = new SmsSet();
smsSet.setDestAddr("888899990000");
smsSet.setDestAddrNpi(1);
smsSet.setDestAddrTon(1);
smsSet.setNetworkId(0);
smsSet.addSms(sms);
SmsDeliveryReportData smsDeliveryReportData = new SmsDeliveryReportData();
smsDeliveryReportData.setDeliveryDate(deliveryDate);
smsDeliveryReportData.setStatusReportQualifier(StatusReportQualifier.SmsSubmitResult);
smsDeliveryReportData.setStatusVal(64);
SmsSignalInfo smsSignalInfo = proxy.createSignalInfoStatusReport(sms, true, smsDeliveryReportData);
String s1 = smsSignalInfo.toString();
assertNotNull(smsSignalInfo);
SmsStatusReportTpdu si = (SmsStatusReportTpdu) smsSignalInfo.decodeTpdu(false);
assertEquals(si.getDischargeTime().getMinute(), 40);
assertEquals(si.getServiceCentreTimeStamp().getMinute(), 30);
assertFalse(si.getForwardedOrSpawned());
assertEquals(si.getMessageReference(), 34);
assertTrue(si.getMoreMessagesToSend());
// assertNull(si.getParameterIndicator());
assertEquals(si.getProtocolIdentifier().getCode(), 0);
assertEquals(si.getRecipientAddress().getAddressValue(), "888899990000");
assertEquals(si.getRecipientAddress().getNumberingPlanIdentification(), NumberingPlanIdentification.ISDNTelephoneNumberingPlan);
assertEquals(si.getRecipientAddress().getTypeOfNumber(), TypeOfNumber.InternationalNumber);
assertEquals(si.getStatus().getCode(), Status.REMOTE_PROCEDURE_ERROR);
assertEquals(si.getStatusReportQualifier(), StatusReportQualifier.SmsSubmitResult);
}
use of org.mobicents.smsc.library.SmsSet in project smscgateway by RestComm.
the class MtCommonSbb method onInvokeTimeout.
public void onInvokeTimeout(InvokeTimeout evt, ActivityContextInterface aci) {
SmsSet smsSet = getSmsSet();
if (smsSet == null) {
logger.severe("MtCommonSbb.onInvokeTimeout(): CMP smsSet is missed");
markDeliveringIsEnded(true);
return;
}
if (logger.isWarningEnabled()) {
this.logger.warning("\nRx : onInvokeTimeout targetId=" + smsSet.getTargetId() + ", " + evt);
}
}
Aggregations