Advice On Building A REST API Over ASTDB

Home » Asterisk Users » Advice On Building A REST API Over ASTDB
Asterisk Users No Comments

Hello,

I’m using an Asterisk 17 dialplan that currently includes:
1. many “DB gets” calls (ie statements like Set(FOO=${DB(Foo/Bar)})
2. and a couple of “DB puts” (ie statements like Set(DB(Foo/Bar)=Foo) or DB_DELETE(Foo/bar))

I would like to add an HTTP Provisionning API that would allow an external program to mostly change or sometimes read some ASTDB values.

Which architecture would you suggest for this ?

I can foresee the following options but I would very curious to discover alternatives.

1. Use AMI over HTTP

2. Use ARI but if I’m not mistaken, AR does not cover ASTDB

3. Develop a custom Web App that either:

3.1 Directly read or write on /var/lib/asterisk/astdb.sqlite3 but what about concurrency

3.2 Use shell CLI (asterisk -rx ‘database put Foo Bar Baz’)

4. Replace dialplan’s ASTDB calls with CURL statements (if positive, how to avoid repeating CURLOPT calls all over my dialplan).

Best regards