Esempio n. 1
0
 function mb_str_pad($str, $len, $padstr = ' ', $padtype = STR_PAD_RIGHT, $enc = '')
 {
     if (!function_exists('mb_strlen')) {
         return str_pad($str, $len, $padstr, $padtype);
     }
     if ($enc === '') {
         $enc = mb_internal_encoding();
     }
     $strlen = mb_strLen($str, $enc);
     $flen = $len - $strlen;
     if ($flen <= 0) {
         return $str;
     }
     $pad = str_repeat($padstr, $flen);
     switch ($padtype) {
         case STR_PAD_RIGHT:
             $pad = mb_subStr($pad, 0, $flen, $enc);
             return $str . $pad;
         case STR_PAD_LEFT:
             $pad = mb_subStr($pad, 0, $flen, $enc);
             return $pad . $str;
         case STR_PAD_BOTH:
             $flenh = $flen / 2;
             $padl = mb_subStr($pad, 0, floor($flenh), $enc);
             $padr = mb_subStr($pad, 0, ceil($flenh), $enc);
             return $padl . $str . $padr;
         default:
             trigger_error('mb_str_pad(): Padding type has to be STR_PAD_LEFT, STR_PAD_RIGHT, or STR_PAD_BOTH.', E_USER_WARNING);
             return null;
     }
 }
Esempio n. 2
0
function gs_user_comment_set($user, $comment = '')
{
    if (!preg_match('/^[a-z0-9\\-_.]+$/', $user)) {
        return new GsError('User must be alphanumeric.');
    }
    $comment = mb_subStr($comment, 0, 200);
    # connect to db
    #
    $db = gs_db_master_connect();
    if (!$db) {
        return new GsError('Could not connect to database.');
    }
    # get user_id
    #
    $user_id = $db->executeGetOne('SELECT `id` FROM `users` WHERE `user`=\'' . $db->escape($user) . '\'');
    if (!$user_id) {
        return new GsError('Unknown user.');
    }
    # set comment
    #
    $ok = $db->execute('UPDATE `users` SET `user_comment`=\'' . $db->escape($comment) . '\' WHERE `id`=' . $user_id);
    if (!$ok) {
        return new GsError('Failed to set comment.');
    }
    return true;
}
Esempio n. 3
0
 /**
  * @return string
  * @param string $string
  */
 public static function parse($string)
 {
     $toParse = mb_subStr($string, 2, -2, 'UTF-8');
     $toParse = trim($toParse);
     $toParse = preg_replace('/^\\s*\\*[^@]/m', '', $toParse);
     $parts = preg_split('/(@(?:description|param))\\s*/', $toParse, null, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
     $count = count($parts);
     $result = array();
     for ($i = 0; $i < $count; ++$i) {
         $tag = strToLower(subStr($parts[$i], 1));
         if ($i + 1 >= $count) {
             continue;
         }
         if ('@' != $parts[$i + 1][0]) {
             $function = 'parse' . ucFirst($tag);
             $item = self::$function($parts[$i + 1]);
             $item['name'] = $tag;
             $result[] = $item;
             ++$i;
         }
     }
     return $result;
 }
        echo ' &nbsp;&nbsp; ', __('Anlage'), ':', "\n";
        echo '<select name="boi_host_id" tabindex="100" onchange="this.form.submit();">', "\n";
        $tmp_host_id = null;
        if (!$rs) {
            gs_log(GS_LOG_WARNING, 'Failed to get nodes / foreign hosts');
        } else {
            while ($r = $rs->fetchRow()) {
                if ($tmp_host_id !== null) {
                    continue;
                }
                # do not show foreign host twice for local admins
                echo '<option value="', $r['id'], '"';
                if ($r['id'] === $_SESSION['sudo_user']['boi_host_id']) {
                    echo ' selected="selected"';
                }
                echo '>', htmlEnt(mb_subStr($r['comment'], 0, 20));
                if ($r['id'] === $_SESSION['real_user']['info']['host_id'] || !$_SESSION['real_user']['info']['host_is_foreign'] && $r['id'] === 0) {
                    echo ' &bull;';
                    $tmp_host_id = $r['id'];
                }
                echo '</option>', "\n";
            }
        }
        unset($tmp_host_id);
        echo '</select>', "\n";
        echo '</div>', "\n";
    }
    echo '</form>', "\n";
}
?>
<br style="float:none; clear:right;" />
Esempio n. 5
0
# g723.1
setting('codec_size', $i, '20');
# 20 ms, valid values: 20, 30, 40, 60
# G.723.1 needs 30 or 60 ms. All other codecs work with 20, 40 and 60 ms only.
setting('user_host', $i, $host);
setting('user_outbound', $i, $sip_proxy_and_sbc['sip_proxy_from_wan']);
setting('user_proxy_require', $i, '');
setting('user_shared_line', $i, 'off');
setting('user_name', $i, $user_ext);
setting('user_pname', $i, $user_ext);
setting('user_pass', $i, $user['secret']);
//setting('user_hash'          ,$i, md5($user['secret']));
//setting('user_hash'          ,$i, md5($user_ext .':'. $host .':'. $user['secret']));
//setting('user_hash'          ,$i, md5($user_ext .':'. 'asterisk' .':'. $user['secret']));
setting('user_realname', $i, $user['callerid']);
setting('user_idle_text', $i, $user_ext . ' ' . mb_subStr($user['firstname'], 0, 1) . '. ' . $user['lastname']);
setting('record_missed_calls', $i, 'on');
setting('record_dialed_calls', $i, 'off');
setting('record_received_calls', $i, 'off');
# andere Accounts
#
for ($i = 2; $i <= 12; ++$i) {
    setting('user_active', $i, 'off', null, true);
    setting('allow_mismatched_sdp_answers', $i, 'on');
}
# Account 1 als aktiv setzen
#
psetting('active_line', '1');
#####################################################################
#  Kurzwahlen loeschen
#####################################################################
Esempio n. 6
0
				$softkey['data'] = $prov_url_aastra.'login.php?a=login';
			else
				$softkey['data'] = $prov_url_aastra.'login.php';
			break;
		}
		psetting($key_name.' type' , $softkey['function'], true, $dynamic);
		psetting($key_name.' value', $softkey['data'    ], true, $dynamic);
		psetting($key_name.' label', $softkey['label'   ], true, $dynamic);
	}
}

#####################################################################
#  SIP
#####################################################################

psetting('sip screen name'         , $user_ext .' '. mb_subStr($user['firstname'],0,1) .'. '. $user['lastname'], true, $dynamic);
psetting('sip display name'        , $user['firstname'].' '.$user['lastname'], true, $dynamic);
psetting('sip user name'           , $user_ext, true, $dynamic);
psetting('sip auth name'           , $user_ext, true, $dynamic);
psetting('sip password'            , $user['secret'], true, $dynamic);
psetting('sip registrar ip'        , $host, true, $dynamic);
psetting('sip outbound proxy'      , ($sip_proxy_and_sbc['sip_proxy_from_wan'] != '' ? $sip_proxy_and_sbc['sip_proxy_from_wan'] : $host), true, $dynamic );
psetting('sip proxy ip'            , $host, true, $dynamic);

#####################################################################
#  other settings
#####################################################################

/*
#setting('language', 0, $prov_url_aastra .'lang_en.txt');  # English. Default
setting('language', 1, $prov_url_aastra .'lang/lang_de.txt');
Esempio n. 7
0
psetting('https_port', '443');
psetting('http_client_user', '');
psetting('http_client_password', '');
psetting('http_proxy_user', '');
psetting('http_proxy_password', '');
psetting('emergency_proxy', '');
psetting('emergency_numbers', '');
#####################################################################
# USER settings
#####################################################################
for ($i = 1; $i < 10; ++$i) {
    setting('user_active', $i, 'off');
}
foreach ($users as $i => $user) {
    setting('user_active', $i, 'on');
    setting('user_realname', $i, $user['ext'] . ' ' . mb_subStr($user['firstname'], 0, 1) . '. ' . $user['lastname']);
    setting('user_name', $i, $user['ext']);
    setting('user_host', $i, $user['host']);
    setting('user_outbound', $i, '');
    setting('user_authname', $i, $user['ext']);
    setting('user_pass', $i, $user['secret']);
    setting('user_mailbox', $i, $user['mailbox']);
    setting('user_pbxtype', $i, 'asterisk');
    setting('rtp_encryption', $i, 'off');
    setting('user_country_code', $i, '');
    setting('area_code', $i, '');
    setting('user_expiry', $i, '3600');
    setting('user_sip_info', $i, '0');
    setting('conference_uri', $i, '');
    setting('codec1_name', $i, '8');
    setting('codec2_name', $i, '0');
Esempio n. 8
0
    ?>
><?php 
    echo __('Zentrale');
    ?>
</option>
<?php 
    $rs = $DB->execute('SELECT `id`, `host`, `comment` FROM `hosts` WHERE `is_foreign`=1 ORDER BY `comment`');
    if ($rs->numRows() > 0) {
        echo '<option value="" disabled="disabled">-</option>', "\n";
    }
    while ($r = $rs->fetchRow()) {
        echo '<option value="', $r['id'], '"';
        if ($r['id'] == $pbx_id) {
            echo ' selected="selected"';
        }
        echo '>', htmlEnt(mb_subStr($r['comment'], 0, 20)), ' (', htmlEnt($r['host']), ')', '</option>', "\n";
    }
    ?>
		</select>
	</td>
	<td>
		<select name="phone_type">
			<option value=""><?php 
    echo __('alle');
    ?>
</option>
<?php 
    foreach ($phone_types as $phone_type_name => $phone_type_display) {
        echo '<option value="', $phone_type_name, '"';
        if ($phone_type_name === $phone_type) {
            echo ' selected="selected"';
}
if (in_array($phone_model, array('bt200', 'bt201'), true)) {
    psetting('P270', $user_ext);
    # Account Name ( maxlength 96 )
}
psetting('P47', $host);
# SIP Server
psetting('P48', $sip_proxy_and_sbc['sip_proxy_from_wan']);
# Outbound Proxy
psetting('P35', $user_ext);
# SIP User ID
psetting('P36', $user_ext);
# Authentication ID
psetting('P34', $user['secret']);
# SIP Authentication Password (cleartext)
psetting('P3', $user_ext . ' ' . mb_subStr($user['firstname'], 0, 1) . '. ' . $user['lastname']);
# Display (CallerID) Name
psetting('P103', '0');
# Use DNS SRV ( 0 = no, 1 = yes )
psetting('P63', '1');
# UserID is phone number ( 0 = no, 1 = yes )
psetting('P31', '1');
# SIP Registration ( 0 = no register, 1 = register )
psetting('P81', '1');
# Unregister on Reboot ( 0 = no, 1 = yes )
if (in_array($phone_model, array('ht287', 'bt110'), true)) {
    psetting('P239', '300');
    # Register Expiration (in seconds | default 3600)
}
if (in_array($phone_model, array('bt200', 'bt201', 'gxp280', 'gxp1200', 'gxp2000', 'gxp2010', 'gxp2020', 'gxv3000', 'gxv3005', 'gxv3140'), true)) {
    psetting('P32', '5');
Esempio n. 10
0
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
\*******************************************************************/
defined('GS_VALID') or die('No direct access.');
include_once GS_DIR . 'inc/util.php';
include_once GS_DIR . 'inc/gs-fns/gs_callforward_get.php';
include_once GS_DIR . 'inc/gs-fns/gs_prov_phone_checkcfg.php';
include_once GS_DIR . 'inc/gs-fns/gs_user_comment_get.php';
include_once GS_DIR . 'inc/gs-fns/gs_user_comment_set.php';
$action = array_key_exists('action', $_REQUEST) ? $_REQUEST['action'] : '';
if (!@$_SESSION['sudo_user']['info']['host_is_foreign']) {
    if ($action === 'reboot') {
        gs_prov_phone_checkcfg_by_ext($_SESSION['sudo_user']['info']['ext'], true);
    } elseif ($action === 'setcomment') {
        $comment = rTrim(mb_subStr(trim(@$_REQUEST['comment']), 0, 200));
        gs_user_comment_set($_SESSION['sudo_user']['name'], $comment);
    }
}
echo '<h2>';
if (@$MODULES[$SECTION]['icon']) {
    echo '<img alt=" " src="', GS_URL_PATH, str_replace('%s', '32', $MODULES[$SECTION]['icon']), '" /> ';
}
if (count($MODULES[$SECTION]['sub']) > 1) {
    echo $MODULES[$SECTION]['title'], ' - ';
}
echo $MODULES[$SECTION]['sub'][$MODULE]['title'];
echo '</h2>', "\n";
//echo '<br />', "\n";
echo '<h2>', __('Willkommen'), ', ', htmlEnt($_SESSION['sudo_user']['info']['firstname'] . ' ' . $_SESSION['sudo_user']['info']['lastname']), '!</h2>', "\n";
if ($_SESSION['sudo_user']['name'] === 'sysadmin') {
Esempio n. 11
0
function gs_boi_get_gui_menu($api, $host, $role, $ext, $session = null)
{
    $old_default_socket_timeout = ini_get('default_socket_timeout');
    ini_set('default_socket_timeout', 8);
    $old_soap_wsdl_cache_ttl = ini_get('soap.wsdl_cache_ttl');
    ini_set('soap.wsdl_cache_ttl', 3600);
    gs_log(GS_LOG_DEBUG, 'BOI SOAP: Getting menu for ' . $role . ', ' . $ext . ' from ' . $host);
    $SoapClient = gs_get_soap_client($api, 'guiintegration', $host);
    if (!$SoapClient) {
        return false;
    }
    try {
        if ($session !== null) {
            $SoapClient->__setCookie('session', $session);
        }
        $ret = $SoapClient->getMenu(gs_boi_gs_role_to_server_role($role), $ext);
        /*
        $ret = $SoapClient->__soapCall( 'getMenu',
        	array( gs_boi_gs_role_to_server_role($role), $ext),
        	null
        	);
        */
        //print_r($ret);
        if ($ret === null || $ret === false) {
            gs_log(GS_LOG_WARNING, 'Got empty SOAP response!');
            return false;
        } else {
            $ret = obj2arr_r($ret);
            if (is_array($ret) && array_key_exists('menu', $ret)) {
                $ret = $ret['menu'];
            }
            //echo "<pre>", print_r($ret, true) ,"</pre>";
            $ret = _fix_broken_soap_array($ret);
            /*
            $ret = array(
            	array('title' => "Anruflisten"     , 'link' => ''     ),
            	array('title' => "gew\xC3\xA4hlt"  , 'link' => '/dl/g'),
            	array('title' => "verpa\xC3\x9Ft"  , 'link' => '/dl/v'),
            	array('title' => "angenommen"      , 'link' => '/dl/a'),
            	
            	array('title' => "Statistik"       , 'link' => ''     ),
            	array('title' => "Queues"          , 'link' => '/s/q' ),
            	array('title' => "Gespr\xC3\xA4che", 'link' => '/s/g' )
            );
            */
            //echo "<pre>", print_r($ret, true) ,"</pre>";
            if (!is_array($ret)) {
                return false;
            }
            $menu = array();
            //$main_menu_cnt = 0;
            //$sub_menu_cnt  = 0;
            foreach ($ret as $entry) {
                if (!is_array($entry)) {
                    continue;
                }
                if (!array_key_exists('title', $entry) || !array_key_exists('link', $entry)) {
                    continue;
                }
                if (trim($entry['link']) == '') {
                    # is a main menu
                    //++$main_menu_cnt;
                    //$menu['boi'.$main_menu_cnt] = array(
                    $key = 'boi-' . mb_subStr(preg_replace('/[^a-z0-9\\-_]/', '', str_replace(array("ä", "ö", "ü", "ß"), array('ae', 'oe', 'ue', 'ss'), str_replace(' ', '-', mb_strToLower(html_entity_decode($entry['title']))))), 0, 20);
                    while (array_key_exists($key, $menu)) {
                        $key .= '-';
                    }
                    $menu[$key] = array('is_boi' => true, 'title' => htmlEnt(html_entity_decode(trim($entry['title']), ENT_QUOTES, 'UTF-8')), 'icon' => 'crystal-svg/%s/act/misc.png', 'sub' => array());
                    # html_entity_decode() is done because the other party already
                    # encodes special characters although it shouldn't. don't remove
                    # the htmlEnt() around it - doing so would make this vulnerable.
                    //$sub_menu_cnt = 0;
                } else {
                    //$main_menu_idx = count($menu)-1;
                    end($menu);
                    $main_menu_idx = key($menu);
                    if (!array_key_exists($main_menu_idx, $menu)) {
                        continue;
                    }
                    //++$sub_menu_cnt;
                    //$menu[$main_menu_idx]['sub']['boi'.$sub_menu_cnt] = 3;
                    $key = mb_subStr(preg_replace('/[^a-z0-9\\-_]/', '', str_replace(array("ä", "ö", "ü", "ß"), array('ae', 'oe', 'ue', 'ss'), str_replace(' ', '-', mb_strToLower(html_entity_decode($entry['title']))))), 0, 20);
                    while (array_key_exists($key, $menu[$main_menu_idx]['sub'])) {
                        $key .= '-';
                    }
                    if (subStr($entry['link'], 0, 1) !== '/') {
                        $entry['link'] = '/' . $entry['link'];
                    }
                    $menu[$main_menu_idx]['sub'][$key] = array('title' => htmlEnt(html_entity_decode(trim($entry['title']), ENT_QUOTES, 'UTF-8')), 'boi_url' => trim($entry['link']));
                    # see comment about html_entity_decode() above
                }
            }
            //echo "<pre>"; print_r($menu); echo "</pre>";
            return $menu;
        }
    } catch (SOAPFault $SoapFault) {
        //print_r($ret);
        gs_log(GS_LOG_WARNING, 'SOAP error: ' . $SoapFault->faultstring . ' (' . @$SoapFault->faultcode . ')');
        return false;
    }
    ini_set('default_socket_timeout', $old_default_socket_timeout);
    ini_set('soap.wsdl_cache_ttl', $old_soap_wsdl_cache_ttl);
}
Esempio n. 12
0
function gs_utf8_decompose_first_to_ascii($str)
{
    return gs_utf8_decompose_to_ascii(mb_subStr($str, 0, 1)) . mb_subStr($str, 1);
}
Esempio n. 13
0
	$rs_hosts = $DB->execute(
		'SELECT `id`, `host`, `comment` '.
		'FROM `hosts` '.
		'WHERE `is_foreign`=1 AND `id` NOT IN ( '.
			'SELECT `host_id` '.
			'FROM `boi_perms` '.
			'WHERE `user_id`='.(int)$r['uid'].' AND `roles`<>\'\' '.
		') '.
		'ORDER BY `comment`'
		);
	echo '<optgroup label="', __('Fremd-Hosts') ,'">',"\n";
	while ($h = $rs_hosts->fetchRow()) {
		echo '<option value="',$h['id'],'">';
		$comment = mb_subStr($h['comment'], 0, 25+1);
		if (mb_strLen($comment) > 25)
			$comment = mb_subStr($h['comment'], 0, 25-1) ."\xE2\x80\xA6";
		elseif (trim($comment) === '') $comment = '#'.$h['id'];
		echo htmlEnt($comment) ,' -- ', htmlEnt($h['host']);
		if ($h['id'] == $r['hid']) echo ' (&bull;)';
		echo '</option>',"\n";
	}
	echo '</optgroup>',"\n";
	echo '</select>' ,"\n";
	echo '</td>' ,"\n";
	
	echo "<td>\n";
	//echo '[save]';
	echo "</td>\n";
	
	echo "</tr>\n";
?>
Esempio n. 14
0
 # ???
 _set_cfg('reg-number', null, $user_ext);
 # ???
 _set_cfg('fully-qualified-phone-no', null, $user_ext);
 # ???
 _set_cfg('sip-pwd', null, $user['secret']);
 _set_cfg('sip-name', null, _siemens_xml_esc(mb_subStr(rTrim(preg_replace('/<[^>]*>/', '', $user['callerid'])), 0, 24)));
 _set_cfg('register-by-name', null, 'false');
 $tmp = $user_ext . ' ';
 if ($user['firstname'] != '') {
     $tmp .= mb_subStr($user['firstname'], 0, 1);
 }
 if ($user['lastname'] != '') {
     $tmp .= mb_subStr($user['lastname'], 0, 3);
 }
 $tmp = _siemens_xml_esc(mb_subStr(rTrim($tmp), 0, 24));
 _set_cfg('display-id', null, _siemens_xml_esc($tmp));
 # max. 24 chars
 _set_cfg('display-id-unicode', null, _siemens_xml_esc($tmp));
 #  "
 _set_cfg('use-display-id', null, 'true');
 _set_cfg('reg-addr', null, $host);
 _set_cfg('reg-port', null, '5060');
 _set_cfg('registrar-addr', null, $host);
 _set_cfg('registrar-port', null, '5060');
 _set_cfg('outbound-proxy', null, $sip_proxy_and_sbc['sip_proxy_from_wan'] != '' ? 'true' : 'false');
 _set_cfg('outbound-proxy-user', null, $sip_proxy_and_sbc['sip_proxy_from_wan'] != '' ? 'true' : 'false');
 _set_cfg('sgnl-gateway-addr', null, $sip_proxy_and_sbc['sip_proxy_from_wan'] != '' ? $sip_proxy_and_sbc['sip_proxy_from_wan'] : $host);
 _set_cfg('sgnl-gateway-addr-user', null, $sip_proxy_and_sbc['sip_proxy_from_wan'] != '' ? $sip_proxy_and_sbc['sip_proxy_from_wan'] : $host);
 _set_cfg('sgnl-gateway-port', null, '5060');
 _set_cfg('sgnl-gateway-port-user', null, '5060');
Esempio n. 15
0
    exec('locale -a | grep -i ' . qsa('^' . $lang . '_') . ' 2>>/dev/null', $out, $err);
    if ($err != 0) {
        gs_log(GS_LOG_NOTICE, 'Failed to find locales on your system');
    } else {
        $lfound = setLocale(LC_TIME, $out);
        if ($lfound === false) {
            gs_log(GS_LOG_NOTICE, 'Your system does not have any locales like "' . $lang . '_*"');
        } else {
            gs_log(GS_LOG_NOTICE, 'Using locale "' . $lfound . '" as a fallback');
        }
    }
}
$wdays = array('mo' => 'Mon', 'tu' => 'Tue', 'we' => 'Wed', 'th' => 'Thu', 'fr' => 'Fri', 'sa' => 'Sat', 'su' => 'Sun');
$wdaysl = array();
foreach ($wdays as $col => $wdca) {
    $wdaysl[$col] = mb_subStr(strFTime('%a', strToTime('last ' . $wdca)), 0, 1);
}
unset($wdays);
setLocale(LC_TIME, array($oldLocale, 'C'));
$i = 0;
$rs = $DB->execute('SELECT * from `queue_cf_timerules` WHERE `_queue_id`=' . $queue_id . ' ORDER BY `ord`');
while ($route = $rs->fetchRow()) {
    echo '<input type="hidden" name="tr_' . $route['id'] . '" value="' . $route['id'] . '" />';
    echo '<tr><td>';
    echo $route['ord'];
    echo '</td><td>';
    foreach ($wdaysl as $col => $v) {
        echo '<span class="nobr"><input type="checkbox" name="' . $route['id'] . '-d_', $col, '" id="ipt-' . $route['id'] . '-r_d_', $col, '" value="1" ', $route['d_' . $col] ? 'checked="checked" ' : '', '/>';
        echo '<label for="ipt-r_d_', $col, '">', $v, '</label></span>';
    }
    echo '</td>', "\n";
Esempio n. 16
0
#####################################################################
# private call
#####################################################################
if (!isset($_REQUEST['prv'])) {
    $prv = false;
} else {
    $prv = strToLower(trim($_REQUEST['prv']));
    $prv = $prv > 0 || $prv === 'yes' || $prv === 'true';
}
$prvPrefix = $prv ? '*7*' : '';
#####################################################################
# init call
#####################################################################
gs_log(GS_LOG_DEBUG, "Init call - user: {$user_code}, from: " . ($from_num ? $from_num : 'default (' . $from_num_effective . ')') . ", to: {$to_num}, clir: " . ($clir ? 'yes' : 'no'));
if (!$clir) {
    $firstname_abbr = mb_subStr($user['firstname'], 0, 1);
    $firstname_abbr = $firstname_abbr != '' ? $firstname_abbr . '. ' : '';
    if (!$cidnum) {
        $callerid = $firstname_abbr . $user['lastname'] . ' <' . $from_num_effective . '>';
    } else {
        $callerid = $firstname_abbr . $user['lastname'] . ' <' . ($cidnum ? $cidnum : $from_num_effective) . '>';
    }
} else {
    $callerid = 'Anonymous <anonymous>';
}
if (!$is_foreign) {
    //FIXME? - is this code correct for numbers in the same area?
    $to_num = subStr($to_num_obj->dial, 0, 1) === '0' ? '0' . $to_num_obj->dial : $to_num_obj->dial;
    $from_num_dial = subStr($from_num_effective_obj->dial, 0, 1) === '0' ? '0' . $from_num_effective_obj->dial : $from_num_effective_obj->dial;
    $call = "Channel: Local/urldial-" . $from_num_dial . "@to-internal-users-self\n" . "MaxRetries: 0\n" . "WaitTime: 15\n" . "Context: urldial\n" . "Extension: {$prvPrefix}{$to_num}\n" . "Callerid: Rufaufbau <call>\n" . "Setvar: __user_id=" . $user['id'] . "\n" . "Setvar: __user_name=" . $user['ext'] . "\n" . "Setvar: CHANNEL(language)=" . gs_get_conf('GS_INTL_ASTERISK_LANG', 'de') . "\n" . "Setvar: __is_callfile_origin=1\n" . "Setvar: __saved_callerid=" . $callerid . "\n" . "Setvar: __callfile_from_user="******"\n";
    //echo $call;
Esempio n. 17
0
    psetting('SRV_' . $i . '_SIP_URI_DOMAIN_CONFIG', 0);
    psetting('SRV_' . $i . '_DTMF_SIGNALLING', 2);
    #####################################################################
    # SIP Registration
    #####################################################################
    psetting('SUBSCR_' . $i . '_SIP_UA_DATA_SIP_NAME', '"' . $user['ext'] . '"');
    psetting('SUBSCR_' . $i . '_SIP_UA_DATA_SIP_NAME_ALIAS', '"' . $user['ext'] . '"');
    psetting('SUBSCR_' . $i . '_UA_DATA_AUTH_NAME', '"' . $user['ext'] . '"');
    psetting('SUBSCR_' . $i . '_UA_DATA_AUTH_PASS', '"' . $user['secret'] . '"');
    psetting('SUBSCR_' . $i . '_SIP_UA_DATA_VOICE_MAILBOX_NUMBER', '"' . $user['mailbox'] . '"');
    psetting('SUBSCR_' . $i . '_SIP_UA_DATA_VOICE_MAILBOX_NAME', '""');
    psetting('SUBSCR_' . $i . '_UA_DATA_DISP_NAME', '"' . $user['ext'] . '"');
    #####################################################################
    # Handset name
    #####################################################################
    psetting('HANDSET_' . ($i + 1) . '_NAME', '"' . $user['ext'] . ' ' . mb_subStr($user['firstname'], 0, 1) . '. ' . $user['lastname'] . '"');
}
for ($i = 1; $i < 9; ++$i) {
    #####################################################################
    # Handset settings
    #####################################################################
    psetting('HANDSET_' . $i . '_CW', 0);
    psetting('HANDSET_' . $i . '_DND', 0);
    #####################################################################
    # Handset to line mapping
    #####################################################################
    psetting('USER_VOIP_LINE_PP' . $i, $i);
    psetting('CALL_GROUPS' . $i, pow(2, $i) + 1);
    #####################################################################
    # Feature codes
    #####################################################################
Esempio n. 18
0
#  /yealink/config/WebItemsLevel.cfg
#####################################################################
# 0 = item is visible in all access level (user, var, admin)
# 1 = item is visible in admin and var level
# 2 = item is only visible in admin level
psetting('Phone|path', '/yealink/config/WebItemsLevel.cfg');
psetting('Phone|features', '2');
psetting('Phone|SMS', '2');
#####################################################################
# /yealink/config/voip/sipAccount0.cfg
#####################################################################
# account
psetting('account|path', '/yealink/config/voip/sipAccount0.cfg');
psetting('account|Enable', '1');
# 0 = disable, 1 = enable
psetting('account|Label', $user_ext . ' ' . mb_subStr($user['firstname'], 0, 1) . '. ' . $user['lastname']);
psetting('account|DisplayName', $user['callerid']);
psetting('account|UserName', $user_ext);
psetting('account|AuthName', $user_ext);
psetting('account|Password', $user['secret']);
psetting('account|SIPServerHost', $host);
psetting('account|SIPServerPort', '5060');
psetting('account|UseOutboundProxy', '0');
# 0 = disable, 1 = enable
psetting('account|OutboundHost', '');
psetting('account|OutboundPort', '5061');
psetting('account|Transport', '0');
# 0 = UDP, 1 = TCP, 2 = TLS
psetting('account|BakOutboundHost', '');
psetting('account|BakOutboundPort', '5062');
psetting('account|proxy-require', '');
Esempio n. 19
0
File: mon.php Progetto: rkania/GS3
        if ($new_first_digit != $first_digit) {
            if ($first_digit !== null) {
                echo '<br class="nofloat" />', "\n";
                echo '</div>', "\n";
                echo '<div class="extensions-block">', "\n";
            }
            $first_digit = $new_first_digit;
            //echo '<div class="first-digit">', $first_digit ,'</div>' ,"\n";
        }
        echo '<div class="e e_ukn" id="e', $ext, '">';
        echo '<span class="num">', $ext, '</span>';
        //echo '<span class="nam">', $ext_info['abbr'] ,'</span>';
        $ext_info['ln'] = $ext_info['ln'];
        $abbr = mb_strCut($ext_info['ln'], 0, 18 - strLen($ext) * 2.8);
        if (mb_strLen($abbr) < 9 && trim($ext_info['fn']) != '') {
            $abbr = mb_subStr($ext_info['fn'], 0, 1) . '. ' . $abbr;
        }
        if (mb_strLen($ext_info['ln']) > mb_strLen($abbr)) {
            $abbr = mb_strCut($abbr, 0, -1) . '.';
        }
        echo '<span class="nam">', htmlEnt($abbr), '</span>';
        echo '<span class="link" id="e', $ext, 'l"></span>';
        echo '</div>', "\n";
    }
    echo '<br class="nofloat" />', "\n";
    echo '</div>', "\n";
}
?>


Esempio n. 20
0
 function retrieve_keys($phone_type, $variables = array())
 {
     if ($this->_user_id > 0) {
         $this->_keys = gs_keys_get_by_user($this->_user_name, $phone_type);
     } else {
         $this->_keys = gs_keys_get_by_profile($this->_profile_id, $phone_type);
     }
     if (isGsError($this->_keys) || !is_array($this->_keys)) {
         gs_log(GS_LOG_NOTICE, isGsError($this->_keys) ? $this->_keys->getMsg() : 'Failed to get softkeys');
         $this->_keys = null;
         return false;
     }
     if (is_array($variables) && count($variables) > 0) {
         $search = array_keys($variables);
         $replace = array_values($variables);
         unset($variables);
         foreach ($this->_keys as $key_name => $key_defs) {
             foreach ($key_defs as $inh_slf => $key_def) {
                 if ($this->_keys[$key_name][$inh_slf]['data'] != '') {
                     $this->_keys[$key_name][$inh_slf]['data'] = str_replace($search, $replace, $key_def['data']);
                 }
             }
         }
     }
     # key "fkey0"/"P1" should be set to "line"
     #
     $this->_keys['f000']['slf'] = array('key' => 'f000', 'function' => 'line', 'data' => '', 'label' => 'Line', 'user_writeable' => 0, '_set_by' => 'p', '_setter' => null);
     # get the pickup groups
     #
     $pgroups = array();
     $rs = $this->_db->execute('SELECT DISTINCT(`p`.`id`) `id`, `p`.`title` ' . 'FROM ' . '`pickupgroups_users` `pu` JOIN ' . '`pickupgroups` `p` ON (`p`.`id`=`pu`.`group_id`) ' . 'WHERE `pu`.`user_id`=' . (int) $this->_user_id . ' ' . 'ORDER BY `p`.`id` ' . 'LIMIT 10');
     while ($r = $rs->fetchRow()) {
         $pgroups[$r['id']] = $r['title'];
     }
     # fix some key definitions
     #
     foreach ($this->_keys as $key_name => $key_defs) {
         foreach ($key_defs as $inh_slf => $key_def) {
             # make sure the user does not set keys for pickup groups
             # which he/she does not belong to
             #
             if (in_array($key_def['function'], array('dest', 'blf'), true) && subStr($key_def['data'], 0, 2) === '*8') {
                 if (preg_match('/(?:^|[:])\\*8\\*([0-9]+)/S', $key_def['data'], $m)) {
                     $pgrpid = (int) lTrim($m[1], '0');
                 } else {
                     $pgrpid = 0;
                 }
                 if ($pgrpid > 0) {
                     if (!array_key_exists($pgrpid, $pgroups)) {
                         $pgrpid = 0;
                     }
                 }
                 if ($pgrpid < 1) {
                     unset($this->_keys[$key_name][$inh_slf]);
                 } else {
                     $this->_keys[$key_name][$inh_slf]['data'] = '*8*' . str_pad($pgrpid, 5, '0', STR_PAD_LEFT);
                     $title = mb_subStr(trim($pgroups[$pgrpid]), 0, 20);
                     $this->_keys[$key_name][$inh_slf]['label'] = 'Grp. ' . ($title != '' ? $title : $pgrpid);
                     unset($pgroups[$pgrpid]);
                 }
             }
         }
     }
     # find free keys for the remaining pickup groups (if any)
     #
     //FIXME ?
     return true;
 }
     echo "</td>\n";
     echo "</tr>\n";
     ++$i;
 }
 echo '<tr class="', $i % 2 === 0 ? 'odd' : 'even', '">', "\n";
 echo "<td>&nbsp;</td>\n";
 echo '<td colspan="2">', "\n";
 echo '<select name="bp_add_h">', "\n";
 echo '<option value="">', __('hinzuf&uuml;gen ...'), '</option>', "\n";
 $rs_hosts = $DB->execute('SELECT `id`, `host`, `comment` ' . 'FROM `hosts` ' . 'WHERE `is_foreign`=1 AND `id` NOT IN ( ' . 'SELECT `host_id` ' . 'FROM `boi_perms` ' . 'WHERE `user_id`=' . (int) $r['uid'] . ' AND `roles`<>\'\' ' . ') ' . 'ORDER BY `comment`');
 echo '<optgroup label="', __('Fremd-Hosts'), '">', "\n";
 while ($h = $rs_hosts->fetchRow()) {
     echo '<option value="', $h['id'], '">';
     $comment = mb_subStr($h['comment'], 0, 25 + 1);
     if (mb_strLen($comment) > 25) {
         $comment = mb_subStr($h['comment'], 0, 25 - 1) . "…";
     } elseif (trim($comment) === '') {
         $comment = '#' . $h['id'];
     }
     echo htmlEnt($comment), ' -- ', htmlEnt($h['host']);
     if ($h['id'] == $r['hid']) {
         echo ' (&bull;)';
     }
     echo '</option>', "\n";
 }
 echo '</optgroup>', "\n";
 echo '</select>', "\n";
 echo '</td>', "\n";
 echo "<td>\n";
 //echo '[save]';
 echo "</td>\n";
Esempio n. 22
0
 /**
  * @return String
  * @param int $start
  * @param int $length
  */
 public function subStr($start, $length = null)
 {
     return new self(mb_subStr($this->value, $start, $length, $this->encoding));
 }