Skip to main content

 

Splunk Lantern

Longest and shortest call duration by destination

You might want to see the longest and shortest call durations on your network when doing the following:

Prerequisites 

In order to execute this procedure in your environment, the following data, services, or apps are required:

Example

You work for a large telecommunications provider and use Splunk to monitor the services you provide. You need a search that will give insight into who your top customers are and from where they are calling.

To optimize the search shown below, you should specify a time range.  You may also need to adjust fields to match what is available in your data source. 

  1. Ensure your lookup files are uploaded to your Splunk deployment.
  2. Run the following search:
    | sourcetype=<call detail records>
    | eval _time = start
    | lookup <cdr disposition mapping file> disposition
    | search disposition="ANSWERED" OR disposition="BUSY"
    | rex field=src "(?<srcCountry>\d+)(?=\d{10})"
    | rex field=dst "(?<dstCountry>\d+)(?=\d{10})"
    | lookup <country code to name mapping file> phoneCode AS dstCountry OUTPUTNEW countryName AS dstCountryName ISO2 AS dstCountryCode
    | fields src dst dstCountryName duration
    | stats count list(dst) AS dst list(dstCountryName) AS dstCountryName BY duration src
    | rename duration AS "Call Duration" src AS "Caller" dst AS "Called Number" dstCountryName AS "Destination Country"
    | sort - "Call Duration"

Search explanation

The table provides an explanation of what each part of this search achieves. You can adjust this query based on the specifics of your environment.

Splunk Search Explanation
| sourcetype=<call detail records> Search only your telephony data.
| eval _time = start Extract the timestamp and put it in a field called "start".
| lookup <cdr disposition mapping file> disposition

Enrich the search results with clearer descriptions of the dispositions.

If your lookup file does not contain user and score columns, adjust the search to match the names in your lookup.

| search disposition="ANSWERED" OR disposition="BUSY" Search for successful call events, identified with a disposition of ANSWERED or BUSY.

| rex field=src "(?<srcCountry>\d+)(?=\d{10})"

| rex field=dst "(?<dstCountry>\d+)(?=\d{10})"

Extract the source (src) country code, then the destination (dst) country code.

This example assumes that the country code is what precedes a 10 digit number.

| lookup <country code to name mapping file> phoneCode AS dstCountry OUTPUTNEW countryName AS dstCountryName ISO2 AS dstCountryCode

Enrich the results by adding a country name and iso code, based on the dstCountry field extracted.

If the column names in your lookup file differ from those shown here, adjust the search to match the names in your lookup.

| fields src dst dstCountryName duration Return only the fields shown.
| stats count list(dst) AS dst list(dstCountryName) AS dstCountryName BY duration src List the destinations and country names of placed calls, with a total count for each result. Then, sort the results first by duration and then by source.
| rename duration AS "Call Duration" src AS "Caller" dst AS "Called Number" dstCountryName AS "Destination Country" Rename the fields as shown for better readability.
| sort - "Call Duration" Sort the results with the largest call duration first, or remove the - to sort with the shortest call duration first.

Result

Use the information from this search to create targeting marketing or campaigns or to generate time-series reports displaying call routing and associated costs.