FreePBX | Register | Issues | Wiki | Portal | Support

Porting 2.11 version 'Wake Up Calls" module to V14

(Andrew Nagy) #21

During reload.

Code is here:

This is also where it calls the AGI that you said you couldn’t find.

Function is being called here


Thank you - working.

I had removed the two functions as I could not find references to it.:blush: (There was a sort of warning text that registered at the back of my mind but I ignored it)

Added the two functions and did a reload and all seems to be well.

I just need to do some tidying up and some thorough testing.

How do I package it all up to do a fresh install? Just a simple zip of the folder?

I want to uninstall it and test it starting from the install.

(Andrew Nagy) #23

Yes that will work


Correction: Not quite working.

  1. Originally *67 (feature code for my module) did not work
  2. Added back the two missing functions - working.
  3. I then realized that the function contained a reference to:
    and I did not have such a file in my agi-bin folder.
  4. Conclusion: that these files are global and my *67 was picking up the routine in hotelwakeup.
  5. Copied over the file to my module/agi-bin and called it wakeup67.
  6. Renamed all references there from hotelwakeup to wakeupalarm (some with a capital W)
  7. Changed my function to reference wakeup67.
  8. Did a reload.
  9. Not working
  10. Changed function back to point to ‘wakeup’, did a reload and it works again.

Any suggestions?

(Andrew Nagy) #25

Why don’t you just do your work in the original module and contribute back?

Agis are copied to the agi-bin folder on reload from the agi folder in the module. If this wasn’t working then dialparties wouldn’t be copied and your system would not function.


I most certainly would like to contribute my module as a replacement for hotelwakeup.

I tried to use that as a base (twice) but wasted days on it. I just could not get to grips with trying to extend the pop-up forms to do what I wanted.

So I went for ringroups as the base it was more ‘traditional’.

The php code i’m using is based on that in hotelwakeup but significantly extended.

So once it is working I would be only too happy to hand it over for it to replace hotelwakeup.

It seems to be working as expected except for this feature code issue.

Further to your comments, I have found that the ‘wakeup67’ agi file is being copied and it in fact runs when *67 is dialed, but is dying at the last line below:

$restrict_mods = true;
include ‘/etc/freepbx.conf’;
require_once “phpagi.php”;
$AGI = new AGI();
$config = FreePBX::Wakeupalarms()->getConfig();

The function does exist inside in </var/www/html/admin/modules/wakeupalarms>

function wakeupalarms_getConfig() {
$dbh = \FreePBX::Database();

A debug line at the front of that function does not get executed so the call is failing.

If I copy that function to the agi file and call it locally it all works.

There is a later reference in the file to an other module function and it now fails there.

Seems like the module is not properly registered. My module.xml file listing is below

<name>Wakeup Alarms</name>
<publisher>Les Desser</publisher>
	Allows the creation of future wakeup alarm calls. Calls can be one-off or repeating. The details are stored in the database.
	**  Initial clone and update: Based on Wakeupalarms to incorporate v14 design
	<wakeupalarms>Wakeup Alarms</wakeupalarms>

(Andrew Nagy) #27

“getConfig” wouldn’t exist inside of there because you are calling it as a class reference. It would be in Wakeupalarms.class.php under /var/www/html/admin/modules/wakeupalarms

The name of this function is “wakeupalarms_getConfig” It’s a procedural function so you need to call it like “wakeupalarms_getConfig()” so.

FreePBX::Wakeupalarms()->getConfig(); is not equal to wakeupalarms_getConfig()


Ops! I moved some functions from the class file to functions as, again, I found no relevant references to them.

This ‘class’ methodology is all new to me.

Thank you.