I am looking for the implementation of the drop down that several modules use for selecting destinations. The label reference is “goto0” – I see it used in several modules but I have not found where it is implemented. I need to see how it prepares the list of potential destinations to implement something similar for fwconsole commands in the allowlist module.
Any pointers?
Thanks!
billsimon
(Bill Simon)
March 3, 2021, 3:15am
2
Take a look at libraries/BMO/Destinations.class.php.
Try this little PHP script on the command line to see a structured list.
<?php
$bootstrap_settings['freepbx_auth'] = false;
require_once '/etc/freepbx.conf';
print_r(FreePBX::Destinations()->getAllDestinations());
?>
2 Likes
jfinstrom
(James Finstrom)
March 3, 2021, 5:10pm
3
<div class="element-container">
<div class="row">
<div class="col-md-12">
<div class="row">
<div class="form-group">
<div class="col-md-3">
<label class="control-label" for="goto0"><?php echo _("Destination after Playback") ?></label>
<i class="fa fa-question-circle fpbx-help-icon" data-for="goto0"></i>
</div>
<div class="col-md-9">
<?php echo drawselects($post_dest,0); ?>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<span id="goto0-help" class="help-block fpbx-help-block"><?php echo _("Where to send the caller after the announcement is played.")?></span>
</div>
</div>
<?php echo drawselects($post_dest,0); ?>
2nd arg is the goto number Above goto0 below goto1
<?php echo drawselects($post_dest,1); ?>
form processing…
$description = isset($request['description']) ? $request['description'] : '';
$recording_id = isset($request['recording_id']) ? $request['recording_id'] : '';
$allow_skip = isset($request['allow_skip']) ? $request['allow_skip'] : 0;
$return_ivr = isset($request['return_ivr']) ? $request['return_ivr'] : 0;
$noanswer = isset($request['noanswer']) ? $request['noanswer'] : 0;
$post_dest = isset($request['post_dest']) ? $request['post_dest'] : '';
$repeat_msg = isset($request['repeat_msg']) ? $request['repeat_msg'] : '';
if (isset($request['goto0']) && $request['goto0']) {
// 'ringgroup_post_dest' 'ivr_post_dest' or whatever
$post_dest = $request[ $request['goto0'].'0' ];
}
switch ($action) {
case 'add':
$_REQUEST['extdisplay'] = announcement_add($description, $recording_id, $allow_skip, $post_dest, $return_ivr, $noanswer, $repeat_msg);
needreload();
break;
case 'edit':
announcement_edit($announcement_id, $description, $recording_id, $allow_skip, $post_dest, $return_ivr, $noanswer, $repeat_msg);
Yeah I saw that, but I’m trying to find the code that actually gathers up the list and package the information for display. My aim is to replicate it for a console command to select a destination.
Perfect, thanks! I’ve got some reading to do. That first comment line is a classic, and quite apropos.
Bill, James,
Thank you both for your notes – that put me on the right track.
Mitch
system
(system)
Closed
June 3, 2021, 11:09pm
8
This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.