Grafana dashboard: Asterisk: CDR and Count calls
Description: Calls panel displaying incoming and outgoing calls on your Asterisk PBX with tabular view and counters with metrics such as total calls, total received, total made, and total call contingency.
Calls panel displaying incoming and outgoing calls on your Asterisk PBX with tabular view and counters with metrics such as total calls, total received, total made, and total call contingency.
Site: https://am3telecom.page/
Contact: https://wa.me/5521982767492
#asterisk
#pbx
#pabx
#voip
#cdr
#statistics

Once the storage of CDR tickets in a MySQL database is created on the Asterisk server, just create a data source for it and start working with the data stored there.

FYY: (1) The "contingency" counter refers to a proprietary construct in the dial plan where I use the "contingency" context to contingency a call that receives a failed status to go out on another route. (2) The pie chart also represents its own construction where using the "userfield" column I assign a specific value to each incoming call to count the incoming calls on each DID.

{
  "__inputs": [
    {
      "name": "DS_ASTERISK",
      "label": "CDR",
      "description": "MariaDB 10 created with the default Asterisk table for persistence of call tickets. Reference: https://wiki.asterisk.org/wiki/display/AST/MySQL+CDR+Backend",
      "type": "datasource",
      "pluginId": "mysql",
      "pluginName": "MySQL"
    }
  ],
  "__requires": [
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "7.3.7"
    },
    {
      "type": "panel",
      "id": "grafana-piechart-panel",
      "name": "Pie Chart",
      "version": "1.6.1"
    },
    {
      "type": "datasource",
      "id": "mysql",
      "name": "MySQL",
      "version": "1.0.0"
    },
    {
      "type": "panel",
      "id": "stat",
      "name": "Stat",
      "version": ""
    },
    {
      "type": "panel",
      "id": "table",
      "name": "Table",
      "version": ""
    }
  ],
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": "-- Grafana --",
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "type": "dashboard"
      }
    ]
  },
  "description": "Calls panel displaying incoming and outgoing calls on your Asterisk PBX with tabular view and counters with metrics such as total calls, total received, total made, and total call contingency.\nCalls panel displaying incoming and outgoing calls on your Asterisk PBX with tabular view and counters with metrics such as total calls, total received, total made, and total call contingency.\nSite: https://am3telecom.page/\nContact: https://wa.me/5521982767492\n#asterisk\n#pbx\n#pabx\n#voip\n#cdr\n#statistics",
  "editable": true,
  "gnetId": 15498,
  "graphTooltip": 0,
  "id": null,
  "iteration": 1641625178319,
  "links": [],
  "panels": [
    {
      "aliasColors": {},
      "breakPoint": "50%",
      "cacheTimeout": null,
      "combine": {
        "label": "Others",
        "threshold": 0
      },
      "datasource": "${DS_ASTERISK}",
      "decimals": null,
      "fieldConfig": {
        "defaults": {
          "custom": {
            "align": null,
            "filterable": false
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": []
      },
      "fontSize": "80%",
      "format": "short",
      "gridPos": {
        "h": 10,
        "w": 11,
        "x": 0,
        "y": 0
      },
      "id": 11,
      "interval": null,
      "legend": {
        "header": "Chamadas",
        "percentage": true,
        "show": true,
        "values": true
      },
      "legendType": "Right side",
      "links": [],
      "nullPointMode": "connected",
      "pieType": "pie",
      "pluginVersion": "7.3.7",
      "strokeWidth": 1,
      "targets": [
        {
          "format": "time_series",
          "group": [
            {
              "params": [
                "$__interval",
                "none"
              ],
              "type": "time"
            }
          ],
          "metricColumn": "none",
          "rawQuery": false,
          "rawSql": "SELECT\n  $__timeGroupAlias(calldate,$__interval),\n  count(userfield) AS \"2454-7171\"\nFROM cdr_local\nWHERE\n  $__timeFilter(calldate) AND\n  userfield = '2124547171'\nGROUP BY 1\nORDER BY $__timeGroup(calldate,$__interval)",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "userfield"
                ],
                "type": "column"
              },
              {
                "params": [
                  "count"
                ],
                "type": "aggregate"
              },
              {
                "params": [
                  "2454-7171"
                ],
                "type": "alias"
              }
            ]
          ],
          "table": "cdr_local",
          "timeColumn": "calldate",
          "timeColumnType": "timestamp",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            },
            {
              "datatype": "varchar",
              "name": "",
              "params": [
                "userfield",
                "=",
                "'2124547171'"
              ],
              "type": "expression"
            }
          ]
        },
        {
          "format": "time_series",
          "group": [
            {
              "params": [
                "$__interval",
                "none"
              ],
              "type": "time"
            }
          ],
          "metricColumn": "none",
          "rawQuery": false,
          "rawSql": "SELECT\n  $__timeGroupAlias(calldate,$__interval),\n  count(userfield) AS \"2464-5921\"\nFROM cdr_local\nWHERE\n  $__timeFilter(calldate) AND\n  userfield = '2124645921'\nGROUP BY 1\nORDER BY $__timeGroup(calldate,$__interval)",
          "refId": "B",
          "select": [
            [
              {
                "params": [
                  "userfield"
                ],
                "type": "column"
              },
              {
                "params": [
                  "count"
                ],
                "type": "aggregate"
              },
              {
                "params": [
                  "2464-5921"
                ],
                "type": "alias"
              }
            ]
          ],
          "table": "cdr_local",
          "timeColumn": "calldate",
          "timeColumnType": "timestamp",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            },
            {
              "datatype": "varchar",
              "name": "",
              "params": [
                "userfield",
                "=",
                "'2124645921'"
              ],
              "type": "expression"
            }
          ]
        },
        {
          "format": "time_series",
          "group": [
            {
              "params": [
                "$__interval",
                "none"
              ],
              "type": "time"
            }
          ],
          "metricColumn": "none",
          "rawQuery": false,
          "rawSql": "SELECT\n  $__timeGroupAlias(calldate,$__interval),\n  count(userfield) AS \"2489-8922\"\nFROM cdr_local\nWHERE\n  $__timeFilter(calldate) AND\n  userfield = '2124898922'\nGROUP BY 1\nORDER BY $__timeGroup(calldate,$__interval)",
          "refId": "C",
          "select": [
            [
              {
                "params": [
                  "userfield"
                ],
                "type": "column"
              },
              {
                "params": [
                  "count"
                ],
                "type": "aggregate"
              },
              {
                "params": [
                  "2489-8922"
                ],
                "type": "alias"
              }
            ]
          ],
          "table": "cdr_local",
          "timeColumn": "calldate",
          "timeColumnType": "timestamp",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            },
            {
              "datatype": "varchar",
              "name": "",
              "params": [
                "userfield",
                "=",
                "'2124898922'"
              ],
              "type": "expression"
            }
          ]
        },
        {
          "format": "time_series",
          "group": [
            {
              "params": [
                "$__interval",
                "none"
              ],
              "type": "time"
            }
          ],
          "metricColumn": "none",
          "rawQuery": false,
          "rawSql": "SELECT\n  $__timeGroupAlias(calldate,$__interval),\n  count(userfield) AS \"2489-9156\"\nFROM cdr_local\nWHERE\n  $__timeFilter(calldate) AND\n  userfield = '2124899156'\nGROUP BY 1\nORDER BY $__timeGroup(calldate,$__interval)",
          "refId": "D",
          "select": [
            [
              {
                "params": [
                  "userfield"
                ],
                "type": "column"
              },
              {
                "params": [
                  "count"
                ],
                "type": "aggregate"
              },
              {
                "params": [
                  "2489-9156"
                ],
                "type": "alias"
              }
            ]
          ],
          "table": "cdr_local",
          "timeColumn": "calldate",
          "timeColumnType": "timestamp",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            },
            {
              "datatype": "varchar",
              "name": "",
              "params": [
                "userfield",
                "=",
                "'2124899156'"
              ],
              "type": "expression"
            }
          ]
        },
        {
          "format": "time_series",
          "group": [
            {
              "params": [
                "$__interval",
                "none"
              ],
              "type": "time"
            }
          ],
          "metricColumn": "none",
          "rawQuery": false,
          "rawSql": "SELECT\n  $__timeGroupAlias(calldate,$__interval),\n  count(userfield) AS \"3217-4874\"\nFROM cdr_local\nWHERE\n  $__timeFilter(calldate) AND\n  userfield = '2132174874'\nGROUP BY 1\nORDER BY $__timeGroup(calldate,$__interval)",
          "refId": "E",
          "select": [
            [
              {
                "params": [
                  "userfield"
                ],
                "type": "column"
              },
              {
                "params": [
                  "count"
                ],
                "type": "aggregate"
              },
              {
                "params": [
                  "3217-4874"
                ],
                "type": "alias"
              }
            ]
          ],
          "table": "cdr_local",
          "timeColumn": "calldate",
          "timeColumnType": "timestamp",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            },
            {
              "datatype": "varchar",
              "name": "",
              "params": [
                "userfield",
                "=",
                "'2132174874'"
              ],
              "type": "expression"
            }
          ]
        },
        {
          "format": "time_series",
          "group": [
            {
              "params": [
                "$__interval",
                "none"
              ],
              "type": "time"
            }
          ],
          "metricColumn": "none",
          "rawQuery": false,
          "rawSql": "SELECT\n  $__timeGroupAlias(calldate,$__interval),\n  count(userfield) AS \"3217-4875\"\nFROM cdr_local\nWHERE\n  $__timeFilter(calldate) AND\n  userfield = '2132174875'\nGROUP BY 1\nORDER BY $__timeGroup(calldate,$__interval)",
          "refId": "F",
          "select": [
            [
              {
                "params": [
                  "userfield"
                ],
                "type": "column"
              },
              {
                "params": [
                  "count"
                ],
                "type": "aggregate"
              },
              {
                "params": [
                  "3217-4875"
                ],
                "type": "alias"
              }
            ]
          ],
          "table": "cdr_local",
          "timeColumn": "calldate",
          "timeColumnType": "timestamp",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            },
            {
              "datatype": "varchar",
              "name": "",
              "params": [
                "userfield",
                "=",
                "'2132174875'"
              ],
              "type": "expression"
            }
          ]
        },
        {
          "format": "time_series",
          "group": [
            {
              "params": [
                "$__interval",
                "none"
              ],
              "type": "time"
            }
          ],
          "metricColumn": "none",
          "rawQuery": false,
          "rawSql": "SELECT\n  $__timeGroupAlias(calldate,$__interval),\n  count(userfield) AS \"3995-9907\"\nFROM cdr_local\nWHERE\n  $__timeFilter(calldate) AND\n  userfield = '2139959907'\nGROUP BY 1\nORDER BY $__timeGroup(calldate,$__interval)",
          "refId": "G",
          "select": [
            [
              {
                "params": [
                  "userfield"
                ],
                "type": "column"
              },
              {
                "params": [
                  "count"
                ],
                "type": "aggregate"
              },
              {
                "params": [
                  "3995-9907"
                ],
                "type": "alias"
              }
            ]
          ],
          "table": "cdr_local",
          "timeColumn": "calldate",
          "timeColumnType": "timestamp",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            },
            {
              "datatype": "varchar",
              "name": "",
              "params": [
                "userfield",
                "=",
                "'2139959907'"
              ],
              "type": "expression"
            }
          ]
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Chamadas recebidas por número",
      "type": "grafana-piechart-panel",
      "valueName": "total"
    },
    {
      "datasource": "${DS_ASTERISK}",
      "description": "Total de chamadas recebidas e realizadas.",
      "fieldConfig": {
        "defaults": {
          "custom": {},
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 5,
        "w": 7,
        "x": 11,
        "y": 0
      },
      "id": 6,
      "options": {
        "colorMode": "value",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "sum"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "value"
      },
      "pluginVersion": "7.3.7",
      "targets": [
        {
          "format": "table",
          "group": [
            {
              "params": [
                "$__interval",
                "none"
              ],
              "type": "time"
            }
          ],
          "metricColumn": "none",
          "rawQuery": false,
          "rawSql": "SELECT\n  $__timeGroupAlias(calldate,$__interval),\n  count(channel) AS \"channel\"\nFROM cdr_local\nWHERE\n  $__timeFilter(calldate) AND\n  dcontext != 'interno'\nGROUP BY 1\nORDER BY $__timeGroup(calldate,$__interval)",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "channel"
                ],
                "type": "column"
              },
              {
                "params": [
                  "count"
                ],
                "type": "aggregate"
              },
              {
                "params": [
                  "channel"
                ],
                "type": "alias"
              }
            ]
          ],
          "table": "cdr_local",
          "timeColumn": "calldate",
          "timeColumnType": "timestamp",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            },
            {
              "datatype": "varchar",
              "name": "",
              "params": [
                "dcontext",
                "!=",
                "'interno'"
              ],
              "type": "expression"
            }
          ]
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Total de chamadas",
      "transformations": [],
      "type": "stat"
    },
    {
      "datasource": "${DS_ASTERISK}",
      "description": "Total de chamadas recebidas que foram desviadas para o celular. Significa que a chamada recebida não pode ser entregue no ML Phone e como contingência foi desviada para o celular da recepção.",
      "fieldConfig": {
        "defaults": {
          "custom": {},
          "mappings": [],
          "noValue": "0",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "dark-red",
                "value": null
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 5,
        "w": 6,
        "x": 18,
        "y": 0
      },
      "id": 9,
      "options": {
        "colorMode": "value",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "sum"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "value"
      },
      "pluginVersion": "7.3.7",
      "targets": [
        {
          "format": "table",
          "group": [
            {
              "params": [
                "$__interval",
                "none"
              ],
              "type": "time"
            }
          ],
          "metricColumn": "none",
          "rawQuery": false,
          "rawSql": "SELECT\n  $__timeGroupAlias(calldate,$__interval),\n  count(channel) AS \"channel\"\nFROM cdr_local\nWHERE\n  $__timeFilter(calldate) AND\n  dcontext = 'contingencia'\nGROUP BY 1\nORDER BY $__timeGroup(calldate,$__interval)",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "channel"
                ],
                "type": "column"
              },
              {
                "params": [
                  "count"
                ],
                "type": "aggregate"
              },
              {
                "params": [
                  "channel"
                ],
                "type": "alias"
              }
            ]
          ],
          "table": "cdr_local",
          "timeColumn": "calldate",
          "timeColumnType": "timestamp",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            },
            {
              "datatype": "varchar",
              "name": "",
              "params": [
                "dcontext",
                "=",
                "'contingencia'"
              ],
              "type": "expression"
            }
          ]
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Contingência",
      "transformations": [],
      "type": "stat"
    },
    {
      "datasource": "${DS_ASTERISK}",
      "description": "Total de chamadas recebidas.",
      "fieldConfig": {
        "defaults": {
          "custom": {},
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "dark-blue",
                "value": null
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 5,
        "w": 7,
        "x": 11,
        "y": 5
      },
      "id": 8,
      "options": {
        "colorMode": "value",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "sum"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "value"
      },
      "pluginVersion": "7.3.7",
      "targets": [
        {
          "format": "table",
          "group": [
            {
              "params": [
                "$__interval",
                "none"
              ],
              "type": "time"
            }
          ],
          "metricColumn": "none",
          "rawQuery": false,
          "rawSql": "SELECT\n  $__timeGroupAlias(calldate,$__interval),\n  count(channel) AS \"channel\"\nFROM cdr_local\nWHERE\n  $__timeFilter(calldate) AND\n  dcontext = 'to-ccm'\nGROUP BY 1\nORDER BY $__timeGroup(calldate,$__interval)",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "channel"
                ],
                "type": "column"
              },
              {
                "params": [
                  "count"
                ],
                "type": "aggregate"
              },
              {
                "params": [
                  "channel"
                ],
                "type": "alias"
              }
            ]
          ],
          "table": "cdr_local",
          "timeColumn": "calldate",
          "timeColumnType": "timestamp",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            },
            {
              "datatype": "varchar",
              "name": "",
              "params": [
                "dcontext",
                "=",
                "'to-ccm'"
              ],
              "type": "expression"
            }
          ]
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Recebidas",
      "transformations": [],
      "type": "stat"
    },
    {
      "datasource": "${DS_ASTERISK}",
      "description": "Total de chamadas realizadas.",
      "fieldConfig": {
        "defaults": {
          "custom": {},
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "yellow",
                "value": null
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 5,
        "w": 6,
        "x": 18,
        "y": 5
      },
      "id": 7,
      "options": {
        "colorMode": "value",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "sum"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "value"
      },
      "pluginVersion": "7.3.7",
      "targets": [
        {
          "format": "table",
          "group": [
            {
              "params": [
                "$__interval",
                "none"
              ],
              "type": "time"
            }
          ],
          "metricColumn": "none",
          "rawQuery": false,
          "rawSql": "SELECT\n  $__timeGroupAlias(calldate,$__interval),\n  count(channel) AS \"channel\"\nFROM cdr_local\nWHERE\n  $__timeFilter(calldate) AND\n  dcontext = 'out_stfc'\nGROUP BY 1\nORDER BY $__timeGroup(calldate,$__interval)",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "channel"
                ],
                "type": "column"
              },
              {
                "params": [
                  "count"
                ],
                "type": "aggregate"
              },
              {
                "params": [
                  "channel"
                ],
                "type": "alias"
              }
            ]
          ],
          "table": "cdr_local",
          "timeColumn": "calldate",
          "timeColumnType": "timestamp",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            },
            {
              "datatype": "varchar",
              "name": "",
              "params": [
                "dcontext",
                "=",
                "'out_stfc'"
              ],
              "type": "expression"
            }
          ]
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Realizadas",
      "transformations": [],
      "type": "stat"
    },
    {
      "datasource": "${DS_ASTERISK}",
      "fieldConfig": {
        "defaults": {
          "custom": {
            "align": "center",
            "filterable": true
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "#EAB839",
                "value": 0
              }
            ]
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Tipo"
            },
            "properties": [
              {
                "id": "mappings",
                "value": [
                  {
                    "from": "",
                    "id": 0,
                    "operator": "",
                    "text": "Recebida",
                    "to": "",
                    "type": 1,
                    "value": "to-ccm"
                  },
                  {
                    "from": "",
                    "id": 1,
                    "operator": "",
                    "text": "Interna",
                    "to": "",
                    "type": 1,
                    "value": "interno"
                  },
                  {
                    "from": "",
                    "id": 2,
                    "text": "Saída",
                    "to": "",
                    "type": 1,
                    "value": "out_stfc"
                  },
                  {
                    "from": "",
                    "id": 3,
                    "text": "> Contingência <",
                    "to": "",
                    "type": 1,
                    "value": "contingencia"
                  },
                  {
                    "from": "",
                    "id": 4,
                    "text": "Recebida",
                    "to": "",
                    "type": 1,
                    "value": "from-pstn"
                  }
                ]
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Duração"
            },
            "properties": [
              {
                "id": "unit",
                "value": "dthms"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Data e Hora"
            },
            "properties": [
              {
                "id": "unit",
                "value": "dateTimeAsUS"
              },
              {
                "id": "custom.width",
                "value": null
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Destino"
            },
            "properties": [
              {
                "id": "mappings",
                "value": [
                  {
                    "from": "",
                    "id": 1,
                    "text": "ML Phone",
                    "to": "",
                    "type": 1,
                    "value": "100"
                  }
                ]
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Status"
            },
            "properties": [
              {
                "id": "mappings",
                "value": [
                  {
                    "from": "",
                    "id": 1,
                    "text": "Atendida",
                    "to": "",
                    "type": 1,
                    "value": "ANSWERED"
                  },
                  {
                    "from": "",
                    "id": 2,
                    "text": "Não atendida",
                    "to": "",
                    "type": 1,
                    "value": "NO ANSWER"
                  },
                  {
                    "from": "",
                    "id": 3,
                    "text": "Ocupado",
                    "to": "",
                    "type": 1,
                    "value": "BUSY"
                  },
                  {
                    "from": "",
                    "id": 4,
                    "text": "indisponível",
                    "to": "",
                    "type": 1,
                    "value": "CHANUNAVAIL"
                  },
                  {
                    "from": "",
                    "id": 5,
                    "text": "Indisponível",
                    "to": "",
                    "type": 1,
                    "value": "FAILED"
                  }
                ]
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Origem"
            },
            "properties": [
              {
                "id": "mappings",
                "value": [
                  {
                    "from": "",
                    "id": 1,
                    "text": "LA3 Suporte (900)",
                    "to": "",
                    "type": 1,
                    "value": "900"
                  },
                  {
                    "from": "",
                    "id": 2,
                    "text": "LA3 ML Phone (79)",
                    "to": "",
                    "type": 1,
                    "value": "79"
                  }
                ]
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 16,
        "w": 24,
        "x": 0,
        "y": 10
      },
      "id": 4,
      "options": {
        "showHeader": true,
        "sortBy": [
          {
            "desc": true,
            "displayName": "Data e Hora"
          }
        ]
      },
      "pluginVersion": "7.3.7",
      "targets": [
        {
          "format": "table",
          "group": [],
          "metricColumn": "none",
          "rawQuery": false,
          "rawSql": "SELECT\n  calldate AS \"time\",\n  dst AS \"Destino\",\n  src AS \"Origem\",\n  disposition AS \"Status\",\n  billsec AS \"Duração\",\n  dcontext AS \"Tipo\",\n  userfield AS \"Tel. de entrada\"\nFROM cdr_local\nWHERE\n  $__timeFilter(calldate) AND\n  dcontext = '$Tipo'\nORDER BY calldate",
          "refId": "A",
          "select": [
            [
              {
                "params": [
                  "dst"
                ],
                "type": "column"
              },
              {
                "params": [
                  "Destino"
                ],
                "type": "alias"
              }
            ],
            [
              {
                "params": [
                  "src"
                ],
                "type": "column"
              },
              {
                "params": [
                  "Origem"
                ],
                "type": "alias"
              }
            ],
            [
              {
                "params": [
                  "disposition"
                ],
                "type": "column"
              },
              {
                "params": [
                  "Status"
                ],
                "type": "alias"
              }
            ],
            [
              {
                "params": [
                  "billsec"
                ],
                "type": "column"
              },
              {
                "params": [
                  "Duração"
                ],
                "type": "alias"
              }
            ],
            [
              {
                "params": [
                  "dcontext"
                ],
                "type": "column"
              },
              {
                "params": [
                  "Tipo"
                ],
                "type": "alias"
              }
            ],
            [
              {
                "params": [
                  "userfield"
                ],
                "type": "column"
              },
              {
                "params": [
                  "Tel. de entrada"
                ],
                "type": "alias"
              }
            ]
          ],
          "table": "cdr_local",
          "timeColumn": "calldate",
          "timeColumnType": "timestamp",
          "where": [
            {
              "name": "$__timeFilter",
              "params": [],
              "type": "macro"
            },
            {
              "datatype": "varchar",
              "name": "",
              "params": [
                "dcontext",
                "=",
                "'$Tipo'"
              ],
              "type": "expression"
            }
          ]
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Detalhamento de chamadas",
      "transformations": [
        {
          "id": "organize",
          "options": {
            "excludeByName": {},
            "indexByName": {
              "Destino": 4,
              "Duração": 6,
              "Origem": 2,
              "Status": 5,
              "Tel. de entrada": 1,
              "Tipo": 3,
              "time": 0
            },
            "renameByName": {
              "time": "Data e Hora"
            }
          }
        }
      ],
      "type": "table"
    }
  ],
  "refresh": "5m",
  "schemaVersion": 26,
  "style": "dark",
  "tags": [],
  "templating": {
    "list": [
      {
        "allValue": "none",
        "current": {},
        "datasource": "${DS_ASTERISK}",
        "definition": "select src from cdr_local",
        "error": null,
        "hide": 2,
        "includeAll": false,
        "label": "Ramal",
        "multi": false,
        "name": "Ramal",
        "options": [],
        "query": "select src from cdr_local",
        "refresh": 1,
        "regex": "..",
        "skipUrlSync": false,
        "sort": 0,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      },
      {
        "allValue": null,
        "current": {
          "selected": true,
          "text": "to-ccm",
          "value": "to-ccm"
        },
        "error": null,
        "hide": 0,
        "includeAll": false,
        "label": "Tipo de chamada",
        "multi": false,
        "name": "Tipo",
        "options": [
          {
            "selected": false,
            "text": "out_stfc",
            "value": "out_stfc"
          },
          {
            "selected": true,
            "text": "to-ccm",
            "value": "to-ccm"
          }
        ],
        "query": "out_stfc,to-ccm",
        "queryValue": "",
        "skipUrlSync": false,
        "type": "custom"
      }
    ]
  },
  "time": {
    "from": "now-30d",
    "to": "now"
  },
  "timepicker": {
    "refresh_intervals": [
      "10s",
      "30s",
      "1m",
      "5m",
      "15m",
      "30m",
      "1h",
      "2h",
      "1d"
    ]
  },
  "timezone": "utc",
  "title": "Asterisk: CDR and Count calls",
  "uid": "1eVldKfMz",
  "version": 14
}