コード例 #1
0
ファイル: follow.php プロジェクト: jamesrusso/Aastra_Scripts
 require_once 'AastraIPPhoneExecute.class.php';
 $object = new AastraIPPhoneExecute();
 # Update LED + idle screen
 if ($fm == '2') {
     $fm = '0';
 }
 $data = Aastra_get_user_context($user, 'follow');
 $last = $data['last'];
 $key = $data['key'];
 $data['last'] = $fm;
 if ($fm != $last) {
     Aastra_save_user_context($user, 'follow', $data);
     $object->setBeep();
     $object->addEntry($XML_SERVER . '&action=msg&value=' . $fm);
     if ($key != '') {
         if (Aastra_is_ledcontrol_supported()) {
             if ($fm == '0') {
                 $object->AddEntry('Led: ' . $key . '=off');
             } else {
                 $object->AddEntry('Led: ' . $key . '=on');
             }
         }
     }
 }
 # Send a SIP Notification if mode is device and user
 if (!$AA_FREEPBX_USEDEVSTATE and $AA_FREEPBX_MODE == '2') {
     Aastra_propagate_changes_Asterisk($user, Aastra_get_userdevice_Asterisk($user), array('follow'));
 }
 # Back to the display
 if ($action == 'change_status') {
     $object->addEntry($XML_SERVER);
コード例 #2
0
ファイル: dnd.php プロジェクト: jamesrusso/Aastra_Scripts
        }
        # Update needed?
        if ($action == 'check' and $dnd == $last) {
            $update = 0;
        }
        if ($action == 'register' and $dnd == 0) {
            $update = 0;
        }
        # Prepare display update
        require_once 'AastraIPPhoneExecute.class.php';
        $object = new AastraIPPhoneExecute();
        if ($update == 1) {
            # Change msg status
            $object->addEntry($XML_SERVER . '&action=msg&status=' . $dnd);
            # Change LED if supported
            if ($key != '' and Aastra_is_ledcontrol_supported()) {
                if ($dnd == 1) {
                    $object->addEntry('Led: ' . $key . '=on');
                } else {
                    $object->addEntry('Led: ' . $key . '=off');
                }
            }
        } else {
            # Do nothing
            $object->addEntry('');
        }
        break;
}
# Display object
$object->output();
exit;
コード例 #3
0
ファイル: key.php プロジェクト: jamesrusso/Aastra_Scripts
function update_special_keys($user, $array_config)
{
    # Return array
    $return = array();
    # All the functions
    $list = array('cfwd', 'dnd', 'daynight', 'away', 'agent', 'follow', 'parking');
    # Get current data
    foreach ($list as $value) {
        $array1[$value] = Aastra_get_user_context($user, $value);
    }
    $count = !Aastra_is_ledcontrol_supported();
    # Remove vmail
    Aastra_remove_vmail_Asterisk('', $user, $count);
    # Some data
    if ($array_config != NULL) {
        foreach ($array_config as $key => $value) {
            if (strstr($value, 'dnd.php')) {
                $pieces = explode(' ', $key);
                if (stristr($pieces[0], 'expmod')) {
                    $array2['dnd']['key'] = $pieces[0] . ' ' . $pieces[1];
                } else {
                    $array2['dnd']['key'] = $pieces[0];
                }
            }
            if (strstr($value, 'cfwd.php')) {
                $pieces = explode(' ', $key);
                if (stristr($pieces[0], 'expmod')) {
                    $array2['cfwd']['key'] = $pieces[0] . ' ' . $pieces[1];
                } else {
                    $array2['cfwd']['key'] = $pieces[0];
                }
            }
            if (strstr($value, 'daynight.php')) {
                $pieces = explode(' ', $key);
                if (stristr($pieces[0], 'expmod')) {
                    $key = $pieces[0] . ' ' . $pieces[1];
                } else {
                    $key = $pieces[0];
                }
                $url = parse_url($value);
                parse_str($url['query'], $parse);
                if ($parse['index'] != '') {
                    $array2['daynight']['key'][$parse['index']] = $key;
                } else {
                    $array2['daynight']['key']['ALL'] = $key;
                }
            }
            if (strstr($value, 'away.php')) {
                $pieces = explode(' ', $key);
                if (stristr($pieces[0], 'expmod')) {
                    $array2['away']['key'] = $pieces[0] . ' ' . $pieces[1];
                } else {
                    $array2['away']['key'] = $pieces[0];
                }
            }
            if (strstr($value, 'agent.php')) {
                $pieces = explode(' ', $key);
                if (stristr($pieces[0], 'expmod')) {
                    $array2['agent']['key'] = $pieces[0] . ' ' . $pieces[1];
                } else {
                    $array2['agent']['key'] = $pieces[0];
                }
            }
            if (strstr($value, 'follow.php')) {
                $pieces = explode(' ', $key);
                if (stristr($pieces[0], 'expmod')) {
                    $array2['follow']['key'] = $pieces[0] . ' ' . $pieces[1];
                } else {
                    $array2['follow']['key'] = $pieces[0];
                }
            }
            if (strstr($value, 'park.php')) {
                $pieces = explode(' ', $key);
                if (stristr($pieces[0], 'expmod')) {
                    $array2['parking']['key'] = $pieces[0] . ' ' . $pieces[1];
                }
                $array2['parking']['key'] = $pieces[0];
            }
            if (strstr($value, 'vmail.php')) {
                $url = parse_url($value);
                parse_str($url['query'], $parse);
                if ($parse['user'] != '') {
                    Aastra_add_vmail_Asterisk($parse['user'], $user, $count);
                    $pieces = explode(' ', $key);
                    if (stristr($pieces[0], 'expmod')) {
                        $vmail[$parse['user']]['key'] = $pieces[0] . ' ' . $pieces[1];
                        $vmail[$parse['user']]['label'] = $array_config[$pieces[0] . ' ' . $pieces[1] . ' label'];
                    } else {
                        $vmail[$parse['user']]['key'] = $pieces[0];
                        $vmail[$parse['user']]['label'] = $array_config[$pieces[0] . ' label'];
                    }
                }
            }
        }
    }
    # Compare before and after
    $notify = Aastra_get_user_context($user, 'notify');
    foreach ($list as $value) {
        if ($value != 'daynight') {
            if ($array1[$value]['key'] != $array2[$value]['key']) {
                Aastra_save_user_context($user, $value, $array2[$value]);
                $notify[$value] = '1';
                if ($value == 'parking') {
                    Aastra_remove_parking_Asterisk($user);
                    if ($array2[$value]['key'] != '') {
                        Aastra_add_parking_Asterisk($user);
                    }
                } else {
                    $return[] = $value;
                }
            }
        } else {
            $list2 = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'ALL');
            $diff = False;
            foreach ($list2 as $value2) {
                if ($array1[$value]['key'][$value2] != $array2[$value]['key'][$value2]) {
                    $diff = True;
                    break;
                }
            }
            if ($diff) {
                Aastra_save_user_context($user, $value, $array2[$value]);
                $notify[$value] = '1';
                $return[] = $value;
            }
        }
    }
    # Update vmail anyways
    Aastra_save_user_context($user, 'vmail', $vmail);
    # Prepare notification
    $notify['vmail'] = '1';
    Aastra_save_user_context($user, 'notify', $notify);
    # Return changes
    return $return;
}
コード例 #4
0
ファイル: agent.php プロジェクト: jamesrusso/Aastra_Scripts
        if ($status != $last) {
            $data['last'] = $status;
            Aastra_save_user_context($agent, 'agent', $data);
        }
        # Update needed?
        if ($action == 'check' and $status == $last) {
            $update = 0;
        }
        if ($action == 'register' and $status == 0) {
            $update = 0;
        }
        # Prepare display update
        require_once 'AastraIPPhoneExecute.class.php';
        $object = new AastraIPPhoneExecute();
        # Update LED if necessary
        if ($key != '' and Aastra_is_ledcontrol_supported() and $update == 1) {
            if ($status == 1) {
                $object->addEntry('Led: ' . $key . '=on');
            } else {
                $object->addEntry('Led: ' . $key . '=off');
            }
        } else {
            # Do nothing
            $object->addEntry('');
        }
        break;
}
# Display XML object
if ($refresh == 1) {
    $object->output();
} else {
コード例 #5
0
ファイル: sync.php プロジェクト: jamesrusso/Aastra_Scripts
function init_special_keys($user, $array_config = NULL)
{
    # Mode
    if ($array_config == NULL) {
        # Get MAC address and type of phone
        $header = Aastra_decode_HTTP_header();
        # Read config file
        $array_temp = Aastra_readCFGfile(AASTRA_TFTP_DIRECTORY . '/' . $header['mac'] . '.cfg', '#', ':');
        $array_config = $array_temp[''];
    }
    # Global parameters
    $is_sip_notify_supported = Aastra_is_sip_notify_supported();
    # Remove the special keys
    $cfwd['key'] = '';
    $dnd['key'] = '';
    $daynight['key'] = array();
    $away['key'] = '';
    $agent['key'] = '';
    $follow['key'] = '';
    $parking['key'] = '';
    $vmail = array();
    Aastra_remove_parking_Asterisk($user);
    $count = !Aastra_is_ledcontrol_supported();
    Aastra_remove_vmail_Asterisk('', $user, $count);
    # Some data
    if ($array_config != NULL) {
        foreach ($array_config as $key => $value) {
            if (strstr($value, 'dnd.php')) {
                $pieces = explode(' ', $key);
                if (stristr($pieces[0], 'expmod')) {
                    $dnd['key'] = $pieces[0] . ' ' . $pieces[1];
                } else {
                    $dnd['key'] = $pieces[0];
                }
            }
            if (strstr($value, 'cfwd.php')) {
                $pieces = explode(' ', $key);
                if (stristr($pieces[0], 'expmod')) {
                    $cfwd['key'] = $pieces[0] . ' ' . $pieces[1];
                } else {
                    $cfwd['key'] = $pieces[0];
                }
            }
            if (strstr($value, 'daynight.php')) {
                $pieces = explode(' ', $key);
                if (stristr($pieces[0], 'expmod')) {
                    $key = $pieces[0] . ' ' . $pieces[1];
                } else {
                    $key = $pieces[0];
                }
                $url = parse_url($value);
                parse_str($url['query'], $parse);
                if (isset($parse['index'])) {
                    if ($parse['index'] != '') {
                        $daynight['key'][$parse['index']] = $key;
                    } else {
                        $daynight['key']['ALL'] = $key;
                    }
                } else {
                    $daynight['key']['ALL'] = $key;
                }
            }
            if (strstr($value, 'away.php')) {
                $pieces = explode(' ', $key);
                if (stristr($pieces[0], 'expmod')) {
                    $away['key'] = $pieces[0] . ' ' . $pieces[1];
                } else {
                    $away['key'] = $pieces[0];
                }
            }
            if (strstr($value, 'agent.php')) {
                $pieces = explode(' ', $key);
                if (stristr($pieces[0], 'expmod')) {
                    $agent['key'] = $pieces[0] . ' ' . $pieces[1];
                } else {
                    $agent['key'] = $pieces[0];
                }
            }
            if (strstr($value, 'follow.php')) {
                $pieces = explode(' ', $key);
                if (stristr($pieces[0], 'expmod')) {
                    $follow['key'] = $pieces[0] . ' ' . $pieces[1];
                } else {
                    $follow['key'] = $pieces[0];
                }
            }
            if (strstr($value, 'park.php') and $is_sip_notify_supported) {
                $pieces = explode(' ', $key);
                if (stristr($pieces[0], 'expmod')) {
                    $parking['key'] = $pieces[0] . ' ' . $pieces[1];
                } else {
                    $parking['key'] = $pieces[0];
                }
                Aastra_add_parking_Asterisk($user);
            }
            if (strstr($value, 'vmail.php') and $is_sip_notify_supported) {
                $url = parse_url($value);
                parse_str($url['query'], $parse);
                if ($parse['user'] != '') {
                    Aastra_add_vmail_Asterisk($parse['user'], $user, $count);
                    $pieces = explode(' ', $key);
                    if (stristr($pieces[0], 'expmod')) {
                        $vmail[$parse['user']]['key'] = $pieces[0] . ' ' . $pieces[1];
                        if (isset($array_config[$pieces[0] . ' ' . $pieces[1] . ' label'])) {
                            $vmail[$parse['user']]['label'] = $array_config[$pieces[0] . ' ' . $pieces[1] . ' label'];
                        } else {
                            $vmail[$parse['user']]['label'] = '';
                        }
                    } else {
                        if (stristr($pieces[0], 'key')) {
                            $vmail[$parse['user']]['key'] = $pieces[0];
                            if (isset($array_config[$pieces[0] . ' label'])) {
                                $vmail[$parse['user']]['label'] = $array_config[$pieces[0] . ' label'];
                            } else {
                                $vmail[$parse['user']]['label'] = '';
                            }
                        }
                    }
                }
            }
        }
    }
    # Cache them for the device not the user
    Aastra_save_user_context($user, 'cfwd', $cfwd);
    Aastra_save_user_context($user, 'dnd', $dnd);
    Aastra_save_user_context($user, 'daynight', $daynight);
    Aastra_save_user_context($user, 'away', $away);
    Aastra_save_user_context($user, 'agent', $agent);
    Aastra_save_user_context($user, 'follow', $follow);
    Aastra_save_user_context($user, 'parking', $parking);
    Aastra_save_user_context($user, 'vmail', $vmail);
}