The <AddJob/> Element

This element adds a job into your job queue

The text of the element is used to specify the job details.

After the element completes, it is possible to check if the job was successfully added by inspecting 'JobAdded'.

Available job types

msg_call (makes a call and if the call is answered, plays a message)

1
2
3
4
5
6
7
8
{
  "type": "msg_call",
  "data": {
    "calling_number": "05068680000",
    "called_number": "09012341234",
    "audio_file": "some_msg.wav"
  }
}

ivr_call (makes a call and if the call is answered, executes an IVR)

1
2
3
4
5
6
7
8
9
10
11
{
  "type": "ivr_call",
  "data": {
    "calling_number": "0506868000",
    "called_number": "09012341234",
    "ivr_xml": {
      "type": "inline",
      "data": "<IVR><SendFax>some_fax.tiff</SendFax></IVR>"
    }
  }
}

Options

When specifying the job you can include some options:

  • attempts: number of times the call should be attempted

  • delay: delay before making the first call attempt (in milliseconds)

  • backoff: specifies how to delay the next attempts

Ex:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
{
  "type": "msg_call",
  "data": {
    "calling_number": "05068680000",
    "called_number": "09012341234",
    "audio_file": "some_msg.wav"
  },
  "options": {
    "attempts": 3,
    "delay": 10000,
    "backoff": {
      "delay": 10000,
      "type": "fixed"
    }
  }
}

Examples

Example 1: add and job to callback the caller and play a pre-recorded message.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<IVR>
  <AddJob>{
            "type": "msg_call",
            "data": {
                "calling_number": "{{CalledNumber}}",
                "called_number": "{{CallingNumber}}",
                "audio_file": "some_message.wav"
            },
            "options": {
                "delay": 10000
            }
        }</AddJob>
  <If expr="JobAdded">
    <Then>
      <Speak>Hi, thank you for calling. I am calling you back in a few seconds.</Speak>
    </Then>
    <Else>
      <Speak>Sorry. Something went wrong.</Speak>
    </Else>
  </If>
</IVR>