Let me guess. Printed out and on your desk in the smallest font visible to man's naked eye is an excel spreadsheet with all the phone numbers of your unit listed. It's likely right next to a $500 Cisco Voice-over IP computer phone. To dial a number, you'll break out the bifocals and painstakingly use your finger to line up to the right number on the spreadsheet and punch it in manually on the phone fatfingering the dial pad 10% of the time. Sound familiar?

Wouldn't it be nice if that $500 computer phone could geterate an easily navigatable directory that was as up to date as the listings in the Call Manager? Well, thats exactly what we had in mind when developing the Dynamic Phone Directory (DPD)

Download files used for this Project

How it works

DPD is a simple PHP based web page that queries the call manager for the line text of the phone (particularly the Display ASCII line text) and parses out the line text using the spaces within it. It'll use the words in the line text to create a directory structure that is hierachical in nature by grouping like words and omitting all other words at the next space after the search string.

How to set it up

As simple as it seems, setting it all up is rather complicated unless you are already fairly familiar with IIS, PHP, AXL, SOAP, and certificates. But don't worry, with these simple instructional videos and notes, even the simplest among us should be successful in setting it up.

Setup an IIS server with PHP installed

You'll need to host the PHP file on a dedicated webserver. For these instructions, i'll be using Microsoft Server 2012. If you already know how to do this, great! But there are a few options that will need to be enabled in PHP, and here's some notes on the install:

Install IIS: 

  1. Open Server Manager, select roles
  2. Add the Web Server role and include the following:
    1. Common HTTP Features -> HTTP Redirection
    2. Application Development -> CGI
  3. Open Internet Explorer and access http://localhost, it should bring up the IIS splash page

Install Visual C++ Redistributable

  1. Copy Visual C++ Redistributable for Visual Studios 2015  (get vcredist_x86.exe) to the desktop of the webserver
  2. Execute and install the application

Install PHP Services

  1. Download and unzip php-5.6.30-nts-Win32-VC11-x86.zip (non-threadsafe) to c:program file(x86)php directory on the web server (you'll have to create the directory).
  2. Open up the IIS manager > Handler Mappings > Add Module Mapping then fill in the following information and click OK:
    1. Request Path: *.php
    2. Module: FastCgiModule
    3. Executable (optional): c:program file(x86)phpphp-cgi.exe
  3. Copy php.ini-development in the c:program file(x86)php directory and rename the new file to php.ini
  4. Open php.ini in Notepad and remove the ; in front of the following and save
    cgi.fix_pathinfo=1
    fastcgi.impersonate=1
    cgi.force_redirect=0
    fastcgi.logging=0
    extension_dir="ext"

    extension=php_curl.dll
    extension=php_gd2.dll
    extension=php_intl.dll
    extension=php_mbstring.dll
    extension=php_mysql.dll
    extension=php_mysqli.dll
    extension=php_openssl.dll

    extension=php_soap.dll


  5. Search, uncomment and change date.timezone

    date.timezone=America/New_York


  6. Create a file called phpinfo.php in c:inetpubwwwroot with the following

    <?php phpinfo(); ?>

  7. Open Internet explorer and access http://localhost/phpinfo.php

Get Certificate and AXL DLL Files

 You will need to get DLL files from the call manager for the AXL/SOAP to work on your webpage.

  1. Log into the CUCM server through the web console with your admin account
  2. Go to Cisco Unified CM Administration
  3. Go to Application - Plugins
  4. Download Cisco AXL Toolkit
  5. Unzip the file and copy the contents of folder schema8.5 (or whatever your version of call manager is) to the webserver under c:inetpubwwwroot
    1. It should contain:
      AXLAPI.wsdl
      AXLSoap.xsd
      AXLEnums.xsd (maybe, not necesary if it does not)

You will also need to get the self signed certificate from the Call Manager (if it doesn't have a CA based certificate) or the CA certificate (if it does)

Self signed certs - 

  1. Open the primary CUCM admin web page in Firefox from your admin computer
  2. Click Cisco Unified Communications Manager On the URL bar, there should be a lock with a yellow or red mark indicating there is trouble with the sites certificate. Click the icon.
    1. Click the arrow to the right, then More Information
    2. Click View Certificates then Details
    3. Click Export and save the certificate to your desktop
    4. Copy the downloaded certificate to your web server under C:inetpubwwroot 

CA based certs - Certificate Requestor Procedures part 1

  1. Login to the webserver that needs the certificate
  2. Go to Server Manager - Tools- Internet Information Services (IIS) Manager
  3. Choose the server under Connections and open Server Certificates
  4. Click Create Cert Request
  5. Fill in the appropriate information for the server with the common name being the FQDN of the web server
  6. Click Next
  7. Choose Microsoft RSA SChannel Cryptographic Provider and a bit length of 2048
    1. Some applications may require a different cryptographic provider
  8. Choose the CA authority if prompted
  9. Save the file as <servername>_req.txt
  10. Copy the file to the CA server

Certificate generation procedures

  1. On the CA server, copy the text request file to a directory you can reach from the command prompt
  2. Go to Serrver Manager - Tools - Internet Information Services (IIS) Manager
  3. Run command prompt or powershell as an admin
  4. navigate to the directory of the cert request
  5. Run the following command to generate the certificate

    certreq -attrib "CertificateTemplate:web server" <servername>_req.txt
  6. Copy the generated certificate to the web server

Certifiacte Requestor procedures Part 2

  1. Login to the web server
  2. Go to Server Manager - Tools - Internet Information Services (IIS) Manager
  3. Choose the server under Connections and open Server Certificates
  4. Choose Complete Certificate Request
  5. Navigate to the certificate and change the friendly name to the server name
  6. Select Personal and OK

Add the CUCM host name to the hosts file - If you have the server in DNS already, you might not have to do this part.

  1. On the web server, open c:windowssystem32driversetchosts as an admin in notepad
  2. add the IP address followed by the full path of the server to the host file so the server will know which certificate to use for the corresponding IP address. 
    Example:
    192.168.2.252 callmanagerserver.domain.com
  3. save the file

Enable CUCM AXL Service

  1. Login to the CUCM and navigate to Cisco Unified Serviceability
  2. Go to Tools - Service Activation
  3. Select the main server in the cluster (or the one the PHP file will point to)
  4. Check Cisco AXL Web Service and press Save

Create a Service Account on CUCM for AXL Access

  1. On the CUCM server management page, login and go to User Management - User Group
  2. Click Add New and name the group AXL Group
  3. Once created, click the (i) under Roles
  4. Click Assign role to group and choose the Standard AXL API Access
  5. Click Save
  6. go to User Management - Application User
  7. Click Add New and name it AXL_User
  8. Assign a stndard password used with service accounts
  9. Click Add to User Group and select AXL Group
  10. Click Save

Copy and Edit the DPD.php file 

  1. Copy DPD.php to the web servers default root directory (c:inetpubwwwroot)
    1. If using a CA certificate, copy over DPD - For Working Certificates.php and rename it to DPD.php
  2. Open the new copy of DPD.php in notepad and change the following:
    1. $host = (your CUCM server FQDN)
    2. $username = (CUCM username with AXL access - AXL_User)
    3. $password = (CUCM AXL_User password)
    4. $WebServerIP = (your web server IP address)
  3. If using a CA certificate, change the following as well under 
    1. 'cafile' => "c:inetpubwwwrootCUCMserverdomainnet-ms.crt",
      1. (this will be the certificate you received from the certificate request)
    2. 'CN_match' => "CUCMserver.domain.net",
      1. (This should be the FQDN of your call manager)
  4. Save and close

Create an XML main directory

This will be the main page that will start off the searches in DPD. This can also link to other DPD.php's or directories on other CUCM clusters

  1. Create a new notepad document
  2. Copy and past the following, adjusting the approriate values to match your installation where YourBN will be the first word DPD searches for

    <?xml version="1.0"?>
    <CiscoIPPhoneMenu>
    <Prompt>Your Directory</Prompt>
    <MenuItem>
    <Name>Your Battalion</Name>
    <URL>http://x.x.x.x/DPD.php?desc=YourBN</URL>
    </MenuItem>
    </CiscoIPPhoneMenu>
  3. Change the URL and name, add more entries if neccessary. Use the IP address of the webserver rather than the domain name
  4. Save the file as main.xml in c:inetpubwwwroot on your web server

Test a few phones

  1. On the CUCM Server, find a phone to test on and edit the device configuration
  2. Change Services Provisioning to Both
  3. Change the Directory to the URL to your main.xml
    1. use the IP address of the server, not the domain name
      ex: http://192.168.0.1/main.xml
  4. Save and apply config
  5. Test the directory on the phone

Implement on all phones

The directory will be implemented as a service on all phones in the directory. This will not restart any phones, but each phone will need to be restarted in order for the phone to see the new directory options

  1. On the CUCM server, go to Device - Device Settings - Phone Services
  2. Choose Add New
  3. Name the service name and ASCII service name the name that will appear in the directory with the name of the unit
  4. Enter the URL to the XML directory for the unit for both Service URL and Secure-Service URL
  5. Service Category: XML Service
  6. Service Type: Directories
  7. Check Enable
  8. Check Enterprise Subscriptions
  9. Click Save

Relabeling the Phones and Lines

For this to work, you'll need to standardize the phone line labels so that they have the element identifier at each level within the text. Then you'll need to strictly enforce the "naming" or labeling standard, and keep in mind it is case sensitive. To get everything standardized in an environment already in production, we bulk admin, excel and a the provided powershell script will end up saving you a lot of time. I didn't say it'll save you effort, it'll still require coming up with a label for each line, but it's much better than editing each line individually in the web interface of the directory itself.