Grandstream idle screen: Unterschied zwischen den Versionen

Aus metasec wiki
Wechseln zu: Navigation, Suche
(Die Seite wurde neu angelegt: „ <pre> [grandstream-idle-screen-refresh] Event=>x-gs-screen Content-Length=>0 </pre> <pre> <?php include("/var/www/zphone/etc/config.inc.php"); include($CCBOX[…“)
 
Zeile 1: Zeile 1:
 
 
<pre>
 
<pre>
  
Zeile 98: Zeile 97:
 
</pre>
 
</pre>
  
 +
<pre>
 +
#!/usr/bin/php4 -q
 +
<?php
 +
 +
/*
 +
some zphone specific includes
 +
*/
 +
 +
// main config file
 +
include_once("/var/www/zphone/etc/config.inc.php");
 +
 +
// main file for doing any sql lookups
 +
include($CCBOX["INC"]."func_sql.inc.php");
 +
 +
// some other zAPI files
 +
include($CCBOX["INC"]."func_manager.inc.php");
 +
 +
 +
$in = fopen("php://stdin", "r" );
 +
$err = fopen("php://stderr", "r" );
 +
 +
 +
/*
 +
 +
asterisk pass some values via stdin to the agi
 +
script. format is key: vale
 +
just get the values and extact them into an
 +
array named $agivars with key value index
 +
 +
*/
 +
 +
$agivars = array();
 +
while (!feof($in)) {
 +
    $agivar = trim(fgets($in));
 +
 +
    if ($agivar === '')
 +
        break;
 +
 +
    $agivar = explode(':', $agivar);
 +
    $agivars[$agivar[0]] = trim($agivar[1]);
 +
}
 +
 +
 +
/*
 +
this is needed if executing via DeadAGI dialplan app
 +
*/
 +
pcntl_signal(SIGHUP, SIG_IGN);
 +
 +
/*
 +
hier kommt der code hin, den man verwenden will
 +
wenn man die richtigen includes im kopf definiert,
 +
stehen einem alle zphone internen funktionen zur
 +
verfuegung
 +
 +
 +
paste here your code you want to use
 +
if you include the needed/right files in the
 +
header of this file, you are able to user all
 +
of the internal zphone functions form the zAPI
 +
*/
 +
 +
/*
 +
 +
print("noop just an info...\n");
 +
print("set varialble Z_AGI_TEST hallo\n");
 +
 +
*/
 +
exec("echo kahsdkjhd >> /tmp/akshkjsad");
 +
zphone_manager_exec_cmd("sip notify grandstream-idle-screen-refresh ".$argv[1]);
 +
 +
fclose($in);
 +
fclose($err);
 +
return 0;
 +
 +
 +
?>
 +
</pre>
  
 
<pre>
 
<pre>
 
exten => h,n,System(/usr/sbin/asterisk -rx "sip notify grandstream-idle-screen-refresh ${CALLERID(num)}")
 
exten => h,n,System(/usr/sbin/asterisk -rx "sip notify grandstream-idle-screen-refresh ${CALLERID(num)}")
 
</pre>
 
</pre>

Version vom 25. November 2009, 14:30 Uhr


[grandstream-idle-screen-refresh]
Event=>x-gs-screen
Content-Length=>0

<?php
include("/var/www/zphone/etc/config.inc.php");
include($CCBOX["INC"]."func_sql.inc.php");
include($CCBOX["INC"]."func_manager.inc.php");


function zphone_manager_db_get( $family, $key ) {


    $str    = trim(zphone_manager_exec_cmd("database get ".$family." ".$key));
    $uml_nr = (string)str_replace("Value: ","", $str );

    if ( $uml_nr == "" || $uml_nr == -1 || $uml_nr == "0I>" || $uml_nr == 0 )
        return -1;
    else
        return $uml_nr;


    return true;

}





$str = $_SERVER["HTTP_USER_AGENT"];
$_arr = explode("DevId", $str);
$_arr[1] = trim($_arr[1]);

$s = new SQL;
$s->query("SELECT ae_ext FROM ast_users WHERE ae_mac_ip='".strtoupper($_arr[1])."'");
$s->next_record();
$ae_ext = $s->f("ae_ext");
$s->free_result();

//$uml = $ae_ext;
$uml = zphone_manager_db_get( "uml_target", $ae_ext );
print("<?xml version=\"1.0\"?>\n");
?>
<Screen>
   <IdleScreen>
       <ShowStatusLine>true</ShowStatusLine>
       <DisplayString font="f10h" halign="Center" a1reg="false">
           <DisplayStr>$N</DisplayStr>
           <X>64</X>
           <Y>1</Y>
       </DisplayString>
       <DisplayString font="f10b" halign="Center" a1reg="true">
           <DisplayStr>$N</DisplayStr>
           <X>64</X>
           <Y>1</Y>
       </DisplayString>

       <DisplayString font="f16" halign="Center" a1reg="false">
           <DisplayStr>$X</DisplayStr>
           <X>64</X>
           <Y>10</Y>
       </DisplayString>

       <DisplayString font="f16b" halign="Center" a1reg="true">
           <DisplayStr>$X</DisplayStr>
           <X>64</X>
           <Y>10</Y>
       </DisplayString>

<?php
if ( $uml > 0 ) {
?>
       <DisplayString font="f8" halign="Center" a1reg="true">
           <DisplayStr>UML: <?php
           print($uml);
           ?></DisplayStr>
           <X>64</X>
           <Y>28</Y>
       </DisplayString>
<?php
}
?>
       <DisplayString font="f8" halign="Center">
           <DisplayStr>$M $D, $Y</DisplayStr>
           <X>64</X>
           <Y>40</Y>
       </DisplayString>
   </IdleScreen>
</Screen>

#!/usr/bin/php4 -q
<?php

/*
 some zphone specific includes
 */

// main config file
include_once("/var/www/zphone/etc/config.inc.php");

// main file for doing any sql lookups
include($CCBOX["INC"]."func_sql.inc.php");

// some other zAPI files
include($CCBOX["INC"]."func_manager.inc.php");


$in = fopen("php://stdin", "r" );
$err = fopen("php://stderr", "r" );


/*

 asterisk pass some values via stdin to the agi
 script. format is key: vale
 just get the values and extact them into an
 array named $agivars with key value index

*/

$agivars = array();
while (!feof($in)) {
    $agivar = trim(fgets($in));

    if ($agivar === '')
        break;

    $agivar = explode(':', $agivar);
    $agivars[$agivar[0]] = trim($agivar[1]);
}


/*
 this is needed if executing via DeadAGI dialplan app
 */
pcntl_signal(SIGHUP, SIG_IGN);

/*
 hier kommt der code hin, den man verwenden will
 wenn man die richtigen includes im kopf definiert,
 stehen einem alle zphone internen funktionen zur
 verfuegung


 paste here your code you want to use
 if you include the needed/right files in the
 header of this file, you are able to user all
 of the internal zphone functions form the zAPI
 */

/*

print("noop just an info...\n");
print("set varialble Z_AGI_TEST hallo\n");

*/
exec("echo kahsdkjhd >> /tmp/akshkjsad");
zphone_manager_exec_cmd("sip notify grandstream-idle-screen-refresh ".$argv[1]);

fclose($in);
fclose($err);
return 0;


?>
exten => h,n,System(/usr/sbin/asterisk -rx "sip notify grandstream-idle-screen-refresh ${CALLERID(num)}")