use of org.mobicents.smsc.library.Sms in project smscgateway by RestComm.
the class CassandraTest method archiveMessage2.
public void archiveMessage2(SmsSet smsSet) throws Exception {
Sms sms = smsSet.getSms(0);
Date date = new Date();
Date date2 = new Date(date.getTime() - 1000 * 3600 * 24);
sms.setDeliveryDate(date2);
sms.getSmsSet().setType(SmType.SMS_FOR_SS7);
sms.getSmsSet().setImsi("12345678900000");
ISDNAddressStringImpl networkNodeNumber = new ISDNAddressStringImpl(AddressNature.international_number, NumberingPlan.ISDN, "2223334444");
LocationInfoWithLMSIImpl locationInfoWithLMSI = new LocationInfoWithLMSIImpl(networkNodeNumber, null, null, false, null);
sms.getSmsSet().setLocationInfoWithLMSI(locationInfoWithLMSI);
sbb.c2_createRecordArchive(sms, null, null, true, true);
Sms smsy = sbb.c2_getRecordArchiveForMessageId(sms.getMessageId());
this.checkTestSms(1, smsy, sms.getDbId(), true);
// bad MessageId
smsy = sbb.c2_getRecordArchiveForMessageId(sms.getMessageId() + 1234124124);
assertNull(smsy);
}
use of org.mobicents.smsc.library.Sms in project smscgateway by RestComm.
the class CassandraTest method testingLifeCycle.
@Test(groups = { "cassandra" })
public void testingLifeCycle() throws Exception {
if (!this.cassandraDbInited)
return;
long dueSlot = this.addingNewMessages();
this.readAlertMessage();
SmsSet smsSet = this.readDueSlotMessage(dueSlot, 1, 1);
String[] remoteMessageId = new String[3];
long l1 = 10000000;
for (int i1 = 0; i1 < 3; i1++) {
l1++;
remoteMessageId[i1] = MessageUtil.createMessageIdString(l1);
}
String esmeId = "esme_3";
archiveMessage(smsSet, remoteMessageId, esmeId);
this.addingNewMessages2(dueSlot + 1);
smsSet = this.readDueSlotMessage(dueSlot + 1, 2, 0);
SmsSetCache.getInstance().clearProcessingSmsSet();
smsSet = this.readDueSlotMessage(dueSlot, 1, 1);
Sms sms = smsSet.getSms(0);
assertFalse(smsSet.isAlertingSupported());
sbb.c2_updateAlertingSupport(sms.getDueSlot(), sms.getSmsSet().getTargetId(), sms.getDbId());
SmsSetCache.getInstance().clearProcessingSmsSet();
smsSet = this.readDueSlotMessage(dueSlot, 1, 1);
assertTrue(smsSet.isAlertingSupported());
}
use of org.mobicents.smsc.library.Sms in project smscgateway by RestComm.
the class CassandraTest method addingNewMessages2.
public void addingNewMessages2(long dueSlot) throws Exception {
Date dt = new Date();
PreparedStatementCollection psc = sbb.getStatementCollection(dt);
// adding an extra messages for "1111"
TargetAddress lock = this.sbb.obtainSynchroObject(ta1);
try {
synchronized (lock) {
Sms sms_a5 = this.createTestSms(5, ta1.getAddr(), id5);
sms_a5.setDueSlot(dueSlot);
sbb.c2_registerDueSlotWriting(dueSlot);
try {
sbb.c2_createRecordCurrent(sms_a5);
} finally {
sbb.c2_unregisterDueSlotWriting(dueSlot);
}
}
} finally {
this.sbb.obtainSynchroObject(lock);
}
}
use of org.mobicents.smsc.library.Sms in project smscgateway by RestComm.
the class MtDatabaseCassandraTest method prepareSms.
private Sms prepareSms(SmsSet smsSet, int num) {
Sms sms = new Sms();
sms.setStored(true);
sms.setSmsSet(smsSet);
sms.setDbId(UUID.randomUUID());
// sms.setDbId(id);
sms.setSourceAddr("4444");
sms.setSourceAddrTon(1);
sms.setSourceAddrNpi(1);
sms.setMessageId(8888888 + num);
sms.setMoMessageRef(102 + num);
sms.setMessageId(num);
sms.setOrigEsmeName("esme_1");
sms.setOrigSystemId("sys_1");
sms.setSubmitDate(new Date());
// sms.setDeliveryDate(new GregorianCalendar(2013, 1, 15, 12, 15 +
// num).getTime());
// sms.setServiceType("serv_type__" + num);
sms.setEsmClass(3);
sms.setProtocolId(0);
sms.setPriority(0);
sms.setRegisteredDelivery(0);
sms.setReplaceIfPresent(0);
sms.setDataCoding(0);
sms.setDefaultMsgId(0);
sms.setShortMessage(this.msg.getBytes());
return sms;
}
use of org.mobicents.smsc.library.Sms in project smscgateway by RestComm.
the class MtSbb method setupMtForwardShortMessageRequest.
// *********
// Main service methods
public void setupMtForwardShortMessageRequest(ISDNAddressString networkNode, String imsiData, LMSI lmsi, int networkId) {
if (this.logger.isFineEnabled()) {
this.logger.fine("mperforming setupMtForwardShortMessageRequest ISDNAddressString= " + networkNode);
}
SmsSet smsSet = getSmsSet();
if (smsSet == null) {
markDeliveringIsEnded(true);
logger.severe("MtSbb.setupMtForwardShortMessageRequest(): CMP smsSet is missed");
return;
}
Sms sms0 = smsSet.getSms(0);
Integer mtRemoteSccpTt = sms0.getMtRemoteSccpTt();
SccpAddress networkNodeSccpAddress = this.getMSCSccpAddress(networkNode, mtRemoteSccpTt);
IMSI imsi = this.mapParameterFactory.createIMSI(imsiData);
SM_RP_DA sm_RP_DA = this.mapParameterFactory.createSM_RP_DA(imsi);
AddressString scAddress = this.getServiceCenterAddressString(networkId);
SM_RP_OA sm_RP_OA = this.mapParameterFactory.createSM_RP_OA_ServiceCentreAddressOA(scAddress);
if (sms0 != null) {
// we only set it for first sms in the list
sms0.setMtServiceCenterAddress(scAddress.getAddress());
}
this.setNnn(networkNode);
this.setNetworkNode(networkNodeSccpAddress);
this.setSmRpDa(sm_RP_DA);
this.setSmRpOa(sm_RP_OA);
// Set cache with MAP version
MAPApplicationContextVersion mapApplicationContextVersion = mapVersionCache.getMAPApplicationContextVersion(networkNode.getAddress());
if (mapApplicationContextVersion == null) {
mapApplicationContextVersion = MAPApplicationContextVersion.getInstance(smscPropertiesManagement.getMaxMapVersion());
} else {
this.setNegotiatedMapVersionUsing(true);
}
this.setMAPVersionTested(mapApplicationContextVersion);
// dropaftersri mproc rules
try {
if (this.getTotalUnsentMessageCount() > 0) {
ArrayList<Sms> lstPermFailured = new ArrayList<Sms>();
ArrayList<Sms> lstRerouted = new ArrayList<Sms>();
ArrayList<Integer> lstNewNetworkId = new ArrayList<Integer>();
TargetAddress lock = persistence.obtainSynchroObject(new TargetAddress(smsSet));
try {
synchronized (lock) {
this.applyMprocRulesOnImsiResponse(smsSet, lstPermFailured, lstRerouted, lstNewNetworkId, networkNode, imsiData);
this.onImsiDrop(smsSet, lstPermFailured, lstRerouted, lstNewNetworkId, networkNode, imsiData);
}
} finally {
persistence.releaseSynchroObject(lock);
}
}
} catch (Throwable e) {
}
if (this.getTotalUnsentMessageCount() == 0) {
setupReportSMDeliveryStatusRequestSuccess(smsSet, true);
smsSet.setStatus(ErrorCode.SUCCESS);
this.markDeliveringIsEnded(true);
} else {
try {
this.sendMtSms(this.getMtFoSMSMAPApplicationContext(mapApplicationContextVersion), MessageProcessingState.firstMessageSending, null, smsSet.getNetworkId());
} catch (SmscProcessingException e) {
String reason = "SmscPocessingException when invoking sendMtSms() from setupMtForwardShortMessageRequest()-firstMessageSending: " + e.toString();
this.logger.severe(reason, e);
ErrorCode smStatus = ErrorCode.SC_SYSTEM_ERROR;
try {
smStatus = ErrorCode.fromInt(e.getSmppErrorCode());
} catch (IllegalArgumentException e1) {
}
this.onDeliveryError(smsSet, ErrorAction.permanentFailure, smStatus, reason, true, null, false, ProcessingType.SS7_MT);
} catch (Throwable e) {
String reason = "Exception when invoking sendMtSms() from setupMtForwardShortMessageRequest()-firstMessageSending: " + e.toString();
this.logger.severe(reason, e);
ErrorCode smStatus = ErrorCode.SC_SYSTEM_ERROR;
this.onDeliveryError(smsSet, ErrorAction.permanentFailure, smStatus, reason, true, null, false, ProcessingType.SS7_MT);
}
}
}
Aggregations