FreePBX | Register | Issues | Wiki | Portal | Support

Porting 2.11 version 'Wake Up Calls" module to V14


(Andrew Nagy) #21

During reload.

Code is here: https://github.com/FreePBX/hotelwakeup/blob/release/13.0/functions.inc.php#L44

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

Function is being called here https://github.com/FreePBX/hotelwakeup/blob/7ea43c7b67e3171769b052514438841d342216ce/functions.inc.php#L22


#22

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


#24

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:
    ext_AGI(‘wakeup’))
    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.


#26

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’;
set_time_limit(0);
error_reporting(0);
require_once “phpagi.php”;
$AGI = new AGI();
$AGI->answer();
$config = FreePBX::Wakeupalarms()->getConfig();

The function does exist inside functions.inc.php 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

<module>
<rawname>wakeupalarms</rawname>
<repo>local</repo>
<name>Wakeup Alarms</name>
<version>14.0.0.1</version>
<publisher>Les Desser</publisher>
<license>GPLv3+</license>
<licenselink>http://www.gnu.org/licenses/gpl-3.0.txt</licenselink>
<category>Applications</category>
<description>
	Allows the creation of future wakeup alarm calls. Calls can be one-off or repeating. The details are stored in the database.
</description>
<changelog>
	*14.0.0.1*  Initial clone and update: Based on Wakeupalarms to incorporate v14 design
</changelog>
<depends>
	<version>13.0.1</version>
</depends>
<menuitems>
	<wakeupalarms>Wakeup Alarms</wakeupalarms>
</menuitems>
<popovers>
	<wakeupalarms>
		<display>wakeupalarms</display>
		<view>form</view>
	</wakeupalarms>
</popovers>
<supported>
	<version>14.0</version>
</supported>
<location/>
<md5sum/>

(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()


#28

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.