Creating extensions, ivrs, trunks and queues programmatically

Hi everyone.

To start I am a web developer and this is my first dive into Asterisk related applications. now I was tasked with building a portable for my company’s customers with a button like that in home page:
create new extension
create new ivr
create new trunk
create new queue

So how can I do it programmatically? Can anyone help me?

On Sunday 12 May 2024 at 08:16:26, saminab via Asterisk Community wrote:

To start I am a web developer and this is my first dive into Asterisk
related applications. now I was tasked with building a portable for my
company’s customers with a button like that in home page:

  • create new extension
  • create new ivr
  • create new trunk
  • create new queue

Asterisk itself contains no support for the sort of thing you’re trying to do.

Asterisk is like the engine of an aeroplane - put it on a wing and it can fly.

Building the cockpit and all the controls is an entirely separate and very
non-trivial task. Asterisk ends up as just one small component of the end
result.

Does your company already use Asterisk? Does it already provide telphony
services to its customers? If so, you should go and talk to the people who
manage the Asterisk system and ask them how you can build a web front-end for
these functions.

If not, I suggest something like https://www.freepbx.org

Antony.


Most people would be a lot less bothered about what other people think of them
if they only realised how seldom they do.

                                               Please reply to the list;
                                                     please *don't* CC me.

Unless you have enough time for learning or programming skills, don’t reinvent the wheel; use FreePBX. However, I will still provide you with some hints. IVRs are dial plan applications, and the best way for me to create IVRs on the fly is by using AGI and an external programming language like PHP, Python, or others. For the SIP endpoints (extensions) and the other elements you request, you can use the Asterisk Realtime structure, which is much easier, as all configuration is handled by a database. So, you can easily make changes using a web API to interact with the database.

They asked on the FreePBX forum, first. I asked how it differed from FreePBX. Their answer begged the same question.

I’d use WaitExten, Background, and pure dialplan, for IVRs (noting that Asterisk providers tools that can create IVRs, but has no concept of an IVR itself - it also doesn’t have a concept of a trunk).

I’d also note that, whilst FreePBX makes use of databases, it doesn’t use Asterisk Realtime, but rather puts some options into AstDB, and uses its own database, as a source from which to create plain text configuration files. My impression is that people who use ARA for dialplan tend to be difficult to support, and get confused by the that other database objects get cached.

My recommendations for using Realtime to create SIP endpoints, queues, and other elements, as well as the recommendations for AGI to programmatically handle IVR, were not provided from the perspective of mimicking the FreePBX backend. These pieces of advice were from my own developer perspective and based on how I have done it in the past. That’s why I gave two options: use the existing wheel (FreePBX) or create your own, but using your own programming method.

Hi ambiorixg12
can I use FreePBX API?