Skip to content

Commit

Permalink
Fix for the Issue OpenSIPS#94 Can't get size on shared dialog profile…
Browse files Browse the repository at this point in the history
…s using a module config value to identify the correct name of the profile.
  • Loading branch information
Alconqro committed Jun 30, 2021
1 parent a262076 commit f5d0caa
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
5 changes: 4 additions & 1 deletion config/tools/system/dialog/local.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,7 @@
// what system to talk to for MI functions
$talk_to_this_assoc_id = 1 ;

?>
// Shared Profiles - Add here your shared profiles to be able to get their size on the interface
$shared_profiles = array();

?>
16 changes: 13 additions & 3 deletions web/tools/system/dialog/lib/functions.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,23 @@ function print_profile() {
require ("../../../../config/tools/system/dialog/local.inc.php");
global $config;

if (sizeof($shared_profiles))
for ( $i=0 ; $i<sizeof($shared_profiles) ; $i++) {
$spl = preg_split('/\//', $shared_profiles[$i]);
$shared_profiles[$i] = array("name" => $spl[0], "flag" => "/" . $spl[1]);
}
$mi_connectors=get_proxys_by_assoc_id($talk_to_this_assoc_id);
// get status from the first one only
$message=mi_command("list_all_profiles", NULL, $mi_connectors[0], $errors);

if (!empty($message))
for( $i=0 ; $i<sizeof($message['Profiles']) ; $i++)
$options[]=array("label"=>$message['Profiles'][$i]['name'],"value"=>$message['Profiles'][$i]['name']);
for( $i=0 ; $i<sizeof($message['Profiles']) ; $i++) {
if (sizeof($shared_profiles))
for ($j = 0; $j < sizeof($shared_profiles); $j++)
if ($shared_profiles[$j]['name'] == $message['Profiles'][$i]['name'])
$message['Profiles'][$i]['flag'] = $shared_profiles[$j]['flag'];
$options[] = array("label" => $message['Profiles'][$i]['name'], "value" => $message['Profiles'][$i]['name'] . $message['Profiles'][$i]['flag']);
}

$start_index = 0;
$end_index = sizeof($options);
Expand All @@ -38,7 +48,7 @@ function print_profile() {
<?php
for ($i=$start_index;$i<$end_index;$i++)
{
echo('<option value="'.$options[$i]['label']. '"> '.$options[$i]['label'].'</option>');
echo('<option value="'.$options[$i]['value']. '"> '.$options[$i]['label'].'</option>');
}
?>
</select>
Expand Down

0 comments on commit f5d0caa

Please sign in to comment.