Pre-defined Variables
Variables
Always available
nowrunscenariointegrations
// const now = new Date()
// useful in expressions and javascript actionsrun:
id: "inbound-call:424242"
type: inbound-call # inbound-call, inbound-sms, apiscenario:
sid: callrsid
name: Callr Actions Scenario Nameintegrations:
defaults: # Default connections per provider
<provider>: # microsoft, google, hubspot, salesforce
id:
id: <provider-specific-user-id>
email: [email protected]
firstname: Firstname
lastname: Lastname
username: Username
displayName: Display Name
accessToken: <oauth-access-token>
metadata:
<key>: <value> # Connection specific metadata
<connection-name>: # A connected integration
id:
id: <provider-specific-user-id>
email: [email protected]
firstname: Firstname
lastname: Lastname
username: Username
displayName: Display Name
accessToken: <oauth-access-token>
metadata:
<key>: <value>To learn how to use the integrations variable, visit Fetch Data from Your Platform and Push Data to Your Platform.
Available withInbound Call
call
call is also set on the leg answered by a dial with answerOnBranch (in api-initiated and inbound-sms runs too): there direction is outbound, leg is B and toNumber is the number dialed. It is null in an offline run until then.
call:
cdr: # call detail record (CDR)
billingCredit: "0.0000" # in cents of the account currency
billingDebit: "0.8925" # in cents of the account currency
billingDestinationLabel: FR-GEOGRAPHIC-CLASSIC
billingPaymentType: prepaid # prepaid|postpaid
callee: "+33939140303"
callerName: ""
callerNumber: "+33639980042" # empty if callerid is restricted
callerRestricted: false # sometimes called CLIR
callid: 242359184129 # unique callid
direction: inbound # inbound|outbound
durationAnswered: 4
durationBilled: 60
durationTotal: 5
started: "2025-03-29T17:55:57.093Z"
answered: "2025-03-29T17:55:58.373Z"
ended: "2025-03-29T17:56:01.873Z"
hangupCause: 16 # Q.850 ISDN cause code
hangupSource: callee # caller|callee|gateway
hangupTech: "sip:200" # technology specific hangup cause
scenarioName: Blank
scenarioSid: i6s5ha2q
scenarioTypeName: Actions
scenarioTypeVersion: "1.0"
status: answered # answered|failed|unallocated|busy|canceled
# ended, hangup*, duration*, billingDebit, billingCredit and status: once the call has ended
direction: inbound # inbound|outbound
fromCountry: FR # ISO 3166-1 alpha-2
fromLocation: France
fromNumber: "+33639980042" # empty if callerid is restricted, like fromType, fromCountry and fromLocation
fromType: MOBILE # libphonenumber types
id: 242359184129 # unique callid
leg: A # A|B
startedAt: "2025-03-29T17:55:57.093Z"
toCountry: FR # ISO 3166-1 alpha-2
toLocation: France
toNumber: "+33939140303"
toType: VOIPcall.cdr is the CDR object also documented here: Call Detail Records (CDR).
Available withInbound SMS
sms
sms:
body:
text: Hello, this is an inbound SMS!
cost: "2.50" # in cents of the account currency
created: "2026-04-01T12:35:00Z"
delivered: "2026-04-01T12:35:00Z" # optional, like sent, network and error
direction: inbound
encoding: unicode # gsm|unicode
from: "+33639980011"
parts: 1
paymentType: prepaid
sid: rrh3e8ap
status: delivered # created|pending|sent|delivered|remote-queued|error|failed|expired
statusHistory:
- after: delivered
before: created
at: "2026-04-01T12:35:00Z"
to: "+33639980099"
trafficType: alerting # alerting|marketing
updated: "2026-04-01T12:35:00Z"Available inevents.ready of startRecording and saveRecordingFile
recording: same as theRecordingobject in the REST APIchatchat_texttranscription_leg_atranscription_leg_b
recording:
sid: "<sid>"
url: https://media.callr.com/recordings/<ACCOUNT-SID>/<RECORDING-SID>.mp3
read: false
size: 23544
type: call
callee: "+33939143578"
caller:
name: ""
number: "+33639980010"
restricted: false
callid: 240983641747
status: ready
created: "2025-04-03T15:16:46Z"
options:
ner: false
pii: false
feeds: all
language: en-US
sentiment: false
transcription: true
duration: 3
scenario:
sid: vedqt3xn
name: Call forwarding with AI ✨
transcription:
feeds:
- ner: []
pii: []
data:
language: en-US
display: ""
lexical: ""
phrases: []
feed: leg_a
sentiment:
sentiment: ""
confidenceScores:
neutral: 0
negative: 0
positive: 0
- ner: []
pii: []
data:
language: en-US
display: Sorry, we are not available at the moment.
lexical: sorry we are not available at the moment
phrases:
- words:
- word: Sorry,
offset: 0.88
duration: 0.68
- word: we
offset: 1.68
duration: 0.2
- word: are
offset: 1.88
duration: 0.08
- word: not
offset: 1.96
duration: 0.24
- word: available
offset: 2.2
duration: 0.44
- word: at
offset: 2.64
duration: 0.08
- word: the
offset: 2.72
duration: 0.08
- word: moment.
offset: 2.8
duration: 0.48
offset: 0.88
display: Sorry, we are not available at the moment.
confidence: 0.9216155
feed: leg_b
sentiment:
sentiment: ""
confidenceScores:
neutral: 0
negative: 0
positive: 0
version: 2.0Compatibility Versions
For backward compatibility and rolling updates, you can use a compat.version in your script.
Versions you can use:
2024-04-012025-09-01: default version since April 1st, 2026 if nocompat.versionis specified.
Here is an example:
description: Future-proof script
compat:
version: "2025-09-01" # default
branches:
hangup:
actions:
- action: log@v1
params:
message: >
Call from ${{ call.cdr.callerNumber }}
started at ${{ call.cdr.started }} description: Backward compatible script
compat:
version: "2024-04-01" # deprecated
branches:
hangup:
actions:
- action: log@v1
params:
message: >
Call from ${{ call.cdr.cli_number }}
started at ${{ call.cdr.start }} 2025-09-01
Upgrade guidePlease visit this changelog post for a guide on how to upgrade to this version without breaking your code.
Changes from 2024-04-01
call.cdr and $dial.cdr
call.cdr and $dial.cdrWe’ve updated the structure of the call.cdr and $dial.cdr object in Callr Actions to align with the CDR format from our REST API v2.
| Before | After | Note |
|---|---|---|
credit | billingCredit | |
debit | billingDebit | |
cost_label | billingDestinationLabel | |
callid_in (outbound) | bridged | |
did_intl_number (inbound) number (outbound) | callee | |
cli_name | callerName | |
cli_number | callerNumber | |
cli_pres (string) | callerRestricted | bool callerRestricted = cli_pres === prohib_passed_screen |
duration_answered | durationAnswered | |
duration_billed | durationBilled | |
duration | durationTotal | |
start | started | |
answer | answered | |
hangup | ended | |
hangupcause | hangupCause | int Q.850 ISDN cause code |
hangupcause | hangupTech | string |
hangupsource | hangupSource | |
app_name | scenarioName | |
app_sid | scenarioSid | Value is now lowercase to match SID format |
package_name | scenarioTypeName | "ACTIONS10"⇨ "Actions" |
package_name | scenarioTypeVersion | "ACTIONS10" ⇨"1.0" |
status or dialstatus | status | answered,failed,unallocated,busy,canceled, once the call has ended |
| (new) | billingPaymentType | prepaid,postpaid |
| (new) | direction | inbound,outbound |
customer_field | removed | |
did_sid | removed | |
did_hash | removed | |
number_country_code | removed | |
number_type | removed | |
cli_country_code, cli_number_type (inbound) | removed | |
app_hash | removed | Use scenarioSid |
Other variables and results
| Before (2024-04-01) | 2025-09-01 |
|---|---|
app.name, app.sid (uppercase) | scenario.name, scenario.sid (lowercase); app no longer exists |
call.status | removed |
sms: flat object (fromNumber, toNumber, bodyText, billingDebit, deliveredAt…) | The SMS object of the REST API (from, to, body.text, cost, delivered…), see above |
Result of startRecording@v1 and saveRecordingFile@v1: recording SID in uppercase | Recording SID in lowercase |
recording
recordingWe've updated the structure of the recording variable to align with the Recording object from our REST API v2.
recording:
sid: "<sid>"
url: https://media.callr.com/recordings/<ACCOUNT-SID>/<RECORDING-SID>.mp3
read: false
size: 23544
type: call
callee: "+33939143578"
caller:
name: ""
number: "+33639980010"
restricted: false
callid: 240983641747
status: ready
created: "2025-04-03T15:16:46Z"
options:
ner: false
pii: false
feeds: all
language: en-US
sentiment: false
transcription: true
duration: 3
scenario:
sid: "<scenario-sid>"
name: Call forwarding with AI ✨
transcription:
feeds:
- ner: []
pii: []
data:
language: en-US
display: ""
lexical: ""
phrases: []
feed: leg_a
sentiment:
sentiment: ""
confidenceScores:
neutral: 0
negative: 0
positive: 0
- ner: []
pii: []
data:
language: en-US
display: Sorry, we are not available at the moment.
lexical: sorry we are not available at the moment
phrases:
- words:
- word: Sorry,
offset: 0.88
duration: 0.68
- word: we
offset: 1.68
duration: 0.2
- word: are
offset: 1.88
duration: 0.08
- word: not
offset: 1.96
duration: 0.24
- word: available
offset: 2.2
duration: 0.44
- word: at
offset: 2.64
duration: 0.08
- word: the
offset: 2.72
duration: 0.08
- word: moment.
offset: 2.8
duration: 0.48
offset: 0.88
display: Sorry, we are not available at the moment.
confidence: 0.9216155
feed: leg_b
sentiment:
sentiment: ""
confidenceScores:
neutral: 0
negative: 0
positive: 0
version: 2.0recording:
app:
sid: "<SCENARIO-SID>"
name: Call forwarding with AI ✨
did:
sid: "<DID-SID>"
intl: "+33939140344"
local: "0939140344"
sid: "<RECORDING-SID>"
url:
mp3: https://media.callr.com/recordings/<ACCOUNT-SID>/<RECORDING-SID>.mp3
date: "2025-04-03T14:59:05Z"
read: false
type: CALL
callid: 260068871954
readAt: "0000-00-00T00:00:00Z"
status: READY
options:
ner: false
pii: false
feeds: both
locale: en_US
webhook:
sentiment: false
transcription: true
callerid:
name: ""
number: "+33639980010"
duration: 3
transcription:
feeds:
- ner: []
pii: []
data:
locale: en-US
display: None.
lexical: None
phrases:
- words:
- word: None.
offset: 2.2
duration: 0.12
offset: 2.2
display: None.
confidence: 0.3548299
feed: leg_a
sentiment:
sentiment: ""
confidenceScores:
neutral: 0
negative: 0
positive: 0
- ner: []
pii: []
data:
locale: en-US
display: Sorry, we are not available at the moment.
lexical: sorry we are not available at the moment
phrases:
- words:
- word: Sorry,
offset: 0.88
duration: 0.68
- word: we
offset: 1.68
duration: 0.2
- word: are
offset: 1.88
duration: 0.08
- word: not
offset: 1.96
duration: 0.24
- word: available
offset: 2.2
duration: 0.44
- word: at
offset: 2.64
duration: 0.08
- word: the
offset: 2.72
duration: 0.08
- word: moment.
offset: 2.8
duration: 0.48
offset: 0.88
display: Sorry, we are not available at the moment.
confidence: 0.91178995
feed: leg_b
sentiment:
sentiment: ""
confidenceScores:
neutral: 0
negative: 0
positive: 0
version: 2.0Updated 11 days ago
