Hi GURUs - I need some help on how to trigger the Orange Bar wiht my script

Hi Everyone,

I have done some php coding to come up with my own FollowME module for FreePBX. The need for this has some security considerations behind it.
This is what my code does at core:

$sql=“REPLACE INTO findmefollow(grpnum, strategy, grptime, grppre, grplist, annmsg_id,postdest, dring, needsconf, remotealert_id, toolate_id, ringing, pre_ring) VALUES (’$_POST[grpnum]’,‘ringall’,’$_POST[grptime]’,’$_POST[grppre]’,’$grplist’,‘0’,’$postdest’,’’,’’,‘0’,‘0’,‘Ring’,’$_POST[pre_ring]’)”;

This all conforms with the fields that are filled up by FreePBX followme module but it seems that this is not all becuase the followme doesn’t work when I do it this way. It only works if I press submit and confirm the orange bar.
For one thing, I think the Orange Reload bar does something that I can’t seem to find and that my php code doesn’t do. I tried doing a manual “reload” and “dialplan reload” but that wouldn’t do the job.

Can someone please shed some light if you know where I am stuck and had to tackle the issue yourself?

Thanks,
Bruce

PLEASE, do NOT post the same thing over and over again. One thread is enough.

You answer is: Look in the code, there you will find the function:

needreload();

That is all that you need to do to trigger it.

Or you might try this:

MySQL: update asterisk.admin set value=‘true’ where variable=“need_reload”

Bash: /var/lib/asterisk/bin/module_admin reload

Ward is correct:

MySQL: update asterisk.admin set value='true' where variable="need_reload"

is basically what needreload() does, which simply tells FreePBX to place the orange bar there on the next page load.

Bash: /var/lib/asterisk/bin/module_admin reload

is basically what pressing the orange bar does. More details were further clarified here:

http://www.freepbx.org/forum/freepbx/development/combining-the-save-button-and-reload-button

Thanks for that guys. However, I seem to be missing something. Here is what I have that doesn’t work.

PHP Code:


Insert values for FollowMe

$sql=“REPLACE INTO findmefollow
(grpnum, strategy, grptime, grppre, grplist, annmsg_id, postdest, dring,
needsconf, remotealert_id, toolate_id, ringing, pre_ring) VALUES
(’$_POST[grpnum]’,‘ringall’,’$_POST[grptime]’,’$_POST[grppre]’,
’$grplist’,‘0’,’$postdest’,’’,’’,‘0’,‘0’,‘Ring’,’$_POST[pre_ring]’)”;

Reload configs into FPBX and Asterisk

$sql2=“UPDATE admin SET value=‘true’ WHERE variable=‘need_reload’”;

Relaod

system(’/var/lib/asterisk/bin/module_admin reload’);


I think this is the problem (what I grabbed from Asterisk CLI):

dialparties.agi: Caller ID name is ‘JOHN SMITH’ number is '4156668888’
dialparties.agi: USE_CONFIRMATION: 'FALSE’
dialparties.agi: RINGGROUP_INDEX: ''
dialparties.agi: Methodology of ring is ‘ringall’
– dialparties.agi: Filtered ARG3:
> dialparties.agi: NODEST: 9999 adding M(auto-blkvm) to dialopts: trM(auto-blkvm)
> dialparties.agi: NODEST: 9999 blkvm enabled macro already in dialopts: trM(auto-blkvm)
dialparties.agi: Setting default NOANSWER DIALSTATUS since no extensions available
== Manager ‘admin’ logged off from 127.0.0.1
– AGI Script dialparties.agi completed, returning 0

Your input is much appreciated.

I would suggest you step back and describe to folks what your overall end goal is as well as what you can’t do with the current module that you are trying to resolve.

Your questions right now are fairly ambiguous and the things you are doing that you highlighted above don’t make much sense, and depending on where you are doing that script, could be problematic.

If you provide a bigger picture view, you may end up getting some good ideas as to how to solve your issue.

I am trying to create a simple followme.php page which will be the only thing that the user will have access to. Also, it is to be much simpler as the user is confused by the current followMe module.

The code I inserted, is the part of followme.php which harvests the necessary fields from the web page and to INSERT them into MySql table so that the followMe works for that specific extension. User choses extension number and then enters a followme number, and the php file fills the rest of fields such as strategy and $postdest, etc…

However, I think there is more than meets the eye and I should probably do more than simply setting the need_reload=true and setting the findmefollow table as suggested.

Currently, this is what I do:

1- Fill up all the fields found in MySql > asterisk > findmefollow
2- Set need_reload=true in admin table
3- Execture “/var/lib/asterisk/bin/module_admin reload” by system()
Above steps don’t work. I see all values inserted but when I dial it’s Service Not Available message that comes up. However, if I press Submit and then press Orange Bar on the Followme module of FreePBX then it works just fine. So, I am missing a step between #2 and #3.

Thanks,

Anything on this guys?

I know that there is more than meets the eyes and you guys (developers) know where I have to poke. So, please help me and I will try to donate a bit to the project as I love FreePBX.

Thanks for all the input.

Have you seen the ARI (Asterisk Recording Interface) that is included with FreePBX? It provides a nice interface to Follow Me.

You can also look at it’s code to see what it is doing.
The URL for direct access http://my.ip.add.ress/recordings

Bruce, I guess that you did not look at all the code in module findmefollow (you must have looked there as you have spotted the mysql table).

In findmefollow/functions.inc.php there is a function defined called findmefollow_add(), in that function you can see that there is more to it that just add an entry in the mysql database.

There are a lot of entries that go into the astdb to be used in the dial plan.

Mikael,

Yes, I did have a look at the file and it’s tons and tons of stuff. I was hoping an easy way for this or if one of you guys would know what else has to be added so that I can code for it. I guess it’s more complicated and I may drop the idea at this point.

Thanks,

Also, I was asking for specific help here because I don’t want to tamper with other modules or break something else. So, going over the findmefollow_add() function, I may actually break something else if I copy it.

Regards,

Bruce,

the point of the ARI was in fact to simplify what a user has access to.

In addition, it also assures that the user can never trigger a reload as that is a really bad idea giving a user access to that.

For that reason, all the setting in the ARI for follow-me do not require a reload to be triggered. They also have the advantage of not requiring a user to ever put a hash (#) at the end of a number if it is external. It figures that out.

You should be able to look at the ARI module to get an idea what can be done without a reload. Some things that currently can’t be done is selecting a ring strategy for example.

I would use that as a template in trying to achieve what you want to do.

And that was my original question to which I got the response that I should do a reload. If ARI can do this without a reload why can’t I do that within my code? So, back to my original post, I would like to do the same thing.

I guess I’d have to look at ARI code to see if they fill the asterisk findmefollow table the same way as I do or if they change the configuration files to achieve this.

-Bruce