Can you make functions within the dialplan?

Here’s a snippet of AEL:

                        switch  (${STEP-${IDX}-TYPE})
                                {
                                case ACCOUNT-NUMBER:
                                case LOOKUP-TTS-SNIPPETS:
                                case PROMPT:
                                case SAY-DIGITS:
                                        agi(${TOLOWER(${STEP-${IDX}-TYPE})},${DEBUG-MODE},${TEST-MODE},${VERBOSE-MODE});
                                        break;
                                case COMPLETE:
                                        if      (("760xxxxxxx" = "${CID}")
                                        ||       ("619xxxxxxx" = "${CID}")
                                        ||       ("sedwards" = "${CID}")
                                                )
                                                {
                                                playback(vtpv/ka-ching);
                                                };
                                        STATE=COMPLETE;
                                        break;
                                case DIAL:
                                        agi(dial.pl,${DEBUG-MODE},${TEST-MODE},${VERBOSE-MODE});
                                        break;
                                default:
                                        verbose(1,****** Error, unknown step type - ${STEP-${IDX}-TYPE});
                                        break;
                                };

Where:

  1. account-number asks for an account number, validates it, and sets a channel variable.
  2. lookup-tts-snippets reads rows from the database and sets channel variables.
  3. prompt plays a [list of] prompt[s].
  4. COMPLETE marks the end of the billable portion of a call.
  5. dial.pl places an outbound call to a live operator.

1, 2, and 3 are written in C. 5 is written in Perl.

1 Like