Legacy Dev Forum Posts

 View Only

Sign Up

Query build does not have a satisfied result for

  • 1.  Query build does not have a satisfied result for

    Posted 06-05-2025 18:11

    NielsS | 2017-03-31 15:45:16 UTC | #1

    While making a Analytics query I would like to see a result where a call waiting is returned.

    The Query used:

    {
     "interval": "2017-03-30T22:00:00.000Z/2017-03-31T22:00:00.000Z",
     "order": "asc",
     "orderBy": "conversationStart",
     "paging": {
      "pageSize": 25,
      "pageNumber": 1
     },
     "segmentFilters": [
      {
       "type": "and",
       "clauses": [
        {
         "type": "and",
         "predicates": [
          {
           "type": "dimension",
           "dimension": "segmentType",
           "operator": "matches",
           "value": "delay"
          }
         ]
        }
       ],
       "predicates": [
        {
         "type": "dimension",
         "dimension": "disconnectType",
         "operator": "notExists",
         "value": null
        }
       ]
      }
     ]
    }

    The result:

    {
          "conversationId": "0893cb78-30b0-49de-b2ae-11ea4700ab2e",
          "conversationStart": "2017-03-31T12:47:29.053Z",
          "participants": [
            {
              "participantId": "a0ed1395-bd2e-4fbb-b6e0-12c9e1467c27",
              "participantName": "Netherlands",
              "purpose": "external",
              "sessions": [
                {
                  "mediaType": "voice",
                  "sessionId": "3fa893b5-0ac2-4584-b33c-80d686518ba9",
                  "ani": "tel:Phonenumber",
                  "direction": "inbound",
                  "dnis": "tel:PhonenumberDNIS",
                  "edgeId": "736df700-753f-4d52-82fa-8e386fa0233b",
                  "segments": [
                    {
                      "segmentStart": "2017-03-31T12:47:29.053Z",
                      "segmentEnd": "2017-03-31T12:47:29.129Z",
                      "segmentType": "system",
                      "conference": false
                    },
                    {
                      "segmentStart": "2017-03-31T12:47:29.129Z",
                      "segmentType": "interact",
                      "conference": false
                    }
                  ]
                }
              ]
            },
            {
              "participantId": "300b4b8f-a636-44e6-9a16-a0d88a0c6b03",
              "participantName": "CLOUDOE",
              "purpose": "ivr",
              "sessions": [
                {
                  "mediaType": "voice",
                  "sessionId": "4aa351d9-7945-4b14-b74f-fdbe6f1c4920",
                  "ani": "tel:Phonenumber",
                  "direction": "inbound",
                  "edgeId": "736df700-753f-4d52-82fa-8e386fa0233b",
                  "segments": [
                    {
                      "segmentStart": "2017-03-31T12:47:29.073Z",
                      "segmentEnd": "2017-03-31T12:47:29.077Z",
                      "segmentType": "system",
                      "conference": false
                    },
                    {
                      "segmentStart": "2017-03-31T12:47:29.077Z",
                      "segmentEnd": "2017-03-31T12:47:34.117Z",
                      "segmentType": "ivr",
                      "conference": false
                    }
                  ]
                }
              ]
            },
            {
              "participantId": "18fe9115-ddbe-4aa9-a130-b0364e0f65e4",
              "participantName": "CD-Demo",
              "purpose": "acd",
              "sessions": [
                {
                  "mediaType": "voice",
                  "sessionId": "0993d1f1-8429-4138-93de-5a3e04b4a2f4",
                  "ani": "tel:Phonenumber",
                  "direction": "inbound",
                  "edgeId": "736df700-753f-4d52-82fa-8e386fa0233b",
                  "segments": [
                    {
                      "segmentStart": "2017-03-31T12:47:34.153Z",
                      "segmentEnd": "2017-03-31T12:47:34.157Z",
                      "queueId": "09279535-2d88-45c4-9386-101e68ceacdf",
                      "segmentType": "delay",
                      "conference": false
                    },
                    {
                      "segmentStart": "2017-03-31T12:47:34.157Z",
                      "queueId": "09279535-2d88-45c4-9386-101e68ceacdf",
                      "segmentType": "interact",
                      "conference": false
                    }
                  ]
                }
              ]
            }
          ]
        }

    The part I would like to see is where no 'conversation End' is set and Segment Type is Delay. I am seeing all records and not only the above result. What am I doing wrong?


    tim.smith | 2017-03-31 16:25:15 UTC | #2

    The part I would like to see is where no 'conversation End' is set and Segment Type is Delay.

    The query you've defined asks for conversations that have a segment where segmentType=delay and disconnectType=null. That's always going to be true unless the conversation was disconnected during that segment. I think what you're looking for is this:

    {
     "interval": "2017-03-28T15:00:00.000Z/2017-03-29T04:00:00.000Z",
     "order": "asc",
     "orderBy": "conversationStart",
     "paging": {
      "pageSize": "100",
      "pageNumber": 1
     },
     "segmentFilters": [
      {
       "type": "and",
       "predicates": [
        {
         "type": "dimension",
         "dimension": "segmentType",
         "operator": "matches",
         "value": "delay"
        }
       ]
      }
     ],
     "conversationFilters": [
      {
       "type": "and",
       "predicates": [
        {
         "type": "dimension",
         "dimension": "conversationEnd",
         "operator": "notExists",
         "value": null
        }
       ]
      }
     ]
    }

    This creates a query that looks for conversations that don't have a conversation end and do have a segment with segmentType=delay.

    As a side note, I noticed that the analytics query builder doesn't have conversationEnd as an available dimension. I'll look into that.


    NielsS | 2017-04-03 14:45:31 UTC | #3

    This query is what I wanted to have as result. I tried it in Postman and the result returned well.

    Thanks for the updated query.


    system | 2017-08-28 19:33:33 UTC | #4


    This post was migrated from the old Developer Forum.

    ref: 1134