Day/Night Index w/ Aastra XML

Running 1.1100.211.63-3 64-bit

Have set up two day/night indexes and can override them with *271 and *272 respectively just fine.

Have also set up aastra xml scripts… configured the following in /var/www/html/aastra/config/daynight.cfg

[1]
appli=201,202
notify=ALL
chg_label=1
label_night=Orth Day (%d)

[2]
appli=200,201
notify=ALL
chg_label=1
label_night=Pros Day (%d)

And have put the following in the mac.cfg for the two phones that need to control the day/night status…

expmod1 key15 type:xml
expmod1 key15 label:Orth Night
expmod1 key15 value:http://$$AA_XML_SERVER_AA$$/$$AA_XMLDIRECTORY_AA$$/asterisk/daynight.php?user=$$SIPUSERNAME$$&index=1

expmod1 key16 type:xml
expmod1 key16 label:Pros Night
expmod1 key16 value:http://$$AA_XML_SERVER_AA$$/$$AA_XMLDIRECTORY_AA$$/asterisk/daynight.php?user=$$SIPUSERNAME$$&index=2

When I push the buttons on either phone I get a message to the effect that “requested day/night index isn’t configured, see your administrator”

Am I missing something I’m going to feel stupid for not seeing? :slight_smile:

Cheers,

Mike <<<<<

This file was never completed by Aastra. They did about 75% of the work but never actually hooked the day/night application to look to this file.

I’m not sure that the conf file is the major issue.

I’ve been taking a look at the code this afternoon and it’s looking to me as if there may be an issue with the script looking up the daynight table in the asterisk database. If I query the database from the asterisk commandline I can see the 3 day/night indexes and their values in the database… however when the script runs, as far as I can tell it’s not returning any indexes.

In daynight.php on line 75 it makes the call
$array_night=Aastra_manage_daynight_Asterisk(‘get_all’,’’);

but if I do a count($array_night) immediately afterwards I get 0 when I’m assuming I should get 3.

I’m going to take a closer peek at the function that’s getting called, but this is starting to ramp quickly toward the top of my programming skill level.

Cheers,

Mike <<<<<

Add this to the top of the file and it will work. Without this then the phones fail to parse the DB for the indexes.

[ALL]

List of users having the global day/night application separated by a comma or ALL

appli=ALL

It comes down to before Aastra abandon these sample scripts they never finished the logic. I know because we had to finish all the logic on our commercial PBX customers to get it working for them with our End Point Manager.

This will atleast get it working for you but the downside is any phone with the app will be able to see and toggle all indexes. Not ideal but the app will work.

Have to do some more testing in the morning when I’m onsite, but what I found is that the daynight table in mysql was empty and that’s what seemed to be causing the script to throw the error message… I populated it with this content

mysql> select * from daynight;
±----±---------------±------+
| ext | dmode | dest |
±----±---------------±------+
| 0 | fc_description | NIGHT |
| 1 | fc_description | NIGHT |
| 2 | fc_description | NIGHT |
±----±---------------±------+

and the script seems to fire ok even without your addition to the config file. No clue if that’s the proper data or not for the SQL table… but it seems to have made things happy.

Cheers,

Mike <<<<<