Searching by Metadata
You can use call attributes in MQL expressions.
For example, if you would like to search for a greeting phrase "Thank you for calling" for inbound calls only,
then the expression can include $direction
attribute, like in:
AGENT: "thank you for calling" AND $direction = inbound
Call attributes
Table 1. Support call attributes
Attribute | Type | Description | Example |
---|---|---|---|
$caller-number |
text | Caller party phone number | $caller-number = "12345" |
$called-number |
text | Called party phone number | $called-number ~ "866* |
$caller-name |
text | Caller party name | $caller-name = "David Amado" |
$called-name |
text | Called party name | $called-name != "David Amado" |
$participant-number |
text | Participant phone number (either caller or called party) | $participant-number = "12345" |
$participant-name |
text | Participant phone name (either caller or called party) | $participant-name = "David Amado" |
$user-name |
text | Name of the user, to whom the call is assigned | $user-name = "David Amado" |
$user-extension |
text | Extension of the user, to whom the call is assigned | $user-extension = "12345" |
$user-id |
uuid | ID of the user, to whom the call is assigned | $user-id = "9ef4b87c-5446-499a-b712-44d3509c0576" |
$group-name |
text | Name of the group, to whom the call is assigned | $group-name = "Sales Department" |
$group-id |
uuid | ID of the group, to whom the call is assigned | $group-id = "9ef4b87c-5446-499a-b712-44d3509c0576" |
$tenant-name |
text | Name of the tenant, to whom the call is assigned | $tenant-name = "West Coast" |
$tenant-id |
uuid | ID of the tenant, to whom the call is assigned | $tenant-id = "9ef4b87c-5446-499a-b712-44d3509c0576" |
$call-id |
uuid | ID of the call | $call-id = "9ef4b87c-5446-499a-b712-44d3509c0576" |
$parent-call-id |
uuid | ID of the parent call | $parent-call-id = "9ef4b87c-5446-499a-b712-44d3509c0576" |
$setup-time |
datetime | Date and time of the call start time | $setup-time >= "2023-01-01 00:00:00" |
$duration |
timedelta | Duration of the call | $duration < "1:00" |
$diretion |
text | Direction of the call. One of "inbound", "outbound", "internal" and "uknown" | $direction = inbound |
$sentiment-score |
number | Sentiment score of the call | $sentiment-score < 0 |
$sentiment-agent-score |
number | Sentiment score of agent side of the call | $sentiment-agent-score < -50 |
$sentiment-customer-score |
number | Sentiment score of customer side of the call | $sentiment-agent-score >= 0 |
$sentiment-label |
text | Sentiment score label of the call. One of "very-negative", "negative", "neutral", "positive", "very-positive" | $sentiment-label = "very-negative" |
$sentiment-agent-label |
text | Sentiment score label of the call | $sentiment-agent-label = "negative" |
$sentiment-customer-label |
text | Sentiment score label of the call | $sentiment-customer-label = "positive" |
$topic-name |
text | Name of the topic, assigned to the call | $topic-name = "Payment language" |
$topic-id |
uuid | ID of the topic, assigned to the call | $topic-id = "9ef4b87c-5446-499a-b712-44d3509c0576" |
Comparison operators
Table 2. Supported comparison operators for text attribute types
Comparison operator | Description | Example |
---|---|---|
= |
Equal to | $caller-number = "12345" |
== |
Equal to | $caller-number == "12345" |
: |
Equal to | $caller-number: "12345" |
!= |
Not equal to | $caller-number != "12345" |
<> |
Not equal to | $caller-number <> "12345" |
> |
Greater than (by alphabetical order) | $topic-name > "1. Payment language" |
>= |
Greater than or equal to (by alphabetical order) | $topic-name >= "3. Shipping problem" |
< |
Less than (by alphabetical order) | $topic-name < "1. Payment language" |
<= |
Less than or equal to (by alphabetical order) | $topic-name <= "3. Shipping problem" |
~ |
Simple pattern (case sensitive) | $user-name ~ "John*" |
~* |
Simple pattern (case insensitive) | $user-name ~* "john*" |
~~ |
Regex pattern (case sensitive) | $phone-number ~~ "800[0-9]{6}" |
~~* |
Regex pattern (case insensitive) | $phone-name ~~* "(john|marry)" |
Table 3. Supported comparison operators for number attribute types
Comparison operator | Description | Example |
---|---|---|
= |
Equal to | $sentiment-score = 50 |
== |
Equal to | $sentiment-score == 50 |
: |
Equal to | $sentiment-score: 50 |
!= |
Not equal to | $sentiment-score != 50 |
<> |
Not equal to | $sentiment-score <> 50 |
> |
Greater than | $sentiment-score > 0 |
>= |
Greater than or equal to | $sentiment-score >= -50 |
< |
Less than | $sentiment-score < -50 |
<= |
Less than or equal to | $sentiment-score <= 0 |
Table 4. Supported comparison operators for datetime attribute types
Comparison operator | Description | Example |
---|---|---|
= |
Equal to | $setup-time = "2023-01-01 00:00:00" |
== |
Equal to | $setup-time == "2023-01-01 00:00:00" |
: |
Equal to | $setup-time: "2023-01-01 00:00:00" |
!= |
Not equal to | $setup-time != "2023-01-01 00:00:00" |
<> |
Not equal to | $setup-time <> "2023-01-01 00:00:00" |
> |
Greater than | $setup-time > "2023-01-01 00:00:00" |
>= |
Greater than or equal to | $setup-time >= "2023-01-01 00:00:00" |
< |
Less than | $setup-time < "2023-01-01 00:00:00" |
<= |
Less than or equal to | $setup-time <= "2023-01-01 00:00:00" |
Table 5. Supported comparison operators for timedelta attribute types
Comparison operator | Description | Example |
---|---|---|
= |
Equal to | $duration = "5:00" |
== |
Equal to | $duration == "5:00" |
: |
Equal to | $duration: "5:00" |
!= |
Not equal to | $duration != "5:00" |
<> |
Not equal to | $duration <> "5:00" |
> |
Greater than | $duration > "1:00" |
>= |
Greater than or equal to | $duration >= "0:15" |
< |
Less than | $duration < "15:00" |
<= |
Less than or equal to | $duration <= "0:15" |
Table 6. Supported comparison operators for uuid attribute types
Comparison operator | Description | Example |
---|---|---|
= |
Equal to | $topic-id = "79705555-5c4d-46b4-987d-7257fe2ae23e" |
== |
Equal to | $topic-id == "79705555-5c4d-46b4-987d-7257fe2ae23e" |
: |
Equal to | $topic-id: "79705555-5c4d-46b4-987d-7257fe2ae23e" |
!= |
Not equal to | $topic-id != "79705555-5c4d-46b4-987d-7257fe2ae23e" |
<> |
Not equal to | $topic-id <> "79705555-5c4d-46b4-987d-7257fe2ae23e" |
> |
Greater than (by alphabetical order) | $topic-id > "79705555-5c4d-46b4-987d-7257fe2ae23e" |
>= |
Greater than or equal to (by alphabetical order) | $topic-id >= "79705555-5c4d-46b4-987d-7257fe2ae23e" |
< |
Less than (by alphabetical order) | $topic-id < "79705555-5c4d-46b4-987d-7257fe2ae23e" |
<= |
Less than or equal to (by alphabetical order) | $topic-id <= "79705555-5c4d-46b4-987d-7257fe2ae23e" |
Multi-value attributes
Some attributes may have multiple values, like attributes $topic-name
, $participant-number
, $user-name
, $group-name
, etc.
For example, when multiple topics are assigned to a call, then the expression $topic-name = "Payment language"
will evaluate to TRUE
when either of the assigned topics is "Payment language".
Another example is the $participant-number
attribute. Every call has at least two participants, so the expression $participant-number = 1234
will evaluate to TRUE if either of the caller or called party phone numbers is 1234.
Comparing to a sub-expression
A call attribute can be compared to a sub-expression like:
$caller-number = (1234 OR 5679)
$sentiment-label = ("negative" OR "very-negative")
Comparing to another attribute
A call attribute can be compared to another attribute like:
$caller-number = $called-number
Combining an attribute match with a text match
MQL expression can include both text and attribute expressions, like:
"thank you for calling" AND $direction = inbound
(cancel NEAR order) AND $sentiment-score < -30