Pre-defined Variables

Variables

Always available

  • now
  • run
  • scenario
  • integrations
// const now = new Date()
// useful in expressions and javascript actions
run:
  id: "inbound-call:424242"
  type: inbound-call # inbound-call, inbound-sms, api
scenario:
  sid: callrsid
  name: Callr Actions Scenario Name
integrations:
  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:
  cdr: # call detail record (CDR)
    billingCredit: "0.0000" # credit in cents
    billingDebit: "0.8925" # debit in cents
    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|system
    hangupTech: "sip:200" # technology specific hangup cause
    scenarioName: Blank
    scenarioSid: i6s5ha2q
    scenarioTypeName: Actions
    scenarioTypeVersion: 1.0
    status: answered # dialing|ringing|answered|failed|unallocated|busy|canceled
  direction: inbound # inbound
  fromCountry: FR # ISO 3166-2
  fromLocation: France
  fromNumber: "+33639980042" # empty if callerid is restricted
  fromType: MOBILE # libphonenumber types
  id: 242359184129 # unique callid
  leg: A # A|B
  startedAt: "2025-03-29T17:55:57.093Z"
  toCountry: FR # ISO 3166-2
  toLocation: France
  toNumber: "+33939140303"
  toType: VOIP

call.cdr is the CDR object also documented here: Call Detail Records (CDR).


Available withInbound SMS

  • sms
sms:
  sid: callrsid
  direction: inbound
  fromNumber: "+33639980042"
  fromType: MOBILE # libphonenumber types
  fromCountry: FR
  fromLocation: France
  toNumber: "+33639980044"
  toType: MOBILE
  toCountry: FR
  toLocation: France
  status: received # created|error|expired|failed|pending|received|remote-queued|sent
  encoding: gsm # gsm|unicode
  bodyText: Hello, this is an inbound SMS!
  parts: 1
  billingDebit: "1.00" # cents
  billingPaymentType: prepaid # prepaid|postpaid
  network: ""
  receivedAt: "2025-03-31T15:42:00.123Z"
  createdAt: "2025-03-31T15:42:00.123Z"
  updatedAt: "2025-03-31T15:42:00.123Z"
  sentAt: null

Available inevents.ready of startRecording and saveRecordingFile

  • recording: same as the Recording object in the REST API
  • chat
  • chat_text
  • transcription_leg_a
  • transcription_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:46ZZ"
  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.0

Compatibility Versions

For backward compatibility and rolling updates, you can use a compat.version in your script.

Versions you can use:

  • 2024-04-01: current default
  • 2025-09-01: will become the default version on September 1st, 2025 if no compat.version is specified.

Here is an example:

description: Backward compatible script

compat:
  version: "2024-04-01" # default

branches:
  hangup:
    actions:
      - action: log@v1
        params:
          message: >
            Call from ${{ call.cdr.cli_number }}
            started at ${{ call.cdr.start }} 
description: Future-proof script

compat:
  version: "2025-09-01"

branches:
  hangup:
    actions:
      - action: log@v1
        params:
          message: >
            Call from ${{ call.cdr.callerNumber }}
            started at ${{ call.cdr.started }} 

2025-09-01

Upgrade guide

Please visit this changelog post for a guide on how to upgrade to this version without breaking your code.

Changelog

call.cdr and $dial.cdr

We’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.

BeforeAfterNote
creditbillingCredit
debitbillingDebit
cost_labelbillingDestinationLabel
callid_in (outbound)bridged
did_intl_number (inbound) number (outbound)callee
cli_namecallerName
cli_numbercallerNumber
cli_pres (string)callerRestristedbool callerRestricted = cli_res === prohib_passed_screen
duration_answereddurationAnswered
duration_billeddurationBilled
durationdurationTotal
startstarted
answeranswered
hangupended
hangupcausehangupCauseint Q.850 ISDN cause code
hangupcausehangupTechstring
hangupsourcehangupSource
app_namescenarioName
app_sidscenarioSidValue is now lowercase to match SID format
package_namescenarioTypeName"ACTIONS10""Actions"
package_namescenarioTypeVersion"ACTIONS10""1.0"
status or dialstatusstatusEnum values: dialing,ringing,answered,failed,unallocated,busy,canceled
(new)billingPaymentTypeprepaid,postpaid
(new)directioninbound,outbound
customer_fieldremoved
did_sidremoved
did_hashremoved
number_country_coderemoved
number_typeremoved

recording

We've updated the structure of the recording variable to align with the Recording object from ou REST API v2.

recording:
  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.0
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.0