$schema: https://json-schema.org/draft/2020-12/schema
$id: https://app.callr.com/callr-actions-schema.json
title: Callr Actions
description: Callr Actions schema
type: object
additionalProperties: false
properties:
  description:
    title: description
    description: Scenario description
    type: string
    maxLength: 1024
  defaults:
    $ref: "#/$defs/defaults"
  variables:
    title: variables
    description: Variables. They MUST start with a $ sign.
    type: object
    patternProperties:
      ^\$[a-zA-Z][a-zA-Z0-9_]{0,254}$: {}
    additionalProperties: false
    maxProperties: 64
  branches:
    title: branches
    description: Branches of actions
    type: object
    properties:
      api-initiated:
        $ref: "#/$defs/offlineBranch"
      inbound-sms:
        $ref: "#/$defs/offlineBranch"
      inbound-call:
        $ref: "#/$defs/branch"
      hangup:
        $ref: "#/$defs/hangupBranch"
    patternProperties:
      ^[a-zA-Z][a-zA-Z0-9_-]{0,255}$:
        $ref: "#/$defs/branch"
    additionalProperties: false
    maxProperties: 64
    minProperties: 1
  compat:
    type: object
    additionalProperties: false
    required: [version]
    properties:
      version:
        type: string
        description: >
          Compatibility version. Allows for backward compatibility and
          rolling updates.
        enum:
          - "2024-04-01"
          - "2025-09-01"
required:
  - branches
$defs:
  audio:
    type: object
    additionalProperties: false
    properties:
      enabled:
        oneOf:
          - title: enabled
            type: boolean
            default: true
          - $ref: "#/$defs/expr"
      sound:
        oneOf:
          - title: sound
            type: string
            enum:
              - beep
              - loading
              - heartbeat
            default: heartbeat
          - $ref: "#/$defs/expr"
      playId:
        oneOf:
          - title: playId
            type: integer
            minimum: 1
            default: 0
          - $ref: "#/$defs/expr"
      delay:
        oneOf:
          - title: delay
            type: number
            minimum: 0
            maximum: 60
            default: 0
          - $ref: "#/$defs/expr"
    oneOf:
      - allOf:
          - required: []
          - not:
              required:
                - playId
          - not:
              required:
                - sound
      - allOf:
          - required:
              - playId
          - not:
              required:
                - sound
      - allOf:
          - required:
              - sound
          - not:
              required:
                - playId
  branchName:
    type: string
    pattern: ^[a-zA-Z][a-zA-Z0-9_-]{0,255}$
  branch:
    title: branch
    description: Branch
    type: object
    additionalProperties: false
    properties:
      defaults:
        $ref: "#/$defs/defaults"
      actions:
        title: actions
        description: Actions to execute
        type: array
        items:
          $ref: "#/$defs/action"
        minItems: 1
      postHangup:
        title: postHangup
        description: Actions executed after the call is hangup
        type: array
        items:
          $ref: "#/$defs/actionHangup"
        minItems: 1
    required:
      - actions
  offlineBranch:
    title: Offline branch (API-initiated or inbound SMS)
    description: Branch executed when the run is offline (API-initiated or inbound SMS)
    type: object
    additionalProperties: false
    properties:
      defaults:
        $ref: "#/$defs/defaults"
      actions:
        title: actions
        description: Actions to execute
        type: array
        items:
          $ref: "#/$defs/actionOffline"
        minItems: 1
    required:
      - actions
  hangupBranch:
    title: hangup
    description: Branch executed on hangup (inbound call)
    type: object
    additionalProperties: false
    properties:
      defaults:
        $ref: "#/$defs/defaults"
      actions:
        title: actions
        description: Actions to execute
        type: array
        items:
          $ref: "#/$defs/actionHangup"
        minItems: 1
    required:
      - actions
  defaults:
    title: defaults
    description: Default values for actions
    type: object
    additionalProperties: false
    properties:
      voice:
        $ref: "#/$defs/voice"
      language:
        $ref: "#/$defs/speechLanguage"
      autoAnswer:
        title: autoAnswer
        description: Auto answer incoming calls
        type: boolean
        default: true
      hangupOnError:
        title: hangupOnError
        description: Hangup on error
        type: boolean
        default: true
  if:
    oneOf:
      - title: if
        description: If statement - javascript expression
        type: string
        minLength: 1
        maxLength: 1024
        pattern: ^(?!\${{)
      - title: if
        description: If statement - javascript expression
        type: boolean
  label:
    title: label
    description: Label name (used in goto)
    type: string
    pattern: ^[a-zA-Z][a-zA-Z0-9_]{0,255}$
  phoneNumber:
    title: Phone Number
    description: E.164 Phone number
    type: string
    pattern: ^\+[1-9][0-9]{5,32}$
    examples:
      - "+14155551212"
      - "+33639984242"
  sipURI:
    title: SIP URI
    description: RFC 3261 SIP URI
    type: string
    pattern: ^sip:[a-zA-Z0-9._%+-]+(:.+)?@[a-zA-Z0-9.-]+(:[0-9]{1,5})?(;transport=(udp|tcp|tls))?$
    examples:
      - "sip:+33184140000@1.2.3.4"
      - "sip:+33184140000@1.2.3.4:5069"
      - "sip:33184140000@sip.example.com"
      - "sip:user@domain.example.com:5060"
  action:
    oneOf:
      - $ref: "#/$defs/v0"
      - $ref: "#/$defs/amd@v1"
      - $ref: "#/$defs/amd@v2"
      - $ref: "#/$defs/answer@v1"
      - $ref: "#/$defs/bridge@v1"
      - $ref: "#/$defs/conference@v0"
      - $ref: "#/$defs/dial@v1"
      - $ref: "#/$defs/dtmf@v1"
      - $ref: "#/$defs/email@v1"
      - $ref: "#/$defs/fetch@v1"
      - $ref: "#/$defs/fetch@v2"
      - $ref: "#/$defs/gather@v1"
      - $ref: "#/$defs/gather@v2"
      - $ref: "#/$defs/googleAnalytics@v1"
      - $ref: "#/$defs/hangup@v1"
      - $ref: "#/$defs/javascript@v1"
      - $ref: "#/$defs/log@v1"
      - $ref: "#/$defs/memcache@v1"
      - $ref: "#/$defs/mixpanel@v1"
      - $ref: "#/$defs/openai@v1"
      - $ref: "#/$defs/openai@v2"
      - $ref: "#/$defs/play@v1"
      - $ref: "#/$defs/playRecordingFile@v1"
      - $ref: "#/$defs/saveRecordingFile@v1"
      - $ref: "#/$defs/recognize@v1"
      - $ref: "#/$defs/recognize@v2"
      - $ref: "#/$defs/record@v1"
      - $ref: "#/$defs/ringing@v1"
      - $ref: "#/$defs/say@v1"
      - $ref: "#/$defs/say@v2"
      - $ref: "#/$defs/sms@v1"
      - $ref: "#/$defs/startRecording@v1"
      - $ref: "#/$defs/stopRecording@v1"
      - $ref: "#/$defs/voicebot@v1"
      - $ref: "#/$defs/wait@v1"
      - $ref: "#/$defs/waitForSilence@v1"
      - $ref: "#/$defs/then"
      - $ref: "#/$defs/goto"
  actionOffline:
    oneOf:
      - $ref: "#/$defs/v0"
      - $ref: "#/$defs/dialOffline@v1"
      - $ref: "#/$defs/email@v1"
      - $ref: "#/$defs/fetch@v1"
      - $ref: "#/$defs/fetch@v2"
      - $ref: "#/$defs/googleAnalytics@v1"
      - $ref: "#/$defs/javascript@v1"
      - $ref: "#/$defs/log@v1"
      - $ref: "#/$defs/memcache@v1"
      - $ref: "#/$defs/mixpanel@v1"
      - $ref: "#/$defs/openai@v1"
      - $ref: "#/$defs/openai@v2"
      - $ref: "#/$defs/saveRecordingFile@v1"
      - $ref: "#/$defs/sms@v1"
      - $ref: "#/$defs/wait@v1"
      - $ref: "#/$defs/thenOffline"
      - $ref: "#/$defs/goto"
  actionHangup:
    oneOf:
      - $ref: "#/$defs/v0"
      - $ref: "#/$defs/email@v1"
      - $ref: "#/$defs/fetch@v1"
      - $ref: "#/$defs/fetch@v2"
      - $ref: "#/$defs/googleAnalytics@v1"
      - $ref: "#/$defs/javascript@v1"
      - $ref: "#/$defs/log@v1"
      - $ref: "#/$defs/memcache@v1"
      - $ref: "#/$defs/mixpanel@v1"
      - $ref: "#/$defs/openai@v1"
      - $ref: "#/$defs/openai@v2"
      - $ref: "#/$defs/saveRecordingFile@v1"
      - $ref: "#/$defs/sms@v1"
      - $ref: "#/$defs/stopRecording@v1"
      - $ref: "#/$defs/thenHangup"
      - $ref: "#/$defs/goto"
  v0:
    description: v0 WIP actions
    type: object
    additionalProperties: false
    properties:
      if:
        $ref: "#/$defs/if"
      label:
        $ref: "#/$defs/label"
      action:
        type: string
        pattern: ^[a-z][a-zA-Z0-9]+@v0$
      params:
        type: object
      result:
        $ref: "#/$defs/variable"
    required:
      - action
  ringing@v1:
    title: ringing@v1
    description: Indicate ringing tone before the call is answered (inbound calls only)
    type: object
    additionalProperties: false
    properties:
      if:
        $ref: "#/$defs/if"
      label:
        $ref: "#/$defs/label"
      action:
        type: string
        const: ringing@v1
    required:
      - action
  voicebot@v1:
    title: voicebot@v1
    description: AI agent
    type: object
    additionalProperties: false
    properties:
      if:
        $ref: "#/$defs/if"
      label:
        $ref: "#/$defs/label"
      action:
        type: string
        const: voicebot@v1
      params:
        type: object
        additionalProperties: false
        properties:
          voice:
            oneOf:
              - $ref: "#/$defs/voice"
              - $ref: "#/$defs/expr"
          language:
            oneOf:
              - $ref: "#/$defs/speechLanguage"
              - $ref: "#/$defs/expr"
          engine:
            type: object
            additionalProperties: false
            properties:
              name:
                type: string
                const: OpenAI
              auth:
                type: string
                minLength: 1
                maxLength: 255
              model:
                type: string
                minLength: 1
                maxLength: 255
              url:
                type: string
                format: uri
              params:
                type: object
                additionalProperties: false
                required: []
                properties:
                  temperature:
                    oneOf:
                      - type: number
                        minimum: 0
                        maximum: 2
                        default: 0.2
                      - $ref: "#/$defs/expr"
                  maxCompletionTokens:
                    oneOf:
                      - type: integer
                        minimum: 0
                        default: 0
                      - $ref: "#/$defs/expr"
            required:
              - name
              - model
          pleaseWait:
            type: object
            additionalProperties: false
            properties:
              enabled:
                oneOf:
                  - type: boolean
                    default: false
                  - $ref: "#/$defs/expr"
              delay:
                oneOf:
                  - type: number
                    minimum: 0
                    maximum: 30
                    default: 4
                  - $ref: "#/$defs/expr"
              sentences:
                oneOf:
                  - type: array
                    maxItems: 10
                    minItems: 1
                    items:
                      type: string
                      minLength: 1
                      maxLength: 1024
                  - $ref: "#/$defs/expr"
          stopSpeaking:
            type: object
            additionalProperties: false
            properties:
              enabled:
                oneOf:
                  - type: boolean
                    default: true
                  - $ref: "#/$defs/expr"
              minWords:
                oneOf:
                  - type: integer
                    minimum: 1
                    maximum: 10
                    default: 3
                  - $ref: "#/$defs/expr"
            required:
              - enabled
          initialMessages:
            oneOf:
              - $ref: "#/$defs/expr"
              - type: array
                minItems: 1
                maxItems: 32
                items:
                  type: object
                  additionalProperties: false
                  properties:
                    role:
                      type: string
                      enum:
                        - system
                        - developer
                        - assistant
                        - user
                    content:
                      type: string
                      minLength: 1
                      maxLength: 65536
                  required:
                    - role
                    - content
          tools:
            type: array
            maxItems: 10
            items:
              type: object
              additionalProperties: false
              required:
                - name
                - description
                - url
              properties:
                name:
                  type: string
                  minLength: 1
                  maxLength: 32
                  examples:
                    - Search Knowledge Base
                    - Get Weather
                type:
                  type: string
                  const: url
                url:
                  type: string
                  format: uri
                  examples:
                    - https://api.example.com/knowledge-base
                    - https://api.example.com/weather
                method:
                  type: string
                  default: GET
                  enum:
                    - GET
                    - POST
                    - PUT
                    - DELETE
                    - PATCH
                headers:
                  type: object
                  additionalProperties: false
                  patternProperties:
                    ^[a-zA-Z0-9-]+$:
                      type: string
                      minLength: 1
                      maxLength: 1024
                description:
                  type: string
                  minLength: 1
                  maxLength: 1024
                  examples:
                    - Search the knowledge base
                    - Get the weather
                params:
                  type: array
                  maxItems: 10
                  items:
                    type: object
                    additionalProperties: true
                    required:
                      - name
                      - type
                      - description
                    properties:
                      name:
                        type: string
                        minLength: 1
                        maxLength: 32
                        examples:
                          - query
                          - location
                      type:
                        type: string
                        enum:
                          - string
                          - number
                          - boolean
                          - object
                          - array
                          - "null"
                        examples:
                          - string
                          - number
                          - boolean
                      description:
                        type: string
                        minLength: 1
                        maxLength: 1024
                        examples:
                          - The search query
                          - The location
        required:
          - engine
          - initialMessages
      result:
        $ref: "#/$defs/variable"
  wait@v1:
    title: wait@v1
    description: Wait for a given amount of time
    type: object
    additionalProperties: false
    properties:
      if:
        $ref: "#/$defs/if"
      label:
        $ref: "#/$defs/label"
      action:
        type: string
        const: wait@v1
      params:
        type: object
        additionalProperties: false
        properties:
          seconds:
            oneOf:
              - type: number
                minimum: 0.1
                maximum: 120
              - $ref: "#/$defs/expr"
        required:
          - seconds
    required:
      - action
      - params
  waitForSilence@v1:
    title: waitForSilence@v1
    description: Wait for silence
    type: object
    additionalProperties: false
    properties:
      if:
        $ref: "#/$defs/if"
      label:
        $ref: "#/$defs/label"
      action:
        type: string
        const: waitForSilence@v1
      params:
        type: object
        additionalProperties: false
        properties:
          silence:
            oneOf:
              - type: number
                minimum: 1
                maximum: 10
              - $ref: "#/$defs/expr"
          iterations:
            oneOf:
              - type: integer
                minimum: 1
                maximum: 10
              - $ref: "#/$defs/expr"
          timeout:
            oneOf:
              - type: number
                minimum: 1
                maximum: 30
              - $ref: "#/$defs/expr"
      result:
        $ref: "#/$defs/variable"
    required:
      - action
  amd@v1:
    deprecated: true
    x-replaced-with: amd@v2
    title: amd@v1 (DEPRECATED)
    description: Use amd@v2 instead
    type: object
    additionalProperties: false
    properties:
      if:
        $ref: "#/$defs/if"
      label:
        $ref: "#/$defs/label"
      action:
        type: string
        const: amd@v1
      params:
        type: object
        additionalProperties: false
        properties:
          skip:
            title: skip
            description: Skip the first seconds
            oneOf:
              - type: integer
                minimum: 0
                maximum: 5000
                default: 1500
              - $ref: "#/$defs/expr"
          initialSilence:
            title: initialSilence
            description: Is maximum initial silence duration before greeting. If this is exceeded, the result is detection as a MACHINE.
            oneOf:
              - type: integer
                minimum: 100
                maximum: 10000
                default: 4000
              - $ref: "#/$defs/expr"
          greeting:
            title: greeting
            description: is the maximum length of a greeting. If this is exceeded, the result is detection as a MACHINE.
            oneOf:
              - type: integer
                minimum: 100
                maximum: 10000
                default: 1500
              - $ref: "#/$defs/expr"
          afterGreetingSilence:
            title: afterGreetingSilence
            description: Is the silence after detecting a greeting. If this is exceeded, the result is detection as a MACHINE.
            oneOf:
              - type: integer
                minimum: 100
                maximum: 10000
                default: 1000
              - $ref: "#/$defs/expr"
          totalAnalysisTime:
            title: totalAnalysisTime
            description: Is the maximum time allowed for the algorithmto decide on whether the audio represents a HUMAN, or a MACHINE.
            oneOf:
              - type: integer
                minimum: 100
                maximum: 10000
                default: 4000
              - $ref: "#/$defs/expr"
          miniumWordLength:
            title: miniumWordLength
            description: Is the minimum duration of Voice considered to be a word.
            oneOf:
              - type: integer
                minimum: 100
                maximum: 4000
                default: 120
              - $ref: "#/$defs/expr"
          betweenWordSilence:
            title: betweenWordSilence
            description: Is the minimum duration of silence after a word to consider the audio that follows to be a new word.
            oneOf:
              - type: integer
                minimum: 100
                maximum: 4000
                default: 50
              - $ref: "#/$defs/expr"
          maximumNumberOfWords:
            title: maximumNumberOfWords
            description: Is the maximum number of words in a greeting. If this is exceeded, then the result is detection as a MACHINE.
            oneOf:
              - type: integer
                minimum: 1
                maximum: 20
                default: 4
              - $ref: "#/$defs/expr"
          silenceThreshold:
            title: silenceThreshold
            description: What is the average level of noise from 0 to 32767 which if not exceeded, should be considered silence?
            oneOf:
              - type: integer
                minimum: 0
                maximum: 32767
                default: 384
              - $ref: "#/$defs/expr"
          maximumWordLength:
            title: maximumWordLength
            description: Is the maximum duration of a word to accept. If exceeded, then the result is detection as a MACHINE.
            oneOf:
              - type: integer
                minimum: 100
                maximum: 10000
                default: 4000
              - $ref: "#/$defs/expr"
      result:
        $ref: "#/$defs/variable"
    required:
      - action
  amd@v2:
    title: amd@v2
    description: Answering Maching Detection
    type: object
    additionalProperties: false
    properties:
      if:
        $ref: "#/$defs/if"
      label:
        $ref: "#/$defs/label"
      action:
        type: string
        const: amd@v2
      params:
        type: object
        additionalProperties: false
        properties:
          prompt:
            $ref: "#/$defs/prompt"
          language:
            oneOf:
              - $ref: "#/$defs/speechLanguage"
              - $ref: "#/$defs/expr"
          timeout:
            oneOf:
              - type: integer
                minimum: 1
                maximum: 10
                default: 6
              - $ref: "#/$defs/expr"
          minWords:
            oneOf:
              - type: integer
                minimum: 1
                maximum: 10
                default: 4
              - $ref: "#/$defs/expr"
          yesHints:
            oneOf:
              - type: array
                items:
                  type: string
                  minLength: 1
                  maxLength: 32
                minItems: 1
                maxItems: 10
              - $ref: "#/$defs/expr"
          noHints:
            oneOf:
              - type: array
                items:
                  type: string
                  minLength: 1
                  maxLength: 32
                minItems: 1
                maxItems: 10
              - $ref: "#/$defs/expr"
      result:
        $ref: "#/$defs/variable"
    required:
      - action
  answer@v1:
    title: answer@v1
    description: Answer the call (inbound calls only)
    type: object
    additionalProperties: false
    properties:
      if:
        $ref: "#/$defs/if"
      label:
        $ref: "#/$defs/label"
      action:
        type: string
        const: answer@v1
    required:
      - action
  bridge@v1:
    title: bridge@v1
    description: Bridge the outbound leg of a dial@v1
    type: object
    additionalProperties: false
    properties:
      if:
        $ref: "#/$defs/if"
      label:
        $ref: "#/$defs/label"
      action:
        type: string
        const: bridge@v1
    required:
      - action
  hangup@v1:
    title: hangup@v1
    description: Hangup the call, with optional Q.850 cause code
    type: object
    additionalProperties: false
    properties:
      if:
        $ref: "#/$defs/if"
      label:
        $ref: "#/$defs/label"
      action:
        type: string
        const: hangup@v1
      params:
        type: object
        additionalProperties: false
        properties:
          cause:
            oneOf:
              - title: cause
                description: Q.850 Cause Code
                type: integer
                minimum: 1
                maximum: 127
                default: 16
              - $ref: "#/$defs/expr"
    required:
      - action
  dial@v1:
    title: dial@v1
    description: Connect the current caller to another party
    type: object
    additionalProperties: false
    properties:
      if:
        $ref: "#/$defs/if"
      label:
        $ref: "#/$defs/label"
      action:
        type: string
        const: dial@v1
      params:
        type: object
        additionalProperties: false
        properties:
          cli:
            oneOf:
              - type: string
                const: CLONE
                default: CLONE
                description: Use the caller ID of the original call
                title: cli
              - type: string
                const: BLOCKED
                description: Hide the caller ID (CLIR)
                title: cli
              - $ref: "#/$defs/phoneNumber"
              - $ref: "#/$defs/expr"
          parallel:
            oneOf:
              - type: boolean
                title: parallel
                description: Dial all destinations in parallel (fork dialing). First target to answer wins, the other ones are canceled.
                default: false
              - $ref: "#/$defs/expr"
          answerOnBranch:
            allOf:
              - title: answerOnBranch
                description: If defined, the outbound call is not bridged upon answer; the callee will receive its actions from this branch while the caller hears a ringtone. Useful for whisper messages. The Leg B branch must call bridge@v1 to bridge the legs.
              - oneOf:
                  - $ref: "#/$defs/branchName"
                  - $ref: "#/$defs/expr"
          targets:
            oneOf:
              - title: targets
                type: array
                minItems: 1
                maxItems: 5
                items:
                  $ref: "#/$defs/dialTarget"
              - $ref: "#/$defs/expr"
          ring:
            $ref: "#/$defs/playNested@v1"
        required:
          - targets
      result:
        $ref: "#/$defs/variable"
    required:
      - action
      - params
  dialOffline@v1:
    title: dial@v1
    description: Start an outbound call
    type: object
    additionalProperties: false
    properties:
      if:
        $ref: "#/$defs/if"
      label:
        $ref: "#/$defs/label"
      action:
        type: string
        const: dial@v1
      params:
        type: object
        additionalProperties: false
        properties:
          cli:
            oneOf:
              - type: string
                const: CLONE
                default: CLONE
                description: Use the caller ID of the original call
                title: cli
              - type: string
                const: BLOCKED
                description: Hide the caller ID (CLIR)
                title: cli
              - $ref: "#/$defs/phoneNumber"
              - $ref: "#/$defs/expr"
          parallel:
            oneOf:
              - type: boolean
                title: parallel
                description: Dial all destinations in parallel (fork dialing). First target to answer wins, the other ones are canceled.
                default: false
              - $ref: "#/$defs/expr"
          answerOnBranch:
            allOf:
              - title: answerOnBranch
                description: Must be defined for offline actions. If the call answers, the script will continue on the specified branch.
              - oneOf:
                  - $ref: "#/$defs/branchName"
                  - $ref: "#/$defs/expr"
          targets:
            oneOf:
              - title: targets
                type: array
                minItems: 1
                maxItems: 5
                items:
                  $ref: "#/$defs/dialTarget"
              - $ref: "#/$defs/expr"
        required:
          - targets
          - answerOnBranch
      result:
        $ref: "#/$defs/variable"
    required:
      - action
      - params
  dtmf@v1:
    title: dtmf@v1
    description: Sends DTMF to the current call
    type: object
    additionalProperties: false
    properties:
      if:
        $ref: "#/$defs/if"
      label:
        $ref: "#/$defs/label"
      action:
        type: string
        const: dtmf@v1
      params:
        type: object
        additionalProperties: false
        properties:
          digits:
            oneOf:
              - type: string
                pattern: ^[0-9#*]+$
                title: digits
                description: DTMF digits to send
                minLength: 1
                maxLength: 32
              - $ref: "#/$defs/expr"
          timeout:
            oneOf:
              - type: integer
                title: timeout
                description: Amount of time to wait in ms between tones
                default: 250
                minimum: 50
                maximum: 1000
              - $ref: "#/$defs/expr"
          duration:
            oneOf:
              - title: duration
                description: Duration of each digit in ms
                type: integer
                default: 250
                minimum: 50
                maximum: 1000
              - $ref: "#/$defs/expr"
        required:
          - digits
    required:
      - action
      - params
  dialTarget:
    title: target
    type: object
    additionalProperties: false
    properties:
      number:
        oneOf:
          - $ref: "#/$defs/phoneNumber"
          - $ref: "#/$defs/sipURI"
          - $ref: "#/$defs/expr"
      timeout:
        oneOf:
          - type: integer
            default: 60
            minimum: 5
            maximum: 120
          - $ref: "#/$defs/expr"
    required:
      - number
      - timeout
  email:
    format: email
    minLength: 1
    maxLength: 1024
    pattern: ^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,63}$
  email@v1:
    title: email@v1
    description: Send en email
    type: object
    additionalProperties: false
    properties:
      if:
        $ref: "#/$defs/if"
      label:
        $ref: "#/$defs/label"
      action:
        type: string
        const: email@v1
      params:
        type: object
        additionalProperties: false
        properties:
          to:
            oneOf:
              - type: array
                items:
                  oneOf:
                    - $ref: "#/$defs/email"
                    - $ref: "#/$defs/expr"
                minItems: 1
                maxItems: 10
                title: to
              - $ref: "#/$defs/expr"
          subject:
            title: subject
            type: string
            minLength: 1
            maxLength: 1024
          text:
            title: text
            type: string
            minLength: 1
            maxLength: 10240
          fromName:
            oneOf:
              - title: fromName
                type: string
                minLength: 1
                maxLength: 255
                pattern: "^[^$][a-zA-Z0-9]"
              - $ref: "#/$defs/expr"
          replyTo:
            oneOf:
              - $ref: "#/$defs/email"
              - $ref: "#/$defs/expr"
        required:
          - to
          - subject
          - text
      result:
        $ref: "#/$defs/variable"
    required:
      - action
      - params
  fetch@v1:
    deprecated: true
    x-replaced-with: fetch@v2
    title: fetch@v1 (DEPRECATED)
    description: Use fetch@v2 instead
    type: object
    additionalProperties: false
    properties:
      if:
        $ref: "#/$defs/if"
      label:
        $ref: "#/$defs/label"
      action:
        type: string
        const: fetch@v1
      params:
        type: object
        additionalProperties: false
        properties:
          url:
            oneOf:
              - title: url
                type: string
                format: uri
                minLength: 1
                maxLength: 1024
              - $ref: "#/$defs/expr"
          method:
            oneOf:
              - title: method
                type: string
                enum:
                  - GET
                  - POST
                  - PUT
                  - DELETE
                  - PATCH
                  - HEAD
                  - OPTIONS
                default: GET
              - $ref: "#/$defs/expr"
          headers:
            oneOf:
              - title: headers
                type: object
                additionalProperties: false
                patternProperties:
                  ^[a-zA-Z0-9-]+$:
                    type: string
                    minLength: 1
                    maxLength: 1024
                minProperties: 1
                maxProperties: 32
              - $ref: "#/$defs/expr"
          body:
            title: body
            type: string
            minLength: 1
            maxLength: 10240
          responseFormat:
            oneOf:
              - title: responseFormat
                type: string
                enum:
                  - auto
                  - json
                default: auto
              - $ref: "#/$defs/expr"
          timeout:
            oneOf:
              - title: timeout
                type: integer
                minimum: 1
                maximum: 60
                default: 10
              - $ref: "#/$defs/expr"
        required:
          - url
      result:
        $ref: "#/$defs/variable"
    required:
      - action
      - params
  fetch@v2:
    title: fetch@v2
    description: Fetch HTTP resource
    type: object
    additionalProperties: false
    properties:
      if:
        $ref: "#/$defs/if"
      label:
        $ref: "#/$defs/label"
      action:
        type: string
        const: fetch@v2
      params:
        type: object
        additionalProperties: false
        properties:
          url:
            oneOf:
              - title: url
                type: string
                format: uri
                minLength: 1
                maxLength: 1024
              - $ref: "#/$defs/expr"
          method:
            oneOf:
              - title: method
                type: string
                enum:
                  - GET
                  - POST
                  - PUT
                  - DELETE
                  - PATCH
                  - HEAD
                  - OPTIONS
                default: GET
              - $ref: "#/$defs/expr"
          headers:
            oneOf:
              - title: headers
                type: object
                additionalProperties: false
                patternProperties:
                  ^[a-zA-Z0-9-]+$:
                    type: string
                    minLength: 1
                    maxLength: 1024
                minProperties: 1
                maxProperties: 32
              - $ref: "#/$defs/expr"
          body:
            title: body
            type: string
            minLength: 1
            maxLength: 10240
          responseFormat:
            oneOf:
              - title: responseFormat
                type: string
                enum:
                  - auto
                  - json
                default: auto
              - $ref: "#/$defs/expr"
          timeout:
            oneOf:
              - title: timeout
                type: integer
                minimum: 1
                maximum: 60
                default: 10
              - $ref: "#/$defs/expr"
          audio:
            $ref: "#/$defs/audio"
        required:
          - url
      result:
        $ref: "#/$defs/variable"
    required:
      - action
      - params
  gather@v1:
    deprecated: true
    x-replaced-with: gather@v2
    title: gather@v1 (DEPRECATED)
    description: Use gather@v2 instead
    type: object
    additionalProperties: false
    properties:
      if:
        $ref: "#/$defs/if"
      label:
        $ref: "#/$defs/label"
      action:
        type: string
        const: gather@v1
      params:
        type: object
        additionalProperties: false
        properties:
          maxDigits:
            oneOf:
              - title: maxDigits
                description: "Maximum number of digits to collect: 1..30"
                type: integer
                minimum: 1
                maximum: 30
              - $ref: "#/$defs/expr"
          timeout:
            oneOf:
              - title: timeout
                description: "Timeout in seconds: 1..60"
                type: number
                minimum: 1
                maximum: 60
                default: 4
              - $ref: "#/$defs/expr"
          stopOnTalk:
            oneOf:
              - $ref: "#/$defs/stopOnTalk"
              - $ref: "#/$defs/expr"
          nest:
            oneOf:
              - $ref: "#/$defs/sayNested@v1"
              - $ref: "#/$defs/playNested@v1"
        required:
          - nest
      result:
        $ref: "#/$defs/variable"
    required:
      - action
      - params
  gather@v2:
    title: gather@v2
    description: Gather digits (DTMF) from the caller
    type: object
    additionalProperties: false
    properties:
      if:
        $ref: "#/$defs/if"
      label:
        $ref: "#/$defs/label"
      action:
        type: string
        const: gather@v2
      params:
        type: object
        additionalProperties: false
        properties:
          endOnKey:
            oneOf:
              - title: endOnKey
                description: "DTMF key that ends the gather"
                type: string
                pattern: ^[0-9#*]$
                default: "#"
              - $ref: "#/$defs/expr"
          maxDigits:
            oneOf:
              - title: maxDigits
                description: "Maximum number of digits to collect: 0..30"
                type: integer
                default: 0
                minimum: 0
                maximum: 30
              - $ref: "#/$defs/expr"
          timeout:
            oneOf:
              - title: timeout
                description: "Timeout in seconds: 1..60"
                type: number
                minimum: 1
                maximum: 60
                default: 10
              - $ref: "#/$defs/expr"
          stopOnTalk:
            oneOf:
              - $ref: "#/$defs/stopOnTalkWords"
              - $ref: "#/$defs/expr"
          prompt:
            $ref: "#/$defs/prompt"
      result:
        $ref: "#/$defs/variable"
    required:
      - action
      - params
  prompt:
    type: object
    # additionalProperties: false
    # because it is nested
    properties:
      what:
        type: string
        minLength: 1
        maxLength: 1024
      voice:
        oneOf:
          - $ref: "#/$defs/voice"
          - $ref: "#/$defs/expr"
      language:
        oneOf:
          - $ref: "#/$defs/speechLanguage"
          - $ref: "#/$defs/expr"
    oneOf:
      - allOf:
          - required:
              - what
          - not:
              required:
                - voice
          - not:
              required:
                - language
      - allOf:
          - required:
              - what
              - voice
          - not:
              required:
                - language
      - allOf:
          - required:
              - what
              - language
          - not:
              required:
                - voice
  recognize@v1:
    deprecated: true
    x-replaced-with: recognize@v2
    title: recognize@v1 (DEPRECATED)
    description: Use recognize@v2 instead
    type: object
    additionalProperties: false
    properties:
      if:
        $ref: "#/$defs/if"
      label:
        $ref: "#/$defs/label"
      action:
        type: string
        const: recognize@v1
      params:
        type: object
        additionalProperties: false
        properties:
          beep:
            oneOf:
              - title: beep
                type: boolean
                default: true
              - $ref: "#/$defs/expr"
          language:
            oneOf:
              - $ref: "#/$defs/speechLanguage"
              - $ref: "#/$defs/expr"
          timeout:
            oneOf:
              - title: timeout
                type: number
                minimum: 1
                maximum: 30
                default: 5
              - $ref: "#/$defs/expr"
          nest:
            oneOf:
              - $ref: "#/$defs/sayNested@v1"
              - $ref: "#/$defs/playNested@v1"
          hints:
            title: hints
            type: array
            minItems: 1
            maxItems: 10
            items:
              type: string
              minLength: 1
              maxLength: 255
      result:
        $ref: "#/$defs/variable"
    required:
      - action
  recognize@v2:
    title: recognize@v2
    description: Recognize voice - Speech-to-Text
    type: object
    additionalProperties: false
    properties:
      if:
        $ref: "#/$defs/if"
      label:
        $ref: "#/$defs/label"
      action:
        type: string
        const: recognize@v2
      params:
        type: object
        additionalProperties: false
        properties:
          language:
            oneOf:
              - $ref: "#/$defs/speechLanguage"
              - $ref: "#/$defs/expr"
          timeout:
            oneOf:
              - title: timeout
                type: number
                minimum: 1
                maximum: 60
                default: 10
              - $ref: "#/$defs/expr"
          prompt:
            $ref: "#/$defs/prompt"
          hints:
            title: hints
            type: array
            minItems: 1
            maxItems: 10
            items:
              type: string
              minLength: 1
              maxLength: 255
          stopOnDTMF:
            oneOf:
              - type: boolean
                default: false
              - $ref: "#/$defs/expr"
      result:
        $ref: "#/$defs/variable"
    required:
      - action
  javascript@v1:
    title: javascript@v1
    description: Execute JavaScript code
    type: object
    additionalProperties: false
    properties:
      if:
        $ref: "#/$defs/if"
      label:
        $ref: "#/$defs/label"
      action:
        type: string
        const: javascript@v1
      params:
        type: object
        additionalProperties: false
        properties:
          code:
            type: string
            minimum: 1
            maximum: 10240
        required:
          - code
      result:
        $ref: "#/$defs/variable"
    required:
      - action
      - params
  log@v1:
    title: log@v1
    description: Log something
    type: object
    additionalProperties: false
    properties:
      if:
        $ref: "#/$defs/if"
      label:
        $ref: "#/$defs/label"
      action:
        type: string
        const: log@v1
      params:
        type: object
        additionalProperties: false
        properties:
          message:
            title: message
            type: string
            minimum: 1
            maximum: 10240
        required:
          - message
    required:
      - action
      - params
  memcache@v1:
    title: memcache@v1
    description: Key/value store for short term storage
    type: object
    additionalProperties: false
    properties:
      if:
        $ref: "#/$defs/if"
      label:
        $ref: "#/$defs/label"
      action:
        type: string
        const: memcache@v1
      params:
        type: object
        additionalProperties: false
        properties:
          command:
            type: string
            enum:
              - get
              - set
          key:
            title: key
            type: string
            minLength: 1
            maxLength: 255
          value:
            title: value
          ttl:
            oneOf:
              - title: ttl
                type: integer
                minimum: 1
                maximum: 3600
                default: 3600
              - $ref: "#/$defs/expr"
        if:
          properties:
            command:
              const: set
        then:
          required:
            - command
            - key
            - value
        else:
          allOf:
            - required:
                - command
                - key
            - not:
                required:
                  - value
            - not:
                required:
                  - ttl
      result:
        $ref: "#/$defs/variable"
    required:
      - action
      - params
  mixpanel@v1:
    title: mixpanel@v1
    description: Push event to Mixpanel
    type: object
    additionalProperties: false
    properties:
      if:
        $ref: "#/$defs/if"
      label:
        $ref: "#/$defs/label"
      action:
        type: string
        const: mixpanel@v1
      params:
        type: object
        additionalProperties: false
        properties:
          username:
            title: username
            type: string
            minLength: 1
            maxLength: 255
          secret:
            title: secret
            type: string
            minLength: 1
            maxLength: 255
          project_id:
            oneOf:
              - title: project_id
                type: string
                minLength: 1
                maxLength: 255
              - type: integer
          event:
            title: event
            type: string
            minLength: 1
            maxLength: 255
            default: Call
          properties:
            title: properties
            type: object
            additionalProperties: true
        required:
          - username
          - secret
          - project_id
    required:
      - action
      - params
  googleAnalytics@v1:
    title: googleAnalytics@v1
    description: Measure offline (phone) interactions with Google Analytics
    type: object
    additionalProperties: false
    properties:
      if:
        $ref: "#/$defs/if"
      label:
        $ref: "#/$defs/label"
      action:
        type: string
        const: googleAnalytics@v1
      params:
        type: object
        additionalProperties: false
        properties:
          id:
            title: id
            type: string
            minLength: 1
            maxLength: 255
          secret:
            title: secret
            type: string
            minLength: 1
            maxLength: 255
          clientID:
            title: clientID
            type: string
            minLength: 1
            maxLength: 255
          events:
            oneOf:
              - title: events
                type: array
                minItems: 1
                maxItems: 25
                items:
                  type: object
                  additionalProperties: false
                  properties:
                    name:
                      type: string
                      minLength: 1
                      maxLength: 255
                    params:
                      type: object
                      additionalProperties: true
                      maxProperties: 25
                  required:
                    - name
              - $ref: "#/$defs/expr"
        required:
          - id
          - secret
          - clientID
          - events
    required:
      - action
      - params
  openai@v1:
    deprecated: true
    x-replaced-with: openai@v2
    title: openai@v1 (DEPRECATED)
    description: Use openai@v2 instead
    type: object
    additionalProperties: false
    properties:
      if:
        $ref: "#/$defs/if"
      label:
        $ref: "#/$defs/label"
      action:
        type: string
        const: openai@v1
      params:
        type: object
        additionalProperties: false
        properties:
          secret:
            title: secret
            type: string
            minLength: 1
            maxLength: 255
          endpoint:
            title: endpoint
            type: string
            minLength: 1
            maxLength: 255
          timeout:
            oneOf:
              - title: timeout
                type: integer
                minimum: 1
                maximum: 60
                default: 20
              - $ref: "#/$defs/expr"
          properties:
            title: properties
            type: object
            additionalProperties: true
            minProperties: 1
        required:
          - secret
          - endpoint
          - properties
      result:
        $ref: "#/$defs/variable"
    required:
      - action
      - params
  openai@v2:
    title: openai@v2
    description: Communicate with OpenAI's API
    type: object
    additionalProperties: false
    properties:
      if:
        $ref: "#/$defs/if"
      label:
        $ref: "#/$defs/label"
      action:
        type: string
        const: openai@v2
      params:
        type: object
        additionalProperties: false
        properties:
          audio:
            $ref: "#/$defs/audio"
          secret:
            title: secret
            type: string
            minLength: 1
            maxLength: 255
          endpoint:
            title: endpoint
            type: string
            minLength: 1
            maxLength: 255
          timeout:
            oneOf:
              - title: timeout
                type: integer
                minimum: 1
                maximum: 60
                default: 20
              - $ref: "#/$defs/expr"
          properties:
            title: properties
            type: object
            additionalProperties: true
            minProperties: 1
        required:
          - secret
          - endpoint
          - properties
      result:
        $ref: "#/$defs/variable"
    required:
      - action
      - params
  say@v1:
    deprecated: true
    x-replaced-with: say@v2
    title: say@v1 (DEPRECATED)
    description: Use say@v2 instead
    type: object
    additionalProperties: false
    properties:
      if:
        $ref: "#/$defs/if"
      label:
        $ref: "#/$defs/label"
      action:
        type: string
        const: say@v1
      params:
        type: object
        additionalProperties: false
        properties:
          what:
            title: what
            type: string
            minLength: 1
            maxLength: 1024
          voice:
            oneOf:
              - $ref: "#/$defs/voice"
              - $ref: "#/$defs/expr"
          language:
            oneOf:
              - $ref: "#/$defs/speechLanguage"
              - $ref: "#/$defs/expr"
          stopOnTalk:
            oneOf:
              - $ref: "#/$defs/stopOnTalk"
              - $ref: "#/$defs/expr"
        oneOf:
          - allOf:
              - required:
                  - what
              - not:
                  required:
                    - voice
              - not:
                  required:
                    - language
          - allOf:
              - required:
                  - what
                  - voice
              - not:
                  required:
                    - language
          - allOf:
              - required:
                  - what
                  - language
              - not:
                  required:
                    - voice
      result:
        $ref: "#/$defs/variable"
    required:
      - action
      - params
  say@v2:
    title: say@v2
    description: Say something with Text-to-Speech
    type: object
    additionalProperties: false
    properties:
      if:
        $ref: "#/$defs/if"
      label:
        $ref: "#/$defs/label"
      action:
        type: string
        const: say@v2
      params:
        allOf:
          - $ref: "#/$defs/prompt"
          - type: object
            # commented because we are merging objects
            # additionalProperties: false
            properties:
              stopOnTalk:
                type: object
                properties:
                  enabled:
                    oneOf:
                      - type: boolean
                        default: false
                      - $ref: "#/$defs/expr"
                  minWords:
                    oneOf:
                      - type: integer
                        minimum: 1
                        maximum: 10
                        default: 3
                      - $ref: "#/$defs/expr"
                additionalProperties: false
                required:
                  - enabled
              stopOnDTMF:
                oneOf:
                  - type: boolean
                    default: false
                  - $ref: "#/$defs/expr"
      result:
        $ref: "#/$defs/variable"
    required:
      - action
      - params
  sayNested@v1:
    title: say@v1
    description: Say something with Text-to-Speech
    type: object
    additionalProperties: false
    properties:
      action:
        type: string
        const: say@v1
      params:
        type: object
        additionalProperties: false
        properties:
          what:
            title: what
            type: string
            minLength: 1
            maxLength: 1024
          voice:
            oneOf:
              - $ref: "#/$defs/voice"
              - $ref: "#/$defs/expr"
          language:
            oneOf:
              - $ref: "#/$defs/speechLanguage"
              - $ref: "#/$defs/expr"
        oneOf:
          - allOf:
              - required:
                  - what
              - not:
                  required:
                    - voice
              - not:
                  required:
                    - language
          - allOf:
              - required:
                  - what
                  - voice
              - not:
                  required:
                    - language
          - allOf:
              - required:
                  - what
                  - language
              - not:
                  required:
                    - voice
    required:
      - action
      - params
  play@v1:
    title: play@v1
    description: Play uploaded media file
    type: object
    additionalProperties: false
    properties:
      if:
        $ref: "#/$defs/if"
      label:
        $ref: "#/$defs/label"
      action:
        type: string
        const: play@v1
      params:
        type: object
        additionalProperties: false
        properties:
          id:
            oneOf:
              - title: id
                type: integer
                minimum: 1
              - $ref: "#/$defs/expr"
          stopOnTalk:
            oneOf:
              - $ref: "#/$defs/stopOnTalk"
              - $ref: "#/$defs/expr"
        required:
          - id
      result:
        $ref: "#/$defs/variable"
    required:
      - action
      - params
  playNested@v1:
    title: play@v1
    description: Play uploaded media file
    type: object
    additionalProperties: false
    properties:
      action:
        type: string
        const: play@v1
      params:
        type: object
        additionalProperties: false
        properties:
          id:
            oneOf:
              - title: id
                type: integer
                minimum: 1
              - $ref: "#/$defs/expr"
        required:
          - id
    required:
      - action
      - params
  playRecordingFile@v1:
    title: playRecordingFile@v1
    description: Play a file recorded with record@v1
    type: object
    additionalProperties: false
    properties:
      if:
        $ref: "#/$defs/if"
      label:
        $ref: "#/$defs/label"
      action:
        type: string
        const: playRecordingFile@v1
      params:
        type: object
        additionalProperties: false
        properties:
          file:
            title: file
            type: string
            minLength: 1
            maxLength: 1024
        required:
          - file
    required:
      - action
      - params
  saveRecordingFile@v1:
    title: saveRecordingFile@v1
    description: Save a file recorded with record@v1 as a Recording object in the API
    type: object
    additionalProperties: false
    properties:
      if:
        $ref: "#/$defs/if"
      label:
        $ref: "#/$defs/label"
      action:
        type: string
        const: saveRecordingFile@v1
      params:
        type: object
        additionalProperties: false
        properties:
          file:
            title: file
            type: string
            minLength: 1
            maxLength: 1024
          transcription:
            $ref: "#/$defs/transcription"
        required:
          - file
      result:
        $ref: "#/$defs/variable"
      events:
        title: events
        type: object
        additionalProperties: false
        properties:
          ready:
            title: ready
            type: array
            items:
              $ref: "#/$defs/actionHangup"
            minItems: 1
    required:
      - action
      - params
  record@v1:
    title: record@v1
    description: Record raw audio
    type: object
    additionalProperties: false
    properties:
      if:
        $ref: "#/$defs/if"
      label:
        $ref: "#/$defs/label"
      action:
        type: string
        const: record@v1
      params:
        type: object
        additionalProperties: false
        properties:
          maxLength:
            oneOf:
              - title: maxLength
                type: integer
                minimum: 5
                maximum: 300
                default: 30
              - $ref: "#/$defs/expr"
          beep:
            oneOf:
              - title: beep
                type: boolean
                default: true
              - $ref: "#/$defs/expr"
          timeout:
            oneOf:
              - title: timeout
                type: integer
                minimum: 0
                maximum: 10
                default: 5
              - $ref: "#/$defs/expr"
          finishOnAnyKey:
            oneOf:
              - title: finishOnAnyKey
                type: boolean
                default: true
              - $ref: "#/$defs/expr"
      result:
        $ref: "#/$defs/variable"
    required:
      - action
  sms@v1:
    title: sms@v1
    description: Send SMS
    type: object
    additionalProperties: false
    properties:
      if:
        $ref: "#/$defs/if"
      label:
        $ref: "#/$defs/label"
      action:
        type: string
        const: sms@v1
        description: Send SMS
      params:
        type: object
        additionalProperties: false
        properties:
          from:
            oneOf:
              - type: string
                pattern: ^([a-zA-Z][ a-zA-Z0-9_-]{1,10}|\+[1-9][0-9]{5,32})$
                title: from
                description: Sender phone number or alphanumeric sender ID
                default: ""
              - $ref: "#/$defs/expr"
          to:
            oneOf:
              - title: to
                type: array
                items:
                  oneOf:
                    - $ref: "#/$defs/expr"
                    - $ref: "#/$defs/phoneNumber"
                minItems: 1
                maxItems: 10
              - $ref: "#/$defs/expr"
          body:
            title: body
            type: string
            minLength: 1
            maxLength: 3200
            description: Message text
          nature:
            oneOf:
              - type: string
                enum:
                  - MARKETING
                  - ALERTING
                default: MARKETING
                title: nature
                description: Message nature
              - $ref: "#/$defs/expr"
          forceGSM:
            oneOf:
              - type: boolean
                title: forceGSM
                description: Force GSM 7-bit encoding
                default: false
              - $ref: "#/$defs/expr"
        required:
          - to
          - body
      result:
        $ref: "#/$defs/variable"
    required:
      - action
      - params
  startRecording@v1:
    title: startRecording@v1
    description: Start call recording
    type: object
    additionalProperties: false
    properties:
      if:
        $ref: "#/$defs/if"
      label:
        $ref: "#/$defs/label"
      action:
        type: string
        const: startRecording@v1
      params:
        type: object
        additionalProperties: false
        properties:
          feeds:
            oneOf:
              - title: feeds
                type: string
                enum:
                  - all
                  - leg_a
                  - leg_b
                default: all
              - $ref: "#/$defs/expr"
          transcription:
            $ref: "#/$defs/transcription"
      result:
        $ref: "#/$defs/variable"
      events:
        title: events
        type: object
        additionalProperties: false
        properties:
          ready:
            title: ready
            type: array
            items:
              $ref: "#/$defs/actionHangup"
            minItems: 1
    required:
      - action
  stopRecording@v1:
    title: stopRecording@v1
    description: Stop call recording
    type: object
    additionalProperties: false
    properties:
      if:
        $ref: "#/$defs/if"
      label:
        $ref: "#/$defs/label"
      action:
        type: string
        const: stopRecording@v1
      result:
        $ref: "#/$defs/variable"
    required:
      - action
  conference@v0:
    title: conference@v0
    description: Conference room
    type: object
    additionalProperties: false
    properties:
      if:
        $ref: "#/$defs/if"
      label:
        $ref: "#/$defs/label"
      action:
        type: string
        const: conference@v0
      params:
        type: object
        additionalProperties: false
        properties:
          id:
            type: string
            examples:
              - 1234
          silent:
            type: boolean
            default: false
        required:
          - id
    required:
      - action
      - params
  then:
    description: Sequence of actions following an if
    type: object
    additionalProperties: false
    properties:
      if:
        $ref: "#/$defs/if"
      label:
        $ref: "#/$defs/label"
      then:
        description: Sequence of actions
        type: array
        items:
          $ref: "#/$defs/action"
        minItems: 1
        maxItems: 64
    required:
      - if
      - then
  thenOffline:
    description: Sequence of actions following an if
    type: object
    additionalProperties: false
    properties:
      if:
        $ref: "#/$defs/if"
      label:
        $ref: "#/$defs/label"
      then:
        description: Sequence of actions
        type: array
        items:
          $ref: "#/$defs/actionOffline"
        minItems: 1
        maxItems: 64
    required:
      - if
      - then
  thenHangup:
    description: Sequence of actions following an if
    type: object
    additionalProperties: false
    properties:
      if:
        $ref: "#/$defs/if"
      label:
        $ref: "#/$defs/label"
      then:
        description: Sequence of actions
        type: array
        items:
          $ref: "#/$defs/actionHangup"
        minItems: 1
        maxItems: 64
    required:
      - if
      - then
  goto:
    title: goto
    description: Go to branch and/or label
    type: object
    additionalProperties: false
    properties:
      if:
        $ref: "#/$defs/if"
      label:
        $ref: "#/$defs/label"
      goto:
        type: object
        properties:
          branch:
            $ref: "#/$defs/branchName"
          label:
            $ref: "#/$defs/label"
        oneOf:
          - required:
              - branch
          - required:
              - label
    required:
      - goto
  expr:
    title: Dynamic Javascript expression
    type: string
    pattern: \${{ .+ }}
  variable:
    title: variable
    type: string
    pattern: ^\$[a-zA-Z][a-zA-Z0-9_]{0,254}$
  stopOnTalk:
    title: stopOnTalk
    description: Stop action when talk is detected
    type: object
    additionalProperties: false
    properties:
      enabled:
        oneOf:
          - title: enabled
            type: boolean
            default: false
          - $ref: "#/$defs/expr"
      silence:
        oneOf:
          - title: silence
            type: integer
            minimum: 100
            maximum: 10000
            default: 1000
          - $ref: "#/$defs/expr"
      min:
        oneOf:
          - title: min
            type: integer
            minimum: 100
            maximum: 10000
            default: 100
          - $ref: "#/$defs/expr"
      max:
        oneOf:
          - title: max
            type: integer
            minimum: 100
            maximum: 10000
          - type: string
            const: infinity
            default: infinity
          - $ref: "#/$defs/expr"
      analysisTime:
        oneOf:
          - title: analysisTime
            type: integer
            minimum: 100
            maximum: 10000
          - type: string
            const: infinity
            default: infinity
          - $ref: "#/$defs/expr"
    required:
      - enabled
  stopOnTalkWords:
    title: stopOnTalk
    description: Stop action when talk is detected
    type: object
    additionalProperties: false
    properties:
      enabled:
        oneOf:
          - title: enabled
            type: boolean
            default: false
          - $ref: "#/$defs/expr"
      minWords:
        oneOf:
          - title: minWords
            type: integer
            minimum: 1
            maximum: 30
            default: 2
          - $ref: "#/$defs/expr"
    required:
      - enabled
  transcription:
    title: transcription
    type: object
    additionalProperties: false
    properties:
      language:
        oneOf:
          - $ref: "#/$defs/speechLanguage"
          - $ref: "#/$defs/expr"
      enabled:
        oneOf:
          - title: enabled
            type: boolean
            default: true
          - $ref: "#/$defs/expr"
      sentiment:
        oneOf:
          - title: sentiment
            type: boolean
            default: true
          - $ref: "#/$defs/expr"
      ner:
        oneOf:
          - title: ner
            type: boolean
            default: true
          - $ref: "#/$defs/expr"
      pii:
        oneOf:
          - title: pii
            type: boolean
            default: true
          - $ref: "#/$defs/expr"
  voice:
    oneOf:
      - title: voice
        type: string
        description: Voice to use for the text-to-speech
        enum:
          - da-DK-Christel
          - da-DK-Jeppe
          - de-AT-Ingrid
          - de-AT-Jonas
          - de-CH-Jan
          - de-CH-Leni
          - de-DE-Katja
          - de-DE-Conrad
          - de-DE-Amala
          - de-DE-Bernd
          - de-DE-Christoph
          - de-DE-Elke
          - de-DE-Gisela
          - de-DE-Kasper
          - de-DE-Killian
          - de-DE-Klarissa
          - de-DE-Klaus
          - de-DE-Louisa
          - de-DE-Maja
          - de-DE-Ralf
          - de-DE-Tanja
          - de-DE-FlorianMultilingual
          - de-DE-SeraphinaMultilingual
          - el-GR-Athina
          - el-GR-Nestoras
          - en-CA-Clara
          - en-CA-Liam
          - en-GB-Sonia
          - en-GB-Ryan
          - en-GB-Libby
          - en-GB-Abbi
          - en-GB-AdaMultilingual
          - en-GB-Alfie
          - en-GB-Bella
          - en-GB-Elliot
          - en-GB-Ethan
          - en-GB-Hollie
          - en-GB-Maisie
          - en-GB-Noah
          - en-GB-Oliver
          - en-GB-Olivia
          - en-GB-Thomas
          - en-GB-OllieMultilingual
          - en-US-Ava
          - en-US-Andrew
          - en-US-Emma
          - en-US-Brian
          - en-US-Jenny
          - en-US-Guy
          - en-US-Aria
          - en-US-Davis
          - en-US-Jane
          - en-US-Jason
          - en-US-Sara
          - en-US-Tony
          - en-US-Nancy
          - en-US-Amber
          - en-US-Ana
          - en-US-Ashley
          - en-US-Brandon
          - en-US-Christopher
          - en-US-Cora
          - en-US-Elizabeth
          - en-US-Eric
          - en-US-Jacob
          - en-US-JennyMultilingual
          - en-US-Michelle
          - en-US-Monica
          - en-US-Roger
          - en-US-RyanMultilingual
          - en-US-Steffan
          - en-US-AIGenerate1
          - en-US-AIGenerate2
          - en-US-AndrewMultilingual
          - en-US-AvaMultilingual
          - en-US-Blue
          - en-US-Kai
          - en-US-Luna
          - en-US-BrianMultilingual
          - en-US-EmmaMultilingual
          - en-US-AlloyMultilingual
          - en-US-EchoMultilingual
          - en-US-FableMultilingual
          - en-US-OnyxMultilingual
          - en-US-NovaMultilingual
          - en-US-ShimmerMultilingual
          - es-ES-Elvira
          - es-ES-Alvaro
          - es-ES-Abril
          - es-ES-Arnau
          - es-ES-Dario
          - es-ES-Elias
          - es-ES-Estrella
          - es-ES-Irene
          - es-ES-Laia
          - es-ES-Lia
          - es-ES-Nil
          - es-ES-Saul
          - es-ES-Teo
          - es-ES-Triana
          - es-ES-Vera
          - es-ES-Ximena
          - es-ES-ArabellaMultilingual
          - es-ES-IsidoraMultilingual
          - fr-BE-Charline
          - fr-BE-Gerard
          - fr-CA-Sylvie
          - fr-CA-Jean
          - fr-CA-Antoine
          - fr-CA-Thierry
          - fr-CH-Ariane
          - fr-CH-Fabrice
          - fr-FR-Denise
          - fr-FR-Henri
          - fr-FR-Alain
          - fr-FR-Brigitte
          - fr-FR-Celeste
          - fr-FR-Claude
          - fr-FR-Coralie
          - fr-FR-Eloise
          - fr-FR-Jacqueline
          - fr-FR-Jerome
          - fr-FR-Josephine
          - fr-FR-Maurice
          - fr-FR-Yves
          - fr-FR-Yvette
          - fr-FR-RemyMultilingual
          - fr-FR-VivienneMultilingual
          - it-IT-Elsa
          - it-IT-Isabella
          - it-IT-Diego
          - it-IT-Benigno
          - it-IT-Calimero
          - it-IT-Cataldo
          - it-IT-Fabiola
          - it-IT-Fiamma
          - it-IT-Gianni
          - it-IT-Imelda
          - it-IT-Irma
          - it-IT-Lisandro
          - it-IT-Palmira
          - it-IT-Pierina
          - it-IT-Rinaldo
          - it-IT-AlessioMultilingual
          - it-IT-IsabellaMultilingual
          - it-IT-MarcelloMultilingual
          - it-IT-Giuseppe
          - nl-NL-Fenna
          - nl-NL-Colette
          - nl-NL-Maarten
          - pt-PT-Raquel
          - pt-PT-Duarte
          - pt-PT-Fernanda
          - sv-SE-Sofie
          - sv-SE-Hillevi
          - sv-SE-Mattias
      - title: voice
        description: Custom voice to use for the text-to-speech
        type: string
        minLength: 1
        maxLength: 255
        pattern: ^[a-zA-Z0-9]{1,255}$
  speechLanguage:
    title: language
    description: Language for Speech Recognition and Text-to-Speech
    type: string
    enum:
      - af-ZA
      - am-ET
      - ar-AE
      - ar-BH
      - ar-DZ
      - ar-EG
      - ar-IL
      - ar-IQ
      - ar-JO
      - ar-KW
      - ar-LB
      - ar-LY
      - ar-MA
      - ar-OM
      - ar-PS
      - ar-QA
      - ar-SA
      - ar-SY
      - ar-TN
      - ar-YE
      - az-AZ
      - bg-BG
      - bn-IN
      - bs-BA
      - ca-ES
      - cs-CZ
      - cy-GB
      - da-DK
      - de-AT
      - de-CH
      - de-DE
      - el-GR
      - en-AU
      - en-CA
      - en-GB
      - en-GH
      - en-HK
      - en-IE
      - en-IN
      - en-KE
      - en-NG
      - en-NZ
      - en-PH
      - en-SG
      - en-TZ
      - en-US
      - en-ZA
      - es-AR
      - es-BO
      - es-CL
      - es-CO
      - es-CR
      - es-CU
      - es-DO
      - es-EC
      - es-ES
      - es-GQ
      - es-GT
      - es-HN
      - es-MX
      - es-NI
      - es-PA
      - es-PE
      - es-PR
      - es-PY
      - es-SV
      - es-US
      - es-UY
      - es-VE
      - et-EE
      - eu-ES
      - fa-IR
      - fi-FI
      - fil-PH
      - fr-BE
      - fr-CA
      - fr-CH
      - fr-FR
      - ga-IE
      - gl-ES
      - gu-IN
      - he-IL
      - hi-IN
      - hr-HR
      - hu-HU
      - hy-AM
      - id-ID
      - is-IS
      - it-CH
      - it-IT
      - ja-JP
      - jv-ID
      - ka-GE
      - kk-KZ
      - km-KH
      - kn-IN
      - ko-KR
      - lo-LA
      - lt-LT
      - lv-LV
      - mk-MK
      - ml-IN
      - mn-MN
      - mr-IN
      - ms-MY
      - mt-MT
      - my-MM
      - nb-NO
      - ne-NP
      - nl-BE
      - nl-NL
      - pl-PL
      - ps-AF
      - pt-BR
      - pt-PT
      - ro-RO
      - ru-RU
      - si-LK
      - sk-SK
      - sl-SI
      - so-SO
      - sq-AL
      - sr-RS
      - sv-SE
      - sw-KE
      - sw-TZ
      - ta-IN
      - te-IN
      - th-TH
      - tr-TR
      - uk-UA
      - uz-UZ
      - vi-VN
      - wuu-CN
      - yue-CN
      - zh-CN
      - zh-CN-sichuan
      - zh-HK
      - zh-TW
      - zu-ZA
