Clickhouse-softswitch-dashboard

From Initech Technical Wiki
Revision as of 23:02, 18 October 2019 by Timprice (talk | contribs) (Created page with "This is the grafana dashboard for visualising CDR records exported from a XC5 softswitch into clickhouse <pre> { "annotations": { "list": [ {...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This is the grafana dashboard for visualising CDR records exported from a XC5 softswitch into clickhouse

{
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": "-- Grafana --",
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "type": "dashboard"
      }
    ]
  },
  "editable": true,
  "gnetId": null,
  "graphTooltip": 0,
  "id": 7,
  "iteration": 1571439647971,
  "links": [],
  "panels": [
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "ClickHouse",
      "fill": 1,
      "gridPos": {
        "h": 6,
        "w": 8,
        "x": 0,
        "y": 0
      },
      "id": 6,
      "legend": {
        "avg": false,
        "current": false,
        "max": false,
        "min": false,
        "show": true,
        "total": false,
        "values": false
      },
      "lines": true,
      "linewidth": 1,
      "links": [],
      "nullPointMode": "null as zero",
      "percentage": false,
      "pointradius": 2,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": true,
      "steppedLine": false,
      "targets": [
        {
          "database": "softswitch",
          "dateLoading": false,
          "dateTimeColDataType": "calldate",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "hide": false,
          "intervalFactor": 1,
          "query": "SELECT (intDiv(toUInt32(t), if(($__interval_ms / 1000)<1,1,($__interval_ms / 1000))) * if(($__interval_ms / 1000)<1,1,($__interval_ms / 1000))) * 1000 as t, MAX(metric) as \"NZ Domestic\" FROM (\n  SELECT\n    arrayJoin(\n      arrayMap( x -> toStartOfMinute(addMinutes(toDateTime($from),x)),\n        range(toUInt64(\n          dateDiff('minute',\n            toDateTime($from),\n            toDateTime($to)) +1)))\n    ) as t,\n    0 as metric\n  UNION ALL\n  \n  SELECT\n    toStartOfMinute(calldate) as t,\n    COUNT() \n    FROM $table\n    where t BETWEEN toDateTime($from) AND toDateTime($to)\n    AND ((caller like '64%' and caller not like '642%') or caller = 'Anonymous')\n    AND caller_called_nature = 'OffOn'\n    $conditionalTest(AND (local_user in ($username) or called_user in ($username)),$username)\n    $conditionalTest(AND (caller_owning_carrier in ($carrier) or called_owning_carrier in ($carrier)),$carrier)\n    $conditionalTest(AND reason in ($reason),$reason)\n    $conditionalTest(AND (caller in ($number) or local_number in ($number) or called in ($number)),$number)\n\n\n        GROUP BY t\n)\nGROUP BY t ORDER BY t\n",
          "rawQuery": "SELECT (intDiv(toUInt32(t), if((20000 / 1000)<1,1,(20000 / 1000))) * if((20000 / 1000)<1,1,(20000 / 1000))) * 1000 as t, MAX(metric) as \"NZ Domestic\" FROM (   SELECT     arrayJoin(       arrayMap( x -> toStartOfMinute(addMinutes(toDateTime(1571428847),x)),         range(toUInt64(           dateDiff('minute',             toDateTime(1571428847),             toDateTime(1571439649)) +1)))     ) as t,     0 as metric   UNION ALL      SELECT     toStartOfMinute(calldate) as t,     COUNT()      FROM softswitch.cdr     where t BETWEEN toDateTime(1571428847) AND toDateTime(1571439649)     AND ((caller like '64%' and caller not like '642%') or caller = 'Anonymous')     AND caller_called_nature = 'OffOn'                                   GROUP BY t ) GROUP BY t ORDER BY t",
          "refId": "A",
          "round": "0s",
          "table": "cdr",
          "tableLoading": false
        },
        {
          "database": "softswitch",
          "dateLoading": false,
          "dateTimeColDataType": "calldate",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "hide": false,
          "intervalFactor": 1,
          "query": "SELECT (intDiv(toUInt32(t), if(($__interval_ms / 1000)<1,1,($__interval_ms / 1000))) * if(($__interval_ms / 1000)<1,1,($__interval_ms / 1000))) * 1000 as t, MAX(metric) as \"NZ Mobile\" FROM (\n  SELECT\n    arrayJoin(\n      arrayMap( x -> toStartOfMinute(addMinutes(toDateTime($from),x)),\n        range(toUInt64(\n          dateDiff('minute',\n            toDateTime($from),\n            toDateTime($to)) +1)))\n    ) as t,\n    0 as metric\n  UNION ALL\n  \n  SELECT\n    toStartOfMinute(calldate) as t,\n    COUNT() \n    FROM $table\n    where t BETWEEN toDateTime($from) AND toDateTime($to)\n    AND caller like '642%'\n    AND caller_called_nature = 'OffOn'\n    $conditionalTest(AND (local_user in ($username) or called_user in ($username)),$username)\n    $conditionalTest(AND (caller_owning_carrier in ($carrier) or called_owning_carrier in ($carrier)),$carrier)\n    $conditionalTest(AND reason in ($reason),$reason)\n    $conditionalTest(AND (caller in ($number) or local_number in ($number) or called in ($number)),$number)\n\n\n        GROUP BY t\n)\nGROUP BY t ORDER BY t\n",
          "rawQuery": "SELECT (intDiv(toUInt32(t), if((20000 / 1000)<1,1,(20000 / 1000))) * if((20000 / 1000)<1,1,(20000 / 1000))) * 1000 as t, MAX(metric) as \"NZ Mobile\" FROM (   SELECT     arrayJoin(       arrayMap( x -> toStartOfMinute(addMinutes(toDateTime(1571428847),x)),         range(toUInt64(           dateDiff('minute',             toDateTime(1571428847),             toDateTime(1571439649)) +1)))     ) as t,     0 as metric   UNION ALL      SELECT     toStartOfMinute(calldate) as t,     COUNT()      FROM softswitch.cdr     where t BETWEEN toDateTime(1571428847) AND toDateTime(1571439649)     AND caller like '642%'     AND caller_called_nature = 'OffOn'                                   GROUP BY t ) GROUP BY t ORDER BY t",
          "refId": "D",
          "round": "0s",
          "table": "cdr",
          "tableLoading": false
        },
        {
          "database": "softswitch",
          "dateLoading": false,
          "dateTimeColDataType": "calldate",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "hide": false,
          "intervalFactor": 1,
          "query": "SELECT (intDiv(toUInt32(t), if(($__interval_ms / 1000)<1,1,($__interval_ms / 1000))) * if(($__interval_ms / 1000)<1,1,($__interval_ms / 1000))) * 1000 as t, MAX(metric) as \"International\" FROM (\n  SELECT\n    arrayJoin(\n      arrayMap( x -> toStartOfMinute(addMinutes(toDateTime($from),x)),\n        range(toUInt64(\n          dateDiff('minute',\n            toDateTime($from),\n            toDateTime($to)) +1)))\n    ) as t,\n    0 as metric\n  UNION ALL\n  \n  SELECT\n    toStartOfMinute(calldate) as t,\n    COUNT() \n    FROM $table\n    where t BETWEEN toDateTime($from) AND toDateTime($to)\n    AND caller not like '64%' and caller != 'Anonymous'\n    AND caller_called_nature = 'OffOn'\n    $conditionalTest(AND (local_user in ($username) or called_user in ($username)),$username)\n    $conditionalTest(AND (caller_owning_carrier in ($carrier) or called_owning_carrier in ($carrier)),$carrier)\n    $conditionalTest(AND reason in ($reason),$reason)\n    $conditionalTest(AND (caller in ($number) or local_number in ($number) or called in ($number)),$number)\n\n\n        GROUP BY t\n)\nGROUP BY t ORDER BY t\n",
          "rawQuery": "SELECT (intDiv(toUInt32(t), if((20000 / 1000)<1,1,(20000 / 1000))) * if((20000 / 1000)<1,1,(20000 / 1000))) * 1000 as t, MAX(metric) as \"International\" FROM (   SELECT     arrayJoin(       arrayMap( x -> toStartOfMinute(addMinutes(toDateTime(1571428847),x)),         range(toUInt64(           dateDiff('minute',             toDateTime(1571428847),             toDateTime(1571439649)) +1)))     ) as t,     0 as metric   UNION ALL      SELECT     toStartOfMinute(calldate) as t,     COUNT()      FROM softswitch.cdr     where t BETWEEN toDateTime(1571428847) AND toDateTime(1571439649)     AND caller not like '64%' and caller != 'Anonymous'     AND caller_called_nature = 'OffOn'                                   GROUP BY t ) GROUP BY t ORDER BY t",
          "refId": "B",
          "round": "0s",
          "table": "cdr",
          "tableLoading": false
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeRegions": [],
      "timeShift": null,
      "title": "Inbound calls per minute",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "decimals": 2,
          "format": "none",
          "label": "",
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        },
        {
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": false
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "ClickHouse",
      "fill": 1,
      "gridPos": {
        "h": 6,
        "w": 8,
        "x": 8,
        "y": 0
      },
      "id": 38,
      "legend": {
        "avg": false,
        "current": false,
        "max": false,
        "min": false,
        "show": true,
        "total": false,
        "values": false
      },
      "lines": true,
      "linewidth": 1,
      "links": [],
      "nullPointMode": "null as zero",
      "percentage": false,
      "pointradius": 2,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": true,
      "steppedLine": false,
      "targets": [
        {
          "database": "softswitch",
          "dateLoading": false,
          "dateTimeColDataType": "calldate",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "hide": false,
          "intervalFactor": 1,
          "query": "SELECT (intDiv(toUInt32(t), if(($__interval_ms / 1000)<1,1,($__interval_ms / 1000))) * if(($__interval_ms / 1000)<1,1,($__interval_ms / 1000))) * 1000 as t, MAX(metric) as \"NZ Domestic\" FROM (\n  SELECT\n    arrayJoin(\n      arrayMap( x -> toStartOfMinute(addMinutes(toDateTime($from),x)),\n        range(toUInt64(\n          dateDiff('minute',\n            toDateTime($from),\n            toDateTime($to)) +1)))\n    ) as t,\n    0 as metric\n  UNION ALL\n  \n  SELECT\n    toStartOfMinute(calldate) as t,\n    COUNT() \n    FROM $table\n    where t BETWEEN toDateTime($from) AND toDateTime($to)\n    AND ((caller like '64%' and caller not like '642%') or caller = 'Anonymous')\n    AND caller_called_nature = 'OnOn'\n    $conditionalTest(AND (local_user in ($username) or called_user in ($username)),$username)\n    $conditionalTest(AND (caller_owning_carrier in ($carrier) or called_owning_carrier in ($carrier)),$carrier)\n    $conditionalTest(AND reason in ($reason),$reason)\n    $conditionalTest(AND (caller in ($number) or local_number in ($number) or called in ($number)),$number)\n\n\n        GROUP BY t\n)\nGROUP BY t ORDER BY t\n",
          "rawQuery": "SELECT (intDiv(toUInt32(t), if((20000 / 1000)<1,1,(20000 / 1000))) * if((20000 / 1000)<1,1,(20000 / 1000))) * 1000 as t, MAX(metric) as \"NZ Domestic\" FROM (   SELECT     arrayJoin(       arrayMap( x -> toStartOfMinute(addMinutes(toDateTime(1571428847),x)),         range(toUInt64(           dateDiff('minute',             toDateTime(1571428847),             toDateTime(1571439649)) +1)))     ) as t,     0 as metric   UNION ALL      SELECT     toStartOfMinute(calldate) as t,     COUNT()      FROM softswitch.cdr     where t BETWEEN toDateTime(1571428847) AND toDateTime(1571439649)     AND ((caller like '64%' and caller not like '642%') or caller = 'Anonymous')     AND caller_called_nature = 'OnOn'                                   GROUP BY t ) GROUP BY t ORDER BY t",
          "refId": "A",
          "round": "0s",
          "table": "cdr",
          "tableLoading": false
        },
        {
          "database": "softswitch",
          "dateLoading": false,
          "dateTimeColDataType": "calldate",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "hide": false,
          "intervalFactor": 1,
          "query": "SELECT (intDiv(toUInt32(t), if(($__interval_ms / 1000)<1,1,($__interval_ms / 1000))) * if(($__interval_ms / 1000)<1,1,($__interval_ms / 1000))) * 1000 as t, MAX(metric) as \"NZ Mobile\" FROM (\n  SELECT\n    arrayJoin(\n      arrayMap( x -> toStartOfMinute(addMinutes(toDateTime($from),x)),\n        range(toUInt64(\n          dateDiff('minute',\n            toDateTime($from),\n            toDateTime($to)) +1)))\n    ) as t,\n    0 as metric\n  UNION ALL\n  \n  SELECT\n    toStartOfMinute(calldate) as t,\n    COUNT() \n    FROM $table\n    where t BETWEEN toDateTime($from) AND toDateTime($to)\n    AND caller like '642%'\n    AND caller_called_nature = 'OnOn'\n    $conditionalTest(AND (local_user in ($username) or called_user in ($username)),$username)\n    $conditionalTest(AND (caller_owning_carrier in ($carrier) or called_owning_carrier in ($carrier)),$carrier)\n    $conditionalTest(AND reason in ($reason),$reason)\n    $conditionalTest(AND (caller in ($number) or local_number in ($number) or called in ($number)),$number)\n\n\n        GROUP BY t\n)\nGROUP BY t ORDER BY t\n",
          "rawQuery": "SELECT (intDiv(toUInt32(t), if((20000 / 1000)<1,1,(20000 / 1000))) * if((20000 / 1000)<1,1,(20000 / 1000))) * 1000 as t, MAX(metric) as \"NZ Mobile\" FROM (   SELECT     arrayJoin(       arrayMap( x -> toStartOfMinute(addMinutes(toDateTime(1571428847),x)),         range(toUInt64(           dateDiff('minute',             toDateTime(1571428847),             toDateTime(1571439649)) +1)))     ) as t,     0 as metric   UNION ALL      SELECT     toStartOfMinute(calldate) as t,     COUNT()      FROM softswitch.cdr     where t BETWEEN toDateTime(1571428847) AND toDateTime(1571439649)     AND caller like '642%'     AND caller_called_nature = 'OnOn'                                   GROUP BY t ) GROUP BY t ORDER BY t",
          "refId": "D",
          "round": "0s",
          "table": "cdr",
          "tableLoading": false
        },
        {
          "database": "softswitch",
          "dateLoading": false,
          "dateTimeColDataType": "calldate",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "hide": false,
          "intervalFactor": 1,
          "query": "SELECT (intDiv(toUInt32(t), if(($__interval_ms / 1000)<1,1,($__interval_ms / 1000))) * if(($__interval_ms / 1000)<1,1,($__interval_ms / 1000))) * 1000 as t, MAX(metric) as \"International\" FROM (\n  SELECT\n    arrayJoin(\n      arrayMap( x -> toStartOfMinute(addMinutes(toDateTime($from),x)),\n        range(toUInt64(\n          dateDiff('minute',\n            toDateTime($from),\n            toDateTime($to)) +1)))\n    ) as t,\n    0 as metric\n  UNION ALL\n  \n  SELECT\n    toStartOfMinute(calldate) as t,\n    COUNT() \n    FROM $table\n    where t BETWEEN toDateTime($from) AND toDateTime($to)\n    AND caller not like '64%' and caller != 'Anonymous'\n    AND caller_called_nature = 'OnOn'\n    $conditionalTest(AND (local_user in ($username) or called_user in ($username)),$username)\n    $conditionalTest(AND (caller_owning_carrier in ($carrier) or called_owning_carrier in ($carrier)),$carrier)\n    $conditionalTest(AND reason in ($reason),$reason)\n    $conditionalTest(AND (caller in ($number) or local_number in ($number) or called in ($number)),$number)\n\n\n        GROUP BY t\n)\nGROUP BY t ORDER BY t\n",
          "rawQuery": "SELECT (intDiv(toUInt32(t), if((20000 / 1000)<1,1,(20000 / 1000))) * if((20000 / 1000)<1,1,(20000 / 1000))) * 1000 as t, MAX(metric) as \"International\" FROM (   SELECT     arrayJoin(       arrayMap( x -> toStartOfMinute(addMinutes(toDateTime(1571428847),x)),         range(toUInt64(           dateDiff('minute',             toDateTime(1571428847),             toDateTime(1571439649)) +1)))     ) as t,     0 as metric   UNION ALL      SELECT     toStartOfMinute(calldate) as t,     COUNT()      FROM softswitch.cdr     where t BETWEEN toDateTime(1571428847) AND toDateTime(1571439649)     AND caller not like '64%' and caller != 'Anonymous'     AND caller_called_nature = 'OnOn'                                   GROUP BY t ) GROUP BY t ORDER BY t",
          "refId": "B",
          "round": "0s",
          "table": "cdr",
          "tableLoading": false
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeRegions": [],
      "timeShift": null,
      "title": "On-net calls per minute",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "decimals": 2,
          "format": "none",
          "label": "",
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        },
        {
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": false
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "ClickHouse",
      "fill": 1,
      "gridPos": {
        "h": 6,
        "w": 8,
        "x": 16,
        "y": 0
      },
      "id": 7,
      "legend": {
        "avg": false,
        "current": false,
        "max": false,
        "min": false,
        "show": true,
        "total": false,
        "values": false
      },
      "lines": true,
      "linewidth": 1,
      "links": [],
      "nullPointMode": "null as zero",
      "percentage": false,
      "pointradius": 2,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": true,
      "steppedLine": false,
      "targets": [
        {
          "database": "softswitch",
          "dateLoading": false,
          "dateTimeColDataType": "calldate",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "hide": false,
          "intervalFactor": 1,
          "query": "SELECT (intDiv(toUInt32(t), if(($__interval_ms / 1000)<1,1,($__interval_ms / 1000))) * if(($__interval_ms / 1000)<1,1,($__interval_ms / 1000))) * 1000 as t, AVG(metric) as \"NZ Domestic\" FROM (\n  SELECT\n    arrayJoin(\n      arrayMap( x -> toStartOfMinute(addMinutes(toDateTime($from),x)),\n        range(toUInt64(\n          dateDiff('minute',\n            toDateTime($from),\n            toDateTime($to)) +1)))\n    ) as t,\n    0 as metric\n  UNION ALL\n  \n  SELECT\n    toStartOfMinute(calldate) as t,\n    COUNT() \n    FROM $table\n    where t BETWEEN toDateTime($from) AND toDateTime($to)\n    AND ((called like '64%' and called not like '642%'))\n    AND caller_called_nature = 'OnOff'\n    $conditionalTest(AND (local_user in ($username) or called_user in ($username)),$username)\n    $conditionalTest(AND (caller_owning_carrier in ($carrier) or called_owning_carrier in ($carrier)),$carrier)\n    $conditionalTest(AND reason in ($reason),$reason)\n    $conditionalTest(AND (caller in ($number) or local_number in ($number) or called in ($number)),$number)\n\n        GROUP BY t\n)\nGROUP BY t ORDER BY t\n",
          "rawQuery": "SELECT (intDiv(toUInt32(t), if((20000 / 1000)<1,1,(20000 / 1000))) * if((20000 / 1000)<1,1,(20000 / 1000))) * 1000 as t, AVG(metric) as \"NZ Domestic\" FROM (   SELECT     arrayJoin(       arrayMap( x -> toStartOfMinute(addMinutes(toDateTime(1571428847),x)),         range(toUInt64(           dateDiff('minute',             toDateTime(1571428847),             toDateTime(1571439649)) +1)))     ) as t,     0 as metric   UNION ALL      SELECT     toStartOfMinute(calldate) as t,     COUNT()      FROM softswitch.cdr     where t BETWEEN toDateTime(1571428847) AND toDateTime(1571439649)     AND ((called like '64%' and called not like '642%'))     AND caller_called_nature = 'OnOff'                                  GROUP BY t ) GROUP BY t ORDER BY t",
          "refId": "A",
          "round": "0s",
          "table": "cdr",
          "tableLoading": false
        },
        {
          "database": "softswitch",
          "dateLoading": false,
          "dateTimeColDataType": "calldate",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "hide": false,
          "intervalFactor": 1,
          "query": "SELECT (intDiv(toUInt32(t), if(($__interval_ms / 1000)<1,1,($__interval_ms / 1000))) * if(($__interval_ms / 1000)<1,1,($__interval_ms / 1000))) * 1000 as t, AVG(metric) as \"NZ Mobile\" FROM (\n  SELECT\n    arrayJoin(\n      arrayMap( x -> toStartOfMinute(addMinutes(toDateTime($from),x)),\n        range(toUInt64(\n          dateDiff('minute',\n            toDateTime($from),\n            toDateTime($to)) +1)))\n    ) as t,\n    0 as metric\n  UNION ALL\n  \n  SELECT\n    toStartOfMinute(calldate) as t,\n    COUNT() \n    FROM $table\n    where t BETWEEN toDateTime($from) AND toDateTime($to)\n    AND called like '642%'\n    AND caller_called_nature = 'OnOff'\n    $conditionalTest(AND (local_user in ($username) or called_user in ($username)),$username)\n    $conditionalTest(AND (caller_owning_carrier in ($carrier) or called_owning_carrier in ($carrier)),$carrier)\n    $conditionalTest(AND reason in ($reason),$reason)\n    $conditionalTest(AND (caller in ($number) or local_number in ($number) or called in ($number)),$number)\n\n\n        GROUP BY t\n)\nGROUP BY t ORDER BY t\n",
          "rawQuery": "SELECT (intDiv(toUInt32(t), if((20000 / 1000)<1,1,(20000 / 1000))) * if((20000 / 1000)<1,1,(20000 / 1000))) * 1000 as t, AVG(metric) as \"NZ Mobile\" FROM (   SELECT     arrayJoin(       arrayMap( x -> toStartOfMinute(addMinutes(toDateTime(1571428847),x)),         range(toUInt64(           dateDiff('minute',             toDateTime(1571428847),             toDateTime(1571439649)) +1)))     ) as t,     0 as metric   UNION ALL      SELECT     toStartOfMinute(calldate) as t,     COUNT()      FROM softswitch.cdr     where t BETWEEN toDateTime(1571428847) AND toDateTime(1571439649)     AND called like '642%'     AND caller_called_nature = 'OnOff'                                   GROUP BY t ) GROUP BY t ORDER BY t",
          "refId": "D",
          "round": "0s",
          "table": "cdr",
          "tableLoading": false
        },
        {
          "database": "softswitch",
          "dateLoading": false,
          "dateTimeColDataType": "calldate",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "hide": false,
          "intervalFactor": 1,
          "query": "SELECT (intDiv(toUInt32(t), if(($__interval_ms / 1000)<1,1,($__interval_ms / 1000))) * if(($__interval_ms / 1000)<1,1,($__interval_ms / 1000))) * 1000 as t, AVG(metric) as \"International\" FROM (\n  SELECT\n    arrayJoin(\n      arrayMap( x -> toStartOfMinute(addMinutes(toDateTime($from),x)),\n        range(toUInt64(\n          dateDiff('minute',\n            toDateTime($from),\n            toDateTime($to)) +1)))\n    ) as t,\n    0 as metric\n  UNION ALL\n  \n  SELECT\n    toStartOfMinute(calldate) as t,\n    COUNT() \n    FROM $table\n    where t BETWEEN toDateTime($from) AND toDateTime($to)\n    AND called not like '64%'\n    AND caller_called_nature = 'OnOff'\n    $conditionalTest(AND (local_user in ($username) or called_user in ($username)),$username)\n    $conditionalTest(AND (caller_owning_carrier in ($carrier) or called_owning_carrier in ($carrier)),$carrier)\n    $conditionalTest(AND reason in ($reason),$reason)\n    $conditionalTest(AND (caller in ($number) or local_number in ($number) or called in ($number)),$number)\n\n\n        GROUP BY t\n)\nGROUP BY t ORDER BY t\n",
          "rawQuery": "SELECT (intDiv(toUInt32(t), if((20000 / 1000)<1,1,(20000 / 1000))) * if((20000 / 1000)<1,1,(20000 / 1000))) * 1000 as t, AVG(metric) as \"International\" FROM (   SELECT     arrayJoin(       arrayMap( x -> toStartOfMinute(addMinutes(toDateTime(1571428847),x)),         range(toUInt64(           dateDiff('minute',             toDateTime(1571428847),             toDateTime(1571439649)) +1)))     ) as t,     0 as metric   UNION ALL      SELECT     toStartOfMinute(calldate) as t,     COUNT()      FROM softswitch.cdr     where t BETWEEN toDateTime(1571428847) AND toDateTime(1571439649)     AND called not like '64%'     AND caller_called_nature = 'OnOff'                                   GROUP BY t ) GROUP BY t ORDER BY t",
          "refId": "B",
          "round": "0s",
          "table": "cdr",
          "tableLoading": false
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeRegions": [],
      "timeShift": null,
      "title": "Outbound calls per minute",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "decimals": 2,
          "format": "none",
          "label": "",
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        },
        {
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": false
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    },
    {
      "cacheTimeout": null,
      "colorBackground": false,
      "colorValue": false,
      "colors": [
        "#299c46",
        "rgba(237, 129, 40, 0.89)",
        "#d44a3a"
      ],
      "datasource": "ClickHouse",
      "format": "none",
      "gauge": {
        "maxValue": 100,
        "minValue": 0,
        "show": false,
        "thresholdLabels": false,
        "thresholdMarkers": true
      },
      "gridPos": {
        "h": 3,
        "w": 4,
        "x": 0,
        "y": 6
      },
      "id": 11,
      "interval": null,
      "links": [],
      "mappingType": 1,
      "mappingTypes": [
        {
          "name": "value to text",
          "value": 1
        },
        {
          "name": "range to text",
          "value": 2
        }
      ],
      "maxDataPoints": 100,
      "nullPointMode": "connected",
      "nullText": null,
      "pluginVersion": "6.1.3",
      "postfix": " calls",
      "postfixFontSize": "50%",
      "prefix": "",
      "prefixFontSize": "50%",
      "rangeMaps": [
        {
          "from": "null",
          "text": "N/A",
          "to": "null"
        }
      ],
      "sparkline": {
        "fillColor": "rgba(31, 118, 189, 0.18)",
        "full": false,
        "lineColor": "rgb(31, 120, 193)",
        "show": false
      },
      "tableColumn": "",
      "targets": [
        {
          "database": "softswitch",
          "dateLoading": false,
          "dateTimeColDataType": "calldate",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "intervalFactor": 1,
          "query": "SELECT\n    $timeSeries as t,\n    count()\nFROM $table\nWHERE $timeFilter\nAND (((caller like '64%' or caller = 'Anonymous') and caller not like '642%') or (called like '64%' and called not like '642%'))\n    $conditionalTest(AND (local_user in ($username) or called_user in ($username)),$username)\n    $conditionalTest(AND (caller_owning_carrier in ($carrier) or called_owning_carrier in ($carrier)),$carrier)\n    $conditionalTest(AND reason in ($reason),$reason)\n    $conditionalTest(AND (caller in ($number) or local_number in ($number) or called in ($number)),$number)\n\nand caller_called_nature = 'OffOn'\ngroup by t",
          "rawQuery": "SELECT     (intDiv(toUInt32(calldate), 120) * 120) * 1000 as t,     count() FROM softswitch.cdr WHERE calldate >= toDateTime(1571428847) AND (((caller like '64%' or caller = 'Anonymous') and caller not like '642%') or (called like '64%' and called not like '642%'))                          and caller_called_nature = 'OffOn' group by t",
          "refId": "A",
          "round": "0s",
          "table": "cdr",
          "tableLoading": false
        }
      ],
      "thresholds": "",
      "timeFrom": null,
      "timeShift": null,
      "title": "NZ Domestic Calls Inbound",
      "type": "singlestat",
      "valueFontSize": "80%",
      "valueMaps": [
        {
          "op": "=",
          "text": "N/A",
          "value": "null"
        }
      ],
      "valueName": "total"
    },
    {
      "cacheTimeout": null,
      "colorBackground": false,
      "colorValue": false,
      "colors": [
        "#299c46",
        "rgba(237, 129, 40, 0.89)",
        "#d44a3a"
      ],
      "datasource": "ClickHouse",
      "decimals": 1,
      "format": "dtdurations",
      "gauge": {
        "maxValue": 100,
        "minValue": 0,
        "show": false,
        "thresholdLabels": false,
        "thresholdMarkers": true
      },
      "gridPos": {
        "h": 3,
        "w": 4,
        "x": 4,
        "y": 6
      },
      "id": 17,
      "interval": null,
      "links": [],
      "mappingType": 1,
      "mappingTypes": [
        {
          "name": "value to text",
          "value": 1
        },
        {
          "name": "range to text",
          "value": 2
        }
      ],
      "maxDataPoints": 100,
      "nullPointMode": "connected",
      "nullText": null,
      "pluginVersion": "6.1.3",
      "postfix": "",
      "postfixFontSize": "80%",
      "prefix": "",
      "prefixFontSize": "50%",
      "rangeMaps": [
        {
          "from": "null",
          "text": "N/A",
          "to": "null"
        }
      ],
      "sparkline": {
        "fillColor": "rgba(31, 118, 189, 0.18)",
        "full": false,
        "lineColor": "rgb(31, 120, 193)",
        "show": false
      },
      "tableColumn": "",
      "targets": [
        {
          "database": "softswitch",
          "dateLoading": false,
          "dateTimeColDataType": "calldate",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "intervalFactor": 1,
          "query": "SELECT\n    $timeSeries as t,\n    sum(duration)\nFROM $table\nWHERE $timeFilter\nAND (((caller like '64%' or caller = 'Anonymous') and caller not like '642%') or (called like '64%' and called not like '642%'))\n    $conditionalTest(AND (local_user in ($username) or called_user in ($username)),$username)\n    $conditionalTest(AND (caller_owning_carrier in ($carrier) or called_owning_carrier in ($carrier)),$carrier)\n    $conditionalTest(AND reason in ($reason),$reason)\n    $conditionalTest(AND (caller in ($number) or local_number in ($number) or called in ($number)),$number)\n\nand caller_called_nature = 'OffOn'\ngroup by t",
          "rawQuery": "SELECT     (intDiv(toUInt32(calldate), 120) * 120) * 1000 as t,     sum(duration) FROM softswitch.cdr WHERE calldate >= toDateTime(1571428847) AND (((caller like '64%' or caller = 'Anonymous') and caller not like '642%') or (called like '64%' and called not like '642%'))                          and caller_called_nature = 'OffOn' group by t",
          "refId": "A",
          "round": "0s",
          "table": "cdr",
          "tableLoading": false
        }
      ],
      "thresholds": "",
      "timeFrom": null,
      "timeShift": null,
      "title": "NZ Domestic Talk Time Inbound",
      "type": "singlestat",
      "valueFontSize": "50%",
      "valueMaps": [
        {
          "op": "=",
          "text": "N/A",
          "value": "null"
        }
      ],
      "valueName": "total"
    },
    {
      "cacheTimeout": null,
      "colorBackground": false,
      "colorValue": false,
      "colors": [
        "#299c46",
        "rgba(237, 129, 40, 0.89)",
        "#d44a3a"
      ],
      "datasource": "ClickHouse",
      "format": "none",
      "gauge": {
        "maxValue": 100,
        "minValue": 0,
        "show": false,
        "thresholdLabels": false,
        "thresholdMarkers": true
      },
      "gridPos": {
        "h": 3,
        "w": 4,
        "x": 8,
        "y": 6
      },
      "id": 39,
      "interval": null,
      "links": [],
      "mappingType": 1,
      "mappingTypes": [
        {
          "name": "value to text",
          "value": 1
        },
        {
          "name": "range to text",
          "value": 2
        }
      ],
      "maxDataPoints": 100,
      "nullPointMode": "connected",
      "nullText": null,
      "pluginVersion": "6.1.3",
      "postfix": " calls",
      "postfixFontSize": "50%",
      "prefix": "",
      "prefixFontSize": "50%",
      "rangeMaps": [
        {
          "from": "null",
          "text": "N/A",
          "to": "null"
        }
      ],
      "sparkline": {
        "fillColor": "rgba(31, 118, 189, 0.18)",
        "full": false,
        "lineColor": "rgb(31, 120, 193)",
        "show": false
      },
      "tableColumn": "",
      "targets": [
        {
          "database": "softswitch",
          "dateLoading": false,
          "dateTimeColDataType": "calldate",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "intervalFactor": 1,
          "query": "SELECT\n    $timeSeries as t,\n    count()\nFROM $table\nWHERE $timeFilter\nAND (((caller like '64%' or caller = 'Anonymous') and caller not like '642%') or (called like '64%' and called not like '642%'))\n    $conditionalTest(AND (local_user in ($username) or called_user in ($username)),$username)\n    $conditionalTest(AND (caller_owning_carrier in ($carrier) or called_owning_carrier in ($carrier)),$carrier)\n    $conditionalTest(AND reason in ($reason),$reason)\n    $conditionalTest(AND (caller in ($number) or local_number in ($number) or called in ($number)),$number)\n\nand caller_called_nature = 'OnOn'\ngroup by t",
          "rawQuery": "SELECT     (intDiv(toUInt32(calldate), 120) * 120) * 1000 as t,     count() FROM softswitch.cdr WHERE calldate >= toDateTime(1571428847) AND (((caller like '64%' or caller = 'Anonymous') and caller not like '642%') or (called like '64%' and called not like '642%'))                          and caller_called_nature = 'OnOn' group by t",
          "refId": "A",
          "round": "0s",
          "table": "cdr",
          "tableLoading": false
        }
      ],
      "thresholds": "",
      "timeFrom": null,
      "timeShift": null,
      "title": "NZ Domestic Calls On-net",
      "type": "singlestat",
      "valueFontSize": "80%",
      "valueMaps": [
        {
          "op": "=",
          "text": "N/A",
          "value": "null"
        }
      ],
      "valueName": "total"
    },
    {
      "cacheTimeout": null,
      "colorBackground": false,
      "colorValue": false,
      "colors": [
        "#299c46",
        "rgba(237, 129, 40, 0.89)",
        "#d44a3a"
      ],
      "datasource": "ClickHouse",
      "decimals": 1,
      "format": "dtdurations",
      "gauge": {
        "maxValue": 100,
        "minValue": 0,
        "show": false,
        "thresholdLabels": false,
        "thresholdMarkers": true
      },
      "gridPos": {
        "h": 3,
        "w": 4,
        "x": 12,
        "y": 6
      },
      "id": 42,
      "interval": null,
      "links": [],
      "mappingType": 1,
      "mappingTypes": [
        {
          "name": "value to text",
          "value": 1
        },
        {
          "name": "range to text",
          "value": 2
        }
      ],
      "maxDataPoints": 100,
      "nullPointMode": "connected",
      "nullText": null,
      "pluginVersion": "6.1.3",
      "postfix": "",
      "postfixFontSize": "80%",
      "prefix": "",
      "prefixFontSize": "50%",
      "rangeMaps": [
        {
          "from": "null",
          "text": "N/A",
          "to": "null"
        }
      ],
      "sparkline": {
        "fillColor": "rgba(31, 118, 189, 0.18)",
        "full": false,
        "lineColor": "rgb(31, 120, 193)",
        "show": false
      },
      "tableColumn": "",
      "targets": [
        {
          "database": "softswitch",
          "dateLoading": false,
          "dateTimeColDataType": "calldate",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "intervalFactor": 1,
          "query": "SELECT\n    $timeSeries as t,\n    sum(duration)\nFROM $table\nWHERE $timeFilter\nAND (((caller like '64%' or caller = 'Anonymous') and caller not like '642%') or (called like '64%' and called not like '642%'))\nAND caller_called_nature = 'OnOn'\n$conditionalTest(AND (caller_owning_carrier in ($carrier) or called_owning_carrier in ($carrier)),$carrier)\n$conditionalTest(AND reason in ($reason),$reason)\n$conditionalTest(AND (local_user in ($username) or called_user in ($username)),$username)\n    $conditionalTest(AND (caller in ($number) or local_number in ($number) or called in ($number)),$number)\n\ngroup by t",
          "rawQuery": "SELECT     (intDiv(toUInt32(calldate), 120) * 120) * 1000 as t,     sum(duration) FROM softswitch.cdr WHERE calldate >= toDateTime(1571428847) AND (((caller like '64%' or caller = 'Anonymous') and caller not like '642%') or (called like '64%' and called not like '642%')) AND caller_called_nature = 'OnOn'              group by t",
          "refId": "A",
          "round": "0s",
          "table": "cdr",
          "tableLoading": false
        }
      ],
      "thresholds": "",
      "timeFrom": null,
      "timeShift": null,
      "title": "NZ Domestic Talk Time Outbound",
      "type": "singlestat",
      "valueFontSize": "50%",
      "valueMaps": [
        {
          "op": "=",
          "text": "N/A",
          "value": "null"
        }
      ],
      "valueName": "total"
    },
    {
      "cacheTimeout": null,
      "colorBackground": false,
      "colorValue": false,
      "colors": [
        "#299c46",
        "rgba(237, 129, 40, 0.89)",
        "#d44a3a"
      ],
      "datasource": "ClickHouse",
      "format": "none",
      "gauge": {
        "maxValue": 100,
        "minValue": 0,
        "show": false,
        "thresholdLabels": false,
        "thresholdMarkers": true
      },
      "gridPos": {
        "h": 3,
        "w": 4,
        "x": 16,
        "y": 6
      },
      "id": 14,
      "interval": null,
      "links": [],
      "mappingType": 1,
      "mappingTypes": [
        {
          "name": "value to text",
          "value": 1
        },
        {
          "name": "range to text",
          "value": 2
        }
      ],
      "maxDataPoints": 100,
      "nullPointMode": "connected",
      "nullText": null,
      "pluginVersion": "6.1.3",
      "postfix": " calls",
      "postfixFontSize": "50%",
      "prefix": "",
      "prefixFontSize": "50%",
      "rangeMaps": [
        {
          "from": "null",
          "text": "N/A",
          "to": "null"
        }
      ],
      "sparkline": {
        "fillColor": "rgba(31, 118, 189, 0.18)",
        "full": false,
        "lineColor": "rgb(31, 120, 193)",
        "show": false
      },
      "tableColumn": "",
      "targets": [
        {
          "database": "softswitch",
          "dateLoading": false,
          "dateTimeColDataType": "calldate",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "intervalFactor": 1,
          "query": "SELECT\n    $timeSeries as t,\n    count()\nFROM $table\nWHERE $timeFilter\nAND (((caller like '64%' or caller = 'Anonymous') and caller not like '642%') or (called like '64%' and called not like '642%'))\n    $conditionalTest(AND (local_user in ($username) or called_user in ($username)),$username)\n    $conditionalTest(AND (caller_owning_carrier in ($carrier) or called_owning_carrier in ($carrier)),$carrier)\n    $conditionalTest(AND reason in ($reason),$reason)\n    $conditionalTest(AND (caller in ($number) or local_number in ($number) or called in ($number)),$number)\n\nand caller_called_nature = 'OnOff'\ngroup by t",
          "rawQuery": "SELECT     (intDiv(toUInt32(calldate), 120) * 120) * 1000 as t,     count() FROM softswitch.cdr WHERE calldate >= toDateTime(1571428847) AND (((caller like '64%' or caller = 'Anonymous') and caller not like '642%') or (called like '64%' and called not like '642%'))                          and caller_called_nature = 'OnOff' group by t",
          "refId": "A",
          "round": "0s",
          "table": "cdr",
          "tableLoading": false
        }
      ],
      "thresholds": "",
      "timeFrom": null,
      "timeShift": null,
      "title": "NZ Domestic Calls Outbound",
      "type": "singlestat",
      "valueFontSize": "80%",
      "valueMaps": [
        {
          "op": "=",
          "text": "N/A",
          "value": "null"
        }
      ],
      "valueName": "total"
    },
    {
      "cacheTimeout": null,
      "colorBackground": false,
      "colorValue": false,
      "colors": [
        "#299c46",
        "rgba(237, 129, 40, 0.89)",
        "#d44a3a"
      ],
      "datasource": "ClickHouse",
      "decimals": 1,
      "format": "dtdurations",
      "gauge": {
        "maxValue": 100,
        "minValue": 0,
        "show": false,
        "thresholdLabels": false,
        "thresholdMarkers": true
      },
      "gridPos": {
        "h": 3,
        "w": 4,
        "x": 20,
        "y": 6
      },
      "id": 20,
      "interval": null,
      "links": [],
      "mappingType": 1,
      "mappingTypes": [
        {
          "name": "value to text",
          "value": 1
        },
        {
          "name": "range to text",
          "value": 2
        }
      ],
      "maxDataPoints": 100,
      "nullPointMode": "connected",
      "nullText": null,
      "pluginVersion": "6.1.3",
      "postfix": "",
      "postfixFontSize": "80%",
      "prefix": "",
      "prefixFontSize": "50%",
      "rangeMaps": [
        {
          "from": "null",
          "text": "N/A",
          "to": "null"
        }
      ],
      "sparkline": {
        "fillColor": "rgba(31, 118, 189, 0.18)",
        "full": false,
        "lineColor": "rgb(31, 120, 193)",
        "show": false
      },
      "tableColumn": "",
      "targets": [
        {
          "database": "softswitch",
          "dateLoading": false,
          "dateTimeColDataType": "calldate",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "intervalFactor": 1,
          "query": "SELECT\n    $timeSeries as t,\n    sum(duration)\nFROM $table\nWHERE $timeFilter\nAND (((caller like '64%' or caller = 'Anonymous') and caller not like '642%') or (called like '64%' and called not like '642%'))\nAND caller_called_nature = 'OnOff'\n$conditionalTest(AND (caller_owning_carrier in ($carrier) or called_owning_carrier in ($carrier)),$carrier)\n$conditionalTest(AND reason in ($reason),$reason)\n$conditionalTest(AND (local_user in ($username) or called_user in ($username)),$username)\n    $conditionalTest(AND (caller in ($number) or local_number in ($number) or called in ($number)),$number)\n\ngroup by t",
          "rawQuery": "SELECT     (intDiv(toUInt32(calldate), 120) * 120) * 1000 as t,     sum(duration) FROM softswitch.cdr WHERE calldate >= toDateTime(1571428847) AND (((caller like '64%' or caller = 'Anonymous') and caller not like '642%') or (called like '64%' and called not like '642%')) AND caller_called_nature = 'OnOff'              group by t",
          "refId": "A",
          "round": "0s",
          "table": "cdr",
          "tableLoading": false
        }
      ],
      "thresholds": "",
      "timeFrom": null,
      "timeShift": null,
      "title": "NZ Domestic Talk Time Outbound",
      "type": "singlestat",
      "valueFontSize": "50%",
      "valueMaps": [
        {
          "op": "=",
          "text": "N/A",
          "value": "null"
        }
      ],
      "valueName": "total"
    },
    {
      "cacheTimeout": null,
      "colorBackground": false,
      "colorValue": false,
      "colors": [
        "#299c46",
        "rgba(237, 129, 40, 0.89)",
        "#d44a3a"
      ],
      "datasource": "ClickHouse",
      "format": "none",
      "gauge": {
        "maxValue": 100,
        "minValue": 0,
        "show": false,
        "thresholdLabels": false,
        "thresholdMarkers": true
      },
      "gridPos": {
        "h": 3,
        "w": 4,
        "x": 0,
        "y": 9
      },
      "id": 12,
      "interval": null,
      "links": [],
      "mappingType": 1,
      "mappingTypes": [
        {
          "name": "value to text",
          "value": 1
        },
        {
          "name": "range to text",
          "value": 2
        }
      ],
      "maxDataPoints": 100,
      "nullPointMode": "connected",
      "nullText": null,
      "pluginVersion": "6.1.3",
      "postfix": " calls",
      "postfixFontSize": "50%",
      "prefix": "",
      "prefixFontSize": "50%",
      "rangeMaps": [
        {
          "from": "null",
          "text": "N/A",
          "to": "null"
        }
      ],
      "sparkline": {
        "fillColor": "rgba(31, 118, 189, 0.18)",
        "full": false,
        "lineColor": "rgb(31, 120, 193)",
        "show": false
      },
      "tableColumn": "",
      "targets": [
        {
          "database": "softswitch",
          "dateLoading": false,
          "dateTimeColDataType": "calldate",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "intervalFactor": 1,
          "query": "SELECT\n    $timeSeries as t,\n    count()\nFROM $table\nWHERE $timeFilter\nAND ((caller like '642%') or (called like '642%'))\n    $conditionalTest(AND (local_user in ($username) or called_user in ($username)),$username)\n    $conditionalTest(AND (caller_owning_carrier in ($carrier) or called_owning_carrier in ($carrier)),$carrier)\n    $conditionalTest(AND reason in ($reason),$reason)\n    $conditionalTest(AND (caller in ($number) or local_number in ($number) or called in ($number)),$number)\n\nand caller_called_nature = 'OffOn'\n\ngroup by t",
          "rawQuery": "SELECT     (intDiv(toUInt32(calldate), 120) * 120) * 1000 as t,     count() FROM softswitch.cdr WHERE calldate >= toDateTime(1571428847) AND ((caller like '642%') or (called like '642%'))                          and caller_called_nature = 'OffOn'  group by t",
          "refId": "A",
          "round": "0s",
          "table": "cdr",
          "tableLoading": false
        }
      ],
      "thresholds": "",
      "timeFrom": null,
      "timeShift": null,
      "title": "NZ Mobile Calls Inbound",
      "type": "singlestat",
      "valueFontSize": "80%",
      "valueMaps": [
        {
          "op": "=",
          "text": "N/A",
          "value": "null"
        }
      ],
      "valueName": "total"
    },
    {
      "cacheTimeout": null,
      "colorBackground": false,
      "colorValue": false,
      "colors": [
        "#299c46",
        "rgba(237, 129, 40, 0.89)",
        "#d44a3a"
      ],
      "datasource": "ClickHouse",
      "decimals": 1,
      "format": "dtdurations",
      "gauge": {
        "maxValue": 100,
        "minValue": 0,
        "show": false,
        "thresholdLabels": false,
        "thresholdMarkers": true
      },
      "gridPos": {
        "h": 3,
        "w": 4,
        "x": 4,
        "y": 9
      },
      "id": 18,
      "interval": null,
      "links": [],
      "mappingType": 1,
      "mappingTypes": [
        {
          "name": "value to text",
          "value": 1
        },
        {
          "name": "range to text",
          "value": 2
        }
      ],
      "maxDataPoints": 100,
      "nullPointMode": "connected",
      "nullText": null,
      "pluginVersion": "6.1.3",
      "postfix": "",
      "postfixFontSize": "80%",
      "prefix": "",
      "prefixFontSize": "50%",
      "rangeMaps": [
        {
          "from": "null",
          "text": "N/A",
          "to": "null"
        }
      ],
      "sparkline": {
        "fillColor": "rgba(31, 118, 189, 0.18)",
        "full": false,
        "lineColor": "rgb(31, 120, 193)",
        "show": false
      },
      "tableColumn": "",
      "targets": [
        {
          "database": "softswitch",
          "dateLoading": false,
          "dateTimeColDataType": "calldate",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "intervalFactor": 1,
          "query": "SELECT\n    $timeSeries as t,\n    sum(duration)\nFROM $table\nWHERE $timeFilter\nAND ((caller like '642%') or (called like '642%'))\n    $conditionalTest(AND (local_user in ($username) or called_user in ($username)),$username)\n    $conditionalTest(AND (caller_owning_carrier in ($carrier) or called_owning_carrier in ($carrier)),$carrier)\n    $conditionalTest(AND reason in ($reason),$reason)\n    $conditionalTest(AND (caller in ($number) or local_number in ($number) or called in ($number)),$number)\n\nand caller_called_nature = 'OffOn'\n\ngroup by t",
          "rawQuery": "SELECT     (intDiv(toUInt32(calldate), 120) * 120) * 1000 as t,     sum(duration) FROM softswitch.cdr WHERE calldate >= toDateTime(1571428847) AND ((caller like '642%') or (called like '642%'))                          and caller_called_nature = 'OffOn'  group by t",
          "refId": "A",
          "round": "0s",
          "table": "cdr",
          "tableLoading": false
        }
      ],
      "thresholds": "",
      "timeFrom": null,
      "timeShift": null,
      "title": "NZ Mobile Talk Time Inbound",
      "type": "singlestat",
      "valueFontSize": "50%",
      "valueMaps": [
        {
          "op": "=",
          "text": "N/A",
          "value": "null"
        }
      ],
      "valueName": "total"
    },
    {
      "cacheTimeout": null,
      "colorBackground": false,
      "colorValue": false,
      "colors": [
        "#299c46",
        "rgba(237, 129, 40, 0.89)",
        "#d44a3a"
      ],
      "datasource": "ClickHouse",
      "format": "none",
      "gauge": {
        "maxValue": 100,
        "minValue": 0,
        "show": false,
        "thresholdLabels": false,
        "thresholdMarkers": true
      },
      "gridPos": {
        "h": 3,
        "w": 4,
        "x": 8,
        "y": 9
      },
      "id": 40,
      "interval": null,
      "links": [],
      "mappingType": 1,
      "mappingTypes": [
        {
          "name": "value to text",
          "value": 1
        },
        {
          "name": "range to text",
          "value": 2
        }
      ],
      "maxDataPoints": 100,
      "nullPointMode": "connected",
      "nullText": null,
      "pluginVersion": "6.1.3",
      "postfix": " calls",
      "postfixFontSize": "50%",
      "prefix": "",
      "prefixFontSize": "50%",
      "rangeMaps": [
        {
          "from": "null",
          "text": "N/A",
          "to": "null"
        }
      ],
      "sparkline": {
        "fillColor": "rgba(31, 118, 189, 0.18)",
        "full": false,
        "lineColor": "rgb(31, 120, 193)",
        "show": false
      },
      "tableColumn": "",
      "targets": [
        {
          "database": "softswitch",
          "dateLoading": false,
          "dateTimeColDataType": "calldate",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "intervalFactor": 1,
          "query": "SELECT\n    $timeSeries as t,\n    count()\nFROM $table\nWHERE $timeFilter\nAND ((caller like '642%') or (called like '642%'))\n    $conditionalTest(AND (local_user in ($username) or called_user in ($username)),$username)\n    $conditionalTest(AND (caller_owning_carrier in ($carrier) or called_owning_carrier in ($carrier)),$carrier)\n    $conditionalTest(AND reason in ($reason),$reason)\n    $conditionalTest(AND (caller in ($number) or local_number in ($number) or called in ($number)),$number)\n\nand caller_called_nature = 'OnOn'\n\ngroup by t",
          "rawQuery": "SELECT     (intDiv(toUInt32(calldate), 120) * 120) * 1000 as t,     count() FROM softswitch.cdr WHERE calldate >= toDateTime(1571428847) AND ((caller like '642%') or (called like '642%'))                          and caller_called_nature = 'OnOn'  group by t",
          "refId": "A",
          "round": "0s",
          "table": "cdr",
          "tableLoading": false
        }
      ],
      "thresholds": "",
      "timeFrom": null,
      "timeShift": null,
      "title": "NZ Mobile Calls On-net",
      "type": "singlestat",
      "valueFontSize": "80%",
      "valueMaps": [
        {
          "op": "=",
          "text": "N/A",
          "value": "null"
        }
      ],
      "valueName": "total"
    },
    {
      "cacheTimeout": null,
      "colorBackground": false,
      "colorValue": false,
      "colors": [
        "#299c46",
        "rgba(237, 129, 40, 0.89)",
        "#d44a3a"
      ],
      "datasource": "ClickHouse",
      "decimals": 1,
      "format": "dtdurations",
      "gauge": {
        "maxValue": 100,
        "minValue": 0,
        "show": false,
        "thresholdLabels": false,
        "thresholdMarkers": true
      },
      "gridPos": {
        "h": 3,
        "w": 4,
        "x": 12,
        "y": 9
      },
      "id": 43,
      "interval": null,
      "links": [],
      "mappingType": 1,
      "mappingTypes": [
        {
          "name": "value to text",
          "value": 1
        },
        {
          "name": "range to text",
          "value": 2
        }
      ],
      "maxDataPoints": 100,
      "nullPointMode": "connected",
      "nullText": null,
      "pluginVersion": "6.1.3",
      "postfix": "",
      "postfixFontSize": "80%",
      "prefix": "",
      "prefixFontSize": "50%",
      "rangeMaps": [
        {
          "from": "null",
          "text": "N/A",
          "to": "null"
        }
      ],
      "sparkline": {
        "fillColor": "rgba(31, 118, 189, 0.18)",
        "full": false,
        "lineColor": "rgb(31, 120, 193)",
        "show": false
      },
      "tableColumn": "",
      "targets": [
        {
          "database": "softswitch",
          "dateLoading": false,
          "dateTimeColDataType": "calldate",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "intervalFactor": 1,
          "query": "SELECT\n    $timeSeries as t,\n    sum(duration)\nFROM $table\nWHERE $timeFilter\nAND ((caller like '642%') or (called like '642%'))\n    $conditionalTest(AND (local_user in ($username) or called_user in ($username)),$username)\n    $conditionalTest(AND (caller_owning_carrier in ($carrier) or called_owning_carrier in ($carrier)),$carrier)\n    $conditionalTest(AND reason in ($reason),$reason)\n    $conditionalTest(AND (caller in ($number) or local_number in ($number) or called in ($number)),$number)\n\nand caller_called_nature = 'OnOn'\n\ngroup by t",
          "rawQuery": "SELECT     (intDiv(toUInt32(calldate), 120) * 120) * 1000 as t,     sum(duration) FROM softswitch.cdr WHERE calldate >= toDateTime(1571428847) AND ((caller like '642%') or (called like '642%'))                          and caller_called_nature = 'OnOn'  group by t",
          "refId": "A",
          "round": "0s",
          "table": "cdr",
          "tableLoading": false
        }
      ],
      "thresholds": "",
      "timeFrom": null,
      "timeShift": null,
      "title": "NZ Mobile Call Total Outbound",
      "type": "singlestat",
      "valueFontSize": "50%",
      "valueMaps": [
        {
          "op": "=",
          "text": "N/A",
          "value": "null"
        }
      ],
      "valueName": "total"
    },
    {
      "cacheTimeout": null,
      "colorBackground": false,
      "colorValue": false,
      "colors": [
        "#299c46",
        "rgba(237, 129, 40, 0.89)",
        "#d44a3a"
      ],
      "datasource": "ClickHouse",
      "format": "none",
      "gauge": {
        "maxValue": 100,
        "minValue": 0,
        "show": false,
        "thresholdLabels": false,
        "thresholdMarkers": true
      },
      "gridPos": {
        "h": 3,
        "w": 4,
        "x": 16,
        "y": 9
      },
      "id": 15,
      "interval": null,
      "links": [],
      "mappingType": 1,
      "mappingTypes": [
        {
          "name": "value to text",
          "value": 1
        },
        {
          "name": "range to text",
          "value": 2
        }
      ],
      "maxDataPoints": 100,
      "nullPointMode": "connected",
      "nullText": null,
      "pluginVersion": "6.1.3",
      "postfix": " calls",
      "postfixFontSize": "50%",
      "prefix": "",
      "prefixFontSize": "50%",
      "rangeMaps": [
        {
          "from": "null",
          "text": "N/A",
          "to": "null"
        }
      ],
      "sparkline": {
        "fillColor": "rgba(31, 118, 189, 0.18)",
        "full": false,
        "lineColor": "rgb(31, 120, 193)",
        "show": false
      },
      "tableColumn": "",
      "targets": [
        {
          "database": "softswitch",
          "dateLoading": false,
          "dateTimeColDataType": "calldate",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "intervalFactor": 1,
          "query": "SELECT\n    $timeSeries as t,\n    count()\nFROM $table\nWHERE $timeFilter\nAND ((caller like '642%') or (called like '642%'))\n    $conditionalTest(AND (local_user in ($username) or called_user in ($username)),$username)\n    $conditionalTest(AND (caller_owning_carrier in ($carrier) or called_owning_carrier in ($carrier)),$carrier)\n    $conditionalTest(AND reason in ($reason),$reason)\n    $conditionalTest(AND (caller in ($number) or local_number in ($number) or called in ($number)),$number)\n\nand caller_called_nature = 'OnOff'\n\ngroup by t",
          "rawQuery": "SELECT     (intDiv(toUInt32(calldate), 120) * 120) * 1000 as t,     count() FROM softswitch.cdr WHERE calldate >= toDateTime(1571428847) AND ((caller like '642%') or (called like '642%'))                          and caller_called_nature = 'OnOff'  group by t",
          "refId": "A",
          "round": "0s",
          "table": "cdr",
          "tableLoading": false
        }
      ],
      "thresholds": "",
      "timeFrom": null,
      "timeShift": null,
      "title": "NZ Mobile Calls Outbound",
      "type": "singlestat",
      "valueFontSize": "80%",
      "valueMaps": [
        {
          "op": "=",
          "text": "N/A",
          "value": "null"
        }
      ],
      "valueName": "total"
    },
    {
      "cacheTimeout": null,
      "colorBackground": false,
      "colorValue": false,
      "colors": [
        "#299c46",
        "rgba(237, 129, 40, 0.89)",
        "#d44a3a"
      ],
      "datasource": "ClickHouse",
      "decimals": 1,
      "format": "dtdurations",
      "gauge": {
        "maxValue": 100,
        "minValue": 0,
        "show": false,
        "thresholdLabels": false,
        "thresholdMarkers": true
      },
      "gridPos": {
        "h": 3,
        "w": 4,
        "x": 20,
        "y": 9
      },
      "id": 21,
      "interval": null,
      "links": [],
      "mappingType": 1,
      "mappingTypes": [
        {
          "name": "value to text",
          "value": 1
        },
        {
          "name": "range to text",
          "value": 2
        }
      ],
      "maxDataPoints": 100,
      "nullPointMode": "connected",
      "nullText": null,
      "pluginVersion": "6.1.3",
      "postfix": "",
      "postfixFontSize": "80%",
      "prefix": "",
      "prefixFontSize": "50%",
      "rangeMaps": [
        {
          "from": "null",
          "text": "N/A",
          "to": "null"
        }
      ],
      "sparkline": {
        "fillColor": "rgba(31, 118, 189, 0.18)",
        "full": false,
        "lineColor": "rgb(31, 120, 193)",
        "show": false
      },
      "tableColumn": "",
      "targets": [
        {
          "database": "softswitch",
          "dateLoading": false,
          "dateTimeColDataType": "calldate",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "intervalFactor": 1,
          "query": "SELECT\n    $timeSeries as t,\n    sum(duration)\nFROM $table\nWHERE $timeFilter\nAND ((caller like '642%') or (called like '642%'))\n    $conditionalTest(AND (local_user in ($username) or called_user in ($username)),$username)\n    $conditionalTest(AND (caller_owning_carrier in ($carrier) or called_owning_carrier in ($carrier)),$carrier)\n    $conditionalTest(AND reason in ($reason),$reason)\n    $conditionalTest(AND (caller in ($number) or local_number in ($number) or called in ($number)),$number)\n\nand caller_called_nature = 'OnOff'\n\ngroup by t",
          "rawQuery": "SELECT     (intDiv(toUInt32(calldate), 120) * 120) * 1000 as t,     sum(duration) FROM softswitch.cdr WHERE calldate >= toDateTime(1571428847) AND ((caller like '642%') or (called like '642%'))                          and caller_called_nature = 'OnOff'  group by t",
          "refId": "A",
          "round": "0s",
          "table": "cdr",
          "tableLoading": false
        }
      ],
      "thresholds": "",
      "timeFrom": null,
      "timeShift": null,
      "title": "NZ Mobile Call Total Outbound",
      "type": "singlestat",
      "valueFontSize": "50%",
      "valueMaps": [
        {
          "op": "=",
          "text": "N/A",
          "value": "null"
        }
      ],
      "valueName": "total"
    },
    {
      "cacheTimeout": null,
      "colorBackground": false,
      "colorValue": false,
      "colors": [
        "#299c46",
        "rgba(237, 129, 40, 0.89)",
        "#d44a3a"
      ],
      "datasource": "ClickHouse",
      "format": "none",
      "gauge": {
        "maxValue": 100,
        "minValue": 0,
        "show": false,
        "thresholdLabels": false,
        "thresholdMarkers": true
      },
      "gridPos": {
        "h": 3,
        "w": 4,
        "x": 0,
        "y": 12
      },
      "id": 13,
      "interval": null,
      "links": [],
      "mappingType": 1,
      "mappingTypes": [
        {
          "name": "value to text",
          "value": 1
        },
        {
          "name": "range to text",
          "value": 2
        }
      ],
      "maxDataPoints": 100,
      "nullPointMode": "connected",
      "nullText": null,
      "pluginVersion": "6.1.3",
      "postfix": " calls",
      "postfixFontSize": "50%",
      "prefix": "",
      "prefixFontSize": "50%",
      "rangeMaps": [
        {
          "from": "null",
          "text": "N/A",
          "to": "null"
        }
      ],
      "sparkline": {
        "fillColor": "rgba(31, 118, 189, 0.18)",
        "full": false,
        "lineColor": "rgb(31, 120, 193)",
        "show": false
      },
      "tableColumn": "",
      "targets": [
        {
          "database": "softswitch",
          "dateLoading": false,
          "dateTimeColDataType": "calldate",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "intervalFactor": 1,
          "query": "SELECT\n    $timeSeries as t,\n    count()\nFROM $table\nWHERE $timeFilter\nAND (\n\t(caller like '64%' and called not like '64%') OR\n\t(caller not like '64%' and called like '64%') OR\n\t(caller not like '64%' and called not like '64%')\n\t)\n    $conditionalTest(AND (local_user in ($username) or called_user in ($username)),$username)\n    $conditionalTest(AND (caller_owning_carrier in ($carrier) or called_owning_carrier in ($carrier)),$carrier)\n    $conditionalTest(AND reason in ($reason),$reason)\n    $conditionalTest(AND (caller in ($number) or local_number in ($number) or called in ($number)),$number)\n\nand caller_called_nature = 'OffOn'\n\ngroup by t",
          "rawQuery": "SELECT     (intDiv(toUInt32(calldate), 120) * 120) * 1000 as t,     count() FROM softswitch.cdr WHERE calldate >= toDateTime(1571428847) AND ( \t(caller like '64%' and called not like '64%') OR \t(caller not like '64%' and called like '64%') OR \t(caller not like '64%' and called not like '64%') \t)                          and caller_called_nature = 'OffOn'  group by t",
          "refId": "A",
          "round": "0s",
          "table": "cdr",
          "tableLoading": false
        }
      ],
      "thresholds": "",
      "timeFrom": null,
      "timeShift": null,
      "title": "International Calls Inbound",
      "type": "singlestat",
      "valueFontSize": "80%",
      "valueMaps": [
        {
          "op": "=",
          "text": "N/A",
          "value": "null"
        }
      ],
      "valueName": "total"
    },
    {
      "cacheTimeout": null,
      "colorBackground": false,
      "colorValue": false,
      "colors": [
        "#299c46",
        "rgba(237, 129, 40, 0.89)",
        "#d44a3a"
      ],
      "datasource": "ClickHouse",
      "decimals": 1,
      "format": "dtdurations",
      "gauge": {
        "maxValue": 100,
        "minValue": 0,
        "show": false,
        "thresholdLabels": false,
        "thresholdMarkers": true
      },
      "gridPos": {
        "h": 3,
        "w": 4,
        "x": 4,
        "y": 12
      },
      "id": 19,
      "interval": null,
      "links": [],
      "mappingType": 1,
      "mappingTypes": [
        {
          "name": "value to text",
          "value": 1
        },
        {
          "name": "range to text",
          "value": 2
        }
      ],
      "maxDataPoints": 100,
      "nullPointMode": "connected",
      "nullText": null,
      "pluginVersion": "6.1.3",
      "postfix": "",
      "postfixFontSize": "80%",
      "prefix": "",
      "prefixFontSize": "50%",
      "rangeMaps": [
        {
          "from": "null",
          "text": "N/A",
          "to": "null"
        }
      ],
      "sparkline": {
        "fillColor": "rgba(31, 118, 189, 0.18)",
        "full": false,
        "lineColor": "rgb(31, 120, 193)",
        "show": false
      },
      "tableColumn": "",
      "targets": [
        {
          "database": "softswitch",
          "dateLoading": false,
          "dateTimeColDataType": "calldate",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "intervalFactor": 1,
          "query": "SELECT\n    $timeSeries as t,\n    sum(duration)\nFROM $table\nWHERE $timeFilter\nAND (\n\t(caller like '64%' and called not like '64%') OR\n\t(caller not like '64%' and called like '64%') OR\n\t(caller not like '64%' and called not like '64%')\n\t)\n    $conditionalTest(AND (local_user in ($username) or called_user in ($username)),$username)\n    $conditionalTest(AND (caller_owning_carrier in ($carrier) or called_owning_carrier in ($carrier)),$carrier)\n    $conditionalTest(AND reason in ($reason),$reason)\n    $conditionalTest(AND (caller in ($number) or local_number in ($number) or called in ($number)),$number)\n\nand caller_called_nature = 'OffOn'\n\ngroup by t",
          "rawQuery": "SELECT     (intDiv(toUInt32(calldate), 120) * 120) * 1000 as t,     sum(duration) FROM softswitch.cdr WHERE calldate >= toDateTime(1571428847) AND ( \t(caller like '64%' and called not like '64%') OR \t(caller not like '64%' and called like '64%') OR \t(caller not like '64%' and called not like '64%') \t)                          and caller_called_nature = 'OffOn'  group by t",
          "refId": "A",
          "round": "0s",
          "table": "cdr",
          "tableLoading": false
        }
      ],
      "thresholds": "",
      "timeFrom": null,
      "timeShift": null,
      "title": "International Talk Time Inbound",
      "type": "singlestat",
      "valueFontSize": "50%",
      "valueMaps": [
        {
          "op": "=",
          "text": "N/A",
          "value": "null"
        }
      ],
      "valueName": "total"
    },
    {
      "cacheTimeout": null,
      "colorBackground": false,
      "colorValue": false,
      "colors": [
        "#299c46",
        "rgba(237, 129, 40, 0.89)",
        "#d44a3a"
      ],
      "datasource": "ClickHouse",
      "format": "none",
      "gauge": {
        "maxValue": 100,
        "minValue": 0,
        "show": false,
        "thresholdLabels": false,
        "thresholdMarkers": true
      },
      "gridPos": {
        "h": 3,
        "w": 4,
        "x": 8,
        "y": 12
      },
      "id": 41,
      "interval": null,
      "links": [],
      "mappingType": 1,
      "mappingTypes": [
        {
          "name": "value to text",
          "value": 1
        },
        {
          "name": "range to text",
          "value": 2
        }
      ],
      "maxDataPoints": 100,
      "nullPointMode": "connected",
      "nullText": null,
      "pluginVersion": "6.1.3",
      "postfix": " calls",
      "postfixFontSize": "50%",
      "prefix": "",
      "prefixFontSize": "50%",
      "rangeMaps": [
        {
          "from": "null",
          "text": "N/A",
          "to": "null"
        }
      ],
      "sparkline": {
        "fillColor": "rgba(31, 118, 189, 0.18)",
        "full": false,
        "lineColor": "rgb(31, 120, 193)",
        "show": false
      },
      "tableColumn": "",
      "targets": [
        {
          "database": "softswitch",
          "dateLoading": false,
          "dateTimeColDataType": "calldate",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "intervalFactor": 1,
          "query": "SELECT\n    $timeSeries as t,\n    count()\nFROM $table\nWHERE $timeFilter\nAND (\n\t(caller like '64%' and called not like '64%') OR\n\t(caller not like '64%' and called like '64%') OR\n\t(caller not like '64%' and called not like '64%')\n\t)\n    $conditionalTest(AND (local_user in ($username) or called_user in ($username)),$username)\n    $conditionalTest(AND (caller_owning_carrier in ($carrier) or called_owning_carrier in ($carrier)),$carrier)\n    $conditionalTest(AND reason in ($reason),$reason)\n    $conditionalTest(AND (caller in ($number) or local_number in ($number) or called in ($number)),$number)\n\nand caller_called_nature = 'OnOn'\n\ngroup by t",
          "rawQuery": "SELECT     (intDiv(toUInt32(calldate), 120) * 120) * 1000 as t,     count() FROM softswitch.cdr WHERE calldate >= toDateTime(1571428847) AND ( \t(caller like '64%' and called not like '64%') OR \t(caller not like '64%' and called like '64%') OR \t(caller not like '64%' and called not like '64%') \t)                          and caller_called_nature = 'OnOn'  group by t",
          "refId": "A",
          "round": "0s",
          "table": "cdr",
          "tableLoading": false
        }
      ],
      "thresholds": "",
      "timeFrom": null,
      "timeShift": null,
      "title": "International Calls On-net",
      "type": "singlestat",
      "valueFontSize": "80%",
      "valueMaps": [
        {
          "op": "=",
          "text": "N/A",
          "value": "null"
        }
      ],
      "valueName": "total"
    },
    {
      "cacheTimeout": null,
      "colorBackground": false,
      "colorValue": false,
      "colors": [
        "#299c46",
        "rgba(237, 129, 40, 0.89)",
        "#d44a3a"
      ],
      "datasource": "ClickHouse",
      "decimals": 1,
      "format": "dtdurations",
      "gauge": {
        "maxValue": 100,
        "minValue": 0,
        "show": false,
        "thresholdLabels": false,
        "thresholdMarkers": true
      },
      "gridPos": {
        "h": 3,
        "w": 4,
        "x": 12,
        "y": 12
      },
      "id": 22,
      "interval": null,
      "links": [],
      "mappingType": 1,
      "mappingTypes": [
        {
          "name": "value to text",
          "value": 1
        },
        {
          "name": "range to text",
          "value": 2
        }
      ],
      "maxDataPoints": 100,
      "nullPointMode": "connected",
      "nullText": null,
      "pluginVersion": "6.1.3",
      "postfix": "",
      "postfixFontSize": "80%",
      "prefix": "",
      "prefixFontSize": "50%",
      "rangeMaps": [
        {
          "from": "null",
          "text": "N/A",
          "to": "null"
        }
      ],
      "sparkline": {
        "fillColor": "rgba(31, 118, 189, 0.18)",
        "full": false,
        "lineColor": "rgb(31, 120, 193)",
        "show": false
      },
      "tableColumn": "",
      "targets": [
        {
          "database": "softswitch",
          "dateLoading": false,
          "dateTimeColDataType": "calldate",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "intervalFactor": 1,
          "query": "SELECT\n    $timeSeries as t,\n    sum(duration)\nFROM $table\nWHERE $timeFilter\nAND (\n\t(caller like '64%' and called not like '64%') OR\n\t(caller not like '64%' and called like '64%') OR\n\t(caller not like '64%' and called not like '64%')\n\t)\n    $conditionalTest(AND (local_user in ($username) or called_user in ($username)),$username)\n    $conditionalTest(AND (caller_owning_carrier in ($carrier) or called_owning_carrier in ($carrier)),$carrier)\n    $conditionalTest(AND reason in ($reason),$reason)\n    $conditionalTest(AND (caller in ($number) or local_number in ($number) or called in ($number)),$number)\n\nand caller_called_nature = 'OnOn'\n\ngroup by t",
          "rawQuery": "SELECT     (intDiv(toUInt32(calldate), 120) * 120) * 1000 as t,     sum(duration) FROM softswitch.cdr WHERE calldate >= toDateTime(1571428847) AND ( \t(caller like '64%' and called not like '64%') OR \t(caller not like '64%' and called like '64%') OR \t(caller not like '64%' and called not like '64%') \t)                          and caller_called_nature = 'OnOn'  group by t",
          "refId": "A",
          "round": "0s",
          "table": "cdr",
          "tableLoading": false
        }
      ],
      "thresholds": "",
      "timeFrom": null,
      "timeShift": null,
      "title": "International Call Total Outbound",
      "type": "singlestat",
      "valueFontSize": "50%",
      "valueMaps": [
        {
          "op": "=",
          "text": "N/A",
          "value": "null"
        }
      ],
      "valueName": "total"
    },
    {
      "cacheTimeout": null,
      "colorBackground": false,
      "colorValue": false,
      "colors": [
        "#299c46",
        "rgba(237, 129, 40, 0.89)",
        "#d44a3a"
      ],
      "datasource": "ClickHouse",
      "format": "none",
      "gauge": {
        "maxValue": 100,
        "minValue": 0,
        "show": false,
        "thresholdLabels": false,
        "thresholdMarkers": true
      },
      "gridPos": {
        "h": 3,
        "w": 4,
        "x": 16,
        "y": 12
      },
      "id": 16,
      "interval": null,
      "links": [],
      "mappingType": 1,
      "mappingTypes": [
        {
          "name": "value to text",
          "value": 1
        },
        {
          "name": "range to text",
          "value": 2
        }
      ],
      "maxDataPoints": 100,
      "nullPointMode": "connected",
      "nullText": null,
      "pluginVersion": "6.1.3",
      "postfix": " calls",
      "postfixFontSize": "50%",
      "prefix": "",
      "prefixFontSize": "50%",
      "rangeMaps": [
        {
          "from": "null",
          "text": "N/A",
          "to": "null"
        }
      ],
      "sparkline": {
        "fillColor": "rgba(31, 118, 189, 0.18)",
        "full": false,
        "lineColor": "rgb(31, 120, 193)",
        "show": false
      },
      "tableColumn": "",
      "targets": [
        {
          "database": "softswitch",
          "dateLoading": false,
          "dateTimeColDataType": "calldate",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "intervalFactor": 1,
          "query": "SELECT\n    $timeSeries as t,\n    count()\nFROM $table\nWHERE $timeFilter\nAND (\n\t(caller like '64%' and called not like '64%') OR\n\t(caller not like '64%' and called like '64%') OR\n\t(caller not like '64%' and called not like '64%')\n\t)\n    $conditionalTest(AND (local_user in ($username) or called_user in ($username)),$username)\n    $conditionalTest(AND (caller_owning_carrier in ($carrier) or called_owning_carrier in ($carrier)),$carrier)\n    $conditionalTest(AND reason in ($reason),$reason)\n    $conditionalTest(AND (caller in ($number) or local_number in ($number) or called in ($number)),$number)\n\nand caller_called_nature = 'OnOff'\n\ngroup by t",
          "rawQuery": "SELECT     (intDiv(toUInt32(calldate), 120) * 120) * 1000 as t,     count() FROM softswitch.cdr WHERE calldate >= toDateTime(1571428847) AND ( \t(caller like '64%' and called not like '64%') OR \t(caller not like '64%' and called like '64%') OR \t(caller not like '64%' and called not like '64%') \t)                          and caller_called_nature = 'OnOff'  group by t",
          "refId": "A",
          "round": "0s",
          "table": "cdr",
          "tableLoading": false
        }
      ],
      "thresholds": "",
      "timeFrom": null,
      "timeShift": null,
      "title": "International Calls Outbound",
      "type": "singlestat",
      "valueFontSize": "80%",
      "valueMaps": [
        {
          "op": "=",
          "text": "N/A",
          "value": "null"
        }
      ],
      "valueName": "total"
    },
    {
      "cacheTimeout": null,
      "colorBackground": false,
      "colorValue": false,
      "colors": [
        "#299c46",
        "rgba(237, 129, 40, 0.89)",
        "#d44a3a"
      ],
      "datasource": "ClickHouse",
      "decimals": 1,
      "format": "dtdurations",
      "gauge": {
        "maxValue": 100,
        "minValue": 0,
        "show": false,
        "thresholdLabels": false,
        "thresholdMarkers": true
      },
      "gridPos": {
        "h": 3,
        "w": 4,
        "x": 20,
        "y": 12
      },
      "id": 44,
      "interval": null,
      "links": [],
      "mappingType": 1,
      "mappingTypes": [
        {
          "name": "value to text",
          "value": 1
        },
        {
          "name": "range to text",
          "value": 2
        }
      ],
      "maxDataPoints": 100,
      "nullPointMode": "connected",
      "nullText": null,
      "pluginVersion": "6.1.3",
      "postfix": "",
      "postfixFontSize": "80%",
      "prefix": "",
      "prefixFontSize": "50%",
      "rangeMaps": [
        {
          "from": "null",
          "text": "N/A",
          "to": "null"
        }
      ],
      "sparkline": {
        "fillColor": "rgba(31, 118, 189, 0.18)",
        "full": false,
        "lineColor": "rgb(31, 120, 193)",
        "show": false
      },
      "tableColumn": "",
      "targets": [
        {
          "database": "softswitch",
          "dateLoading": false,
          "dateTimeColDataType": "calldate",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "intervalFactor": 1,
          "query": "SELECT\n    $timeSeries as t,\n    sum(duration)\nFROM $table\nWHERE $timeFilter\nAND (\n\t(caller like '64%' and called not like '64%') OR\n\t(caller not like '64%' and called like '64%') OR\n\t(caller not like '64%' and called not like '64%')\n\t)\n    $conditionalTest(AND (local_user in ($username) or called_user in ($username)),$username)\n    $conditionalTest(AND (caller_owning_carrier in ($carrier) or called_owning_carrier in ($carrier)),$carrier)\n    $conditionalTest(AND reason in ($reason),$reason)\n    $conditionalTest(AND (caller in ($number) or local_number in ($number) or called in ($number)),$number)\n\nand caller_called_nature = 'OnOff'\n\ngroup by t",
          "rawQuery": "SELECT     (intDiv(toUInt32(calldate), 120) * 120) * 1000 as t,     sum(duration) FROM softswitch.cdr WHERE calldate >= toDateTime(1571428847) AND ( \t(caller like '64%' and called not like '64%') OR \t(caller not like '64%' and called like '64%') OR \t(caller not like '64%' and called not like '64%') \t)                          and caller_called_nature = 'OnOff'  group by t",
          "refId": "A",
          "round": "0s",
          "table": "cdr",
          "tableLoading": false
        }
      ],
      "thresholds": "",
      "timeFrom": null,
      "timeShift": null,
      "title": "International Call Total Outbound",
      "type": "singlestat",
      "valueFontSize": "50%",
      "valueMaps": [
        {
          "op": "=",
          "text": "N/A",
          "value": "null"
        }
      ],
      "valueName": "total"
    },
    {
      "aliasColors": {},
      "breakPoint": "50%",
      "cacheTimeout": null,
      "combine": {
        "label": "Others",
        "threshold": 0
      },
      "datasource": "ClickHouse",
      "fontSize": "80%",
      "format": "short",
      "gridPos": {
        "h": 4,
        "w": 4,
        "x": 0,
        "y": 15
      },
      "id": 24,
      "interval": null,
      "legend": {
        "percentage": true,
        "show": true,
        "values": false
      },
      "legendType": "Right side",
      "links": [],
      "maxDataPoints": 3,
      "nullPointMode": "connected",
      "pieType": "pie",
      "strokeWidth": 1,
      "targets": [
        {
          "database": "softswitch",
          "dateLoading": false,
          "dateTimeColDataType": "calldate",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "intervalFactor": 1,
          "query": "SELECT\n    $timeSeries as t,\n    count() as \"NZ Domestic\"\nFROM $table\nWHERE $timeFilter\nAND (((caller like '64%' or caller = 'Anonymous') and caller not like '642%') or (called like '64%' and called not like '642%'))\n    $conditionalTest(AND (local_user in ($username) or called_user in ($username)),$username)\n    $conditionalTest(AND (caller_owning_carrier in ($carrier) or called_owning_carrier in ($carrier)),$carrier)\n    $conditionalTest(AND reason in ($reason),$reason)\n    $conditionalTest(AND (caller in ($number) or local_number in ($number) or called in ($number)),$number)\n\nand caller_called_nature = 'OffOn'\ngroup by t",
          "rawQuery": "SELECT     (intDiv(toUInt32(calldate), 3600) * 3600) * 1000 as t,     count() as \"NZ Domestic\" FROM softswitch.cdr WHERE calldate >= toDateTime(1571428847) AND (((caller like '64%' or caller = 'Anonymous') and caller not like '642%') or (called like '64%' and called not like '642%'))                          and caller_called_nature = 'OffOn' group by t",
          "refId": "A",
          "round": "0s",
          "table": "cdr",
          "tableLoading": false
        },
        {
          "database": "softswitch",
          "dateLoading": false,
          "dateTimeColDataType": "calldate",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "intervalFactor": 1,
          "query": "SELECT\n    $timeSeries as t,\n    count() as \"NZ Mobile\"\nFROM $table\nWHERE $timeFilter\nAND ((caller like '642%') or (called like '642%'))\n    $conditionalTest(AND (local_user in ($username) or called_user in ($username)),$username)\n    $conditionalTest(AND (caller_owning_carrier in ($carrier) or called_owning_carrier in ($carrier)),$carrier)\n    $conditionalTest(AND reason in ($reason),$reason)\n    $conditionalTest(AND (caller in ($number) or local_number in ($number) or called in ($number)),$number)\n    \nand caller_called_nature = 'OffOn'\n\ngroup by t",
          "rawQuery": "SELECT     (intDiv(toUInt32(calldate), 3600) * 3600) * 1000 as t,     count() as \"NZ Mobile\" FROM softswitch.cdr WHERE calldate >= toDateTime(1571428847) AND ((caller like '642%') or (called like '642%'))                              and caller_called_nature = 'OffOn'  group by t",
          "refId": "B",
          "round": "0s",
          "table": "cdr",
          "tableLoading": false
        },
        {
          "database": "softswitch",
          "dateLoading": false,
          "dateTimeColDataType": "calldate",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "intervalFactor": 1,
          "query": "SELECT\n    $timeSeries as t,\n    count() as \"International\"\nFROM $table\nWHERE $timeFilter\nAND (\n\t(caller like '64%' and called not like '64%') OR\n\t(caller not like '64%' and called like '64%') OR\n\t(caller not like '64%' and called not like '64%')\n\t)\n    $conditionalTest(AND (local_user in ($username) or called_user in ($username)),$username)\n    $conditionalTest(AND (caller_owning_carrier in ($carrier) or called_owning_carrier in ($carrier)),$carrier)\n    $conditionalTest(AND reason in ($reason),$reason)\n    $conditionalTest(AND (caller in ($number) or local_number in ($number) or called in ($number)),$number)\n    \nand caller_called_nature = 'OffOn'\n\ngroup by t",
          "rawQuery": "SELECT     (intDiv(toUInt32(calldate), 3600) * 3600) * 1000 as t,     count() as \"International\" FROM softswitch.cdr WHERE calldate >= toDateTime(1571428847) AND ( \t(caller like '64%' and called not like '64%') OR \t(caller not like '64%' and called like '64%') OR \t(caller not like '64%' and called not like '64%') \t)                              and caller_called_nature = 'OffOn'  group by t",
          "refId": "C",
          "round": "0s",
          "table": "cdr",
          "tableLoading": false
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Inbound call distribution by total calls",
      "type": "grafana-piechart-panel",
      "valueName": "total"
    },
    {
      "aliasColors": {},
      "breakPoint": "50%",
      "cacheTimeout": null,
      "combine": {
        "label": "Others",
        "threshold": 0
      },
      "datasource": "ClickHouse",
      "fontSize": "80%",
      "format": "short",
      "gridPos": {
        "h": 4,
        "w": 4,
        "x": 4,
        "y": 15
      },
      "id": 25,
      "interval": null,
      "legend": {
        "percentage": true,
        "show": true,
        "values": false
      },
      "legendType": "Right side",
      "links": [],
      "maxDataPoints": 3,
      "nullPointMode": "connected",
      "pieType": "pie",
      "strokeWidth": 1,
      "targets": [
        {
          "database": "softswitch",
          "dateLoading": false,
          "dateTimeColDataType": "calldate",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "intervalFactor": 1,
          "query": "SELECT\n    $timeSeries as t,\n    sum(duration) as \"NZ Domestic\"\nFROM $table\nWHERE $timeFilter\nAND (((caller like '64%' or caller = 'Anonymous') and caller not like '642%') or (called like '64%' and called not like '642%'))\n    $conditionalTest(AND (local_user in ($username) or called_user in ($username)),$username)\n    $conditionalTest(AND (caller_owning_carrier in ($carrier) or called_owning_carrier in ($carrier)),$carrier)\n    $conditionalTest(AND reason in ($reason),$reason)\n    $conditionalTest(AND (caller in ($number) or local_number in ($number) or called in ($number)),$number)\n\nand caller_called_nature = 'OffOn'\ngroup by t",
          "rawQuery": "SELECT     (intDiv(toUInt32(calldate), 3600) * 3600) * 1000 as t,     sum(duration) as \"NZ Domestic\" FROM softswitch.cdr WHERE calldate >= toDateTime(1571428847) AND (((caller like '64%' or caller = 'Anonymous') and caller not like '642%') or (called like '64%' and called not like '642%'))                          and caller_called_nature = 'OffOn' group by t",
          "refId": "A",
          "round": "0s",
          "table": "cdr",
          "tableLoading": false
        },
        {
          "database": "softswitch",
          "dateLoading": false,
          "dateTimeColDataType": "calldate",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "intervalFactor": 1,
          "query": "SELECT\n    $timeSeries as t,\n    sum(duration) as \"NZ Mobile\"\nFROM $table\nWHERE $timeFilter\nAND ((caller like '642%') or (called like '642%'))\n    $conditionalTest(AND (local_user in ($username) or called_user in ($username)),$username)\n    $conditionalTest(AND (caller_owning_carrier in ($carrier) or called_owning_carrier in ($carrier)),$carrier)\n    $conditionalTest(AND reason in ($reason),$reason)\n    $conditionalTest(AND (caller in ($number) or local_number in ($number) or called in ($number)),$number)\n    \nand caller_called_nature = 'OffOn'\n\ngroup by t",
          "rawQuery": "SELECT     (intDiv(toUInt32(calldate), 3600) * 3600) * 1000 as t,     sum(duration) as \"NZ Mobile\" FROM softswitch.cdr WHERE calldate >= toDateTime(1571428847) AND ((caller like '642%') or (called like '642%'))                              and caller_called_nature = 'OffOn'  group by t",
          "refId": "B",
          "round": "0s",
          "table": "cdr",
          "tableLoading": false
        },
        {
          "database": "softswitch",
          "dateLoading": false,
          "dateTimeColDataType": "calldate",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "intervalFactor": 1,
          "query": "SELECT\n    $timeSeries as t,\n    sum(duration) as \"International\"\nFROM $table\nWHERE $timeFilter\nAND (\n\t(caller like '64%' and called not like '64%') OR\n\t(caller not like '64%' and called like '64%') OR\n\t(caller not like '64%' and called not like '64%')\n\t)\n    $conditionalTest(AND (local_user in ($username) or called_user in ($username)),$username)\n    $conditionalTest(AND (caller_owning_carrier in ($carrier) or called_owning_carrier in ($carrier)),$carrier)\n    $conditionalTest(AND reason in ($reason),$reason)\n    $conditionalTest(AND (caller in ($number) or local_number in ($number) or called in ($number)),$number)\n    \nand caller_called_nature = 'OffOn'\n\ngroup by t",
          "rawQuery": "SELECT     (intDiv(toUInt32(calldate), 3600) * 3600) * 1000 as t,     sum(duration) as \"International\" FROM softswitch.cdr WHERE calldate >= toDateTime(1571428847) AND ( \t(caller like '64%' and called not like '64%') OR \t(caller not like '64%' and called like '64%') OR \t(caller not like '64%' and called not like '64%') \t)                              and caller_called_nature = 'OffOn'  group by t",
          "refId": "C",
          "round": "0s",
          "table": "cdr",
          "tableLoading": false
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Inbound call distribution by talk time",
      "type": "grafana-piechart-panel",
      "valueName": "total"
    },
    {
      "aliasColors": {},
      "breakPoint": "50%",
      "cacheTimeout": null,
      "combine": {
        "label": "Others",
        "threshold": 0
      },
      "datasource": "ClickHouse",
      "fontSize": "80%",
      "format": "short",
      "gridPos": {
        "h": 4,
        "w": 4,
        "x": 8,
        "y": 15
      },
      "id": 45,
      "interval": null,
      "legend": {
        "percentage": true,
        "show": true,
        "values": false
      },
      "legendType": "Right side",
      "links": [],
      "maxDataPoints": 3,
      "nullPointMode": "connected",
      "pieType": "pie",
      "strokeWidth": 1,
      "targets": [
        {
          "database": "softswitch",
          "dateLoading": false,
          "dateTimeColDataType": "calldate",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "intervalFactor": 1,
          "query": "SELECT\n    $timeSeries as t,\n    count() as \"NZ Domestic\"\nFROM $table\nWHERE $timeFilter\nAND (((caller like '64%' or caller = 'Anonymous') and caller not like '642%') or (called like '64%' and called not like '642%'))\n    $conditionalTest(AND (local_user in ($username) or called_user in ($username)),$username)\n    $conditionalTest(AND (caller_owning_carrier in ($carrier) or called_owning_carrier in ($carrier)),$carrier)\n    $conditionalTest(AND reason in ($reason),$reason)\n    $conditionalTest(AND (caller in ($number) or local_number in ($number) or called in ($number)),$number)\n\nand caller_called_nature = 'OnOn'\ngroup by t",
          "rawQuery": "SELECT     (intDiv(toUInt32(calldate), 3600) * 3600) * 1000 as t,     count() as \"NZ Domestic\" FROM softswitch.cdr WHERE calldate >= toDateTime(1571428847) AND (((caller like '64%' or caller = 'Anonymous') and caller not like '642%') or (called like '64%' and called not like '642%'))                          and caller_called_nature = 'OnOn' group by t",
          "refId": "A",
          "round": "0s",
          "table": "cdr",
          "tableLoading": false
        },
        {
          "database": "softswitch",
          "dateLoading": false,
          "dateTimeColDataType": "calldate",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "intervalFactor": 1,
          "query": "SELECT\n    $timeSeries as t,\n    count() as \"NZ Mobile\"\nFROM $table\nWHERE $timeFilter\nAND ((caller like '642%') or (called like '642%'))\n    $conditionalTest(AND (local_user in ($username) or called_user in ($username)),$username)\n    $conditionalTest(AND (caller_owning_carrier in ($carrier) or called_owning_carrier in ($carrier)),$carrier)\n    $conditionalTest(AND reason in ($reason),$reason)\n    $conditionalTest(AND (caller in ($number) or local_number in ($number) or called in ($number)),$number)\n    \nand caller_called_nature = 'OnOn'\n\ngroup by t",
          "rawQuery": "SELECT     (intDiv(toUInt32(calldate), 3600) * 3600) * 1000 as t,     count() as \"NZ Mobile\" FROM softswitch.cdr WHERE calldate >= toDateTime(1571428847) AND ((caller like '642%') or (called like '642%'))                              and caller_called_nature = 'OnOn'  group by t",
          "refId": "B",
          "round": "0s",
          "table": "cdr",
          "tableLoading": false
        },
        {
          "database": "softswitch",
          "dateLoading": false,
          "dateTimeColDataType": "calldate",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "intervalFactor": 1,
          "query": "SELECT\n    $timeSeries as t,\n    count() as \"International\"\nFROM $table\nWHERE $timeFilter\nAND (\n\t(caller like '64%' and called not like '64%') OR\n\t(caller not like '64%' and called like '64%') OR\n\t(caller not like '64%' and called not like '64%')\n\t)\n    $conditionalTest(AND (local_user in ($username) or called_user in ($username)),$username)\n    $conditionalTest(AND (caller_owning_carrier in ($carrier) or called_owning_carrier in ($carrier)),$carrier)\n    $conditionalTest(AND reason in ($reason),$reason)\n    $conditionalTest(AND (caller in ($number) or local_number in ($number) or called in ($number)),$number)\n    \nand caller_called_nature = 'OnOn'\n\ngroup by t",
          "rawQuery": "SELECT     (intDiv(toUInt32(calldate), 3600) * 3600) * 1000 as t,     count() as \"International\" FROM softswitch.cdr WHERE calldate >= toDateTime(1571428847) AND ( \t(caller like '64%' and called not like '64%') OR \t(caller not like '64%' and called like '64%') OR \t(caller not like '64%' and called not like '64%') \t)                              and caller_called_nature = 'OnOn'  group by t",
          "refId": "C",
          "round": "0s",
          "table": "cdr",
          "tableLoading": false
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Outbound call distribution by total calls",
      "type": "grafana-piechart-panel",
      "valueName": "total"
    },
    {
      "aliasColors": {},
      "breakPoint": "50%",
      "cacheTimeout": null,
      "combine": {
        "label": "Others",
        "threshold": 0
      },
      "datasource": "ClickHouse",
      "fontSize": "80%",
      "format": "short",
      "gridPos": {
        "h": 4,
        "w": 4,
        "x": 12,
        "y": 15
      },
      "id": 46,
      "interval": null,
      "legend": {
        "percentage": true,
        "show": true,
        "values": false
      },
      "legendType": "Right side",
      "links": [],
      "maxDataPoints": 3,
      "nullPointMode": "connected",
      "pieType": "pie",
      "strokeWidth": 1,
      "targets": [
        {
          "database": "softswitch",
          "dateLoading": false,
          "dateTimeColDataType": "calldate",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "intervalFactor": 1,
          "query": "SELECT\n    $timeSeries as t,\n    sum(duration) as \"NZ Domestic\"\nFROM $table\nWHERE $timeFilter\nAND (((caller like '64%' or caller = 'Anonymous') and caller not like '642%') or (called like '64%' and called not like '642%'))\n    $conditionalTest(AND (local_user in ($username) or called_user in ($username)),$username)\n    $conditionalTest(AND (caller_owning_carrier in ($carrier) or called_owning_carrier in ($carrier)),$carrier)\n    $conditionalTest(AND reason in ($reason),$reason)\n    $conditionalTest(AND (caller in ($number) or local_number in ($number) or called in ($number)),$number)\n\nand caller_called_nature = 'OnOn'\ngroup by t",
          "rawQuery": "SELECT     (intDiv(toUInt32(calldate), 3600) * 3600) * 1000 as t,     sum(duration) as \"NZ Domestic\" FROM softswitch.cdr WHERE calldate >= toDateTime(1571428847) AND (((caller like '64%' or caller = 'Anonymous') and caller not like '642%') or (called like '64%' and called not like '642%'))                          and caller_called_nature = 'OnOn' group by t",
          "refId": "A",
          "round": "0s",
          "table": "cdr",
          "tableLoading": false
        },
        {
          "database": "softswitch",
          "dateLoading": false,
          "dateTimeColDataType": "calldate",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "intervalFactor": 1,
          "query": "SELECT\n    $timeSeries as t,\n    sum(duration) as \"NZ Mobile\"\nFROM $table\nWHERE $timeFilter\nAND ((caller like '642%') or (called like '642%'))\n    $conditionalTest(AND (local_user in ($username) or called_user in ($username)),$username)\n    $conditionalTest(AND (caller_owning_carrier in ($carrier) or called_owning_carrier in ($carrier)),$carrier)\n    $conditionalTest(AND reason in ($reason),$reason)\n    $conditionalTest(AND (caller in ($number) or local_number in ($number) or called in ($number)),$number)\n\nand caller_called_nature = 'OnOn'\n\ngroup by t",
          "rawQuery": "SELECT     (intDiv(toUInt32(calldate), 3600) * 3600) * 1000 as t,     sum(duration) as \"NZ Mobile\" FROM softswitch.cdr WHERE calldate >= toDateTime(1571428847) AND ((caller like '642%') or (called like '642%'))                          and caller_called_nature = 'OnOn'  group by t",
          "refId": "B",
          "round": "0s",
          "table": "cdr",
          "tableLoading": false
        },
        {
          "database": "softswitch",
          "dateLoading": false,
          "dateTimeColDataType": "calldate",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "intervalFactor": 1,
          "query": "SELECT\n    $timeSeries as t,\n    sum(duration) as \"International\"\nFROM $table\nWHERE $timeFilter\nAND (\n\t(caller like '64%' and called not like '64%') OR\n\t(caller not like '64%' and called like '64%') OR\n\t(caller not like '64%' and called not like '64%')\n\t)\n    $conditionalTest(AND (local_user in ($username) or called_user in ($username)),$username)\n    $conditionalTest(AND (caller_owning_carrier in ($carrier) or called_owning_carrier in ($carrier)),$carrier)\n    $conditionalTest(AND reason in ($reason),$reason)\n    $conditionalTest(AND (caller in ($number) or local_number in ($number) or called in ($number)),$number)\n\nand caller_called_nature = 'OnOn'\n\ngroup by t",
          "rawQuery": "SELECT     (intDiv(toUInt32(calldate), 3600) * 3600) * 1000 as t,     sum(duration) as \"International\" FROM softswitch.cdr WHERE calldate >= toDateTime(1571428847) AND ( \t(caller like '64%' and called not like '64%') OR \t(caller not like '64%' and called like '64%') OR \t(caller not like '64%' and called not like '64%') \t)                          and caller_called_nature = 'OnOn'  group by t",
          "refId": "C",
          "round": "0s",
          "table": "cdr",
          "tableLoading": false
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Outbound call distribution by talk time",
      "type": "grafana-piechart-panel",
      "valueName": "total"
    },
    {
      "aliasColors": {},
      "breakPoint": "50%",
      "cacheTimeout": null,
      "combine": {
        "label": "Others",
        "threshold": 0
      },
      "datasource": "ClickHouse",
      "fontSize": "80%",
      "format": "short",
      "gridPos": {
        "h": 4,
        "w": 4,
        "x": 16,
        "y": 15
      },
      "id": 26,
      "interval": null,
      "legend": {
        "percentage": true,
        "show": true,
        "values": false
      },
      "legendType": "Right side",
      "links": [],
      "maxDataPoints": 3,
      "nullPointMode": "connected",
      "pieType": "pie",
      "strokeWidth": 1,
      "targets": [
        {
          "database": "softswitch",
          "dateLoading": false,
          "dateTimeColDataType": "calldate",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "intervalFactor": 1,
          "query": "SELECT\n    $timeSeries as t,\n    count() as \"NZ Domestic\"\nFROM $table\nWHERE $timeFilter\nAND (((caller like '64%' or caller = 'Anonymous') and caller not like '642%') or (called like '64%' and called not like '642%'))\n    $conditionalTest(AND (local_user in ($username) or called_user in ($username)),$username)\n    $conditionalTest(AND (caller_owning_carrier in ($carrier) or called_owning_carrier in ($carrier)),$carrier)\n    $conditionalTest(AND reason in ($reason),$reason)\n    $conditionalTest(AND (caller in ($number) or local_number in ($number) or called in ($number)),$number)\n\nand caller_called_nature = 'OnOff'\ngroup by t",
          "rawQuery": "SELECT     (intDiv(toUInt32(calldate), 3600) * 3600) * 1000 as t,     count() as \"NZ Domestic\" FROM softswitch.cdr WHERE calldate >= toDateTime(1571428847) AND (((caller like '64%' or caller = 'Anonymous') and caller not like '642%') or (called like '64%' and called not like '642%'))                          and caller_called_nature = 'OnOff' group by t",
          "refId": "A",
          "round": "0s",
          "table": "cdr",
          "tableLoading": false
        },
        {
          "database": "softswitch",
          "dateLoading": false,
          "dateTimeColDataType": "calldate",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "intervalFactor": 1,
          "query": "SELECT\n    $timeSeries as t,\n    count() as \"NZ Mobile\"\nFROM $table\nWHERE $timeFilter\nAND ((caller like '642%') or (called like '642%'))\n    $conditionalTest(AND (local_user in ($username) or called_user in ($username)),$username)\n    $conditionalTest(AND (caller_owning_carrier in ($carrier) or called_owning_carrier in ($carrier)),$carrier)\n    $conditionalTest(AND reason in ($reason),$reason)\n    $conditionalTest(AND (caller in ($number) or local_number in ($number) or called in ($number)),$number)\n    \nand caller_called_nature = 'OnOff'\n\ngroup by t",
          "rawQuery": "SELECT     (intDiv(toUInt32(calldate), 3600) * 3600) * 1000 as t,     count() as \"NZ Mobile\" FROM softswitch.cdr WHERE calldate >= toDateTime(1571428847) AND ((caller like '642%') or (called like '642%'))                              and caller_called_nature = 'OnOff'  group by t",
          "refId": "B",
          "round": "0s",
          "table": "cdr",
          "tableLoading": false
        },
        {
          "database": "softswitch",
          "dateLoading": false,
          "dateTimeColDataType": "calldate",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "intervalFactor": 1,
          "query": "SELECT\n    $timeSeries as t,\n    count() as \"International\"\nFROM $table\nWHERE $timeFilter\nAND (\n\t(caller like '64%' and called not like '64%') OR\n\t(caller not like '64%' and called like '64%') OR\n\t(caller not like '64%' and called not like '64%')\n\t)\n    $conditionalTest(AND (local_user in ($username) or called_user in ($username)),$username)\n    $conditionalTest(AND (caller_owning_carrier in ($carrier) or called_owning_carrier in ($carrier)),$carrier)\n    $conditionalTest(AND reason in ($reason),$reason)\n    $conditionalTest(AND (caller in ($number) or local_number in ($number) or called in ($number)),$number)\n    \nand caller_called_nature = 'OnOff'\n\ngroup by t",
          "rawQuery": "SELECT     (intDiv(toUInt32(calldate), 3600) * 3600) * 1000 as t,     count() as \"International\" FROM softswitch.cdr WHERE calldate >= toDateTime(1571428847) AND ( \t(caller like '64%' and called not like '64%') OR \t(caller not like '64%' and called like '64%') OR \t(caller not like '64%' and called not like '64%') \t)                              and caller_called_nature = 'OnOff'  group by t",
          "refId": "C",
          "round": "0s",
          "table": "cdr",
          "tableLoading": false
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Outbound call distribution by total calls",
      "type": "grafana-piechart-panel",
      "valueName": "total"
    },
    {
      "aliasColors": {},
      "breakPoint": "50%",
      "cacheTimeout": null,
      "combine": {
        "label": "Others",
        "threshold": 0
      },
      "datasource": "ClickHouse",
      "fontSize": "80%",
      "format": "short",
      "gridPos": {
        "h": 4,
        "w": 4,
        "x": 20,
        "y": 15
      },
      "id": 27,
      "interval": null,
      "legend": {
        "percentage": true,
        "show": true,
        "values": false
      },
      "legendType": "Right side",
      "links": [],
      "maxDataPoints": 3,
      "nullPointMode": "connected",
      "pieType": "pie",
      "strokeWidth": 1,
      "targets": [
        {
          "database": "softswitch",
          "dateLoading": false,
          "dateTimeColDataType": "calldate",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "intervalFactor": 1,
          "query": "SELECT\n    $timeSeries as t,\n    sum(duration) as \"NZ Domestic\"\nFROM $table\nWHERE $timeFilter\nAND (((caller like '64%' or caller = 'Anonymous') and caller not like '642%') or (called like '64%' and called not like '642%'))\n    $conditionalTest(AND (local_user in ($username) or called_user in ($username)),$username)\n    $conditionalTest(AND (caller_owning_carrier in ($carrier) or called_owning_carrier in ($carrier)),$carrier)\n    $conditionalTest(AND reason in ($reason),$reason)\n    $conditionalTest(AND (caller in ($number) or local_number in ($number) or called in ($number)),$number)\n\nand caller_called_nature = 'OnOff'\ngroup by t",
          "rawQuery": "SELECT     (intDiv(toUInt32(calldate), 3600) * 3600) * 1000 as t,     sum(duration) as \"NZ Domestic\" FROM softswitch.cdr WHERE calldate >= toDateTime(1571428847) AND (((caller like '64%' or caller = 'Anonymous') and caller not like '642%') or (called like '64%' and called not like '642%'))                          and caller_called_nature = 'OnOff' group by t",
          "refId": "A",
          "round": "0s",
          "table": "cdr",
          "tableLoading": false
        },
        {
          "database": "softswitch",
          "dateLoading": false,
          "dateTimeColDataType": "calldate",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "intervalFactor": 1,
          "query": "SELECT\n    $timeSeries as t,\n    sum(duration) as \"NZ Mobile\"\nFROM $table\nWHERE $timeFilter\nAND ((caller like '642%') or (called like '642%'))\n    $conditionalTest(AND (local_user in ($username) or called_user in ($username)),$username)\n    $conditionalTest(AND (caller_owning_carrier in ($carrier) or called_owning_carrier in ($carrier)),$carrier)\n    $conditionalTest(AND reason in ($reason),$reason)\n    $conditionalTest(AND (caller in ($number) or local_number in ($number) or called in ($number)),$number)\n\nand caller_called_nature = 'OnOff'\n\ngroup by t",
          "rawQuery": "SELECT     (intDiv(toUInt32(calldate), 3600) * 3600) * 1000 as t,     sum(duration) as \"NZ Mobile\" FROM softswitch.cdr WHERE calldate >= toDateTime(1571428847) AND ((caller like '642%') or (called like '642%'))                          and caller_called_nature = 'OnOff'  group by t",
          "refId": "B",
          "round": "0s",
          "table": "cdr",
          "tableLoading": false
        },
        {
          "database": "softswitch",
          "dateLoading": false,
          "dateTimeColDataType": "calldate",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "intervalFactor": 1,
          "query": "SELECT\n    $timeSeries as t,\n    sum(duration) as \"International\"\nFROM $table\nWHERE $timeFilter\nAND (\n\t(caller like '64%' and called not like '64%') OR\n\t(caller not like '64%' and called like '64%') OR\n\t(caller not like '64%' and called not like '64%')\n\t)\n    $conditionalTest(AND (local_user in ($username) or called_user in ($username)),$username)\n    $conditionalTest(AND (caller_owning_carrier in ($carrier) or called_owning_carrier in ($carrier)),$carrier)\n    $conditionalTest(AND reason in ($reason),$reason)\n    $conditionalTest(AND (caller in ($number) or local_number in ($number) or called in ($number)),$number)\n\nand caller_called_nature = 'OnOff'\n\ngroup by t",
          "rawQuery": "SELECT     (intDiv(toUInt32(calldate), 3600) * 3600) * 1000 as t,     sum(duration) as \"International\" FROM softswitch.cdr WHERE calldate >= toDateTime(1571428847) AND ( \t(caller like '64%' and called not like '64%') OR \t(caller not like '64%' and called like '64%') OR \t(caller not like '64%' and called not like '64%') \t)                          and caller_called_nature = 'OnOff'  group by t",
          "refId": "C",
          "round": "0s",
          "table": "cdr",
          "tableLoading": false
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Outbound call distribution by talk time",
      "type": "grafana-piechart-panel",
      "valueName": "total"
    },
    {
      "aliasColors": {},
      "breakPoint": "50%",
      "cacheTimeout": null,
      "combine": {
        "label": "Others",
        "threshold": 0
      },
      "datasource": "ClickHouse",
      "decimals": null,
      "fontSize": "80%",
      "format": "short",
      "gridPos": {
        "h": 7,
        "w": 4,
        "x": 0,
        "y": 19
      },
      "id": 29,
      "interval": null,
      "legend": {
        "header": "Total Calls",
        "percentage": false,
        "show": true,
        "values": true
      },
      "legendType": "Right side",
      "links": [],
      "maxDataPoints": 3,
      "nullPointMode": "connected",
      "pieType": "pie",
      "strokeWidth": 1,
      "targets": [
        {
          "database": "softswitch",
          "dateLoading": false,
          "dateTimeColDataType": "calldate",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "intervalFactor": 1,
          "query": "SELECT\n    now() as time,\n    local_user as outcome,\n    count() as measurement\nFROM $table\nWHERE $timeFilter\n    $conditionalTest(AND (local_user in ($username) or called_user in ($username)),$username)\n    $conditionalTest(AND (caller_owning_carrier in ($carrier) or called_owning_carrier in ($carrier)),$carrier)\n    $conditionalTest(AND reason in ($reason),$reason)\n    $conditionalTest(AND (caller in ($number) or local_number in ($number) or called in ($number)),$number)\n\nand caller_called_nature = 'OffOn'\ngroup by time, outcome\norder by measurement desc\nlimit 10",
          "rawQuery": "SELECT     now() as time,     local_user as outcome,     count() as measurement FROM softswitch.cdr WHERE calldate >= toDateTime(1571428847)                          and caller_called_nature = 'OffOn' group by time, outcome order by measurement desc limit 10",
          "refId": "A",
          "round": "0s",
          "table": "cdr",
          "tableLoading": false
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Top 10 Inbound Source Accounts",
      "type": "grafana-piechart-panel",
      "valueName": "total"
    },
    {
      "aliasColors": {},
      "breakPoint": "50%",
      "cacheTimeout": null,
      "combine": {
        "label": "Others",
        "threshold": 0
      },
      "datasource": "ClickHouse",
      "decimals": null,
      "fontSize": "80%",
      "format": "short",
      "gridPos": {
        "h": 7,
        "w": 4,
        "x": 4,
        "y": 19
      },
      "id": 30,
      "interval": null,
      "legend": {
        "header": "Total Calls",
        "percentage": false,
        "show": true,
        "values": true
      },
      "legendType": "Right side",
      "links": [],
      "maxDataPoints": 3,
      "nullPointMode": "connected",
      "pieType": "pie",
      "strokeWidth": 1,
      "targets": [
        {
          "database": "softswitch",
          "dateLoading": false,
          "dateTimeColDataType": "calldate",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "intervalFactor": 1,
          "query": "SELECT\n    now() as time,\n    called_user as outcome,\n    count() as measurement\nFROM $table\nWHERE $timeFilter\n    $conditionalTest(AND (local_user in ($username) or called_user in ($username)),$username)\n    $conditionalTest(AND (caller_owning_carrier in ($carrier) or called_owning_carrier in ($carrier)),$carrier)\n    $conditionalTest(AND reason in ($reason),$reason)\n    $conditionalTest(AND (caller in ($number) or local_number in ($number) or called in ($number)),$number)\n\nand caller_called_nature = 'OffOn'\ngroup by time, outcome\norder by measurement desc\nlimit 10",
          "rawQuery": "SELECT     now() as time,     called_user as outcome,     count() as measurement FROM softswitch.cdr WHERE calldate >= toDateTime(1571428847)                          and caller_called_nature = 'OffOn' group by time, outcome order by measurement desc limit 10",
          "refId": "A",
          "round": "0s",
          "table": "cdr",
          "tableLoading": false
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Top 10 Inbound Destination Accounts",
      "type": "grafana-piechart-panel",
      "valueName": "total"
    },
    {
      "aliasColors": {},
      "breakPoint": "50%",
      "cacheTimeout": null,
      "combine": {
        "label": "Others",
        "threshold": 0
      },
      "datasource": "ClickHouse",
      "decimals": null,
      "fontSize": "80%",
      "format": "short",
      "gridPos": {
        "h": 7,
        "w": 4,
        "x": 8,
        "y": 19
      },
      "id": 47,
      "interval": null,
      "legend": {
        "header": "Total Calls",
        "percentage": false,
        "show": true,
        "values": true
      },
      "legendType": "Right side",
      "links": [],
      "maxDataPoints": 3,
      "nullPointMode": "connected",
      "pieType": "pie",
      "strokeWidth": 1,
      "targets": [
        {
          "database": "softswitch",
          "dateLoading": false,
          "dateTimeColDataType": "calldate",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "intervalFactor": 1,
          "query": "SELECT\n    now() as time,\n    local_user as outcome,\n    count() as measurement\nFROM $table\nWHERE $timeFilter\n    $conditionalTest(AND (local_user in ($username) or called_user in ($username)),$username)\n    $conditionalTest(AND (caller_owning_carrier in ($carrier) or called_owning_carrier in ($carrier)),$carrier)\n    $conditionalTest(AND reason in ($reason),$reason)\n    $conditionalTest(AND (caller in ($number) or local_number in ($number) or called in ($number)),$number)\n\n\nand caller_called_nature = 'OnOn'\ngroup by time, outcome\norder by measurement desc\nlimit 10",
          "rawQuery": "SELECT     now() as time,     local_user as outcome,     count() as measurement FROM softswitch.cdr WHERE calldate >= toDateTime(1571428847)                           and caller_called_nature = 'OnOn' group by time, outcome order by measurement desc limit 10",
          "refId": "A",
          "round": "0s",
          "table": "cdr",
          "tableLoading": false
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Top 10 Outbound Source Accounts",
      "type": "grafana-piechart-panel",
      "valueName": "total"
    },
    {
      "aliasColors": {},
      "breakPoint": "50%",
      "cacheTimeout": null,
      "combine": {
        "label": "Others",
        "threshold": 0
      },
      "datasource": "ClickHouse",
      "decimals": null,
      "fontSize": "80%",
      "format": "short",
      "gridPos": {
        "h": 7,
        "w": 4,
        "x": 12,
        "y": 19
      },
      "id": 48,
      "interval": null,
      "legend": {
        "header": "Total Calls",
        "percentage": false,
        "show": true,
        "values": true
      },
      "legendType": "Right side",
      "links": [],
      "maxDataPoints": 3,
      "nullPointMode": "connected",
      "pieType": "pie",
      "strokeWidth": 1,
      "targets": [
        {
          "database": "softswitch",
          "dateLoading": false,
          "dateTimeColDataType": "calldate",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "intervalFactor": 1,
          "query": "SELECT\n    now() as time,\n    called_user as outcome,\n    count() as measurement\nFROM $table\nWHERE $timeFilter\n    $conditionalTest(AND (local_user in ($username) or called_user in ($username)),$username)\n    $conditionalTest(AND (caller_owning_carrier in ($carrier) or called_owning_carrier in ($carrier)),$carrier)\n    $conditionalTest(AND reason in ($reason),$reason)\n    $conditionalTest(AND (caller in ($number) or local_number in ($number) or called in ($number)),$number)\n\n\nand caller_called_nature = 'OnOn'\ngroup by time, outcome\norder by measurement desc\nlimit 10",
          "rawQuery": "SELECT     now() as time,     called_user as outcome,     count() as measurement FROM softswitch.cdr WHERE calldate >= toDateTime(1571428847)                           and caller_called_nature = 'OnOn' group by time, outcome order by measurement desc limit 10",
          "refId": "A",
          "round": "0s",
          "table": "cdr",
          "tableLoading": false
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Top 10 Outbound Destination Accounts",
      "type": "grafana-piechart-panel",
      "valueName": "total"
    },
    {
      "aliasColors": {},
      "breakPoint": "50%",
      "cacheTimeout": null,
      "combine": {
        "label": "Others",
        "threshold": 0
      },
      "datasource": "ClickHouse",
      "decimals": null,
      "fontSize": "80%",
      "format": "short",
      "gridPos": {
        "h": 7,
        "w": 4,
        "x": 16,
        "y": 19
      },
      "id": 31,
      "interval": null,
      "legend": {
        "header": "Total Calls",
        "percentage": false,
        "show": true,
        "values": true
      },
      "legendType": "Right side",
      "links": [],
      "maxDataPoints": 3,
      "nullPointMode": "connected",
      "pieType": "pie",
      "strokeWidth": 1,
      "targets": [
        {
          "database": "softswitch",
          "dateLoading": false,
          "dateTimeColDataType": "calldate",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "intervalFactor": 1,
          "query": "SELECT\n    now() as time,\n    local_user as outcome,\n    count() as measurement\nFROM $table\nWHERE $timeFilter\n    $conditionalTest(AND (local_user in ($username) or called_user in ($username)),$username)\n    $conditionalTest(AND (caller_owning_carrier in ($carrier) or called_owning_carrier in ($carrier)),$carrier)\n    $conditionalTest(AND reason in ($reason),$reason)\n    $conditionalTest(AND (caller in ($number) or local_number in ($number) or called in ($number)),$number)\n\n\nand caller_called_nature = 'OnOff'\ngroup by time, outcome\norder by measurement desc\nlimit 10",
          "rawQuery": "SELECT     now() as time,     local_user as outcome,     count() as measurement FROM softswitch.cdr WHERE calldate >= toDateTime(1571428847)                           and caller_called_nature = 'OnOff' group by time, outcome order by measurement desc limit 10",
          "refId": "A",
          "round": "0s",
          "table": "cdr",
          "tableLoading": false
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Top 10 Outbound Source Accounts",
      "type": "grafana-piechart-panel",
      "valueName": "total"
    },
    {
      "aliasColors": {},
      "breakPoint": "50%",
      "cacheTimeout": null,
      "combine": {
        "label": "Others",
        "threshold": 0
      },
      "datasource": "ClickHouse",
      "decimals": null,
      "fontSize": "80%",
      "format": "short",
      "gridPos": {
        "h": 7,
        "w": 4,
        "x": 20,
        "y": 19
      },
      "id": 32,
      "interval": null,
      "legend": {
        "header": "Total Calls",
        "percentage": false,
        "show": true,
        "values": true
      },
      "legendType": "Right side",
      "links": [],
      "maxDataPoints": 3,
      "nullPointMode": "connected",
      "pieType": "pie",
      "strokeWidth": 1,
      "targets": [
        {
          "database": "softswitch",
          "dateLoading": false,
          "dateTimeColDataType": "calldate",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "intervalFactor": 1,
          "query": "SELECT\n    now() as time,\n    called_user as outcome,\n    count() as measurement\nFROM $table\nWHERE $timeFilter\n    $conditionalTest(AND (local_user in ($username) or called_user in ($username)),$username)\n    $conditionalTest(AND (caller_owning_carrier in ($carrier) or called_owning_carrier in ($carrier)),$carrier)\n    $conditionalTest(AND reason in ($reason),$reason)\n    $conditionalTest(AND (caller in ($number) or local_number in ($number) or called in ($number)),$number)\n\n\nand caller_called_nature = 'OnOff'\ngroup by time, outcome\norder by measurement desc\nlimit 10",
          "rawQuery": "SELECT     now() as time,     called_user as outcome,     count() as measurement FROM softswitch.cdr WHERE calldate >= toDateTime(1571428847)                           and caller_called_nature = 'OnOff' group by time, outcome order by measurement desc limit 10",
          "refId": "A",
          "round": "0s",
          "table": "cdr",
          "tableLoading": false
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Top 10 Outbound Destination Accounts",
      "type": "grafana-piechart-panel",
      "valueName": "total"
    },
    {
      "columns": [],
      "datasource": "ClickHouse",
      "fontSize": "100%",
      "gridPos": {
        "h": 8,
        "w": 4,
        "x": 0,
        "y": 26
      },
      "id": 34,
      "links": [],
      "pageSize": 10,
      "scroll": false,
      "showHeader": true,
      "sort": {
        "col": null,
        "desc": false
      },
      "styles": [
        {
          "alias": "Number",
          "colorMode": null,
          "colors": [
            "rgba(245, 54, 54, 0.9)",
            "rgba(237, 129, 40, 0.89)",
            "rgba(50, 172, 45, 0.97)"
          ],
          "dateFormat": "YYYY-MM-DD HH:mm:ss",
          "decimals": 2,
          "mappingType": 1,
          "pattern": "Time",
          "thresholds": [],
          "type": "string",
          "unit": "short"
        },
        {
          "alias": "",
          "colorMode": null,
          "colors": [
            "rgba(245, 54, 54, 0.9)",
            "rgba(237, 129, 40, 0.89)",
            "rgba(50, 172, 45, 0.97)"
          ],
          "dateFormat": "YYYY-MM-DD HH:mm:ss",
          "decimals": 2,
          "mappingType": 1,
          "pattern": "Metric",
          "thresholds": [],
          "type": "hidden",
          "unit": "short"
        },
        {
          "alias": "Total Calls",
          "colorMode": null,
          "colors": [
            "rgba(245, 54, 54, 0.9)",
            "rgba(237, 129, 40, 0.89)",
            "rgba(50, 172, 45, 0.97)"
          ],
          "dateFormat": "YYYY-MM-DD HH:mm:ss",
          "decimals": 2,
          "mappingType": 1,
          "pattern": "Value",
          "thresholds": [],
          "type": "string",
          "unit": "short"
        }
      ],
      "targets": [
        {
          "database": "softswitch",
          "dateLoading": false,
          "dateTimeColDataType": "calldate",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "hide": false,
          "intervalFactor": 1,
          "query": "SELECT\n    caller as outcome,\n    count() as measurement\nFROM $table\nWHERE $timeFilter and\n    caller_called_nature = 'OffOn'\n    $conditionalTest(AND (local_user in ($username) or called_user in ($username)),$username)\n    $conditionalTest(AND (caller_owning_carrier in ($carrier) or called_owning_carrier in ($carrier)),$carrier)\n    $conditionalTest(AND reason in ($reason),$reason)\n    $conditionalTest(AND (caller in ($number) or local_number in ($number) or called in ($number)),$number)\n\nGROUP BY outcome\nORDER BY measurement DESC\nLIMIT 20\n",
          "rawQuery": "SELECT     caller as outcome,     count() as measurement FROM softswitch.cdr WHERE calldate >= toDateTime(1571428847) and     caller_called_nature = 'OffOn'                          GROUP BY outcome ORDER BY measurement DESC LIMIT 20",
          "refId": "A",
          "round": "0s",
          "table": "cdr",
          "tableLoading": false
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Top Inbound Calling Numbers",
      "transform": "timeseries_to_rows",
      "type": "table"
    },
    {
      "columns": [],
      "datasource": "ClickHouse",
      "fontSize": "100%",
      "gridPos": {
        "h": 8,
        "w": 4,
        "x": 4,
        "y": 26
      },
      "id": 35,
      "links": [],
      "pageSize": 10,
      "scroll": false,
      "showHeader": true,
      "sort": {
        "col": null,
        "desc": false
      },
      "styles": [
        {
          "alias": "Number",
          "colorMode": null,
          "colors": [
            "rgba(245, 54, 54, 0.9)",
            "rgba(237, 129, 40, 0.89)",
            "rgba(50, 172, 45, 0.97)"
          ],
          "dateFormat": "YYYY-MM-DD HH:mm:ss",
          "decimals": 2,
          "mappingType": 1,
          "pattern": "Time",
          "thresholds": [],
          "type": "string",
          "unit": "short"
        },
        {
          "alias": "",
          "colorMode": null,
          "colors": [
            "rgba(245, 54, 54, 0.9)",
            "rgba(237, 129, 40, 0.89)",
            "rgba(50, 172, 45, 0.97)"
          ],
          "dateFormat": "YYYY-MM-DD HH:mm:ss",
          "decimals": 2,
          "mappingType": 1,
          "pattern": "Metric",
          "thresholds": [],
          "type": "hidden",
          "unit": "short"
        },
        {
          "alias": "Total Calls",
          "colorMode": null,
          "colors": [
            "rgba(245, 54, 54, 0.9)",
            "rgba(237, 129, 40, 0.89)",
            "rgba(50, 172, 45, 0.97)"
          ],
          "dateFormat": "YYYY-MM-DD HH:mm:ss",
          "decimals": 2,
          "mappingType": 1,
          "pattern": "Value",
          "thresholds": [],
          "type": "string",
          "unit": "short"
        }
      ],
      "targets": [
        {
          "database": "softswitch",
          "dateLoading": false,
          "dateTimeColDataType": "calldate",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "hide": false,
          "intervalFactor": 1,
          "query": "SELECT\n    called as outcome,\n    count() as measurement\nFROM $table\nWHERE $timeFilter and\n    caller_called_nature = 'OffOn'\n    $conditionalTest(AND (local_user in ($username) or called_user in ($username)),$username)\n    $conditionalTest(AND (caller_owning_carrier in ($carrier) or called_owning_carrier in ($carrier)),$carrier)\n    $conditionalTest(AND reason in ($reason),$reason)\n    $conditionalTest(AND (caller in ($number) or local_number in ($number) or called in ($number)),$number)\n\nGROUP BY outcome\nORDER BY measurement DESC\nLIMIT 20\n",
          "rawQuery": "SELECT     called as outcome,     count() as measurement FROM softswitch.cdr WHERE calldate >= toDateTime(1571428847) and     caller_called_nature = 'OffOn'                          GROUP BY outcome ORDER BY measurement DESC LIMIT 20",
          "refId": "A",
          "round": "0s",
          "table": "cdr",
          "tableLoading": false
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Top Inbound Called Numbers",
      "transform": "timeseries_to_rows",
      "type": "table"
    },
    {
      "columns": [],
      "datasource": "ClickHouse",
      "fontSize": "100%",
      "gridPos": {
        "h": 8,
        "w": 4,
        "x": 8,
        "y": 26
      },
      "id": 49,
      "links": [],
      "pageSize": 10,
      "scroll": false,
      "showHeader": true,
      "sort": {
        "col": null,
        "desc": false
      },
      "styles": [
        {
          "alias": "Number",
          "colorMode": null,
          "colors": [
            "rgba(245, 54, 54, 0.9)",
            "rgba(237, 129, 40, 0.89)",
            "rgba(50, 172, 45, 0.97)"
          ],
          "dateFormat": "YYYY-MM-DD HH:mm:ss",
          "decimals": 2,
          "mappingType": 1,
          "pattern": "Time",
          "thresholds": [],
          "type": "string",
          "unit": "short"
        },
        {
          "alias": "",
          "colorMode": null,
          "colors": [
            "rgba(245, 54, 54, 0.9)",
            "rgba(237, 129, 40, 0.89)",
            "rgba(50, 172, 45, 0.97)"
          ],
          "dateFormat": "YYYY-MM-DD HH:mm:ss",
          "decimals": 2,
          "mappingType": 1,
          "pattern": "Metric",
          "thresholds": [],
          "type": "hidden",
          "unit": "short"
        },
        {
          "alias": "Total Calls",
          "colorMode": null,
          "colors": [
            "rgba(245, 54, 54, 0.9)",
            "rgba(237, 129, 40, 0.89)",
            "rgba(50, 172, 45, 0.97)"
          ],
          "dateFormat": "YYYY-MM-DD HH:mm:ss",
          "decimals": 2,
          "mappingType": 1,
          "pattern": "Value",
          "thresholds": [],
          "type": "string",
          "unit": "short"
        }
      ],
      "targets": [
        {
          "database": "softswitch",
          "dateLoading": false,
          "dateTimeColDataType": "calldate",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "hide": false,
          "intervalFactor": 1,
          "query": "SELECT\n    caller as outcome,\n    count() as measurement\nFROM $table\nWHERE $timeFilter and\n    caller_called_nature = 'OnOn'\n    $conditionalTest(AND (local_user in ($username) or called_user in ($username)),$username)\n    $conditionalTest(AND (caller_owning_carrier in ($carrier) or called_owning_carrier in ($carrier)),$carrier)\n    $conditionalTest(AND reason in ($reason),$reason)\n    $conditionalTest(AND (caller in ($number) or local_number in ($number) or called in ($number)),$number)\n\nGROUP BY outcome\nORDER BY measurement DESC\nLIMIT 20\n",
          "rawQuery": "SELECT     caller as outcome,     count() as measurement FROM softswitch.cdr WHERE calldate >= toDateTime(1571428847) and     caller_called_nature = 'OnOn'                          GROUP BY outcome ORDER BY measurement DESC LIMIT 20",
          "refId": "A",
          "round": "0s",
          "table": "cdr",
          "tableLoading": false
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Top Outbound Calling Numbers",
      "transform": "timeseries_to_rows",
      "type": "table"
    },
    {
      "columns": [],
      "datasource": "ClickHouse",
      "fontSize": "100%",
      "gridPos": {
        "h": 8,
        "w": 4,
        "x": 12,
        "y": 26
      },
      "id": 50,
      "links": [],
      "pageSize": 10,
      "scroll": false,
      "showHeader": true,
      "sort": {
        "col": null,
        "desc": false
      },
      "styles": [
        {
          "alias": "Number",
          "colorMode": null,
          "colors": [
            "rgba(245, 54, 54, 0.9)",
            "rgba(237, 129, 40, 0.89)",
            "rgba(50, 172, 45, 0.97)"
          ],
          "dateFormat": "YYYY-MM-DD HH:mm:ss",
          "decimals": 2,
          "mappingType": 1,
          "pattern": "Time",
          "thresholds": [],
          "type": "string",
          "unit": "short"
        },
        {
          "alias": "",
          "colorMode": null,
          "colors": [
            "rgba(245, 54, 54, 0.9)",
            "rgba(237, 129, 40, 0.89)",
            "rgba(50, 172, 45, 0.97)"
          ],
          "dateFormat": "YYYY-MM-DD HH:mm:ss",
          "decimals": 2,
          "mappingType": 1,
          "pattern": "Metric",
          "thresholds": [],
          "type": "hidden",
          "unit": "short"
        },
        {
          "alias": "Total Calls",
          "colorMode": null,
          "colors": [
            "rgba(245, 54, 54, 0.9)",
            "rgba(237, 129, 40, 0.89)",
            "rgba(50, 172, 45, 0.97)"
          ],
          "dateFormat": "YYYY-MM-DD HH:mm:ss",
          "decimals": 2,
          "mappingType": 1,
          "pattern": "Value",
          "thresholds": [],
          "type": "string",
          "unit": "short"
        }
      ],
      "targets": [
        {
          "database": "softswitch",
          "dateLoading": false,
          "dateTimeColDataType": "calldate",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "hide": false,
          "intervalFactor": 1,
          "query": "SELECT\n    called as outcome,\n    count() as measurement\nFROM $table\nWHERE $timeFilter and\n    caller_called_nature = 'OnOn'\n    $conditionalTest(AND (local_user in ($username) or called_user in ($username)),$username)\n    $conditionalTest(AND (caller_owning_carrier in ($carrier) or called_owning_carrier in ($carrier)),$carrier)\n    $conditionalTest(AND reason in ($reason),$reason)\n    $conditionalTest(AND (caller in ($number) or local_number in ($number) or called in ($number)),$number)\n\nGROUP BY outcome\nORDER BY measurement DESC\nLIMIT 20\n",
          "rawQuery": "SELECT     called as outcome,     count() as measurement FROM softswitch.cdr WHERE calldate >= toDateTime(1571428847) and     caller_called_nature = 'OnOn'                          GROUP BY outcome ORDER BY measurement DESC LIMIT 20",
          "refId": "A",
          "round": "0s",
          "table": "cdr",
          "tableLoading": false
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Top Outbound Called Numbers",
      "transform": "timeseries_to_rows",
      "type": "table"
    },
    {
      "columns": [],
      "datasource": "ClickHouse",
      "fontSize": "100%",
      "gridPos": {
        "h": 8,
        "w": 4,
        "x": 16,
        "y": 26
      },
      "id": 36,
      "links": [],
      "pageSize": 10,
      "scroll": false,
      "showHeader": true,
      "sort": {
        "col": null,
        "desc": false
      },
      "styles": [
        {
          "alias": "Number",
          "colorMode": null,
          "colors": [
            "rgba(245, 54, 54, 0.9)",
            "rgba(237, 129, 40, 0.89)",
            "rgba(50, 172, 45, 0.97)"
          ],
          "dateFormat": "YYYY-MM-DD HH:mm:ss",
          "decimals": 2,
          "mappingType": 1,
          "pattern": "Time",
          "thresholds": [],
          "type": "string",
          "unit": "short"
        },
        {
          "alias": "",
          "colorMode": null,
          "colors": [
            "rgba(245, 54, 54, 0.9)",
            "rgba(237, 129, 40, 0.89)",
            "rgba(50, 172, 45, 0.97)"
          ],
          "dateFormat": "YYYY-MM-DD HH:mm:ss",
          "decimals": 2,
          "mappingType": 1,
          "pattern": "Metric",
          "thresholds": [],
          "type": "hidden",
          "unit": "short"
        },
        {
          "alias": "Total Calls",
          "colorMode": null,
          "colors": [
            "rgba(245, 54, 54, 0.9)",
            "rgba(237, 129, 40, 0.89)",
            "rgba(50, 172, 45, 0.97)"
          ],
          "dateFormat": "YYYY-MM-DD HH:mm:ss",
          "decimals": 2,
          "mappingType": 1,
          "pattern": "Value",
          "thresholds": [],
          "type": "string",
          "unit": "short"
        }
      ],
      "targets": [
        {
          "database": "softswitch",
          "dateLoading": false,
          "dateTimeColDataType": "calldate",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "hide": false,
          "intervalFactor": 1,
          "query": "SELECT\n    caller as outcome,\n    count() as measurement\nFROM $table\nWHERE $timeFilter and\n    caller_called_nature = 'OnOff'\n    $conditionalTest(AND (local_user in ($username) or called_user in ($username)),$username)\n    $conditionalTest(AND (caller_owning_carrier in ($carrier) or called_owning_carrier in ($carrier)),$carrier)\n    $conditionalTest(AND reason in ($reason),$reason)\n    $conditionalTest(AND (caller in ($number) or local_number in ($number) or called in ($number)),$number)\n\nGROUP BY outcome\nORDER BY measurement DESC\nLIMIT 20\n",
          "rawQuery": "SELECT     caller as outcome,     count() as measurement FROM softswitch.cdr WHERE calldate >= toDateTime(1571428847) and     caller_called_nature = 'OnOff'                          GROUP BY outcome ORDER BY measurement DESC LIMIT 20",
          "refId": "A",
          "round": "0s",
          "table": "cdr",
          "tableLoading": false
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Top Outbound Calling Numbers",
      "transform": "timeseries_to_rows",
      "type": "table"
    },
    {
      "columns": [],
      "datasource": "ClickHouse",
      "fontSize": "100%",
      "gridPos": {
        "h": 8,
        "w": 4,
        "x": 20,
        "y": 26
      },
      "id": 37,
      "links": [],
      "pageSize": 10,
      "scroll": false,
      "showHeader": true,
      "sort": {
        "col": null,
        "desc": false
      },
      "styles": [
        {
          "alias": "Number",
          "colorMode": null,
          "colors": [
            "rgba(245, 54, 54, 0.9)",
            "rgba(237, 129, 40, 0.89)",
            "rgba(50, 172, 45, 0.97)"
          ],
          "dateFormat": "YYYY-MM-DD HH:mm:ss",
          "decimals": 2,
          "mappingType": 1,
          "pattern": "Time",
          "thresholds": [],
          "type": "string",
          "unit": "short"
        },
        {
          "alias": "",
          "colorMode": null,
          "colors": [
            "rgba(245, 54, 54, 0.9)",
            "rgba(237, 129, 40, 0.89)",
            "rgba(50, 172, 45, 0.97)"
          ],
          "dateFormat": "YYYY-MM-DD HH:mm:ss",
          "decimals": 2,
          "mappingType": 1,
          "pattern": "Metric",
          "thresholds": [],
          "type": "hidden",
          "unit": "short"
        },
        {
          "alias": "Total Calls",
          "colorMode": null,
          "colors": [
            "rgba(245, 54, 54, 0.9)",
            "rgba(237, 129, 40, 0.89)",
            "rgba(50, 172, 45, 0.97)"
          ],
          "dateFormat": "YYYY-MM-DD HH:mm:ss",
          "decimals": 2,
          "mappingType": 1,
          "pattern": "Value",
          "thresholds": [],
          "type": "string",
          "unit": "short"
        }
      ],
      "targets": [
        {
          "database": "softswitch",
          "dateLoading": false,
          "dateTimeColDataType": "calldate",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "hide": false,
          "intervalFactor": 1,
          "query": "SELECT\n    called as outcome,\n    count() as measurement\nFROM $table\nWHERE $timeFilter and\n    caller_called_nature = 'OnOff'\n    $conditionalTest(AND (local_user in ($username) or called_user in ($username)),$username)\n    $conditionalTest(AND (caller_owning_carrier in ($carrier) or called_owning_carrier in ($carrier)),$carrier)\n    $conditionalTest(AND reason in ($reason),$reason)\n    $conditionalTest(AND (caller in ($number) or local_number in ($number) or called in ($number)),$number)\n\nGROUP BY outcome\nORDER BY measurement DESC\nLIMIT 20\n",
          "rawQuery": "SELECT     called as outcome,     count() as measurement FROM softswitch.cdr WHERE calldate >= toDateTime(1571428847) and     caller_called_nature = 'OnOff'                          GROUP BY outcome ORDER BY measurement DESC LIMIT 20",
          "refId": "A",
          "round": "0s",
          "table": "cdr",
          "tableLoading": false
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Top Outbound Called Numbers",
      "transform": "timeseries_to_rows",
      "type": "table"
    },
    {
      "columns": [],
      "datasource": "ClickHouse",
      "fontSize": "80%",
      "gridPos": {
        "h": 18,
        "w": 24,
        "x": 0,
        "y": 34
      },
      "id": 9,
      "links": [],
      "pageSize": null,
      "scroll": true,
      "showHeader": true,
      "sort": {
        "col": 0,
        "desc": true
      },
      "styles": [
        {
          "alias": "",
          "colorMode": null,
          "colors": [
            "rgba(245, 54, 54, 0.9)",
            "rgba(237, 129, 40, 0.89)",
            "rgba(50, 172, 45, 0.97)"
          ],
          "dateFormat": "YYYY-MM-DD HH:mm:ss",
          "decimals": 2,
          "mappingType": 1,
          "pattern": "Call Duration",
          "thresholds": [],
          "type": "number",
          "unit": "s"
        },
        {
          "alias": "",
          "colorMode": null,
          "colors": [
            "rgba(245, 54, 54, 0.9)",
            "rgba(237, 129, 40, 0.89)",
            "rgba(50, 172, 45, 0.97)"
          ],
          "dateFormat": "YYYY-MM-DD HH:mm:ss",
          "decimals": 2,
          "link": false,
          "mappingType": 1,
          "pattern": "From Carrier",
          "thresholds": [],
          "type": "string",
          "unit": "short",
          "valueMaps": [
            {
              "text": "",
              "value": ""
            }
          ]
        },
        {
          "alias": "",
          "colorMode": null,
          "colors": [
            "rgba(245, 54, 54, 0.9)",
            "rgba(237, 129, 40, 0.89)",
            "rgba(50, 172, 45, 0.97)"
          ],
          "dateFormat": "YYYY-MM-DD HH:mm:ss",
          "decimals": 2,
          "mappingType": 1,
          "pattern": "From Area",
          "thresholds": [],
          "type": "string",
          "unit": "short",
          "valueMaps": [
            {
              "text": "",
              "value": ""
            }
          ]
        },
        {
          "alias": "",
          "colorMode": null,
          "colors": [
            "rgba(245, 54, 54, 0.9)",
            "rgba(237, 129, 40, 0.89)",
            "rgba(50, 172, 45, 0.97)"
          ],
          "dateFormat": "YYYY-MM-DD HH:mm:ss",
          "decimals": 2,
          "mappingType": 1,
          "pattern": "To Carrier",
          "thresholds": [],
          "type": "string",
          "unit": "short",
          "valueMaps": [
            {
              "text": "",
              "value": ""
            }
          ]
        },
        {
          "alias": "",
          "colorMode": null,
          "colors": [
            "rgba(245, 54, 54, 0.9)",
            "rgba(237, 129, 40, 0.89)",
            "rgba(50, 172, 45, 0.97)"
          ],
          "dateFormat": "YYYY-MM-DD HH:mm:ss",
          "decimals": 2,
          "mappingType": 1,
          "pattern": "To Area",
          "thresholds": [],
          "type": "string",
          "unit": "short",
          "valueMaps": [
            {
              "text": "",
              "value": ""
            }
          ]
        }
      ],
      "targets": [
        {
          "database": "softswitch",
          "dateLoading": false,
          "dateTimeColDataType": "calldate",
          "dateTimeType": "DATETIME",
          "datetimeLoading": false,
          "format": "time_series",
          "formattedQuery": "SELECT $timeSeries as t, count() FROM $table WHERE $timeFilter GROUP BY t ORDER BY t",
          "intervalFactor": 1,
          "query": "SELECT\n    calldate as Time,\n    multiIf(caller_called_nature='OnOff', 'Outbound', caller_called_nature='OffOn', 'Inbound','Unknown') as Direction,\n    caller_owning_carrier as \"From Carrier\",\n    caller_area as \"From Area\",\n    caller as \"From Number\",\n    called_owning_carrier as \"To Carrier\",\n    called_area as \"To Area\",\n    called as \"To Number\",\n    duration as \"Duration\",\n    duration_setup as \"Setup Time\",\n    reason as \"End Reason\",\n    error as \"Error\",\n    cdrid as \"CDR ID\",\n    local_user as \"From User\",\n    called_user as \"To User\"\n    \nFROM $table\nWHERE $timeFilter\n    $conditionalTest(AND (local_user in ($username) or called_user in ($username)),$username)\n    $conditionalTest(AND (caller_owning_carrier in ($carrier) or called_owning_carrier in ($carrier)),$carrier)\n    $conditionalTest(AND reason in ($reason),$reason)\n    $conditionalTest(AND (caller in ($number) or local_number in ($number) or called in ($number)),$number)\n\n\n\nORDER BY calldate",
          "rawQuery": "SELECT     calldate as Time,     multiIf(caller_called_nature='OnOff', 'Outbound', caller_called_nature='OffOn', 'Inbound','Unknown') as Direction,     caller_owning_carrier as \"From Carrier\",     caller_area as \"From Area\",     caller as \"From Number\",     called_owning_carrier as \"To Carrier\",     called_area as \"To Area\",     called as \"To Number\",     duration as \"Duration\",     duration_setup as \"Setup Time\",     reason as \"End Reason\",     error as \"Error\",     cdrid as \"CDR ID\",     local_user as \"From User\",     called_user as \"To User\"      FROM softswitch.cdr WHERE calldate >= toDateTime(1571428847)                            ORDER BY calldate",
          "refId": "A",
          "round": "0s",
          "table": "cdr",
          "tableLoading": false
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Call List",
      "transform": "timeseries_to_columns",
      "type": "table"
    }
  ],
  "refresh": false,
  "schemaVersion": 18,
  "style": "dark",
  "tags": [],
  "templating": {
    "list": [
      {
        "allValue": null,
        "current": {
          "text": "All",
          "value": [
            "$__all"
          ]
        },
        "datasource": "ClickHouse",
        "definition": "select distinct username from (select local_user as username from softswitch.cdr where calldate between '$from' and '$to' union all select called_user as username from softswitch.cdr where calldate between '$from' and '$to')",
        "hide": 0,
        "includeAll": true,
        "label": "Username",
        "multi": true,
        "name": "username",
        "options": [],
        "query": "select distinct username from (select local_user as username from softswitch.cdr where calldate between '$from' and '$to' union all select called_user as username from softswitch.cdr where calldate between '$from' and '$to')",
        "refresh": 2,
        "regex": "",
        "skipUrlSync": false,
        "sort": 5,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      },
      {
        "allValue": null,
        "current": {
          "text": "All",
          "value": [
            "$__all"
          ]
        },
        "datasource": "ClickHouse",
        "definition": "select distinct carrier from (select caller_owning_carrier as carrier from softswitch.cdr where calldate between '$from' and '$to' union all select called_owning_carrier as carrier from softswitch.cdr where calldate between '$from' and '$to')",
        "hide": 0,
        "includeAll": true,
        "label": "Carrier",
        "multi": true,
        "name": "carrier",
        "options": [],
        "query": "select distinct carrier from (select caller_owning_carrier as carrier from softswitch.cdr where calldate between '$from' and '$to' union all select called_owning_carrier as carrier from softswitch.cdr where calldate between '$from' and '$to')",
        "refresh": 2,
        "regex": "",
        "skipUrlSync": false,
        "sort": 1,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      },
      {
        "allValue": null,
        "current": {
          "text": "All",
          "value": [
            "$__all"
          ]
        },
        "datasource": "ClickHouse",
        "definition": "select distinct reason from softswitch.cdr where calldate between '$from' and '$to'",
        "hide": 0,
        "includeAll": true,
        "label": "End Reason",
        "multi": true,
        "name": "reason",
        "options": [],
        "query": "select distinct reason from softswitch.cdr where calldate between '$from' and '$to'",
        "refresh": 2,
        "regex": "",
        "skipUrlSync": false,
        "sort": 1,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      },
      {
        "allValue": null,
        "current": {
          "text": "All",
          "value": [
            "$__all"
          ]
        },
        "datasource": "ClickHouse",
        "definition": "select distinct number from (select caller as number from softswitch.cdr where calldate between '$from' and '$to' union all select local_number as number from softswitch.cdr where calldate between '$from' and '$to' union all select called as number from softswitch.cdr where calldate between '$from' and '$to')",
        "hide": 0,
        "includeAll": true,
        "label": "Phone Number",
        "multi": true,
        "name": "number",
        "options": [],
        "query": "select distinct number from (select caller as number from softswitch.cdr where calldate between '$from' and '$to' union all select local_number as number from softswitch.cdr where calldate between '$from' and '$to' union all select called as number from softswitch.cdr where calldate between '$from' and '$to')",
        "refresh": 2,
        "regex": "",
        "skipUrlSync": false,
        "sort": 3,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      }
    ]
  },
  "time": {
    "from": "now-3h",
    "to": "now"
  },
  "timepicker": {
    "nowDelay": "",
    "refresh_intervals": [
      "5s",
      "10s",
      "30s",
      "1m",
      "5m",
      "15m",
      "30m",
      "1h",
      "2h",
      "1d"
    ],
    "time_options": [
      "5m",
      "15m",
      "1h",
      "6h",
      "12h",
      "24h",
      "2d",
      "7d",
      "30d"
    ]
  },
  "timezone": "",
  "title": "Softswitch",
  "uid": "34AAXspZz",
  "version": 45
}