> ## Documentation Index
> Fetch the complete documentation index at: https://docs.invoca.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Call Recording Condition

## Manage call recording conditions for campaigns

A call recording condition can be set for a campaign to determine whether or not the call should be recorded. The call will be recorded if the full condition is met.

### Set Call Recording Condition

To conditionally record calls, set `"record_calls"` to `true` and set `"call_recording_condition"` to the expression you want to evaluate.

POST

`https://invoca.net/api/2022-08-01/<network_id>/advertisers/<advertiser_id_from_network>/advertiser_campaigns/<advertiser_campaign_id_from_network>.json`

Example Request Body

```json theme={null}
{
  "ivr_tree": {
    "record_calls": true,
    "call_recording_condition": "during_hours and repeat",
    "root": {
      "node_type": "Connect",
      "destination_phone_number": "8056173768",
      "destination_country_code": ""
    }
  }
}
```

### Record All Calls

To record all calls (and to remove an existing call recording condition), set `"record_calls"` to `true` and set `"call_recording_condition"` to empty string `""`.

POST

`https://invoca.net/api/2022-08-01/<network_id>/advertisers/<advertiser_id_from_network>/advertiser_campaigns/<advertiser_campaign_id_from_network>.json`

Example Request Body

```json theme={null}
{
  "ivr_tree": {
    "record_calls": true,
    "call_recording_condition": "",
    "root": {
      "node_type": "Connect",
      "destination_phone_number": "8056173768",
      "destination_country_code": ""
    }
  }
}
```

### Record No Calls

To record no calls (and to remove an existing call recording condition), set `"record_calls"` to `false` and set `"call_recording_condition"` to empty string `""`.

(If `"record_calls"` is `false`, no calls will be recorded even if there is a `"call_recording_condition"` set.)

POST

`https://invoca.net/api/2022-08-01/<network_id>/advertisers/<advertiser_id_from_network>/advertiser_campaigns/<advertiser_campaign_id_from_network>.json`

Example Request Body

```json theme={null}
{
  "ivr_tree": {
    "record_calls": false,
    "call_recording_condition": "",
    "root": {
      "node_type": "Connect",
      "destination_phone_number": "8056173768",
      "destination_country_code": ""
    }
  }
}
```

### Conditions

<table><thead><tr><th>Condition</th><th>Details</th><th>Examples</th></tr></thead><tbody><tr><td>during\_hours</td><td>True if the caller is calling during the hours specified in the campaign.</td><td>during\_hours</td></tr><tr><td>repeat</td><td>True if the caller has already called this campaign in the last N days (the interval N can be set on the campaign; the default is 30 days).</td><td>repeat</td></tr><tr><td>landline</td><td>True if the caller is calling from a landline phone.</td><td>landline</td></tr><tr><td>mobile</td><td>True if the caller is calling from a mobile phone.</td><td>mobile</td></tr><tr><td>pressed\[key]</td><td>True if the caller pressed the key. Supported characters (case sensitive): \[1-9, a-z, W, N]. For a sub-menu keypress, join characters in their expected order with spaces (e.g. 1 1 2).</td><td>pressed\[3]</td></tr><tr><td>custom\_data\[field\_partner\_name]</td><td><ul><li>True if the custom data field value matches (=) the expected value</li><li>True if the custom data field value does not match (!=) the expected value</li><li>True if the custom data field value contains (contains) the expected value</li><li>True if the custom data field value is present (present)</li></ul></td><td><ul><li>custom\_data\[product] = “Printer”</li><li>custom\_data\[product] != “Fax Machine”</li><li>custom\_data\[product] contains “Chair”</li><li>custom\_data\[product] present</li></ul></td></tr><tr><td>affiliate\_name</td><td><ul><li>True if the affiliate name value matches (=) the expected value</li><li>True if the affiliate name value does not match (!=) the expected value</li><li>True if the affiliate name value contains (contains) the expected value</li><li>True if the affiliate name value is present (present)</li></ul></td><td><ul><li>affiliate\_name = “Captain Crunch Publishing”</li><li>affiliate\_name != “Count Chocula Publishing”</li><li>affiliate\_name contains “Cocoa”</li><li>affiliate\_name present</li></ul></td></tr><tr><td>media\_type</td><td><ul><li>True if the media type for the promo number called matches (=) the expected value</li><li>True if the media type for the promo number called does not match (!=) the expected value</li><li>True if the media type for the promo number called contains (contains) the expected value</li><li>True if the media type for the promo number called is present (present)</li></ul></td><td><ul><li>media\_type = “Online: Content / Review Site”</li><li>media\_type != “Online: Email”</li><li>media\_type contains “Online”</li><li>media\_type present</li></ul></td></tr><tr><td>promo\_number\_description</td><td><ul><li>True if the description for the promo number called matches (=) the expected value</li><li>True if the description for the promo number called does not match (!=) the expected value</li><li>True if the description for the promo number called contains (contains) the expected value</li><li>True if the description for the promo number called is present (present)</li></ul></td><td><ul><li>promo\_number\_description = “Very important number”</li><li>promo\_number\_description != “Old marketing number”</li><li>promo\_number\_description contains “New ad campaign”</li><li>promo\_number\_description present</li></ul></td></tr><tr><td>and</td><td>Joins two conditions and is true if both conditions are true.</td><td>repeat and during\_hours</td></tr><tr><td>or</td><td>Joins two conditions and is true if either condition is true.</td><td>repeat or during\_hours</td></tr><tr><td>not</td><td>Inverts the following condition.</td><td>not during\_hours</td></tr><tr><td>( )</td><td>Used for grouping.</td><td>mobile and (repeat or during\_hours)</td></tr></tbody></table>

Note that **and** is higher precedence than **or**. So if you use both in a condition like this:

```
mobile or repeat and during_hours
```

it is equivalent to this:

```
mobile or (repeat and during_hours)
```


## Related topics

- [Conditional Call Recording](https://docs.invoca.com/s/article/conditional-call-recording.md)
- [Network Integration](https://docs.invoca.com/en/latest/api_documentation/network_integration/index.md)
- [Call Recording: Disabling & Management](https://docs.invoca.com/s/article/call-recording-disabling-management.md)
- [Recording Access Security](https://docs.invoca.com/s/article/recording-access-security.md)
- [Reviewing Call Recordings and Transcripts](https://docs.invoca.com/s/article/reviewing-recordings-and-transcripts.md)
