private void doSetDestCluster(SmsSet smsSet) { // Step 1: Check first if this SMS is for SMPP SmsRouteManagement smsRouteManagement = SmsRouteManagement.getInstance(); //Quick and dirty fix for SMSC-171 String orignatingEsmeName = smsSet.getSms(0).getOrigEsmeName(); String destClusterName = smsRouteManagement.getEsmeClusterName(smsSet.getDestAddrTon(), smsSet.getDestAddrNpi(), smsSet.getDestAddr(), orignatingEsmeName, smsSet.getNetworkId()); // Step 2: If no SMPP's found, check if its for SIP // TODO: we possibly do not need to send a SIP-originated message back to SIP if (destClusterName == null) { destClusterName = smsRouteManagement.getSipClusterName(smsSet.getDestAddrTon(), smsSet.getDestAddrNpi(), smsSet.getDestAddr(), smsSet.getNetworkId()); if (destClusterName == null) { // Step 2: If no SIP's found, its for SS7 smsSet.setType(SmType.SMS_FOR_SS7); } else { smsSet.setType(SmType.SMS_FOR_SIP); } } else { // smsSet.setType(destClusterName != null ? SmType.SMS_FOR_ESME // : SmType.SMS_FOR_SS7); smsSet.setType(SmType.SMS_FOR_ESME); } smsSet.setDestClusterName(destClusterName); }
/** * Creating a new SmsSet for Sms * @param sms */ public static void createNewSmsSetForSms(Sms sms) { SmsSet smsSet = new SmsSet(); smsSet.setDestAddr(sms.getSmsSet().getDestAddr()); smsSet.setDestAddrNpi(sms.getSmsSet().getDestAddrNpi()); smsSet.setDestAddrTon(sms.getSmsSet().getDestAddrTon()); smsSet.setCorrelationId(sms.getSmsSet().getCorrelationId()); smsSet.setNetworkId(sms.getSmsSet().getNetworkId()); smsSet.addSms(sms); }
public String getLstSmsSetWithBigMessageCountState() { if (this.lstSmsSetWithBigMessageCount.size() == 0) return null; try { StringBuilder sb = new StringBuilder(); for (FastMap.Entry<String, SmsSet> n = this.lstSmsSetWithBigMessageCount.head(), end = this.lstSmsSetWithBigMessageCount .tail(); (n = n.getNext()) != end && n != null;) { SmsSet smsSet = n.getValue(); sb.append(smsSet.getTargetId()); sb.append(" - "); sb.append(smsSet.getSmsCount()); sb.append(" - "); sb.append(smsSet.getSmsCountWithoutDelivered()); sb.append("\n"); } return sb.toString(); } catch (Throwable e) { return "Exception when getLstSmsSetWithBigMessageCountState() = " + e.getMessage(); } }
public TargetAddress(SmsSet smsSet) { this.addrTon = smsSet.getDestAddrTon(); this.addrNpi = smsSet.getDestAddrNpi(); this.addr = smsSet.getDestAddr(); this.networkId = smsSet.getNetworkId(); this.targetId = formTargetId(); }
public static Sms createSmsStatusReport(Sms sms, boolean delivered, TargetAddress ta, boolean origNetworkIdForReceipts) { Sms smsStatusReport = new Sms(); smsStatusReport.setDbId(UUID.randomUUID()); smsStatusReport.setSourceAddr(sms.getSmsSet().getDestAddr()); smsStatusReport.setSourceAddrNpi(sms.getSmsSet().getDestAddrNpi()); smsStatusReport.setSourceAddrTon(sms.getSmsSet().getDestAddrTon()); else { if (sms.getSmsSet().getStatus() == ErrorCode.VALIDITY_PERIOD_EXPIRED) { statusVal = Status.SMS_VALIDITY_PERIOD_EXPIRED; } else { smsStatusReport.setSubmitDate(sms.getSubmitDate()); SmsSet backSmsSet = new SmsSet(); backSmsSet.setDestAddr(ta.getAddr()); backSmsSet.setDestAddrNpi(ta.getAddrNpi()); backSmsSet.setDestAddrTon(ta.getAddrTon()); if (origNetworkIdForReceipts) backSmsSet.setNetworkId(sms.getOrigNetworkId()); else backSmsSet.setNetworkId(sms.getSmsSet().getNetworkId()); backSmsSet.addSms(smsStatusReport);
SmsSet smsSet0 = new SmsSet(); smsSet0.setDestAddr(addr); smsSet0.setDestAddrNpi(addrNpi); smsSet0.setDestAddrTon(addrTon); smsSet0.setNetworkId(networkId); SmsSet smsSet1 = SmsSetCache.getInstance().getProcessingSmsSet(smsSet0.getTargetId()); if (smsSet1 != null) { dueSlot = pers.c2_getDueSlotForTargetId(smsSet0.getTargetId()); try { if (dueSlot != 0 && dueSlot > pers.c2_getCurrentDueSlot()) { SmsSet smsSet = pers.c2_getRecordListForTargeId(dueSlot, smsSet0.getTargetId()); if (smsSet != null) { if (logger.isInfoEnabled()) { logger.info(String .format("\nReceived AlertServiceCentre for MSISDN=%s, SmsSet was loaded with %d messages", addr, smsSet.getSmsCount())); for (int i1 = 0; i1 < smsSet.getSmsCount(); i1++) { Sms sms = smsSet.getSms(i1); sms.setInvokedByAlert(true); smsSet = lst.get(0); smsSet.setProcessingStarted(); this.scheduler.injectSmsDatabase(smsSet);
boolean addedPacket1) throws PersistenceException { boundStatement.setUUID(Schema.COLUMN_ID, sms.getDbId()); boundStatement.setString(Schema.COLUMN_TARGET_ID, sms.getSmsSet().getTargetId()); if (addedNetworkId) { boundStatement.setInt(Schema.COLUMN_NETWORK_ID, sms.getSmsSet().getNetworkId()); boundStatement.setString(Schema.COLUMN_ADDR_DST_DIGITS, sms.getSmsSet().getDestAddr()); boundStatement.setInt(Schema.COLUMN_ADDR_DST_TON, sms.getSmsSet().getDestAddrTon()); boundStatement.setInt(Schema.COLUMN_ADDR_DST_NPI, sms.getSmsSet().getDestAddrNpi()); boundStatement.setInt(Schema.COLUMN_DUE_DELAY, sms.getSmsSet().getDueDelay()); if (sms.getSmsSet().getStatus() != null) boundStatement.setInt(Schema.COLUMN_SM_STATUS, sms.getSmsSet().getStatus().getCode()); else boundStatement.setToNull(Schema.COLUMN_SM_STATUS); boundStatement.setBool(Schema.COLUMN_ALERTING_SUPPORTED, sms.getSmsSet().isAlertingSupported()); if (sms.getSmsSet().getCorrelationId() != null) { if (addedCorrId) { boundStatement.setString(Schema.COLUMN_CORR_ID, sms.getSmsSet().getCorrelationId()); } else { boundStatement.setString(Schema.COLUMN_IMSI, sms.getSmsSet().getCorrelationId()); if (sms.getSmsSet().getLocationInfoWithLMSI() != null && sms.getSmsSet().getLocationInfoWithLMSI().getNetworkNodeNumber() != null) { boundStatement.setString(Schema.COLUMN_NNN_DIGITS, sms.getSmsSet().getLocationInfoWithLMSI() .getNetworkNodeNumber().getAddress()); boundStatement.setInt(Schema.COLUMN_NNN_AN, sms.getSmsSet().getLocationInfoWithLMSI().getNetworkNodeNumber() .getAddressNature().getIndicator());
smsSet = new SmsSet(); smsSet.setDestAddr(destAddr); smsSet.setDestAddrTon(destAddrTon); smsSet.setDestAddrNpi(destAddrNpi); smsSet.setInSystem(inSystem); smsSet.setStatus(ErrorCode.fromInt(row.getInt(Schema.COLUMN_SM_STATUS))); smsSet.setNetworkId(row.getInt(Schema.COLUMN_NETWORK_ID)); } else { String tagId = row.getString(Schema.COLUMN_TARGET_ID); try { int networkId = Integer.parseInt(s1); smsSet.setNetworkId(networkId); } catch (Exception e) { smsSet.setCorrelationId(row.getString(Schema.COLUMN_CORR_ID)); else smsSet.setCorrelationId(row.getString(Schema.COLUMN_IMSI)); if (dueDelay > smsSet.getDueDelay()) smsSet.setDueDelay(dueDelay); smsSet.setAlertingSupported(true); smsSet.addSms(sms);
public static Sms createReceiptSms(Sms sms, boolean delivered, TargetAddress ta, boolean origNetworkIdForReceipts, String extraString, boolean tempFailure) { Sms receipt = createReceiptSms(sms, delivered, extraString, tempFailure); SmsSet backSmsSet = new SmsSet(); backSmsSet.setDestAddr(ta.getAddr()); backSmsSet.setDestAddrNpi(ta.getAddrNpi()); backSmsSet.setDestAddrTon(ta.getAddrTon()); if (origNetworkIdForReceipts) backSmsSet.setNetworkId(sms.getOrigNetworkId()); else backSmsSet.setNetworkId(sms.getSmsSet().getNetworkId()); backSmsSet.addSms(receipt); // receipt.setStored(true); return receipt; }
SmsSet smsSet2 = null; try { smsSet2 = res.get(smsSet.getTargetId()); } catch (Throwable e) { int dd = 0; smsSet2.addSms(smsSet.getSms(0)); if (smsSet2.getCorrelationId() == null) { smsSet2.setCorrelationId(smsSet.getCorrelationId()); res.put(smsSet.getTargetId(), smsSet); smsSet.resortSms(); SmsSet smsSet2; synchronized (lock) { smsSet2 = SmsSetCache.getInstance().getProcessingSmsSet(smsSet.getTargetId()); if (smsSet2 != null) { if (smsSet2.getLastUpdateTime().after(timeOutDate)) { smsSet2.addSmsSet(smsSet); logger.warn("Timeout of SmsSet in ProcessingSmsSet: targetId=" + smsSet2.getTargetId() + ", messageCount=" + smsSet2.getSmsCount()); smsSet2 = smsSet; SmsSetCache.getInstance().addProcessingSmsSet(smsSet2.getTargetId(), smsSet2, processingSmsSetTimeout); SmsSetCache.getInstance().addProcessingSmsSet(smsSet2.getTargetId(), smsSet2,
sms.setDefaultMsgId(0); SmsSet smsSet = new SmsSet(); smsSet.setDestAddr("222"); smsSet.setDestAddrNpi(1); smsSet.setDestAddrTon(1); smsSet.setNetworkId(0); smsSet.setCorrelationId(null); smsSet.addSms(sms);
.append(smsEvent.getSourceAddrNpi()) .append(CdrGenerator.CDR_SEPARATOR) .append(smsEvent.getSmsSet().getDestAddr()) .append(CdrGenerator.CDR_SEPARATOR) .append(smsEvent.getSmsSet().getDestAddrTon()) .append(CdrGenerator.CDR_SEPARATOR) .append(smsEvent.getSmsSet().getDestAddrNpi()) .append(CdrGenerator.CDR_SEPARATOR) .append(status) .append((receiptLocalMessageId != null && receiptLocalMessageId == -1) ? "xxxx" : smsEvent.getReceiptLocalMessageId()) .append(CdrGenerator.CDR_SEPARATOR) .append(smsEvent.getSmsSet().getLocationInfoWithLMSI() != null ? smsEvent.getSmsSet().getLocationInfoWithLMSI() .getNetworkNodeNumber().getAddress() : null) .append(CdrGenerator.CDR_SEPARATOR) .append(smsEvent.getSmsSet().getImsi()) .append(CdrGenerator.CDR_SEPARATOR) .append(smsEvent.getSmsSet().getCorrelationId()) .append(CdrGenerator.CDR_SEPARATOR) .append(smsEvent.getOriginatorSccpAddress()) .append(smsEvent.getOrigNetworkId()) .append(CdrGenerator.CDR_SEPARATOR) .append(smsEvent.getSmsSet().getNetworkId()) .append(CdrGenerator.CDR_SEPARATOR) .append(smsEvent.getMprocNotes())
public void addSmsSet(SmsSet smsSet) { this.updateLastUpdateTime(); for (int i2 = 0; i2 < al.size(); i2++) { Sms smsx = al.get(i2); if (this.checkSmsPresent(smsx)) { al.remove(i2); i2--; ArrayList<Sms> al2 = segm.smsList; for (int i2 = 0; i2 < al.size(); i2++) { Sms smsx = smsSet.getSms(i2); if (!this.checkSmsPresent(smsx)) { smsx.setSmsSet(this); al2.add(smsx); SmsSetCache.getInstance().registerSmsSetWithBigMessageCount(this.getTargetId(), this);
public static Sms createReceiptSms(Sms sms, boolean delivered, String extraString, boolean tempFailure) { Sms receipt = new Sms(); receipt.setDbId(UUID.randomUUID()); receipt.setSourceAddr(sms.getSmsSet().getDestAddr()); receipt.setSourceAddrNpi(sms.getSmsSet().getDestAddrNpi()); receipt.setSourceAddrTon(sms.getSmsSet().getDestAddrTon()); receipt.setSubmitDate(sms.getSubmitDate()); receipt.setMessageId(sms.getMessageId()); Date validityPeriod = MessageUtil.addHours(new Date(), 24); receipt.setValidityPeriod(validityPeriod); String rcpt = createDeliveryReceiptMessage(sms.getMessageIdText(), sms.getSubmitDate(), new Timestamp(System.currentTimeMillis()), sms.getSmsSet().getStatus().getCode(), sms.getShortMessageText(), delivered, extraString, tempFailure); // TODO: now we are sending all in GSM7 encoding receipt.setDataCoding(0); receipt.setShortMessageText(rcpt); receipt.setReceiptLocalMessageId(sms.getMessageId()); receipt.setOriginationType(OriginationType.LOCAL_ORIG); receipt.setEsmClass(ESME_DELIVERY_ACK | (sms.getEsmClass() & 0x03)); return receipt; }
try { synchronized (lock) { SmsSet smsSet2 = SmsSetCache.getInstance().getProcessingSmsSet(smsSet.getTargetId()); if (smsSet2 != null) { if (smsSet2.getLastUpdateTime().after(timeOutDate)) { smsSet2.addSmsSet(smsSet); logger.warn("Timeout of SmsSet in ProcessingSmsSet: targetId=" + smsSet2.getTargetId() + ", messageCount=" + smsSet2.getSmsCount()); smsSet2 = smsSet; SmsSetCache.getInstance().addProcessingSmsSet(smsSet2.getTargetId(), smsSet2, processingSmsSetTimeout); SmsSetCache.getInstance().addProcessingSmsSet(smsSet2.getTargetId(), smsSet2, processingSmsSetTimeout);
cnt++; SmType destType = sms.getSmsSet().getType(); if (destType == null || destType == SmType.SMS_FOR_SS7) { for (PreparedStatementCollection psc : lstPsc) { dueSlot = this.c2_getDueSlotForTargetId(psc, sms.getSmsSet().getTargetId()); if (dueSlot != 0) break; this.c2_updateDueSlotForTargetId_WithTableCleaning(sms.getSmsSet().getTargetId(), dueSlot); if (dueSlot2 != dueSlot) { dueSlot = dueSlot2; this.c2_updateDueSlotForTargetId_WithTableCleaning(sms.getSmsSet().getTargetId(), dueSlot); this.c2_updateDueSlotForTargetId_WithTableCleaning(sms.getSmsSet().getTargetId(), dueSlot); logger.warn("5 retries of c2_scheduleMessage fails for targetId=" + sms.getSmsSet().getTargetId());
@Override public void updateMessageDestAddr(MProcMessage message, String newDigits) throws MProcRuleException { MProcUtility.checkDestAddr(newDigits); MProcMessageImpl msg = (MProcMessageImpl) message; Sms sms = msg.getSmsContent(); sms.getSmsSet().setDestAddr(newDigits); sms.getSmsSet().setCorrelationId(null); }
@Override public String getDestAddr() { return sms.getSmsSet().getDestAddr(); }
public Sms c2_getRecordArchiveForMessageId(long messageId) throws PersistenceException { Sms sms = SmsSetCache.getInstance().getDeliveredMsgValue(messageId); if (sms != null) return sms; SmsSet result = null; try { // first step - today search Date date = new Date(); PreparedStatementCollection psc = getStatementCollection(date); result = this.doGetArchiveMsg(messageId, psc); if (result == null) { // second step - yesterday search Date date2 = new Date(date.getTime() - 1000 * 3600 * 24); psc = getStatementCollection(date2); result = this.doGetArchiveMsg(messageId, psc); } } catch (Exception e1) { String msg = "Failed getRecordArchiveForMessageId()"; throw new PersistenceException(msg, e1); } if (result != null) return result.getSms(0); else return null; }
public int getSmsCountWithoutDelivered() { int res = (int) (getSmsCount() - markedSmsAsDelivered); if (res > 0) return res; else return 0; }