Porting 2.11 version 'Wake Up Calls" module to V14

I have a personalized version of this module (there is a copy on Github) which adds repeating alarms functionality, the lack of which is holding me back from moving to V14.

I want to port this to v14. I have now made two attempts to do this. The first was partially working when I realized that it was actually based on V13. I then tried using ‘Ring-groups’ as a base but am really at a loss to complete this. There seems to be so much ‘hidden’ stuff. For example, I cannot work out how the ‘Submit’ button works so can’t modify it to save the details to a different table. There are also loads of functions defined which are not explicitly referenced from anywhere in the module code.

The main functionality I need is to input several fields including time and date and to be able to select an extension, and then save them to a table.

Also the ability to amend and delete entries.

Any advice on what existing module to base it on and pointers to V14 methodology would be greatly welcome.

I have managed to work out how to display existing data from the database table but that is about it.

I’m not intending to become a FreePBX developer - just to gain the basic knowledge to achieve the above.


Unsure what you mean

Everything you need should be in and around the wiki article linked above.

Thank you very much for the link. I will get back to work…

As to unreferenced functions, take as an example functions.inc.php in ringgroups:

I have every php file in ringgroups open in notepad++.

Doing a global search for each function in functions.inc.php returns zero calls for the following:



Where are these functions referenced from?

They are hooks.


and so forth.

Sorry to waste your time on what must be basics. My last visit to FreePBX was in 2.11 so looks like I have a lot to learn.

I have looked at your link and have the equivalent class code from ringroups and daynight

<form class="popover-form fpbx-submit" name="editGRP" action="" method="post" onsubmit="return checkGRP(editGRP);" data-fpbx-delete="config.php?display=wakeupalarms&action=delGRP&account=<?php echo $account ?>">

In the 1st ‘action’ is a null string while in the 2nd action="?display=daynight".

Both have an ‘onsubmit=’ “return something” but I can’t fathom out what they are referencing.

checkGRP(editGRP) looks like a function but again checkGRP does not exist anywhere.

Do I need to go back to V12 documentation?

PS: I have made a few postings to the forum recently but have only received pop-up notifications on the web page - which I don’t find very useful (On one post I waited days for a response and eventually went back to try again and only then say that there was a response.)

A few minutes ago I did receive an email for your 2nd response. Can that be made permanent ?

That is only saying where you want to submit the form data back to. Has nothing to do with freepbx. If left empty according to html RFCs it just goes back to the same page

It’s calling javascript probably for validation but only for ringgroups (checkGRP is just a javascript function)

It does, but again it’s javascript and you are looking at PHP https://github.com/FreePBX/ringgroups/blob/release/13.0/assets/js/ringgroups.js#L53

I dont know what you are asking

It already is permanent.

Thank you - beginning to make sense. My reference to V12 is the documentation which shows the move from FreePBX 2.11 to FreePBX 12. I suppose I should start studying the changes at that point.

As to emails, I did not get any notification of your last post. It may be to do with Greylisting implemented on my mail server. I will start a new thread if necessary after checking the mailserver logs.

People say this all the time. The courteous thing to do is to check back every day or two until someone (even if it’s only me) responds. Relying on email for something as spammy as a mailing list is fraught with peril.

Now that I know I will do so.

I subscribe to a fair number of forums and have always relied on the email notifications and never had any problems. So I am rather surprised that this one is so unreliable.

I have looked back at my mail-server logs and indeed it is rather a poor showing.

In the last month I can only find two emails where there should have been around 8.

I see from the email headers that it is coming from ‘sparkpost’ who have on their front page: Your application’s emails: Delivered on time and to the inbox.:blush:

Anyway, thanks for warning - much appreciated.

Thank you for the pointers yesterday - I have progressed quite well with the interface - just a few things still to fix.

One is the pop-out on the right side when in Edit or Add mode.

It works but …

I have 15 alarms in the database and it lists 15 lines.

When I click on a line it loads the mtaching record into Edit mode.

But the two columns are actually empty - actually contain dashes.

I can’t find where to specify the field names to show in the two columns.

I would also like to add a third column.

(The ‘automation’ is quite awesome - minimal change with lots going on in the background - but difficult to reverse engineer).

For troubleshooting use your developer console.

You can see the json response which shows the fields.

In the Class:

namespace FreePBX\modules;

class Foomodule extends \DB_Helper implements \BMO {
   //other stuff
   public function ajaxHandler() {
      if($_REQUEST['command '] == 'getJSON' && $_REQUEST['jdata'] == 'fooGrid'){
         //generate something like below usually somerhing like $this->listStuff();
          return array(array('field1' => 'Foo', 'field2' => 'bar'), array('field1' => 'Baz', 'field2' => 'Narf'));
   //other stuff

I wasn’t really looking to dig deep into the inner workings, but if I must …

How do I get the Developer Tools? Goggling doesn’t come up with anything obvious.

https://webmasters.stackexchange.com/a/77337 Covers all browsers

Thank you. I thought it was was a FreePBX thing.:frowning_face:

A quick question: Whenever I create or amend an alarm the ‘Apply Config’ button appears.

It is obviously irrelevant when creating wake up alarms.

Where do I find the code to stop this happening?

In php it’s: needreload()

in javascript its: toggle_reload_button(“show”);

Got it. Thank you.

I have this more or less working properly and in the process learnt a lot about the FreePBX internals.

One thing I do not understand.

How is a feature code linked to the program code that supports it?

In setting up a feature code, we specify something like documented in the Wiki

$fcc = new featurecode('parking', 'parkedcall');

So there is a link from code *85 to module ‘parking’.

There is no mention of what code to run.

Where is set the link to the program code to run when a user dials *85, or in the case with hotelwakeup *68?

The file that seems to run when dialing *68 is ‘wakeup’ in the agi-bin sub-directory.

I cannot find any explicit reference to this file. Nor does it match the module name so it can’t be a name derived from the module name.

I have created a new module ‘wakeupalarms’ which creates a feature code *67 but when I dial *67 I just get silence.

What do I need to do?

You take that feature code and then you query the feature code class to make sure it’s enabled then you query the class to get the user defined value. Then you generate dialplan. Generating dialplan is not documented.

I don’t quite understand that - yet.

At what point is this done? When the module is installed?