A small http service to perform basic editions into an Asterisk dialplan configuration file and reload the service.
It can be consumed both by web apps to perform modifications on demand, but also making HTTP requests directly from a phone extension through the CURL
utility.
May not work entirely on Windows systems.
- Clone the repository by performing a git clone command.
- Install dependencies by running
npm run i
- Create a default config file by running
npm run config:init
- Modify the
.env
file with your desired parameters. Please note, listening on a network interface different thanlocalhost
IS NOT RECOMMENDED. This is a non-protected service, and it should not be exposed over the Internet. - You can check that everything works as expected by running tests with
npm run test
- Run manually by
npm run start
or in the background withforever
bynpm run start:background
Although this service can be consumed from any kind of software (web apps, cli apps, desktop software, etc.), it has been developed with dialplan scripts in mind.
Here is an example:
Let's suppose that we have a publicly accessible phone number, offered by a SIP provider, and all calls received on that number are redirected to the public
context, and the home
extension.
Our dialplan would be similar to this:
[public]
exten => home,1,Dial(SIP/finalUserToRing, 60)
[private]
If there's the need to deviate calls from finalUserToRing
to anotherUser
, in order to avoid having too many real phone numbers, we could add an extension which will make an http request to edit the dialplan.
[public]
exten => home,1,Dial(SIP/finalUserToRing, 60)
[private]
exten => 1,1,Verbose(0, ${CURL(http://127.0.0.1:300/public/home/1/dial(SIP%2FanotherUser, 120))})
The new extension, performs an http GET request to HTTP ASTERISK DIALPLAN EDITOR, following this format:
http://ipAddress:port/:context/:extension/:priority/:command
It's possible to modify parameters to perform different editions. Have fun! :)