dial@v2

Connect the current caller to another party. Replaces dial@v1 (cli becomes callerId, ring becomes an audioFile).

Versiondial@v2
Runs ininbound-call and your own branches · api-initiated and inbound-sms

Parameters

NameTypeRequiredDefaultDescription
callerId"clone" or "restricted" or phone number (E.164)"clone"clone: Use the caller ID of the current call; restricted: Hide the caller ID (CLIR); phone number (E.164): An approved caller ID (or a phone number) of your account
accepts ${{ }}
parallelbooleanfalseDial all destinations in parallel (fork dialing). First target to answer wins, the other ones are canceled.
accepts ${{ }}
answerOnBranchbranch nameIf 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@v3 to bridge the legs.
accepts ${{ }}
targetsarray of objectyes1..5 items · accepts ${{ }}
targets[].numberphone number (E.164) or SIP URIyesaccepts ${{ }}
targets[].timeoutintegeryes605..120 · accepts ${{ }}
ringobjectAudio file played in a loop to the caller while the targets ring, instead of the ringing tone
ring.audioFileobjectyesAn audio file of your library, by its SID (REST API v2 identifier). audio file of your library: sid

Every parameter that accepts ${{ }} can be computed from an expression.

How it works

Same as dial@v1 with two changes:

  • cli is now callerId: clone (default), restricted (hidden caller ID, CLIR), or a phone number in E.164 format (caller ID rules apply when the call is placed)
  • ring is an audio file of your library: ring: { audioFile: { sid } }

From an api-initiated or inbound-sms branch, answerOnBranch is required and ring is not available.

Examples

Short example

- action: dial@v2
  params:
    targets:
      - number: '+33199004242'
        timeout: 30
  result: $dial

Full example with defaults

- action: dial@v2
  params:
    callerId: clone # clone | restricted | '+33199000000'
    parallel: false
    ring: # audio file played in a loop while the targets ring, instead of the ringing tone
      audioFile:
        sid: 'fdsanjkf'
    targets:
      - number: '+33199004242'
        timeout: 30
    answerOnBranch: outboundCall # the branch must call bridge@v3 when ready
  result: $dial

Using the result

- if: "!$dial?.ok"
  action: play@v3
  params:
    tts:
      text: Sorry, I couldn't connect you to the other party.

Result

Set result: $myVariable to keep it. Result of dial@v1 and dial@v2

FieldTypeDescription
okbooleantrue when the callee answered and was bridged with the caller (status: bridged)
statusbridged, answered, dialing, noanswer, busy, failed, error_dial_on_leg_b, error_no_targetsOutcome of the call. rejected:<reason> when the platform refused to place the call (for example rejected:prefix-blacklisted)
callidinteger or nullCall ID of the outbound leg (leg B), null when no call was placed
cdrobject or nullCDR of the outbound leg, same format as call.cdr (it depends on compat.version). null when no call was placed, or when the CDR was not ready within 4 seconds
hangupcaller, callee, nullcaller when the caller hung up first, callee when the outbound leg ended first (answered or not). null when no call was placed
{
  "ok": true,
  "status": "bridged",
  "callid": 1234567890,
  "cdr": null,
  "hangup": "callee"
}

Older versions

Older versions keep working in existing scenarios. Use the version above in new scenarios.

  • dial@v1: Connect the current caller to another party

Did this page help you?