Search in sources :

Example 1 with DeliveryReceiptData

use of org.mobicents.smsc.mproc.DeliveryReceiptData in project smscgateway by RestComm.

the class CdrDetailedGenerator method generateDetailedCdr.

public static void generateDetailedCdr(boolean mcDeliveryReceipt, String shortMessageText, TlvSet tlvSet, Long tsA, Long tsB, Long tsC, Long messageId, String origEsmeName, EventType eventType, ErrorCode errorCode, String messageType, long statusCode, int mprocRuleId, String sourceAddrAndPort, String destAddrAndPort, int seqNumber, boolean generateReceiptCdr, boolean generateDetailedCdr) {
    if (!generateDetailedCdr) {
        return;
    }
    if (!generateReceiptCdr && mcDeliveryReceipt) {
        // we do not generate CDR's for receipt if generateReceiptCdr option is off
        return;
    }
    String timestamp = DATE_FORMAT.format(new Date());
    String dlrStatus = null;
    String origMessageID = null;
    DeliveryReceiptData deliveryReceiptData = null;
    if (shortMessageText != null && tlvSet != null) {
        deliveryReceiptData = MessageUtil.parseDeliveryReceipt(shortMessageText, tlvSet);
        if (deliveryReceiptData != null) {
            dlrStatus = deliveryReceiptData.getStatus();
            if (deliveryReceiptData.getTlvMessageState() != null) {
                int tlvMessageState = deliveryReceiptData.getTlvMessageState();
                if (tlvMessageState != 0 && dlrStatus != null)
                    if (!dlrStatus.substring(0, 4).equals(MessageState.fromInt(tlvMessageState).toString().substring(0, 5))) {
                        dlrStatus = "err";
                    }
            }
            origMessageID = deliveryReceiptData.getMessageId();
        }
    }
    String destIP = null, destPort = null;
    if (destAddrAndPort != null) {
        String[] parts = destAddrAndPort.split(":");
        destIP = parts[0];
        destPort = parts[1];
    }
    String sourceIP = null, sourcePort = null;
    if (sourceAddrAndPort != null) {
        String[] parts = sourceAddrAndPort.split(":");
        sourceIP = parts[0];
        sourcePort = parts[1];
    }
    String timestampA = null, timestampB = null, timestampC = null;
    if (tsA != null && tsA != 0)
        timestampA = DATE_FORMAT.format(tsA);
    if (tsB != null && tsB != 0)
        timestampB = DATE_FORMAT.format(tsB);
    if (tsC != null && tsC != 0)
        timestampC = DATE_FORMAT.format(tsC);
    StringBuilder sb = new StringBuilder();
    appendObject(sb, timestamp);
    appendObject(sb, eventType);
    appendObject(sb, errorCode);
    appendObject(sb, messageType);
    appendNumber(sb, statusCode);
    appendNumber(sb, messageId);
    appendObject(sb, origMessageID);
    appendObject(sb, dlrStatus);
    appendNumber(sb, Long.valueOf(mprocRuleId));
    appendObject(sb, origEsmeName);
    appendObject(sb, timestampA);
    appendObject(sb, timestampB);
    appendObject(sb, timestampC);
    appendObject(sb, sourceIP);
    appendObject(sb, sourcePort);
    appendObject(sb, destIP);
    appendObject(sb, destPort);
    appendNumber(sb, Long.valueOf(seqNumber));
    CdrDetailedGenerator.generateDetailedCdr(sb.toString());
}
Also used : DeliveryReceiptData(org.mobicents.smsc.mproc.DeliveryReceiptData) Date(java.util.Date)

Example 2 with DeliveryReceiptData

use of org.mobicents.smsc.mproc.DeliveryReceiptData in project smscgateway by RestComm.

the class ParseDeliveryReceiptTest method testParseDeliveryReceipt.

@Test(groups = { "ParseDeliveryReceipt" })
public void testParseDeliveryReceipt() {
    String msg = "id:0512249005 sub:001 dlvrd:000 submit date:1609051327 done date:1609051337 stat:ENROUTE err:054 text:xxssxx";
    String msg2 = "id:0512249005 sub:001 dlvrd:000 submit date:1609051327 done date:1609051337 stat:ENROUTE err:054 text:";
    String msg3 = "id:1010d937-8f43-4754-9dd8-6e987cda32fa sub:001 dlvrd:000 submit date:161008120127 done date:1610081500 stat:UNDELIV err:004 text:exampleMessage02";
    String msg4 = "id:1479978899.393701000100 sub:001 dlvrd:001 submit date:161124101732 done date:161124101735 stat:DELIVRD err:000";
    String msg_issue34604 = "id:07EE36CBE3 sub:001 dlvrd:001 submit date:1708071603 done date:1708071603 stat:UNDELIV err:106 Text:-";
    Date d1 = new Date(116, 9 - 1, 5, 13, 27, 0);
    Date d2 = new Date(116, 9 - 1, 5, 13, 37, 0);
    Date d3 = new Date(116, 10 - 1, 8, 12, 1, 27);
    Date d4 = new Date(116, 10 - 1, 8, 15, 0, 0);
    Date d5 = new Date(116, 11 - 1, 24, 10, 17, 32);
    Date d6 = new Date(116, 11 - 1, 24, 10, 17, 35);
    TlvSet tlvSet = new TlvSet();
    DeliveryReceiptData deliveryReceiptData = MessageUtil.parseDeliveryReceipt(msg, tlvSet);
    assertEquals(deliveryReceiptData.getMessageId(), "0512249005");
    assertEquals(deliveryReceiptData.getMsgSubmitted(), 1);
    assertEquals(deliveryReceiptData.getMsgDelivered(), 0);
    assertTrue(deliveryReceiptData.getSubmitDate().equals(d1));
    assertTrue(deliveryReceiptData.getDoneDate().equals(d2));
    assertEquals(deliveryReceiptData.getStatus(), "ENROUTE");
    assertEquals(deliveryReceiptData.getError(), 54);
    assertEquals(deliveryReceiptData.getText(), "xxssxx");
    assertNull(deliveryReceiptData.getTlvReceiptedMessageId());
    assertNull(deliveryReceiptData.getTlvMessageState());
    deliveryReceiptData = MessageUtil.parseDeliveryReceipt(msg2, tlvSet);
    assertEquals(deliveryReceiptData.getText(), "");
    String rcptId = "00ffab10";
    byte[] data = rcptId.getBytes();
    Tlv tlv = new Tlv(SmppConstants.TAG_RECEIPTED_MSG_ID, data, "rec_msg_id");
    tlvSet.addOptionalParameter(tlv);
    byte[] data2 = new byte[] { 2 };
    Tlv tlv2 = new Tlv(SmppConstants.TAG_MSG_STATE, data2, "msg_state");
    tlvSet.addOptionalParameter(tlv2);
    assertNull(deliveryReceiptData.getTlvReceiptedMessageId());
    assertNull(deliveryReceiptData.getTlvMessageState());
    deliveryReceiptData = MessageUtil.parseDeliveryReceipt(msg3, tlvSet);
    assertEquals(deliveryReceiptData.getMessageId(), "1010d937-8f43-4754-9dd8-6e987cda32fa");
    assertEquals(deliveryReceiptData.getMsgSubmitted(), 1);
    assertEquals(deliveryReceiptData.getMsgDelivered(), 0);
    assertTrue(deliveryReceiptData.getSubmitDate().equals(d3));
    assertTrue(deliveryReceiptData.getDoneDate().equals(d4));
    assertEquals(deliveryReceiptData.getStatus(), "UNDELIV");
    assertEquals(deliveryReceiptData.getError(), 4);
    assertEquals(deliveryReceiptData.getText(), "exampleMessage02");
    assertEquals(deliveryReceiptData.getTlvReceiptedMessageId(), rcptId);
    assertEquals((int) deliveryReceiptData.getTlvMessageState(), 2);
    String rcptId2 = "1479978899.393701000100@1154905154";
    tlvSet.clearAllOptionalParameter();
    data = rcptId2.getBytes();
    tlv = new Tlv(SmppConstants.TAG_RECEIPTED_MSG_ID, data, "rec_msg_id");
    tlvSet.addOptionalParameter(tlv);
    data2 = new byte[] { 2 };
    tlv2 = new Tlv(SmppConstants.TAG_MSG_STATE, data2, "msg_state");
    tlvSet.addOptionalParameter(tlv2);
    deliveryReceiptData = MessageUtil.parseDeliveryReceipt(msg4, tlvSet);
    assertEquals(deliveryReceiptData.getMessageId(), "1479978899.393701000100");
    assertEquals(deliveryReceiptData.getMsgSubmitted(), 1);
    assertEquals(deliveryReceiptData.getMsgDelivered(), 1);
    assertTrue(deliveryReceiptData.getSubmitDate().equals(d5));
    assertTrue(deliveryReceiptData.getDoneDate().equals(d6));
    assertEquals(deliveryReceiptData.getStatus(), "DELIVRD");
    assertEquals(deliveryReceiptData.getError(), 0);
    assertNull(deliveryReceiptData.getText());
    assertEquals(deliveryReceiptData.getTlvReceiptedMessageId(), rcptId2);
    assertEquals((int) deliveryReceiptData.getTlvMessageState(), 2);
    tlvSet.clearAllOptionalParameter();
    rcptId = "07EE36CBE3";
    data = rcptId.getBytes();
    tlv = new Tlv(SmppConstants.TAG_RECEIPTED_MSG_ID, data, "rec_msg_id");
    tlvSet.addOptionalParameter(tlv);
    data2 = new byte[] { 5 };
    tlv2 = new Tlv(SmppConstants.TAG_MSG_STATE, data2, "msg_state");
    tlvSet.addOptionalParameter(tlv2);
    byte[] data3 = new byte[] { 0 };
    Tlv tlv3 = new Tlv(SmppConstants.TAG_NETWORK_ERROR_CODE, data3, "netw_err_code");
    tlvSet.addOptionalParameter(tlv3);
    deliveryReceiptData = MessageUtil.parseDeliveryReceipt(msg_issue34604, tlvSet);
    assertEquals(deliveryReceiptData.getMessageId(), "07EE36CBE3");
    assertEquals(deliveryReceiptData.getStatus(), "UNDELIV");
    assertEquals(deliveryReceiptData.getError(), 106);
    assertEquals(deliveryReceiptData.getText(), "-");
    assertEquals(deliveryReceiptData.getTlvReceiptedMessageId(), rcptId);
    assertEquals((int) deliveryReceiptData.getTlvMessageState(), 5);
}
Also used : DeliveryReceiptData(org.mobicents.smsc.mproc.DeliveryReceiptData) TlvSet(org.restcomm.smpp.parameter.TlvSet) Date(java.util.Date) Tlv(com.cloudhopper.smpp.tlv.Tlv) Test(org.testng.annotations.Test)

Example 3 with DeliveryReceiptData

use of org.mobicents.smsc.mproc.DeliveryReceiptData in project smscgateway by RestComm.

the class TxSmppServerSbb method processSms.

private void processSms(Sms sms0, PersistenceRAInterface store, Esme esme, SubmitSm eventSubmit, DataSm eventData, SubmitMulti eventSubmitMulti, IncomingMessageType incomingMessageType, String messageType, int seqNumber) throws SmscProcessingException {
    sms0.setTimestampA(System.currentTimeMillis());
    if (logger.isInfoEnabled()) {
        logger.info(String.format("\nReceived %s to ESME: %s, sms=%s", incomingMessageType.toString(), esme.getName(), sms0.toString()));
    }
    this.checkSmscState(sms0, smscCongestionControl, SubmitCommonSbb.MaxActivityCountFactor.factor_12);
    boolean withCharging = false;
    switch(smscPropertiesManagement.getTxSmppChargingType()) {
        case Selected:
            withCharging = esme.isChargingEnabled();
            break;
        case All:
            withCharging = true;
            break;
    }
    if (withCharging && (eventSubmit == null && eventData == null)) {
        // we do not support of charging of submit_multi
        String msg = "SMSC GW does not support charging for sumbit_multi and deliver_sm, a message is rejected";
        logger.warning(msg);
        SmscProcessingException e = new SmscProcessingException(msg, SmppConstants.STATUS_PROHIBITED, MAPErrorCode.systemFailure, SmscProcessingException.HTTP_ERROR_CODE_NOT_SET, null, SmscProcessingException.INTERNAL_ERROR_INJECT_STORE_AND_FORWARD_FAST);
        e.setSkipErrorLogging(true);
        throw e;
    }
    // transactional mode / or charging request
    boolean isTransactional = (eventSubmit != null || eventData != null) && MessageUtil.isTransactional(sms0);
    if (isTransactional || withCharging) {
        MessageDeliveryResultResponseSmpp messageDeliveryResultResponse = new MessageDeliveryResultResponseSmpp(!isTransactional, this.smppServerSessions, esme, eventSubmit, eventData, sms0.getMessageId());
        sms0.setMessageDeliveryResultResponse(messageDeliveryResultResponse);
    }
    // delivery receipt transit - replacing of messageId in delivery receipt with local messageId
    if (smscPropertiesManagement.getIncomeReceiptsProcessing() && MessageUtil.isDeliveryReceipt(sms0)) {
        DeliveryReceiptData deliveryReceiptData = MessageUtil.parseDeliveryReceipt(sms0.getShortMessageText(), sms0.getTlvSet());
        if (deliveryReceiptData != null) {
            String clusterName = esme.getClusterName();
            String dlvTlvMessageId = deliveryReceiptData.getTlvReceiptedMessageId();
            String dlvMessageId = deliveryReceiptData.getMessageId();
            Long messageId = null;
            String drFormat = null;
            if (dlvTlvMessageId != null) {
                try {
                    messageId = persistence.c2_getMessageIdByRemoteMessageId(dlvTlvMessageId, clusterName);
                    drFormat = "dlvTlvMessageId";
                } catch (PersistenceException e) {
                    logger.severe("Exception when running c2_getMessageIdByRemoteMessageId() - 1: " + e.getMessage(), e);
                }
            }
            if (messageId == null) {
                // trying to parse as a hex format
                try {
                    messageId = persistence.c2_getMessageIdByRemoteMessageId(dlvMessageId, clusterName);
                    drFormat = "dlvMessageId";
                } catch (PersistenceException e) {
                    logger.severe("Exception when running c2_getMessageIdByRemoteMessageId() - 2: " + e.getMessage(), e);
                } catch (NumberFormatException e) {
                }
            }
            if (messageId != null) {
                // we found in local cache / database a reference to an origin
                logger.info("Remote delivery receipt: clusterName=" + clusterName + ", dlvMessageId=" + dlvMessageId + ", dlvTlvMessageId=" + dlvTlvMessageId + ", receipt=" + sms0.getShortMessageText() + ", drFormat=" + drFormat);
                if (dlvTlvMessageId != null) {
                    sms0.setReceiptOrigMessageId(dlvTlvMessageId);
                    sms0.getTlvSet().removeOptionalParameter(SmppConstants.TAG_RECEIPTED_MSG_ID);
                } else {
                    sms0.setReceiptOrigMessageId(dlvMessageId);
                }
                sms0.setReceiptLocalMessageId(messageId);
                String messageIdStr = MessageUtil.createMessageIdString(messageId);
                String updatedReceiptText = MessageUtil.createDeliveryReceiptMessage(messageIdStr, deliveryReceiptData.getSubmitDate(), deliveryReceiptData.getDoneDate(), deliveryReceiptData.getError(), deliveryReceiptData.getText(), deliveryReceiptData.getStatus().equals(MessageUtil.DELIVERY_ACK_STATE_DELIVERED), null, deliveryReceiptData.getStatus().equals(MessageUtil.DELIVERY_ACK_STATE_ENROUTE));
                sms0.setShortMessageText(updatedReceiptText);
            } else {
                // we have not found a local message - marking as unrecognized receipt
                logger.warning("Remote delivery receipt - but no original message is found in local cache: clusterName=" + clusterName + ", dlvMessageId=" + dlvMessageId + ", dlvTlvMessageId=" + dlvTlvMessageId + ", receipt=" + sms0.getShortMessageText() + ", drFormat=" + drFormat);
                sms0.setReceiptLocalMessageId(-1L);
            }
        }
    }
    this.forwardMessage(sms0, withCharging, smscStatAggregator, messageType, seqNumber);
}
Also used : DeliveryReceiptData(org.mobicents.smsc.mproc.DeliveryReceiptData) PersistenceException(org.mobicents.smsc.cassandra.PersistenceException)

Example 4 with DeliveryReceiptData

use of org.mobicents.smsc.mproc.DeliveryReceiptData in project smscgateway by RestComm.

the class MProcRuleDefaultImpl method matches.

private boolean matches(MProcMessage message) {
    if (destTonMask != -1 && destTonMask != message.getDestAddrTon())
        return false;
    if (destNpiMask != -1 && destNpiMask != message.getDestAddrNpi())
        return false;
    if (destDigMaskPattern != null) {
        if (message.getDestAddr() == null)
            return false;
        Matcher m = this.destDigMaskPattern.matcher(message.getDestAddr());
        if (!m.matches())
            return false;
    }
    if (sourceTonMask != -1 && sourceTonMask != message.getSourceAddrTon())
        return false;
    if (sourceNpiMask != -1 && sourceNpiMask != message.getSourceAddrNpi())
        return false;
    if (sourceDigMaskPattern != null) {
        if (message.getSourceAddr() == null)
            return false;
        Matcher m = this.sourceDigMaskPattern.matcher(message.getSourceAddr());
        if (!m.matches())
            return false;
    }
    if (originatingMask != null && originatingMask != message.getOriginationType())
        return false;
    if (networkIdMask != -1 && networkIdMask != message.getNetworkId())
        return false;
    if (originNetworkIdMask != -1 && originNetworkIdMask != message.getOrigNetworkId())
        return false;
    if (receiptNetworkIdMask != -1) {
        boolean matched = false;
        if (message.isDeliveryReceipt()) {
            Long receiptLocalMessageId = message.getReceiptLocalMessageId();
            DeliveryReceiptData deliveryReceiptData = message.getDeliveryReceiptData();
            if (receiptLocalMessageId != null && deliveryReceiptData != null) {
                MProcMessage sentMsg = message.getOriginMessageForDeliveryReceipt(receiptLocalMessageId);
                if (sentMsg != null) {
                    if (receiptNetworkIdMask == sentMsg.getOrigNetworkId())
                        matched = true;
                }
            }
        }
        if (!matched)
            return false;
    }
    if (origEsmeNameMaskPattern != null) {
        if (message.getOrigEsmeName() == null)
            return false;
        Matcher m = this.origEsmeNameMaskPattern.matcher(message.getOrigEsmeName());
        if (!m.matches())
            return false;
    }
    if (originatorSccpAddressMaskPattern != null) {
        if (message.getOriginatorSccpAddress() == null)
            return false;
        Matcher m = this.originatorSccpAddressMaskPattern.matcher(message.getOriginatorSccpAddress());
        if (!m.matches())
            return false;
    }
    if (imsiDigitsMaskPattern != null) {
        if (message.getImsiDigits() == null)
            return false;
        Matcher m = this.imsiDigitsMaskPattern.matcher(message.getImsiDigits());
        if (!m.matches())
            return false;
    }
    if (nnnDigitsMaskPattern != null) {
        if (message.getNnnDigits() == null)
            return false;
        Matcher m = this.nnnDigitsMaskPattern.matcher(message.getNnnDigits());
        if (!m.matches())
            return false;
    }
    if (processingType != null && processingType != message.getProcessingType())
        return false;
    if (errorCodePattern != null) {
        if (!this.errorCodePattern.containsKey(message.getErrorCode()))
            return false;
    }
    if (this.originatorSccpAddressMask != null && this.originatorSccpAddressMask.length() > 0 && !this.originatorSccpAddressMask.equals("-1") && message.getOriginatorSccpAddress() != null && message.getOriginatorSccpAddress().length() > 0 && this.originatorSccpAddressMask.charAt(0) != message.getOriginatorSccpAddress().charAt(0))
        return false;
    // check tlv
    if ((this.tlvTagToMatch != -1 && this.tlvValueTypeToMatch != null && tlvValueToMatch != null && !tlvValueToMatch.isEmpty())) {
        TlvSet tlvSet = message.getTlvSet();
        if (tlvSet.hasOptionalParameter(this.tlvTagToMatch)) {
            Tlv tlv = tlvSet.getOptionalParameter(this.tlvTagToMatch);
            try {
                String val = "";
                switch(this.tlvValueTypeToMatch) {
                    case BYTE:
                        val = (new Byte(tlv.getValueAsByte())).toString();
                        break;
                    case INT:
                        val = (new Integer(tlv.getValueAsInt())).toString();
                        break;
                    case STRING:
                    default:
                        val = tlv.getValueAsString();
                        break;
                }
                if (!this.tlvValueToMatch.equals(val)) {
                    return false;
                }
            } catch (Exception e) {
                return false;
            }
        } else {
            return false;
        }
    }
    if (percent != -1) {
        return MProcUtility.checkRuleProbability(percent);
    }
    return true;
}
Also used : DeliveryReceiptData(org.mobicents.smsc.mproc.DeliveryReceiptData) Matcher(java.util.regex.Matcher) MProcMessage(org.mobicents.smsc.mproc.MProcMessage) TlvSet(org.restcomm.smpp.parameter.TlvSet) XMLStreamException(javolution.xml.stream.XMLStreamException) Tlv(com.cloudhopper.smpp.tlv.Tlv)

Example 5 with DeliveryReceiptData

use of org.mobicents.smsc.mproc.DeliveryReceiptData in project smscgateway by RestComm.

the class CdrGenerator method generateCdr.

public static void generateCdr(Sms smsEvent, String status, String reason, boolean generateReceiptCdr, boolean generateCdr, boolean messageIsSplitted, boolean lastSegment, boolean calculateMsgPartsLenCdr, boolean delayParametersInCdr, int seqNumber) {
    if (!generateCdr)
        return;
    if (!generateReceiptCdr && smsEvent.isMcDeliveryReceipt())
        // we do not generate CDR's for receipt if generateReceiptCdr option is off
        return;
    int msgParts = 0, charNumbers = 0;
    if (calculateMsgPartsLenCdr) {
        if (messageIsSplitted) {
            msgParts = 1;
        } else {
            DataCodingScheme dataCodingScheme = new DataCodingSchemeImpl(smsEvent.getDataCoding());
            msgParts = MessageUtil.calculateMsgParts(smsEvent.getShortMessageText(), dataCodingScheme, smsEvent.getNationalLanguageLockingShift(), smsEvent.getNationalLanguageSingleShift());
        }
        if (lastSegment) {
            charNumbers = smsEvent.getShortMessageText().length();
        } else {
            charNumbers = 0;
        }
    }
    int dcs = smsEvent.getDataCoding();
    Long receiptLocalMessageId = smsEvent.getReceiptLocalMessageId();
    long msgPartDelTime = -1;
    if (smsEvent.getMsgPartsSeqNumbers().contains(seqNumber - 1)) {
        msgPartDelTime = smsEvent.getMsgPartDelTime(seqNumber) - smsEvent.getMsgPartDelTime(seqNumber - 1);
    } else if (smsEvent.getMsgPartsSeqNumbers().contains(seqNumber)) {
        msgPartDelTime = smsEvent.getMsgPartDelTime(seqNumber) - smsEvent.getSubmitDate().getTime();
    }
    DeliveryReceiptData deliveryReceiptData = MessageUtil.parseDeliveryReceipt(smsEvent.getShortMessageText(), smsEvent.getTlvSet());
    String st = null;
    int tlvMessageState = -1;
    int err = -1;
    if (deliveryReceiptData != null) {
        st = deliveryReceiptData.getStatus();
        tlvMessageState = deliveryReceiptData.getTlvMessageState() == null ? -1 : deliveryReceiptData.getTlvMessageState();
        err = deliveryReceiptData.getError();
    }
    StringBuffer sb = new StringBuffer();
    sb.append(DATE_FORMAT.format(smsEvent.getSubmitDate())).append(CdrGenerator.CDR_SEPARATOR).append(smsEvent.getSourceAddr()).append(CdrGenerator.CDR_SEPARATOR).append(smsEvent.getSourceAddrTon()).append(CdrGenerator.CDR_SEPARATOR).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(CdrGenerator.CDR_SEPARATOR).append(smsEvent.getOriginationType()).append(CdrGenerator.CDR_SEPARATOR).append(smsEvent.getReceiptLocalMessageId() == null ? "message" : "dlr").append(CdrGenerator.CDR_SEPARATOR).append(smsEvent.getOrigSystemId()).append(CdrGenerator.CDR_SEPARATOR).append(smsEvent.getMessageId()).append(CdrGenerator.CDR_SEPARATOR).append(smsEvent.getDlvMessageId()).append(CdrGenerator.CDR_SEPARATOR).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(CdrGenerator.CDR_SEPARATOR).append(smsEvent.getMtServiceCenterAddress()).append(CdrGenerator.CDR_SEPARATOR).append(smsEvent.getOrigNetworkId()).append(CdrGenerator.CDR_SEPARATOR).append(smsEvent.getSmsSet().getNetworkId()).append(CdrGenerator.CDR_SEPARATOR).append(smsEvent.getMprocNotes()).append(CdrGenerator.CDR_SEPARATOR).append(msgParts).append(CdrGenerator.CDR_SEPARATOR).append(charNumbers).append(CdrGenerator.CDR_SEPARATOR).append(delayParametersInCdr ? getProcessingTime(smsEvent.getSubmitDate()) : CDR_EMPTY).append(CdrGenerator.CDR_SEPARATOR).append(delayParametersInCdr ? getScheduleDeliveryDelayMilis(smsEvent.getSubmitDate(), smsEvent.getScheduleDeliveryTime()) : CDR_EMPTY).append(CdrGenerator.CDR_SEPARATOR).append(delayParametersInCdr ? smsEvent.getDeliveryCount() : CDR_EMPTY).append(CdrGenerator.CDR_SEPARATOR).append(msgPartDelTime != -1 ? msgPartDelTime : CDR_EMPTY).append(CdrGenerator.CDR_SEPARATOR).append(dcs).append(CdrGenerator.CDR_SEPARATOR).append("\"").append(getEscapedString(getFirst20CharOfSMS(smsEvent.getShortMessageText()))).append("\"").append(CdrGenerator.CDR_SEPARATOR).append("\"").append(getEscapedString(reason)).append("\"").append(CdrGenerator.CDR_SEPARATOR).append(st != null ? st : CdrGenerator.CDR_EMPTY).append(CdrGenerator.CDR_SEPARATOR).append(tlvMessageState != -1 ? tlvMessageState : CdrGenerator.CDR_EMPTY).append(CdrGenerator.CDR_SEPARATOR).append(err != -1 ? err : CdrGenerator.CDR_EMPTY);
    CdrGenerator.generateCdr(sb.toString());
}
Also used : DataCodingScheme(org.mobicents.protocols.ss7.map.api.smstpdu.DataCodingScheme) DeliveryReceiptData(org.mobicents.smsc.mproc.DeliveryReceiptData) DataCodingSchemeImpl(org.mobicents.protocols.ss7.map.smstpdu.DataCodingSchemeImpl)

Aggregations

DeliveryReceiptData (org.mobicents.smsc.mproc.DeliveryReceiptData)6 Tlv (com.cloudhopper.smpp.tlv.Tlv)2 Date (java.util.Date)2 TlvSet (org.restcomm.smpp.parameter.TlvSet)2 Matcher (java.util.regex.Matcher)1 XMLStreamException (javolution.xml.stream.XMLStreamException)1 ISDNAddressString (org.mobicents.protocols.ss7.map.api.primitives.ISDNAddressString)1 DataCodingScheme (org.mobicents.protocols.ss7.map.api.smstpdu.DataCodingScheme)1 DataCodingSchemeImpl (org.mobicents.protocols.ss7.map.smstpdu.DataCodingSchemeImpl)1 PersistenceException (org.mobicents.smsc.cassandra.PersistenceException)1 MProcMessage (org.mobicents.smsc.mproc.MProcMessage)1 Test (org.testng.annotations.Test)1