Running a flow as a call script

A flow can run as one 3CX call script plus one data file, flow.json, instead of as separate menus and queues. The script itself never changes; changing the flow means writing a new flow.json. In the web app this lives behind Call script… in the toolbar.

Requirements: 3CX V20 Update 5 or newer, on-premise or self-hosted. 3CX-hosted PBXs do not support call scripts.

When to use it

  • You already use 3CX call scripts and want to keep that way of working.
  • Your flow needs smart steps: a caller-ID check, a PIN code, or a lookup against your own web service.
  • You want to review or archive the whole flow as a single file.

Queues, ring groups and menus the flow sends calls to must already exist in 3CX. A flow with steps tagged new has to be published natively first (sandbox or live), or use existing objects instead.

How it works

  1. JEDWare provides a fixed script. 3CX compiles it once.
  2. Next to it lives flow.json, exported from the designer.
  3. On every call the script reads flow.json, finds the branch for the dialled number, plays the prompts, reads the keys and transfers the call.
  4. A dialled number that is not in the file is handed back to normal 3CX routing.
  5. The script writes its own log, runner.log, next to flow.json.

With the JEDWare integration

Open the flow and choose Call script…. The dialog “Run as a 3CX call script” has a Sandbox test / Live switch at the top and shows the current script for that mode, if any: its name, what it runs for, when it was deployed and by whom, and whether it is Up to date, whether “The flow changed since it was deployed”, or whether there is an “Older runner on the PBX, deploy again”.

Test first. With Sandbox test selected, press Deploy. The script gets a number in the sandbox range and the dialog says “Dial 8905 from an extension to test”. Nothing else changes.

Then live.

  1. Switch to Live.
  2. Under “Deploy through the integration” give the script a name (letters, digits and underscore) and choose what it Runs for:
    • Calls to the incoming number: only calls to that number run the script. Use this when you have several flows.
    • Every call on the trunk: every call on the trunk runs the script; numbers not in the flow fall through to normal routing. Use this for one flow with many numbers.
    • Dial by number only: the script gets a number and nothing is re-pointed.
  3. Press Deploy. The designer keeps a copy of the routing your number has now, writes flow.json and the script to 3CX, waits for the compiler (“Deploying and waiting for the 3CX compiler…”) and reports, for example “44227232 now runs this flow”.
  4. Change the flow later: Deploy again. Only flow.json is replaced.
  5. Went wrong? History…Undo last publish points the number back at its previous destination. The script stays on 3CX, unused, until you delete it in the Admin Console. See Undo a publish and history.

If the script is gone from 3CX the dialog says “Not found on the PBX” and offers Forget this script, which clears the reference from the flow.

Without the integration

The bottom of the same dialog, “Install by hand on a 3CX without the integration”, has Download flow.json and Download runner script. It also lists the numbers and prompts the flow uses.

Example: Nordic Bikes has two flows, Sales (number 44227232 to queue 800) and Support (number 38203809 to queue 801). Two flows means two call scripts with the same code and a different flow.json in each.

  1. Download the runner script once, and flow.json for each flow. Download it with Live selected; the sandbox version points at sandbox numbers.
  2. Upload the prompts the flows use: Admin Console › Settings › System prompts.
  3. Admin Console › Integrations › Call Scripts › Add:
    • Name jw_sales, paste the runner script, save, wait for Compiled.
    • Files: upload the Sales flow.json. The name must be exactly flow.json.
    • Routing: select number 44227232.
  4. Repeat for jw_support with the Support flow.json and number 38203809.
  5. Call both numbers. Check …\Ivr\Prompts\Callflows\jw_sales\runner.log if something is off.

Changing a flow later: replace flow.json in the script’s Files list. No recompile, no restart; the next call uses the new file. When JEDWare ships a new runner, paste the new script into every call script; the flow.json files stay.

Rules

  • One call script per flow. Same code in all of them.
  • A script that runs for one incoming number only sees that number. Two flows on the same trunk must both run for their incoming number, not for the trunk.
  • The flow must not contain queues or ring groups tagged new. A sandbox deploy uses the sandbox copies, a live deploy the live copies.
  • Office hours follow the department of the first destination in the flow.

Next: Troubleshooting.