Overview

This documentation will continue to evolve as we learn more about Asterisk and Blockly. It is not intended to be a definitive guide, rather it is the documentation of how we got things working.

The goal of this project is to create an asterisk context in extensions.conf using Blockly.

We assume you have already have a working Blockly example, as these setup steps will show you how to incorporate custom code and blocks for use with Blockly.

Setup

We will go through the process of setting up a single block with supporting code. Then repeating the process to add additional functionality

Define Custom Block

We will be using the Blockly Developer Tools

Add Custom Blocks to Blockly

Within google-blockly/blocks create a file to contain your customer blocks

Start by copying one of the existing block javascript files, then make the following changes

  • Update the provide statement to be goog.provide('Blockly.Constants.Asterisk');
  • Update the Blockly.defineBlocksWithJsonArray, if you have been using teh Blockly Developer Tools, you can easily get the JSON descriptions by going to the block exporter tab
  • Create a generator in google-blockly/generators. We use the same layout that is currently there, creating an asterisk.js and a subsequent asterisk folder

Supported Features

  • Contexts
  • Gotos
  • Answer/Hangup
  • Audo Playback
Demo

Check out the completed demo here

Get the code on Github

Participate in this project on GitHub