stefan.gofferje.net /link.php?id=news1
 Deutsch  English
 
 
Allgemein

Stefan & Co.
StefanFamilie

Tiere
Tex v. FlanzbateEtulinjan AthosSkippy & Charlie

Von & über Stefan

Fotos

Service

Link ext. Link
[] geschützt
* wichtig
** aktualisiert
 X nicht verfügbar
   
astdirectory.php
<?php
  
#############################################################################
  #                                                                           #
  # directory.php                                                             #
  #                                                                           #
  # Display Asterisk database CID records on Cisco 7940/60 IP phones          #
  #                                                                           #
  # Please store all external nos w/ full prefix/areacode                     #
  #                                                                           #
  # (w) 2005 by Stefan Gofferje, License: GPL                                 #
  #                                                                           #
  # Inspired by Asterisk CID scripts by Philipp von Klitzing                  #
  #                                                                           #
  # Don't forget to modify /etc/sudoers:                                      #
  #  wwwrun  ALL=(ALL)       NOPASSWD:   /usr/sbin/asterisk                   #
  #                                                                           #
  #############################################################################
  #                                                                           #
  # If _AKZ is defined, any no. in the db beginning with _NATIONAL will       #
  # be prefixed with _AKZ in the phone directory.                             #

  
define (_AKZ,"0");      #Prefix to dial an external no.
                          #[de] Amtskennziffer
  
define (_NATIONAL,"0"); #Prefix for national calls

  #                                                                           #
  #############################################################################
  
  
header("Content-type: text/xml");
  
header("Connection: close");
  
header("Expires: -1");
?>

<CiscoIPPhoneDirectory>
<Title>Asterisk CID Directory</Title>
<Prompt>Please Select</Prompt>

<?php
  set_time_limit
(5);
  
exec("sudo /usr/sbin/asterisk -rx \"database show cidname\"",$var);

  for (
$i=0;$isizeof($var);$i++)
  {
    if (
preg_match("/^\/cidname\/(\d+)[[:space:]]+:[[:space:]]+(.+)/",$var[$i],$res))
    {
      
$entry[$i][name]=$res[2];
      
$entry[$i][no]=$res[1];
      if (
defined("_AKZ")) if (strncmp($entry[$i][no],_NATIONAL,1)==0$entry[$i][no]=_AKZ.$entry[$i][no];
    }
  }
  
sort($entry);
  for (
$i=0;$isizeof($entry);$i++)
  {
    print 
"<DirectoryEntry>\n";
    print 
"<Name>".utf8_encode($entry[$i][name])."</Name>\n";
    print 
"<Telephone>".$entry[$i][no]."</Telephone>\n";
    print 
"</DirectoryEntry>\n";
  }
?>

<SoftKeyItem>
        <Name>Dial</Name>
        <URL>SoftKey:Dial</URL>
        <Position>1</Position>
        </SoftKeyItem>
<SoftKeyItem>
        <Name>Return</Name>
        <URL>SoftKey:Exit</URL>
        <Position>3</Position>
</SoftKeyItem>
</CiscoIPPhoneDirectory>

 
2008-03-23 18:23 +0200 
Reg'd Linux User #247167 Reg'd Asterisk User #1005 XING Get Firefox
Get Thunderbird
  Valid HTML 4.01!   Valid CSS!   Check PageRank