"Close" and "Open" an extension to dial dynamically

Hi Everybody,

This seems a really active and helpful community. Im pretty new to FreePBX so im sorry if i make a newbie question. I work for an hotel which has finally accepted that Avaya is not the “future”. We need to integrate the PMS (Property Managment System) with Asterisk to perform some hotelier stuff (voice mail, caller_id etc). We pretty much figure out how to do some stuff but one is bugging our mind if how we can dynamically when the PMS perfoms a guest check in let know Asterisk to change the DIALPLAN to allow calls, and the when a checkout is flagged modify the extension to close the line. In our PMS we can generate a script or file to be read by freepbx. Does anyone can point out what files or tables in mysql (in case we have to) modify. My logic says that i can create a config file and have amportal reload the configuration…

Again thanks for your help!

I would not touch the config files.

There is an APC to update extensions. I would just do that and use a con job to check for the PMS updates.

You could also write a script to clear out the VM files on checkout.

Thanks for your help and sorry to ask but what APC stands for? … .as i said im newbie to freepbx and asterisk…my background is java :-/

API, poor typing on my phone…sorry.

2 Likes

In my opinion, @SkykingOH is absolutely right. I would leave the config files alone. You will, on the other hand, need either a custom context or commercial module.

Search Sourceforge for “Java Asterisk API” and you should find a couple of interfaces. That will get you a comfortable programming environment to make your changes. You might not need to do any Java, but once you start to see how the interface works, you’ll see how to interact with the system.

It seems to me there’s a commercial module that allows you to control where an extension can call. I don’t know if it has a feature exactly like what you are looking for, but it wouldn’t hurt you to check that out first.

If the module doesn’t do what you need, it should be relatively simple to engineer a custom context to do this.

Pieces you need:
The asterisk database (using dbget/dbput/etc.). Note - this isn’t a MySQL database - it’s built into asterisk.
Some code that talks to your Property Management System.

So, here’s my concept:

  1. Set up a database entry called “ExternalOK” for each extension and set it to “false”.
  2. Set up a context that looks at the extension number from the phone and look at the ExternalOK flag for that extension. If the flag is false, the only numbers they can dial is the front desk and room service.
  3. Have your PMS connect to Asterisk and have your custom code update the database with “true” ad “false” on check-in/check-out.

This is pretty simple and doesn’t begin to cover all of the possibilities, but it should get you started.

When you start writing your context, put it in “extensions_custom.conf”. and call it something like “no-talk-for-you”.

Good luck.

1 Like

Actually Im way confortable with JAVA. Found a toolkit called astivetoolkit that provides FastAgi y AMI usage in JAVA. Thank so much to SkykingOH and you. Your information was really valuable.