REST API - Block/Allow outbounding calls

Hi at all,
is possible to lock and unlock outbounding calls through API REST?
I need to create a Dashboard for my clients. When a client reach money limit 0€, i want to use API REST for block outbounding calls for all extensions on a specific Free PBX (when i say specific i mean a specific public ip address where free pbx run).

I want know if is possible (through API REST) or:

  • lock and unlock outbounding calls for a extension
  • lock and unlock outbounding calls for all extensions
  • lock and unlock outbounding roules (in this mode people can’t make calls but can receive calls).
  • when a extension try to make a call but not have credit, change the destinations and reproduce a recorded message that say (recharge credit), and when credit will be >0€ on the dashboard, with another API REST request, change the destination from recorded message to the original outbounding route.

Is possible do that with free pbx?

Can give me some info or where search that on some Wiki, because i see all Asterisk wiki and i didn’t found something for do that.
I see only channels… and some other things but i not understand well if i must use channels api rest or there is another mode to do that.

Thanks a lot for your help

1 Like

Yes.

It seems like the hard way to do it. There are other features of the system (including the commercial Routing module) that sound like they’d be a better fix.

You can also write a special context for these that uses the Asterisk database and sets/checks the value of a call counter/money counter and turns on or off access to outside trunks.

I want to manage many Pbx instances, so the scope is do that automatically. I see the commercial module but in this mode I must do manually all the work for each Pbx Instance. Can explain me better how can do that by using script code or api rest ?
thanks

One idea is to put the data into the Asterisk (astdb) database and use a specialized context on the extensions.

You can interact with the Asterisk database through “asterisk -c (I think)” and specify the data you want to update.

Add the custom context to all of your extensions and then let your accounting process to manage the connections through updates to your astdb instances.

@mybuzi any progres on this,
I am tasked also to do custom app which will manage extensions outbound calls.
Can you share any progres whit this.

If we do editing settings of at asterisk through asterisk console directly bypassing Freepbx , whenever FreePBX apply / reload settings modification made over console will vanish ?
Is this true ?

Is there custom file for dialing plans where we can put permanently settings, as we can do custom registrations in /etc/asterisk/sip_custom.conf

Hello @mybuzi,

It would be easier for you to install an external billing server like the A2Billing project,
instead trying to build that from scratch.

Thank you,

Daniel Friedman
Trixton LTD.

1 Like

Some do, some don’t.

I’m not recommending changing anything in the basic context configuration. I was recommending adding a new value to the Asterisk astdb database (which is persistent) and using a context that reads that value and updates it.

If you are doing call cost accounting, the simplest way is to use one of the many commercial accounting systems available.

The extensions_freepbx_override.conf file is there to override the standard contexts and is not overwritten by updates to the system.

1 Like

Does A2Billing supports “locking” / “unlocking” outgoing calls per extension ,
In user friendly GUI?
Thanx in advanced.

Hello @adopilot,

Yes, The A2Billing project supports prepaid/postpaid accounts but it is based on account codes and not extensions.
You need to set on every extension an account code or to set it on the A2Billing server once the calls hit it and before it sends the calls to the billing program.

Thank you,

Daniel Friedman
Trixton LTD.

1 Like