use of org.mobicents.smsc.library.TargetAddress in project smscgateway by RestComm.
the class DeliveryCommonSbb method generateIntermediateReceipts.
/**
* Generating of intermediate receipts for temporary failed messages
*
* @param smsSet
* @param lstTempFailured
*/
protected void generateIntermediateReceipts(SmsSet smsSet, ArrayList<Sms> lstTempFailured) {
if (!smscPropertiesManagement.getReceiptsDisabling() && smscPropertiesManagement.getEnableIntermediateReceipts()) {
for (Sms sms : lstTempFailured) {
// SMPP delivery receipt
int registeredDelivery = sms.getRegisteredDelivery();
if (MessageUtil.isReceiptIntermediate(registeredDelivery)) {
TargetAddress ta = new TargetAddress(sms.getSourceAddrTon(), sms.getSourceAddrNpi(), sms.getSourceAddr(), smsSet.getNetworkId());
Sms receipt = MessageUtil.createReceiptSms(sms, false, ta, smscPropertiesManagement.getOrigNetworkIdForReceipts(), null, true);
this.sendNewGeneratedMessage(receipt, ta);
this.logger.info("Adding an intermediate failure receipt: source=" + receipt.getSourceAddr() + ", dest=" + receipt.getSmsSet().getDestAddr());
}
}
}
}
use of org.mobicents.smsc.library.TargetAddress in project smscgateway by RestComm.
the class DeliveryCommonSbb method applyMprocRulesOnSuccess.
// *********
// applying of mproc rules
/**
* mproc rules applying for delivery phase for success case
*
* @param sms
* @param processingType
*/
protected void applyMprocRulesOnSuccess(Sms sms, ProcessingType processingType) {
// PostDeliveryProcessor - success case
MProcResult mProcResult = MProcManagement.getInstance().applyMProcDelivery(itsMProcRa, sms, false, processingType);
FastList<Sms> addedMessages = mProcResult.getMessageList();
if (addedMessages != null) {
for (FastList.Node<Sms> n = addedMessages.head(), end = addedMessages.tail(); (n = n.getNext()) != end; ) {
Sms smst = n.getValue();
TargetAddress ta = new TargetAddress(smst.getSmsSet().getDestAddrTon(), smst.getSmsSet().getDestAddrNpi(), smst.getSmsSet().getDestAddr(), smst.getSmsSet().getNetworkId());
this.sendNewGeneratedMessage(smst, ta);
if (this.logger.isInfoEnabled()) {
StringBuilder sb = new StringBuilder();
sb.append("Posting of a new message after DeliverySuccess: targetId=");
sb.append(smst.getSmsSet().getTargetId());
sb.append(", sms=");
sb.append(smst);
this.logger.info(sb.toString());
}
}
}
}
use of org.mobicents.smsc.library.TargetAddress in project smscgateway by RestComm.
the class CassandraTest method addingNewMessages.
public long addingNewMessages() throws Exception {
Date dt = new Date();
PreparedStatementCollection psc = sbb.getStatementCollection(dt);
// adding 3 messages for "1111"
TargetAddress lock = this.sbb.obtainSynchroObject(ta1);
long dueSlot;
try {
synchronized (lock) {
Sms sms_a1 = this.createTestSms(1, ta1.getAddr(), id1);
Sms sms_a2 = this.createTestSms(2, ta1.getAddr(), id2);
Sms sms_a3 = this.createTestSms(3, ta1.getAddr(), id3);
dueSlot = this.sbb.c2_getDueSlotForTargetId(psc, ta1.getTargetId());
if (dueSlot == 0 || dueSlot <= sbb.c2_getCurrentDueSlot()) {
dueSlot = sbb.c2_getDueSlotForNewSms();
sbb.c2_updateDueSlotForTargetId(ta1.getTargetId(), dueSlot);
}
sms_a1.setDueSlot(dueSlot);
sms_a2.setDueSlot(dueSlot);
sms_a3.setDueSlot(dueSlot);
sbb.c2_registerDueSlotWriting(dueSlot);
try {
sbb.c2_createRecordCurrent(sms_a1);
sbb.c2_createRecordCurrent(sms_a2);
sbb.c2_createRecordCurrent(sms_a3);
} finally {
sbb.c2_unregisterDueSlotWriting(dueSlot);
}
}
} finally {
this.sbb.obtainSynchroObject(lock);
}
// adding a messages for "1112"
lock = this.sbb.obtainSynchroObject(ta2);
try {
synchronized (lock) {
Sms sms_a1 = this.createTestSms(4, ta2.getAddr(), id4);
sbb.c2_updateDueSlotForTargetId(ta2.getTargetId(), dueSlot);
sms_a1.setDueSlot(dueSlot);
sbb.c2_registerDueSlotWriting(dueSlot);
try {
sbb.c2_createRecordCurrent(sms_a1);
} finally {
sbb.c2_unregisterDueSlotWriting(dueSlot);
}
}
} finally {
this.sbb.obtainSynchroObject(lock);
}
return dueSlot;
}
use of org.mobicents.smsc.library.TargetAddress in project smscgateway by RestComm.
the class CassandraTest method testingOldTimeEncoding.
@Test(groups = { "cassandra" })
public void testingOldTimeEncoding() throws Exception {
if (!this.cassandraDbInited)
return;
this.sbb.setOldShortMessageDbFormat(true);
DataCodingScheme dcsGsm7 = new DataCodingSchemeImpl(0);
DataCodingScheme dcsUcs2 = new DataCodingSchemeImpl(8);
DataCodingScheme dcsGsm8 = new DataCodingSchemeImpl(4);
UserDataHeader udh = new UserDataHeaderImpl();
UserDataHeaderElement informationElement = new ConcatenatedShortMessagesIdentifierImpl(false, 20, 5, 2);
// boolean referenceIs16bit, int reference, int mesageSegmentCount, int
// mesageSegmentNumber
udh.addInformationElement(informationElement);
TargetAddress ta = new TargetAddress(1, 1, "1111", 9);
// GSM7 + UDH
this.testOldFormatMessage(ta, dcsGsm7, "Test eng", udh, 1);
// GSM7
this.testOldFormatMessage(ta, dcsGsm7, "Test eng", null, 0);
// UCS2 + UDH
this.testOldFormatMessage(ta, dcsUcs2, "Test rus ������", udh, 0);
// UCS2
this.testOldFormatMessage(ta, dcsUcs2, "Test rus ������", null, 0);
// GSM8
this.testOldFormatMessage(ta, dcsGsm8, null, udh, 0);
}
use of org.mobicents.smsc.library.TargetAddress in project smscgateway by RestComm.
the class CassandraTest method readAlertMessage.
public void readAlertMessage() throws Exception {
Date dt = new Date();
PreparedStatementCollection psc = sbb.getStatementCollection(dt);
// reading "1112" for Alert
TargetAddress lock = this.sbb.obtainSynchroObject(ta2);
try {
synchronized (lock) {
long dueSlot = this.sbb.c2_getDueSlotForTargetId(psc, ta2.getTargetId());
if (dueSlot == 0) {
fail("Bad dueSlot for reading of ta2");
}
sbb.c2_registerDueSlotWriting(dueSlot);
SmsSet smsSet;
try {
smsSet = sbb.c2_getRecordListForTargeId(dueSlot, ta2.getTargetId());
ArrayList<SmsSet> lst0 = new ArrayList<SmsSet>();
lst0.add(smsSet);
ArrayList<SmsSet> lst = sbb.c2_sortRecordList(lst0);
} finally {
sbb.c2_unregisterDueSlotWriting(dueSlot);
}
assertEquals(smsSet.getSmsCount(), 1);
Sms sms = smsSet.getSms(0);
assertEquals(sms.getDueSlot(), dueSlot);
this.checkTestSms(4, sms, id4, false);
sbb.c2_updateInSystem(sms, DBOperations.IN_SYSTEM_INPROCESS, false);
}
} finally {
this.sbb.obtainSynchroObject(lock);
}
}
Aggregations