<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>Main</title>
    <link>http://developer.cisco.com/web/cuae/wikidocs?p_p_auth=BrzK1CFb&amp;p_p_id=36&amp;p_p_lifecycle=0&amp;p_r_p_185834411_nodeId=8398769</link>
    <description />
    <item>
      <title>2.3.x Series#CUAE 2.3(1) 1.0</title>
      <link>http://developer.cisco.com/web/cuae/wikidocs?p_p_auth=BrzK1CFb&amp;p_p_id=36&amp;p_p_lifecycle=0&amp;p_r_p_185834411_nodeId=8398769&amp;p_r_p_185834411_title=&amp;2.3.x+Series%23CUAE+2.3%281%29</link>
      <description />
      <pubDate>Sun, 25 Nov 2012 10:28:53 GMT</pubDate>
      <guid isPermaLink="false">http://developer.cisco.com/web/cuae/wikidocs?p_p_auth=BrzK1CFb&amp;p_p_id=36&amp;p_p_lifecycle=0&amp;p_r_p_185834411_nodeId=8398769&amp;p_r_p_185834411_title=&amp;2.3.x+Series%23CUAE+2.3%281%29</guid>
      <dc:creator>rana nazzal</dc:creator>
      <dc:date>2012-11-25T10:28:53Z</dc:date>
    </item>
    <item>
      <title>8.x Series 1.6</title>
      <link>http://developer.cisco.com/web/cuae/wikidocs?p_p_auth=BrzK1CFb&amp;p_p_id=36&amp;p_p_lifecycle=0&amp;p_r_p_185834411_nodeId=8398769&amp;p_r_p_185834411_title=&amp;8.x+Series</link>
      <description>== About ==

This table and it's sub-pages are detailed about CUAE 8.x release versions.

|=&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Version&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;|=&amp;nbsp;Date of Release&amp;nbsp;|=&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Notes&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;|
|[[CUAE 8.5(1)]]|15-Dec-2010|1. Support on Windows 2008 Server 32 bit SP2 Standard or Enterprise Edition \\2. Support for UC 8.5 \\3. CUAD Support for windows 7 &amp; Vista\\4. Media API SeekAndPlay\\5. JTAPI Performance Improvements\\6. Increased Media Density\\7. Addition of MDE Plugin|
|[[CUAE 8.0(1)]]|03-May-2010|1. Support for UC 8.0 \\2. RT phone, RT-Lite Support \\3. Simplified Ordering\\4. Expanded JTAPI \\5. Scalability testing &amp; documentation\\6. Integration with Web-Ex Quick Share|</description>
      <pubDate>Sat, 29 Jan 2011 16:43:53 GMT</pubDate>
      <guid isPermaLink="false">http://developer.cisco.com/web/cuae/wikidocs?p_p_auth=BrzK1CFb&amp;p_p_id=36&amp;p_p_lifecycle=0&amp;p_r_p_185834411_nodeId=8398769&amp;p_r_p_185834411_title=&amp;8.x+Series</guid>
      <dc:creator>Nabhonil Sinha</dc:creator>
      <dc:date>2011-01-29T16:43:53Z</dc:date>
    </item>
    <item>
      <title>3.2 Installation Guide 3.2</title>
      <link>http://developer.cisco.com/web/cuae/wikidocs?p_p_auth=BrzK1CFb&amp;p_p_id=36&amp;p_p_lifecycle=0&amp;p_r_p_185834411_nodeId=8398769&amp;p_r_p_185834411_title=&amp;3.2+Installation+Guide</link>
      <description>== About ==

This article contains instructions for installing the following Cisco Unified Application Environment components / developer utilities viz.,

#Platform Services 
#Application Server 
#Media Engine 
#Developer Tools
#Connectors

=== Important Note ===

Prior installing the Unified Applicaiton Environment, you must need to download and install all of the [[3.2.1 Prerequisite|Developer Kit Prerequisites]] if you want to prepare your developer environment on a personal computer which runs on Microsoft Windows XP or Microsoft Windows 2003 with required hardware like a machine hosting both the Cisco Unified Application Server and Cisco Unified Media Engine have at least 1.5 GB of RAM.

An Intel processor is required to run the Cisco Unified Media Engine properly. The Cisco Unified Media Engine is not supported on AMD processors. Some laptops with Intel processors are not compatible with the Cisco Unified Media Engine due to incompatible APIC timer hardware. Read [[Cisco Unified Media Engine Hardware Requirements]] for more details.

All of the above instructions are valid for the latest CUAE 8.0 release &amp; earlier free UAE 2.5 Developer Kits. [[3.2.2 CUAE SDK Installation 2.4.X|CUAE SDK Installation 2.4.X]] contains installation instructions for the previous version of the Developer Kit.

//For complete instructions on the production version of the Cisco Unified Application Environment, see the [[http://www.cisco.com/en/US/docs/voice_ip_comm/cuae/8_0/english/install/guide/uaein.html|Cisco Unified Application Environment Installation Guide]].//

//**Please visit [[3.2.3 Troubleshooting Installation Issues|troubleshooting]] wiki page if you encounter any issues during the installation process.**//

=== Upgrading ===

**To upgrade from 2.4.2 ,2.4.3 and 2.5.1 follow these steps:**

Follow the instructions listed under Installing Platform Services.

**To upgrade from 2.4.1, follow these steps:**
#Download and install WSE 3.0 Redistributable Runtime which can be found at the Microsoft Download Center.
#Follow the instructions listed under Installing Platform Services.

== Installing Platform Services ==

To install platform services, follow these steps:

#Download the platform services installer from the [[3.1 Software Releases|Cisco Unified Application Environment Downloads]] page to the target system. The platform services installer is named CUAE-platsvc-&lt;version&gt;.exe. 
#Execute the installer. 
#The Cisco Unified Application Environment Platform Services installation Wizard appears. Click **Next.**
#The end-user license agreement appears. Read it, and if you agree with the terms, select **I accept the terms in the license agreement.** Click **Next.**
#A notice about cryptographic features appears. Read it, and if you agree to comply with the applicable laws and regulations described in the notice, click **Next.**
#The MySQL Database Server dialog appears. Specify the credentials for a MySQL administrative user with sufficient privileges to create users and databases. Click **Next.** 
#The MySQL Database User dialog appears. Specify the credentials for a MySQL user with read and write permissions on the database. Click **Next.** 
#A Ready to Install the Program dialog box appears. Click **Install.** 
#The dialog window indicates progress as the installation proceeds. Once installation completes, you are prompted to modify the Apache configuration file. Follow the on-screen instructions and save your changes. 
#Restart the Apache service by executing the following at the command prompt:**net stop apache** then **net start apache**
#Click Finish when the installation is complete. 

//**Each installer prompts you to restart your computer. You do not have to restart until you have finished installing all of the components you want on the machine.**//

== Installing the Cisco Unified Application Server ==

To install the Cisco Unified Application Server, follow these steps:

#Download the application server installer from the [[3.1 Software Releases|Cisco Unified Application Environment Downloads]] page to the target system. The application server installer is named CUAE-appserver-&lt;version&gt;.exe. 
#Run the installer. 
#The Cisco Unified Application Server installation Wizard appears. Click **Next.**
#The end-user license agreement appears. Read it, and if you agree with the terms, select **I accept the terms in the license agreement**. Click **Next.**
#A notice about cryptographic features appears. Read it, and if you agree to comply with the applicable laws and regulations described in the notice, then click **Next.**
#A Ready to Install the Program dialog box appears. Click **Install.**
#A dialog indicates that the installation is complete. Click **Finish.**

//**Each installer prompts you to restart your computer. You do not have to restart until you have finished installing all of the components you want on the machine.**//

== Installing the Cisco Unified Media Engine ==

To install the Cisco Unified Media Engine, follow these steps:

#Download the media engine installer from the [[3.1 Software Releases|Cisco Unified Application Environment Downloads]] page to the target system. The media engine installer is named CUAE-mediaengine-&lt;version&gt;.exe. 
#Run the installer. 
#The Media Engine installer searched for required software and prompts you to install the Nuance OpenSpeech Recognizer if it cannot locate it. 
#The Cisco Unified Media Engine installation Wizard appears. Click **Next.**
#The end-user license agreement appears. Read it, and if you agree with the terms, select **I accept the terms in the license agreement**. Click **Next.**
#A notice about cryptographic features appears. Read it, and if you agree to comply with the applicable laws and regulations described in the notice, then click **Next.**
#A Ready to Install the Program dialog box appears. Click **Install.**
#A dialog indicates that the installation is complete. Click **Finish.**

//**Each installer prompts you to restart your computer. You do not have to restart until you have finished installing all of the components you want on the machine.**//

== Configuring and Verifying the Installation ==

Once the system has restarted after executing the last installer, the Cisco Unified Application Environment is considered installed. At this point, it is a best practice to test the integration between the Cisco Unified Application Environment and the Cisco Unified Communications Manager to verify that the installation is functional. The Administration Guide contains steps to set up a test environment and to verify installation and configuration of sample applications.

=== Cisco Unified Application Environment 8.5 ===
Follow the instructions in the Configuring an Example Environment section of the [[http://www.cisco.com/en/US/docs/voice_ip_comm/cuae/8_5/english/administration/guide/example.html|Cisco Unified Application Environment Administration Guide]].

=== Cisco Unified Application Environment 8.0 ===
Follow the instructions in the Configuring an Example Environment section of the [[http://www.cisco.com/en/US/docs/voice_ip_comm/cuae/8_0/english/administration/guide/example.html|Cisco Unified Application Environment Administration Guide]].

=== Cisco Unified Application Environment 2.5 ===
Follow the instructions in the Configuring an Example Environment section of the [[http://cisco.com/en/US/docs/voice_ip_comm/cuae/2_5/english/administration/guide/example.html|Cisco Unified Application Environment Administration Guide]].

===Cisco Unified Application Environment 2.4.x ===
Follow the instructions in the Example configuration and test applications section in the [[http://www.cisco.com/en/US/docs/voice_ip_comm/cuae/2_4/english/administration/guide/start.html#wp1044076|Cisco Unified Application Environment Administration Guide]] to verify basic functionality of the installation.

== Installing Cisco Unified Application Environment Developer Tools ==

//**While not advisable in production environment, for test purposes you can install the downloaded Cisco Unified Application Environment Development Tools on the same computer where you installed the Cisco Unified Application Server.**//

In Cisco Unified Application Environment 8.0 and earlier, the developer tools contains two main components, both of which allow you to develop Unified Communications applications:

*Cisco Unified Application Designer -- The legacy .Net / C# based IDE. 
*CUAE CLI via Etch IDL's -- The cross-platform, language independent [[5. Etch|ETCH]] framework and the **cuae** command-line utility. 

To install the Cisco Unified Application Environment Developer Tools, follow these steps:

#Download the developer tools installer: CUAE-devtools-&lt;version&gt;.exe 
#Run the installer. 
#Installshield checks for prerequisites. 
#Cisco Unified Application Environment Development Tools installer might display any pending requirements to be installed. Click **Install.**
#Once prerequisites are installed, the Welcome page appears. Click **Next.**
#The end-user license agreement appears. Read it, and if you agree with the terms, **select I accept the terms in the license agreement**. Click **Next.**
#A notice about cryptographic features appears. Read it, and if you agree to comply with the applicable laws and regulations described in the notice, then click **Next.**
#Accept the defaults until the completed window appears. Click **Finish.**
#If needed, restart the computer for environment settings to take effect once the installation is complete.

== Connectors ==

These are special purpose plugin softwares which enables integration of the Cisco Unified Application Environment to communicate with other platforms like IBM WebSphere, Salesforce, SAP, Cisco Unity etc... to facilitate application development for Communications Enabled Business Transformation / Process. 

Please visit [[3.3 Connectors|Connectors]] wiki page to set up those based on your requirement.</description>
      <pubDate>Thu, 16 Dec 2010 16:28:50 GMT</pubDate>
      <guid isPermaLink="false">http://developer.cisco.com/web/cuae/wikidocs?p_p_auth=BrzK1CFb&amp;p_p_id=36&amp;p_p_lifecycle=0&amp;p_r_p_185834411_nodeId=8398769&amp;p_r_p_185834411_title=&amp;3.2+Installation+Guide</guid>
      <dc:creator>Nabhonil Sinha</dc:creator>
      <dc:date>2010-12-16T16:28:50Z</dc:date>
    </item>
    <item>
      <title>3.1 Software Releases 2.9</title>
      <link>http://developer.cisco.com/web/cuae/wikidocs?p_p_auth=BrzK1CFb&amp;p_p_id=36&amp;p_p_lifecycle=0&amp;p_r_p_185834411_nodeId=8398769&amp;p_r_p_185834411_title=&amp;3.1+Software+Releases</link>
      <description>== Get a CCO account to download software releases ==

Cisco has made full-featured versions of the Cisco Unified Application Environment products available as free downloads - licensed for development and test use only. 

In order to download these products, you will need to register for a Cisco.com (CCO) account. This is a very simple process and should require less than 5 minutes of your time. Simply click the following link to go to the registration page, and follow the instructions there to set up your Cisco.com account. Then return to this page to get download instructions. **[[https://tools.cisco.com/RPF/register/register.do|Register now!]]**

== What is available as download ? ==

The following Cisco Unified Application Environment products are available as free downloads for development and test purposes:

=== [[1. Overview#Developer Tools |Cisco Unified Application Environment Developer Tools]] ===

Developers can choose to develop applications that run in-process in the Unified Application Server or inside an application container of their choice on some other network server. 

For in-process applications, the developer may use the Cisco Unified Application Designer. The Unified Application Designer is a visual development environment where the developer uses drag-and-drop techniques to construct applications containing communications business logic. 

For applications that need to run outside the container provided by the Unified Application Server, the Cisco Unified Application Environment development tools include utilities and interface definitions that leverage Etch. Using Etch, Cisco Unified Communications applications may be built with either Java or C# and embedded in the application container of the developer's choice.

=== [[1. Overview#Application Server|Cisco Unified Application Server]] ===

The Cisco Unified Application Server abstracts the complexity of unified communications and exports a network service that gives the application developer a single, technologically consistent entry point into Cisco Unified Communications. Applications can be hosted by the application server itself or embedded in an application container of the developer's choice (e.g., J2EE, ASP.NET, etc.)

=== [[1. Overview#Media Engine|Cisco Unified Media Engine]] ===

The Cisco Unified Media Engine is a software-only media server that provides ready-to-use, sophisticated media processing capabilities such as interactive voice response (IVR), conferencing, transcoding, text-to-speech (TTS), speech recognition, and speaker verification. These capabilities are exposed to applications through the interfaces provided by the Unified Application Server.

=== CUAE Connectors ===
Cisco Unified Application Environment connectors are special purpose packaged software which enables integeration of Unified Communication platform with other technologies so as to facilitate Communications Enabled Business Transformation/Process. For more details visit **[[3.3 Connectors|Connectors]]**.

== Before downloading the CUAE S/w; Read the below Instructions ==

=== Prerequisites ===

Instructions on the software you need to download and install before installing the Cisco Unified Application Environment Software. **[[3.2.1 Prerequisite|Prerequisite Instructions]].**
 
=== Installation ===

Instructions to install the Cisco Unified Application Environment software. **[[3.2 Installation Guide|Installation Instructions]].**

== Table of Releases ==

=== [[8.x Series]] ===

|=&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Version&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;|=&amp;nbsp;Date of Release&amp;nbsp;|=&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Notes&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;|
|[[CUAE 8.5(1)]]|15-Dec-2010|1. Support for UC 8.5 \\2. CUAD Support for windows 7 &amp; Vista\\3. Media API SeekAndPlay\\4. JTAPI Performance Improvements\\5. Increased Media Density\\6. Addition of MDE Plugin|
|[[CUAE 8.0(1)]]|03-May-2010|1. Support for UC 8.0 \\2. RT phone, RT-Lite Support \\3. Simplified Ordering\\4. Expanded JTAPI \\5. Scalability testing &amp; documentation\\6. Integration with Web-Ex Quick Share|

=== [[2.5.x Series]] ===
|=&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Version&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;|=&amp;nbsp;Date of Release&amp;nbsp;|=&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Notes&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;|
|[[CUAE 2.5(1) SR2]]|19-Mar-2009|1. New Messaging Plugin\\2. New JTAPI Events\\3. Support for Cisco Unified Communications Manager 7.1 and 4.3\\4. Core Addendum and Prerequisite Update|
|[[CUAE 2.5(1) SR1]]|23-Jan-2009|[[http://www.cisco.com/en/US/docs/voice_ip_comm/cuae/2_5/english/release/notes/uaern251sr1.html|Release Notes]]|
|[[CUAE 2.5(1)]]|07-Oct-2008|[[http://www.cisco.com/en/US/docs/voice_ip_comm/cuae/2_5/english/release/notes/uaern25fcs.html|Release Notes]]|

=== [[2.4.x Series]] ===
|=&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Version&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;|=&amp;nbsp;Date of Release&amp;nbsp;|=&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Notes&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;|
|[[CUAE 2.4(3) SR1]]|19-Dec-2008|It's a Service Release|
|[[CUAE 2.4(2)]]|18-Dec-2007|It's a Maintenance Release|
|[[CUAE 2.4(1)]]|24-Jul-2007|Added broad MCS hardware support for: \\ 7816, 7825, 7835, 7845|

=== [[2.3.x Series]] ===
|=&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Version&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;|=&amp;nbsp;Date of Release&amp;nbsp;|=&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Notes&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;|
|[[2.3.x Series#CUAE 2.3(1)|CUAE 2.3(1)]]|21-Dec-2006|Maintenance Release. \\Eliminated dependency on MSMQ \\ **(No free download, service contract required)**\\ \\ End-of-sale date: 27-Feb-2009 \\ \\For more information, \\see the [[http://www.cisco.com/en/US/prod/collateral/voicesw/ps6789/ps7047/ps7058/end_of_life_notice_c51-491724.html|End-of-Sale and End-of-Life Announcement]]|
|[[2.3.x Series#CUAE 2.3(0)|CUAE 2.3(0)]]|Oct-2006|First Cisco Release. \\Only one supported platform: MCS 7845-H1 \\ **(No free download, service contract required)**\\ \\ End-of-sale date: 27-Feb-2009 \\ \\For more information, \\see the [[http://www.cisco.com/en/US/prod/collateral/voicesw/ps6789/ps7047/ps7058/end_of_life_notice_c51-491724.html|End-of-Sale and End-of-Life Announcement]]|</description>
      <pubDate>Thu, 16 Dec 2010 16:24:34 GMT</pubDate>
      <guid isPermaLink="false">http://developer.cisco.com/web/cuae/wikidocs?p_p_auth=BrzK1CFb&amp;p_p_id=36&amp;p_p_lifecycle=0&amp;p_r_p_185834411_nodeId=8398769&amp;p_r_p_185834411_title=&amp;3.1+Software+Releases</guid>
      <dc:creator>Nabhonil Sinha</dc:creator>
      <dc:date>2010-12-16T16:24:34Z</dc:date>
    </item>
    <item>
      <title>CUAE 8.5(1) 1.5</title>
      <link>http://developer.cisco.com/web/cuae/wikidocs?p_p_auth=BrzK1CFb&amp;p_p_id=36&amp;p_p_lifecycle=0&amp;p_r_p_185834411_nodeId=8398769&amp;p_r_p_185834411_title=&amp;CUAE+8.5%281%29</link>
      <description>== About ==

For Details on Cisco Unified Application Environment release 8.5(1) Features &amp; Improvements see the [[http://www.cisco.com/en/US/docs/voice_ip_comm/cuae/8_5/english/release/notes/uaern85.html|Release Notes for the Cisco Unified Application Environment Release 8.5(1)]].

== Installers ==

Click the links below to access the installers.

=== Public Files ===
The software listed here is free for development use. For installation instructions, see the [[3.2 Installation Guide|Installation]] topic.

*[[http://www.cisco.com/cisco/software/release.html?mdfid=280786386&amp;catid=278875240&amp;flowid=5484&amp;softwareid=282074216&amp;release=8.5(1)&amp;rellifecycle=&amp;relind=AVAILABLE&amp;reltype=latest|CUAE-devtools-8.5.1.0005.exe]]\\Developer Tools installer. Install on your development machine.
*[[http://www.cisco.com/cisco/software/release.html?mdfid=280786386&amp;catid=278875240&amp;flowid=5484&amp;softwareid=282074216&amp;release=8.5(1)&amp;rellifecycle=&amp;relind=AVAILABLE&amp;reltype=latest|CUAE-platsvc-8.5.1.0005.exe]]\\Contains common services. Install first on machines that will run Application Server and/or Media Engine.
*[[http://www.cisco.com/cisco/software/release.html?mdfid=280786386&amp;catid=278875240&amp;flowid=5484&amp;softwareid=282074216&amp;release=8.5(1)&amp;rellifecycle=&amp;relind=AVAILABLE&amp;reltype=latest|CUAE-appserver-8.5.1.0005.exe]]\\Application Server installer. Install Platform Services first.
*[[http://www.cisco.com/cisco/software/release.html?mdfid=280786386&amp;catid=278875240&amp;flowid=5484&amp;softwareid=282074216&amp;release=8.5(1)&amp;rellifecycle=&amp;relind=AVAILABLE&amp;reltype=latest|CUAE-mediaengine-8.5.1.0005.exe]]\\Media Engine installer. Install Platform Services first. 
*[[http://www.cisco.com/cisco/software/release.html?mdfid=280786386&amp;catid=278875240&amp;flowid=5484&amp;softwareid=282074216&amp;release=8.5(1)&amp;rellifecycle=&amp;relind=AVAILABLE&amp;reltype=latest|CUAEMigrationTool.exe]]\\CUAE Migration Tool. Tools for migration MCS OS 2003 or Microsoft Windows 2003 versions of CUAEe.g 2.5, 8.0 to CUAE 8.5 on Microsoft Windows 2008. 
*[[http://www.cisco.com/cisco/software/release.html?mdfid=280786386&amp;catid=278875240&amp;flowid=5484&amp;softwareid=282074216&amp;release=8.5(1)&amp;rellifecycle=&amp;relind=AVAILABLE&amp;reltype=latest|MDE.zip]]\\Message Delivery Engine. Install after CUAE is installed.
*[[http://www.cisco.com/cisco/software/release.html?mdfid=280786386&amp;catid=278875240&amp;flowid=5484&amp;softwareid=282074216&amp;release=8.5(1)&amp;rellifecycle=&amp;relind=AVAILABLE&amp;reltype=latest|CUAE-lbt-8.5.1.0005.exe]]\\Legacy Backup Tools. Tools for migration of pre-2.3 versions of CUAE. 

=== Contract-Only Files ===

Click the link below to access the Core Addendum installer, which installs all of the 3rd-party software dependencies of the Cisco Unified Application Environment onto a Cisco MCS server running Microsoft Windows 2008(32-bit) SP2 Standard or Enterprise Edition.

*[[http://www.cisco.com/cisco/software/release.html?mdfid=280786386&amp;catid=278875240&amp;flowid=5484&amp;softwareid=282074216&amp;release=8.5(1)&amp;rellifecycle=&amp;relind=AVAILABLE&amp;reltype=latest|CUAE-coreadd-8.5.1.11-GA.exe]]\\CUAE Core Addendum Installer.  Install Core Addendum before installing Platform Services. 

**Important Note:** //Neither of the Core Addendum installers are free downloads. They are restricted to customers who hold a support contract for Cisco Unified Application Environment. Users who do not have a paid support contract for Unified Application Environment can freely download the required software packages and the instructions for downloading and installing each dependency from the wiki: [[3.2.1 Prerequisite | Developer Kit Prerequisites]]//</description>
      <pubDate>Wed, 15 Dec 2010 11:08:45 GMT</pubDate>
      <guid isPermaLink="false">http://developer.cisco.com/web/cuae/wikidocs?p_p_auth=BrzK1CFb&amp;p_p_id=36&amp;p_p_lifecycle=0&amp;p_r_p_185834411_nodeId=8398769&amp;p_r_p_185834411_title=&amp;CUAE+8.5%281%29</guid>
      <dc:creator>Nabhonil Sinha</dc:creator>
      <dc:date>2010-12-15T11:08:45Z</dc:date>
    </item>
    <item>
      <title>2. Documentation 3.0</title>
      <link>http://developer.cisco.com/web/cuae/wikidocs?p_p_auth=BrzK1CFb&amp;p_p_id=36&amp;p_p_lifecycle=0&amp;p_r_p_185834411_nodeId=8398769&amp;p_r_p_185834411_title=&amp;2.+Documentation</link>
      <description>== Cisco Unified Application Environment Documents ==

The following links will help you in fetching the right UAE documentation you are looking for, to build Unified Application Environment _or_ to develop Unified Communication Applications.

=== Developer's API Reference Material ===
*List of all application programing interface with respect to Unified Application Environment is detailed; version wise &amp; developer's utility ([[1. Overview#Application Designer |Designer]] /  [[1. Overview#CUAE CLI| CUAE CLI]]) wise in the **[[API Reference]]** wiki.
*The [[Hosted CUAE Services|Cisco Unified Hosted CUAE Services]] wiki child-page gists about the various API namespace exposed by the Unified Application Enviornment.

=== Administration Guide ===
*Cisco Unified Application Environment 8.5 Admin Guide is available in CCO over [[http://www.cisco.com/en/US/docs/voice_ip_comm/cuae/8_5/english/administration/guide/cuae_8_5_admin_guide.html|here]].
*Cisco Unified Application Environment 8.0 Admin Guide is available in CCO over [[http://www.cisco.com/en/US/docs/voice_ip_comm/cuae/8_0/english/administration/guide/cuae_8_0_admin_guide.html|here]].
*Cisco Unified Application Environment 2.5 Admin Guide is available in CCO over [[http://cisco.com/en/US/docs/voice_ip_comm/cuae/2_5/english/administration/guide/CUAE-Admin_Book-Wrapper.html|here]].
*Cisco Unified Application Environment 2.4 Admin Guide is available in CCO over [[http://www.cisco.com/en/US/docs/voice_ip_comm/cuae/2_4/english/administration/guide/admin.html|here]].
*Cisco Unified Application Environment 2.3 Admin Guide is available in CCO over [[http://www.cisco.com/en/US/docs/voice_ip_comm/cuae/2_3/english/administration/guide/admin.html|here]].

=== Install &amp; Upgrade Guides ===
1. Unified Application Environment **installation and upgrade guides** for various versions are placed in CCO over [[http://www.cisco.com/en/US/products/ps7058/prod_installation_guides_list.html|here]]:
*You will also find Installation &amp; Admin guide for CUAE Webex / Unified IP Phone integration in the above link.
*As well the link comprise the installation guide for the Cisco Unified Communications Manager 6.0 SDK release which is for developer use with [[3.2.2 CUAE SDK Installation 2.4.X|Cisco Unified App Environment 2.4]].
*It also has [[CUAE - Unity Messaging Plugin|Unified Application Environment Messaging Plugin]] installation guide.

2. **Product Release Notes** for various releases of CUAE is available over [[http://www.cisco.com/en/US/products/ps7058/prod_release_notes_list.html|here]].

3. Cisco Unified Application Environment **hardware and software compatibility matrix** available over [[http://www.cisco.com/en/US/products/ps7058/products_device_support_tables_list.html|here]].

=== Product Information ===
*[[http://www.cisco.com/en/US/prod/collateral/voicesw/ps6789/ps7047/ps7056/product_data_sheet0900aecd805e6a9f.html|Cisco Unified Application Designer Data Sheet]]
*[[http://www.cisco.com/en/US/prod/collateral/voicesw/ps6789/ps7047/ps7058/product_data_sheet0900aecd805e6c2a.html|Cisco Unified Application Server Data Sheet]]
*[[http://www.cisco.com/en/US/prod/collateral/voicesw/ps6789/ps7047/ps7059/product_data_sheet0900aecd805e6d25.html|Cisco Unified Media Engine Data Sheet]]

**Note:** End of Sale / End of Support / End of Life notices are available over [[http://www.cisco.com/en/US/products/ps7058/prod_eol_notices_list.html|here]].

-------------------------------------------

//Go thru the **[[Developer Trainings]]** wiki to get insight about latest design and architecture updates about CUAE. We also share developers with additional sample applications and the training presos over there. Visit the **[[HowTo Articles]]** wiki to have a step by step hands-on experience in CUAE and gain good hold of it.//</description>
      <pubDate>Wed, 15 Dec 2010 10:26:42 GMT</pubDate>
      <guid isPermaLink="false">http://developer.cisco.com/web/cuae/wikidocs?p_p_auth=BrzK1CFb&amp;p_p_id=36&amp;p_p_lifecycle=0&amp;p_r_p_185834411_nodeId=8398769&amp;p_r_p_185834411_title=&amp;2.+Documentation</guid>
      <dc:creator>Nabhonil Sinha</dc:creator>
      <dc:date>2010-12-15T10:26:42Z</dc:date>
    </item>
    <item>
      <title>API Reference 3.0</title>
      <link>http://developer.cisco.com/web/cuae/wikidocs?p_p_auth=BrzK1CFb&amp;p_p_id=36&amp;p_p_lifecycle=0&amp;p_r_p_185834411_nodeId=8398769&amp;p_r_p_185834411_title=&amp;API+Reference</link>
      <description>== About ==

The links below provides one with the list of all API's for the Cisco Unified Application Environment. 

=== 8.5 API's ===

|=  Designer API's  |=  Java Developers' API  |=  C# Developers' API
|[[http://developer.cisco.com/static/cuae/8.5/8.5.1/Designer/index.html|Core API's]]|[[http://developer.cisco.com/static/cuae/8.5/8.5.1/java/Legacy/index.html|Core API]]\\[[http://developer.cisco.com/static/cuae/8.5/8.5.1/java/Bridge/index.html|Etch Bridge API]]\\[[http://developer.cisco.com/static/cuae/8.5/8.5.1/java/Management/index.html|Management API]]|[[http://developer.cisco.com/static/cuae/8.5/8.5.1/csharp/Legacy/index.html|Core API]]\\[[http://developer.cisco.com/static/cuae/8.5/8.5.1/csharp/Bridge/index.html|Etch Bridge API]]\\[[http://developer.cisco.com/static/cuae/8.5/8.5.1/csharp/Management/index.html|Management API]]|

=== 8.0 API's ===

|=  Designer API's  |=  Java Developers' API  |=  C# Developers' API  |=  Messaging Plugin 
|[[http://developer.cisco.com/static/cuae/8.0/8.0.1/Designer/index.html|Core API's]]|[[http://developer.cisco.com/static/cuae/8.0/8.0.1/java/Legacy/index.html|Core API]]\\[[http://developer.cisco.com/static/cuae/8.0/8.0.1/java/Bridge/index.html|Etch Bridge API]]\\[[http://developer.cisco.com/static/cuae/8.0/8.0.1/java/Management/index.html|Management API]]|[[http://developer.cisco.com/static/cuae/8.0/8.0.1/csharp/Legacy/index.html|Core API]]\\[[http://developer.cisco.com/static/cuae/8.0/8.0.1/csharp/Bridge/index.html|Etch Bridge API]]\\[[http://developer.cisco.com/static/cuae/8.0/8.0.1/csharp/Management/index.html|Management API]]|[[http://developer.cisco.com/static/cuae/8.0/8.0.1/MessagingPlugin/index.html|Messaging Plugin Java API's]] 


=== 2.5 API's ===

==== 2.5.1 SR1 ===

|=  Designer API's  |=  Java Developers' API  |=  C# Developers' API  |=  Messaging Plugin   
|[[http://developer.cisco.com/static/cuae/2.5/2.5.1SR1/Designer/index.html|Core API's]]|[[http://developer.cisco.com/static/cuae/2.5/2.5.1SR1/java/Legacy/index.html|Core API]]\\[[http://developer.cisco.com/static/cuae/2.5/2.5.1SR1/java/Bridge/index.html|Etch Bridge API]]\\[[http://developer.cisco.com/static/cuae/2.5/2.5.1SR1/java/Management/index.html|Management API]]|[[http://developer.cisco.com/static/cuae/2.5/2.5.1SR1/csharp/Legacy/Index.html|Core API]]\\[[http://developer.cisco.com/static/cuae/2.5/2.5.1SR1/csharp/Bridge/Index.html|Etch Bridge API]]\\[[http://developer.cisco.com/static/cuae/2.5/2.5.1SR1/csharp/Management/Index.html|Management API]]|[[http://developer.cisco.com/static/cuae/2.5/2.5.1SR1/MessagingPlugin/index.html|Messaging Plugin Java API's]]

==== 2.5.1 ===

|=  Designer API's  |=  Java Developers' API  |=  C# Developers' API  |=  Messaging Plugin   
|[[http://developer.cisco.com/static/cuae/2.5/current/Designer/index.html|Core API's]]|[[http://developer.cisco.com/static/cuae/2.5/2.5.1/java/Legacy/index.html|Core API]]\\[[http://developer.cisco.com/static/cuae/2.5/2.5.1/java/Bridge/index.html|Etch Bridge API]]\\[[http://developer.cisco.com/static/cuae/2.5/2.5.1/java/Management/index.html|Management API]]|[[http://developer.cisco.com/static/cuae/2.5/2.5.1/csharp/Legacy/Index.html|Core API]]\\[[http://developer.cisco.com/static/cuae/2.5/2.5.1/csharp/Bridge/Index.html|Etch Bridge API]]\\[[http://developer.cisco.com/static/cuae/2.5/2.5.1/csharp/Management/Index.html|Management API]]|[[http://developer.cisco.com/static/cuae/2.5/2.5.1/MessagingPlugin/index.html|Messaging Plugin Java API's]]


=== 2.4 API's ==

|=  Designer API's  |
|[[http://developer.cisco.com/static/cuae/2.4/2.4.3/Designer/index.html|2.4.3 Core API's]]|
|[[http://developer.cisco.com/static/cuae/2.4/2.4.2/Designer/index.html|2.4.2 Core API's]]|
|[[http://developer.cisco.com/static/cuae/2.4/2.4.1/Designer/index.html|2.4.1 Core API's]]|</description>
      <pubDate>Tue, 14 Dec 2010 10:39:22 GMT</pubDate>
      <guid isPermaLink="false">http://developer.cisco.com/web/cuae/wikidocs?p_p_auth=BrzK1CFb&amp;p_p_id=36&amp;p_p_lifecycle=0&amp;p_r_p_185834411_nodeId=8398769&amp;p_r_p_185834411_title=&amp;API+Reference</guid>
      <dc:creator>Nabhonil Sinha</dc:creator>
      <dc:date>2010-12-14T10:39:22Z</dc:date>
    </item>
    <item>
      <title>Software Prerequisites 2.0</title>
      <link>http://developer.cisco.com/web/cuae/wikidocs?p_p_auth=BrzK1CFb&amp;p_p_id=36&amp;p_p_lifecycle=0&amp;p_r_p_185834411_nodeId=8398769&amp;p_r_p_185834411_title=&amp;Software+Prerequisites</link>
      <description>== CUAE 2.5.1 &amp; 8.0.1 SDK Installation Pre-Requisites ==

=== Microsoft .NET Framework 3.0 Redistributable Package ===
*On the [[http://www.microsoft.com/downloads/Search.aspx?displaylang=en|Microsoft Download Center]], search for **.net 3.0 runtime** and download the installer.
*Run the dotnetfx3setup.exe installer and accept all defaults.

=== Microsoft .NET Web Services Enhancements 3.0 ===
*On the [[http://www.microsoft.com/downloads/Search.aspx?displaylang=en|Microsoft Download Center]], search for **Microsoft WSE 3.0** and download the installer.
*Run the Microsoft WSE 3.0.msi installer and accept all defaults

=== Apache 1.3.x ===
*Download the windows binaries for Apache 1.3 from [[http://archive.apache.org/dist/httpd/binaries/win32/|Apache Win32 Archives]]. Apache 2.0 is not compatible with the Cisco Unified Application Environment at this time.
*Before installing, check that nothing is running on port 80, such as IIS. If there is something using port 80, stop the program before installing.
*Run the Apache installer and accept all defaults.

=== J2SE JDK 5.0 ===
*Download a recent version of the JDK installer, such as 5.0 (also known as 1.5) from the [[http://java.sun.com/javase/downloads/index_jdk5.jsp|Previous JDK 5 Downloads]] page.
*Run the JDK installer and accept all defaults. It is not sufficient to install the JRE; the JDK must be installed.

=== MySQL ODBC Connector 3.51 ===
*Download the MySQL Connector/ODBC 3.51 MSI installer package from the [[http://dev.mysql.com/downloads/connector/odbc/3.51.html|MySQL ODBC Downloads]] page.
*Run the MySQL ODBC Connector installer and accept all defaults.

=== MySQL 5 ===
*Download the Windows executable (.exe) for MySQL 5.0 from the [[http://dev.mysql.com/downloads/mysql/5.0.html|MySQL Downloads]] page. 
*Run the MySQL installer (mysql-5.0.51-win32) and accept all defaults until you reach the MySQL Server Configuration section. As you proceed through this section, make the following selections: 
** Detailed Configuration
** Developer Machine (Recommended)
** Transactional Database Only
** Best Support for Multilingualism
** Install As Windows Service (automatic launch)
** Enter the password for the root user and be sure to remember it; you will need it later when installing the Cisco Unified Application Environment software if you decide to configure the platform to use the root account for accessing MySQL. 

=== Dialogic HMP 3.0 ===
*Download the Windows installers for Dialogic HMP from the [[http://www.dialogic.com/products/ip_enabled/HMPWindows.htm|Dialogic HMP Software for Windows]] page.
*Run the HMP installer and accept all defaults, choosing the top 4 installation check boxes when prompted to select individual components to install. 

=== NeoSpeech TTS 3.7 ===
*Download Windows installers from the [[http://www.pentaxneospeech.com/Products/custom/cisco/TYT2HDQVRGHRRJQ4RGT4/3.7/20070822_TTS_Server_3.7.1.3_CISCO.zip|Neospeech TTS Server]] page and [[http://www.pentaxneospeech.com/Products/custom/cisco/TYT2HDQVRGHRRJQ4RGT4/3.7/20070328_Voicetext-Kate-L08%20Master-RamIO.zip|Neospeech Kate Voice]] page.
*Run the VoiceText Kate Master installer and accept all defaults.
*Run the Neospeech TTS Server installer and accept all defaults.

Edit the TTS configuration file at C:\ttssrv.ini. 
*Change the NfsDir path to match the path of the Cisco Unified Media Engine, which by default is C:/Program Files/Cisco Systems/Unified Application Environment/MediaServer. 
*Verify that the following two lines are present: 
** KateSelect 1 ; Kate DB Select
** YumiSelect 0 ; Yumi DB Select

=== Final Steps ===

Modify your environment variables as follows:
#Add the JDK to the path. Using JDK 5.0 Update 11 as an example, append **;C:\Program Files\Java\jdk1.5.0_11\jre\bin**.
#Add MySQL to the PATH environment variable. By default, append **;C:\Program Files\MySQL\MySQL Server 5.0\bin.**
#Restart your machine.
#You are done. You may proceed to [[3.2 Installation Guide|installing the Cisco Unified Application Environment software]].</description>
      <pubDate>Fri, 13 Aug 2010 16:19:40 GMT</pubDate>
      <guid isPermaLink="false">http://developer.cisco.com/web/cuae/wikidocs?p_p_auth=BrzK1CFb&amp;p_p_id=36&amp;p_p_lifecycle=0&amp;p_r_p_185834411_nodeId=8398769&amp;p_r_p_185834411_title=&amp;Software+Prerequisites</guid>
      <dc:creator>Ramgopal Chockalingam</dc:creator>
      <dc:date>2010-08-13T16:19:40Z</dc:date>
    </item>
    <item>
      <title>CatPluginClient-Java 2.3</title>
      <link>http://developer.cisco.com/web/cuae/wikidocs?p_p_auth=BrzK1CFb&amp;p_p_id=36&amp;p_p_lifecycle=0&amp;p_r_p_185834411_nodeId=8398769&amp;p_r_p_185834411_title=&amp;CatPluginClient-Java</link>
      <description>==About the Application==

This application uses the [[CatPlugin | CatPlugin Example]]. The application cannot be created if you do not have this plugin correctly created, installed,and running. 

===Creating the Application Project===

1. Open a Command Prompt window.

2. Navigate to the directory you want to use as your workspace. To use the CUAE command-line tool to create a new application, type the **cuae create** command and the name of the application project.
{{{

c:&gt; cd \workspace
c:\workspace&gt; cuae create CatPluginClient
}}}

The tool then prompts you for additional information.

**Tip:**

// Once you are more familiar with the options, you can type the full command rather than answering the prompts by using the following syntax://

//cuae create -l language -m namespace -t project type ~[options~] projectname//
 


3. First the tool prompts you to choose between building an application or a plugin. In this example, the correct choice is application:

{{{
Project Type? [application or plugin] application
}}}


4. Next the tool prompts you to specify the programming language. In this example, the correct choice is java:
{{{
Programming language? [java or csharp] java
}}}

5. The tool prompts you to choose the build format you prefer. In this example we are using ant.

{{{
Build format? [ant or maven2] ant
}}}

6. The tool asks you for the namespace for the application. A program might want to use a fully qualified namespace like com.company.catpluginclient or something simple like catpluginclient. The tool offers you a simple namespace based on the project name. Let's accept the tool's suggestion for now and use catpluginclient:

{{{
Project namespace? [default: catpluginclient] &lt;Return&gt;
}}}

7. Finally, the tool asks if you would like to specify a triggering event. All applications need to register against at least one triggering event. You can specify the triggering event now or wait and specify the
triggering event later. You can also change the triggering event during development. Again, since we know that this application needs to be triggered on an incoming call, let's go ahead and specify the triggering event now. Select option 9:

{{{

 Available application triggering event:
   0: Skip this step
   1: cisco.uc.cuae.legacy.JTapi.JTapiIncomingCall
   2: cisco.uc.cuae.legacy.JTapi.JTapiCallInitiated
   3: cisco.uc.cuae.legacy.JTapi.JTapiCallEstablished
   4: cisco.uc.cuae.legacy.CallControl.IncomingCall
   5: cisco.uc.cuae.legacy.Http.GotRequest
   6: cisco.uc.cuae.legacy.Presence.SubscriptionTerminated
   7: cisco.uc.cuae.legacy.Presence.Notify
   8: cisco.uc.cuae.legacy.TimerFacility.TimerFire
   9: catplugin.CatPlugin.triggerOnImageUpdate
 Triggering event? [0-9] 9

}}}

The tool now has enough information to generate the project template.
{{{
   Generating:
   * application named "CatClientPlugin"
   * with namespace "catclientplugin"
   * with language "java"
   * with trigger event "catplugin.CatPlugin.triggerOnImageUpdate"
   * in location C:\workspace\
Created project "CatClientPlugin" in directory
 "C:\workspace\CatClientPlugin\"

}}}

Here is the whole sequence again with all of the steps together:

{{{

c:/workspace&gt; cuae create CatClientPlugin
Project type? [application or plugin] application
Programming language? [java or csharp] java
Build format? [ant or maven2] ant
Project namespace? [default: catclientplugin]
Available application triggering event:
   0: Skip this step
   1: cisco.uc.cuae.legacy.JTapi.JTapiIncomingCall
   2: cisco.uc.cuae.legacy.JTapi.JTapiCallInitiated
   3: cisco.uc.cuae.legacy.JTapi.JTapiCallEstablished
   4: cisco.uc.cuae.legacy.CallControl.IncomingCall
   5: cisco.uc.cuae.legacy.Http.GotRequest
   6: cisco.uc.cuae.legacy.Presence.SubscriptionTerminated
   7: cisco.uc.cuae.legacy.Presence.Notify
   8: cisco.uc.cuae.legacy.TimerFacility.TimerFire
   9: catplugin.CatPlugin.triggerOnImageUpdate
Triggering event? [0-9] 9
Generating:
   * application named "CatClientPlugin"
   * with namespace "catclientplugin"
   * with laguage "java"
   * with trigger event "catplugin.CatPlugin.triggerOnImageUpdate"
   * in location C:\workspace\
Created project "CatClientPlugin" in directory
 "C:\workspace\CatClientPlugin\"

}}}


==Inspecting the Generated Project==

Let's inspect the files that were generated by the CUAE command-line tool. It created an CatClientPlugin directory in the directory from which you ran the cuae create command. The CatClientPlugin directory contains the following files and directories:

   * CatClientPlugin .etch 
   * CatClientPlugin .properties 
   * build.xml 
   * cuae-resources/ 
   * README.txt 
   * src/ 

The most important of which, for your purposes, are:

   * **CatClientPlugin.etch**--CUAE application Etch service definition. Edit this file to use additional CUAE services in your project. 
   * **build.xml**--Ant build script file with predefined targets for managing the lifecycle of your CUAE project. 
   * **cuae-resources/**--CUAE application resource directory. 
   * **src/**--Generated application source files. 

==Declaring Services==

The first step in building an Etch-based application is identifying which [[Hosted CUAE Services | Cisco Unified Application Environment hosted services]] the application requires and then editing the .etch file to declare the names of those services into the application.

**Tip:**
 
//Once you identify the services you need, you can familiarize yourself with them by visiting the [[API Reference]] for the version of the Unified Application Environment you are using//. 


The following snippet is the default content of the .etch file that the CUAE command-line tool generates. We use the **mixin** command to declare the appropriate services. 

{{{


// CUAE Application Etch Service Definition
//
// This service defines your application and the CUAE services that you
// use in your application.

// The service module namespace, this will be translated to the
// namespace of the generated source code.
module catpluginclient

// The name of your service.
service CatPluginClient
{
    // By default, you must always use the EtchBridge service. Do not
    // remove this mixin, otherwise your application won't work.
    mixin cisco.uc.cuae.EtchBridge

    // You may add any additional service mixins that you require. For
    // example, if you'd like to make and receive phone calls, add the
    // following line:
    //     mixin cisco.uc.cuae.legacy.CallControl
    mixin catplugin.CatPlugin

}

}}}

Because this application will use methods in the CatPlugin library to send an image to an IpPhone, we need to utilize the CatPlugin and CiscoIpPhone services. The default etch file already has a mixin for CatPlugin because of the triggering event you selected when creating the application project.
{{{
    mixin catplugin.CatPlugin
}}}

We need to add a declaration for the CiscoIpPhone service, using the full namespace. Add the following line right after the mixin for CatPlugin but before the final "}":
{{{
mixin cisco.uc.cuae.legacy.CiscoIpPhone
}}}

The new CatPluginClient.etch file should look like this:
{{{


// CUAE Application Etch Service Definition
// 
// This service defines your application and the CUAE services that you
// use in your application.

// The service module namespace, this will be translated to the
// namespace of the generated source code.
module catpluginclient

// The name of your service.
service CatPluginClient
{
    // By default, you must always use the EtchBridge service. Do not
    // remove this mixin, otherwise your application won't work.
    mixin cisco.uc.cuae.EtchBridge

    // You may add any additional service mixins that you require. For
    // example, if you'd like to make and receive phone calls, add the
    // following line:
    //     mixin cisco.uc.cuae.legacy.CallControl
    mixin catplugin.CatPlugin
    mixin cisco.uc.cuae.legacy.CiscoIpPhone
    
}

}}}

==Building the Application==

After declaring the services you need, you must build the application to generate source files.  

1. Open a Command Prompt and navigate to the application directory.

2. Run the ant command to generate source files.

{{{
c:\workspace\CatPluginClient&gt;ant
}}}

The following source file templates are then created in the directory src\catplugin:

  * MainCatPluginClientClient.java 
  * ImplCatPluginClientClient.java 

==Writing Application Code==

This section provides instructions and code samples for writing the application logic.

===Import the Project into your IDE===

1. Open Eclipse (or another IDE of your preference).

2. Create a new Java project from an existing Ant buildfile by selecting **File** -&gt; **New** -&gt; **Other** -&gt; **Java Project from an existing Ant buildfile** and selecting the build.xml file from the CatPluginClient directory.

3. Click **Next**.

4. Browse to C:\workspace\CatPluginClient\ and select the **build.xml** file.

5. Click **Open**.

6. Select **"javac" task found in target "build~[default~]"**.

===First example code snippet: ImplCatPluginClientClient.java===

When a triggerOnImageUpdate occurs, construct a GraphicFileMenu with the image and send it to an IpPhone with the method SendExecute.

====Code Sample====

{{{

@Override
public void triggerOnImageUpdate( String sessionId, String name )
{
	String phoneIpAddr = "&lt;phone ip address&gt;";
		
	System.out.println( String.format("ImplCatPluginClientClient.triggerOnImageUpdate - starts, sessionId is %s, name is %s", sessionId, name ) );
	String imgUrl = server.getImageLink( sessionId );
	System.out.println("Image link returned from server: "+imgUrl);

	ConstructGraphicFileMenuOptions opt = new ConstructGraphicFileMenuOptions();
	opt.locationX = 1;
	opt.locationY = 1;
	opt.title = "LolCat";
	opt.uRL = imgUrl;
	opt.formatURL = true;
	ConstructGraphicFileMenuResult res = server.constructGraphicFileMenu(sessionId, opt );
	if (!"success".equalsIgnoreCase( res.returnValue ))
	{
		System.out.println( String
			.format( "ConstructGraphicFile call is not success: %s",
				res.returnValue ) );
	}
	else
	{
		System.out.println( "XML object sent to the phone: " + res.xmlObject );
		server.sendExecute( sessionId, res.xmlObject, phoneIpAddr, new SendExecuteOptions("&lt;username&gt;", "&lt;password&gt;"));
	}
	server.removeCuaeSession( sessionId );
}
}}}

  * Below given code block is to get an update on any plugin which goes down or restarts while the application is still executing. This code block is to be added into the file ImplCatPluginClientClient.java. 


====Code Sample====

{{{

@Override
public void pluginStatusUpdate(String pluginName, String nameSpace, PluginStatus status )
{
	System.out.println("Plugin Name : " + pluginName + "NameSpace" + nameSpace + "Status" + status);
}
}}}

==Registering the Application==

The previous steps completed the core logic of the example applications, but before any Etch-based API calls can actually be made, we must register the application with the Cisco Unified Application Server. To register your application, follow these steps:

1. Open the MainCatPluginClientClient file in the /src directory. It contains the following content by default:

{{{

// Generated by:
// 0.96.0 (LOCAL-0) / java 0.96.0 (LOCAL-0)
// Wed Jul 16 11:23:49 CDT 2008

package catpluginclient;

/**
 * Main program for CatPluginClientClient. This program makes a connection to the
 * listener created by MainCatPluginClientListener.
 */
public class MainCatPluginClientClient implements CatPluginClientHelper.CatPluginClientClientFactory
{
	/**
	 * Main program for CatPluginClientClient.
	 * 
	 * @param args command line arguments.
	 * @throws Exception
	 */
	public static void main( String[] args ) throws Exception
	{
		// TODO Change to correct URI
		String uri = "tcp://localhost:9000";
		
		RemoteCatPluginClientServer server = CatPluginClientHelper.newServer( uri, null,
			new MainCatPluginClientClient() );

		// Connect to the service
		server._startAndWaitUp( 4000 );

		// TODO Insert Your Code Here
		
		// Disconnect from the service
		server._stopAndWaitDown( 4000 );
	}

	public CatPluginClientClient newCatPluginClientClient( RemoteCatPluginClientServer server )
		throws Exception
	{
		return new ImplCatPluginClientClient( server );
	}
}

}}}

2. To make a connection to the listener, add a server.registerApplication() request.

{{{

String key = server.registerApplication("CatPluginClient", "Default", "&lt;username&gt;", "&lt;password&gt;");
System.out.println("CatPluginClient registered with key: " + key);
System.out.println("Click any key and hit return to terminate the client...");
System.in.read();
}}}


3. Modify the String URI to match the IP address and port of the Cisco Unified Application Server. 

URI settings vary slightly between 2.5(1) Beta 1 and more recent versions of 2.5(1), as follows:

====2.5(1) and 2.5(1) Beta 2, Beta 3, Beta 4&amp; later releases====


{{{

// TODO Change to correct URI
String uri = "tls://appserver_ipaddress:9000?TlsConnection.authReqd=false&amp;filter=KeepAlive
 &amp;KeepAlive.Count=5&amp;Packetizer.maxPktSize=102400&amp;TcpTransport.reconnectDelay=4000;

}}}


**Note:**

// In Beta 2, the Etch Bridge was updated to use [[Etch Bridge TLS|Transport Layer Security]] for encryption by default. For your applications to work, you must specify TLS as the protocol in the URI and set the authReqd parameter to false. In the example above, the [[Keep Alive]] filter and [[MaxPacketSize]] and [[Etch Connection URI | Reconnect Delay]] parameters have also been set//.
 

====2.5(1) Beta 1====

{{{
// TODO Change to correct URI
		String uri = "tcp://appserver_ipaddress:9000?&amp;TcpConnection.reconnect_delay=4000";
}}}
**Note:**

// In addition to setting the correct IP address and port for the Cisco Unfied Application Server, the Reconnect Delay parameter should be set on all connection URIs//. 
 
==Packaging The Test Application==

1. Execute a successful build request for your test application within your IDE.

2. To package the application, execute the "cuae package" command from a DOS command shell in the parent directory of the test application.

{{{

C:\workspace\CatPluginClient&gt;cuae package
Created package file
"C:\workspace\CatPluginClient\bin\CatPluginClient.mca"

}}}

The following files will be added to the "\bin" sub-directory:

  * CatPluginClient.mca (application bundle to be uploaded into the application server) 
  * INSTALLER.xml - (contains the config items in config.yaml) 
  * MANIFEST.xml - (bundle details for the package comamnd) 

Installing The Test Application

  * To install the test application on a CUAE server, execute the **cuae install** command from a DOS command shell in test application parent directory of the test application. The **cuae install** command varies slightly between 2.5(1) Beta 1 and Beta 2. 


====2.5(1) Beta 2====

 
You are prompted to enter an IP address, username, and password (to view the help, run the **cuae install -h** command). When prompted, enter Y or N to save management settings. This will save the answers to the above three questions in the properties file and remember them the next time you go to install.


**Note**

// You are also prompted for the communications protocol (TCP or TLS). Select the protocol that is set on the Management Service. TLS is the default supported protocol. If you want to use TCP, follow the instructions in [[Management Service TLS | Management Service Transport Layer Security (TLS)]] to change the default URI of the Management Service before running these commands//.
 
{{{

C:\workspace\CatPluginClient&gt;cuae package
Created package file
"C:\workspace\CatPluginClient\bin\CatPluginClient.mca"

C:\workspace\CatPluginClient&gt;cuae install
Enter the hostname or IP address of the management service (for example: localhost, 1.1.1.1): localhost
Protocol: tls
Generated mgmt-service uri: tls://localhost:9001?TlsConnection.authReqd=false
Enter management service login username:
Entermanagement service login password: ********
Save the amanagement settings with the project? [yes or no] n
Application : C:\workspace\CatPluginClientbin\CatPluginClient.mca
Uploading :  ===========================&gt; 100%
Application has been installed successfully

}}}

====2.5(1) Beta 1 ====



You are prompted to enter an IP address, username, and password (to view the help, run the **cuae install -h** command). When prompted, enter Y or N to save management settings. This will save the answers to the above three questions in the properties file and remember them the next time you go to install.

{{{

C:\workspace\CatPluginClient&gt;cuae package
Created package file
"C:\workspace\CatPluginClient\bin\CatPluginClient.mca"

C:\workspace\CatPluginClient&gt;cuae install
Enter management service uri or host/IP &lt;for example: localhost, tcp://1.1.1.1.:4001&gt;:
Enter management service login username:
Entermanagement service login password: ********
Save the amanagement settings with the project? [YyNn] n
Application : C:\workspace\CatPluginClient\bin\CatPluginClient.mca
Uploading :  ===========================&gt; 100%
Application ahas been installed successfully

}}}

===Configuring the Application in the Administration Interface===

====Adding a trigger====

1. Log in to the Administration interface.

2. Click **Applications**&gt;**Find/List Triggers** to generate a list of applications and their associated triggers.

3. Select the application CatPluginClient in the list.

4. For name enter "name" and for value enter "cat".

5. Click **Add Parameter**.

===Running the Application===

1. Run the class CatPluginClient.MainCatPluginClientClient to register the application.

At this point the application will remain registered and running until either you stop your application or the application loses connectivity to the Unified Application server.

2. The program will automatically detect and download new images as they are posted to the RSS feed. The application does not have to be manually triggered.</description>
      <pubDate>Fri, 30 Jul 2010 23:30:15 GMT</pubDate>
      <guid isPermaLink="false">http://developer.cisco.com/web/cuae/wikidocs?p_p_auth=BrzK1CFb&amp;p_p_id=36&amp;p_p_lifecycle=0&amp;p_r_p_185834411_nodeId=8398769&amp;p_r_p_185834411_title=&amp;CatPluginClient-Java</guid>
      <dc:creator>Bhuvaneswari Rajamanickam</dc:creator>
      <dc:date>2010-07-30T23:30:15Z</dc:date>
    </item>
    <item>
      <title>CatPluginClient-Designer 1.9</title>
      <link>http://developer.cisco.com/web/cuae/wikidocs?p_p_auth=BrzK1CFb&amp;p_p_id=36&amp;p_p_lifecycle=0&amp;p_r_p_185834411_nodeId=8398769&amp;p_r_p_185834411_title=&amp;CatPluginClient-Designer</link>
      <description>Designer implementation of CatPluginClient

==About the Application==


This application uses the [[]]. The application cannot be created if you do not have this plugin correctly created, installed, and running. 

==Creating the Application Project==

1. Open the Designer and Create a new project. (File&gt;New Project)

2. Create a project named "CatPluginClient":

{{1_newProject.JPG}}


3. When creating a new project, the Designer will prompt you to name first script and to select a triggering event for that script. However, we want to use a plugin trigger to trigger the app, and if you inspect the list of available triggers, you will note that the trigger "catplugin.CatPlugin.triggerOnImageUpdate"isnot currently available.So we need to add a reference to the plugin before we can select the proper trigger. So hit **Cancel** for now and do not add a script yet. (You will note that the Project itself has been created on the left hand side, there are just no scripts associated.

{{2_appScript.JPG}}

4. To add the reference, R-click on the CatPluginClient project in the Explorer window. Select **Add Reference**.

{{3_addReferences.JPG}}

5. Now we need to add the appropriate reference file, which differs between plugins and providers. Here We need to add only the provider reference.

  * **Provider**: Navigate to the file LolCatProvider\bin\Debug\LolCatProvider.dll 

Now select **Open**.


6. Now we can add a script to our project. Go to the explorer window and R-click on the project. Select **Add Script**&gt;**New Script**.
{{4_addNewScript.JPG}}

7. We will accept the default script name "script1". For the triggering event, select "catplugin.CatPlugin.triggerOnImageUpdate". Hit **OK**.
{{5_script1.JPG}}

===Handle 'OntriggerOnImageUpdate'===

Developing applications in the CUAD is an exercise in implementing handlers for various generated events. When you add new triggers or actions to your CUAD application, the Designer automatically inspects those triggers and actions and determines which events need to be handled.

These events will appear as 'tabs' above the Designer's canvas. To implement handlers for these events, you click on a tab and drag into the canvas new actions to be executed.

The first, and for now only event, we have in this application is the 'OntriggerOnImageUpdate' event. This is the event that is associated with the 'calplugin.CatPlugin.triggerOnImageUpdate' trigger that we specified at application creation.

We must now handle the 'OntriggerOnImageUpdate' event:

1. Click on the 'OntriggerOnImageUpdate' tab to highlight a canvas for this event:

{{6_OntriggerOnImageUpdate.JPG}}

2. When we are alerted that there is a new image, we want to download the image URL, create a GraphicFileMenu, and send it to the phone using SendExecute. So our first action is to get the image link. Since this is one of the actions created by the plugin, it is not in the Toolbox by default. Therefore, we must manually add it in. R-Click inside of the toolbox on the Cisco IP Phone menu and select "Add/Remove Items...".

{{7_addremoveitems.JPG}}


A window called "Customize Toolbox" will appear. Scroll to the bottom of the actions and check the box next to getImageLink. Click **OK**. Now if you scroll to the bottom of the CiscoIPPhone toolbox you will see the action for getImageLink.

{{8_addremoveitems2.JPG}}

3. Drag and drop the getImageLink action onto the canvas.

{{9_getImageCanvas.JPG}}

The Start node will automatically be connected to the new action. 

{{10_getimagelink.JPG}}


====Saving the Result====

The getImageLink action returns a url that we want to be able to access later in the script. Therefore, we need to save it to a local variable.

1. First we want to view the Variable tray. R-click anywhere on the canvas and click the first option, Variable Tray. 

**Tip**

//The variable tray can be viewed by either R-clicking on the canvas and selecting "Variable Tray", or by going to View&gt;Variable Tray. These actions will toggle the variable tray between being displayed and hidden//.
 
{{11_addVariableTray.JPG}}

2. Right click on the variable tray at the bottom of the canvas. Select "Add new item". Call the new variable imgURL. 

{{12_add_newItem.JPG}}

3. To store the result of getImageLink into imgURL, select the getImageLink action on the canvas. Go to the Properties box and click the dropdown menu for Result Date&gt; result. Select imgURL.

{{13_getResult.JPG}}

====Adding the GraphicFileMenu====


Now that we have the image URL saved in imgURL, we can use the data to create a graphic file menu.

1. Expand the CiscoIpPhone toolbox and locate CreateGraphicFileMenu. Drag and drop this action onto the canvas. To connect getImageLink to CreateGraphicFileMenu, move your cursor to the getImageLink icon. When your cursor approachs the center of the icon a 'dot' will appear in the center of the icon and your cursor will turn into a 'hand'. Once your cursor has become a 'hand', click and drag the cursor from the getImageLink action to the CreateGraphicFilMenu action. We will leave it as the default action to follow getImageLink.


{{14_CreateGraphicFileMenu.JPG}}


2. To set the parameters for CreateGraphicFileMenu, select the action in the designer canvas. When it is selected, a green box will outline the action. Go to the Properties box. You will have to set Format URL to "true", LocationX to "1", LocationY to "1", and title to "LolCat". We also want to initialize URL to our local variable imgURL. To do this, click on the plus sign next to URL to expand the options. Set user type to variable. Then set URL to imgURL from the drop down menu.

{{CreateGraphicFileMenuProperties.JPG}}


3. The result of CreateGraphicFileMenu is the xml object that we want to push to the phone. We need to save this data to a local variable in order to use it in another action. Create a local variable by R-clicking on the variable tray and selecting "Add new item". Call this item lolCat.

4. The default type for a variable is a string, which is what we used to store imgURL. However, since we want to store a graphic file menu, we need to specify this type. Click on the variable and go to the Properties toolbox. Under type, find and select "GraphicFileMenu". 


{{15_basicProperties.JPG}}

5. Now that we have setup a variable, let's save the result data to it. Click on CreateGraphicFileMenu on the designer canvas. Under ResultData, select lolCat from the drop-down menu.

{{16_graphicFileMenu.JPG}}


====If CreateGraphicFileMenu Fails====


1. If CreateGraphicFileMenu fails, then we want to end the application. To do this, expand Application Components in the Toolbox and drag and drop EndScript onto the canvas. Connect CreateGraphicFileMenu and EndScript. Since we want EndScript to occur only if CreateGraphicFileMenu fails, click on where the wire says "default", and reset this to "Failure" from the drop down menu.

{{17_failure.JPG}}

====If CreateGraphicFileMenu Succeeds====

1. If CreateGraphicFileMenu succeeds, then we want to send the resulting object to an IP Phone. Since we've already saved the data to the local variable lolCat, we are ready to send it to the phone. So expand Cisco Ip Phone in the toolbox. Find the action SendExecute and drag and drop it onto the canvas. Connect CreateGraphicFileMenu to SendExecute. 


{{18_SendExecute.JPG}}

2.Set the parameters for SendExecute in the Properties box. Message will be the variable lolCat, and password, phoneIp, and username are all strings.

{{18_SendExecute2.JPG}}

====Add an EndScript====

Since that is the end of the application, go to Application Components in the toolbox and drag and drop an EndScript. Connect it to SendExecute.

{{19_endScriptAdd.JPG}}

====Adding a new function to get a status update if any provider goes down while executing this application.====


1. Adding the function


{{20_Adding_StatusUpdate.JPG}}

2. Now we need to add two variables, **Provider** and **status**, to this newly added function and initialize these with the values **PluginName** and **Status** event variables. This is shown in the pictures below:

{{21_Adding_Variable_Provider.JPG}}
{{22_Adding_Variable_status.JPG}}

3. Now we'll add one **LogWrite** action. It will write the status update of the provider into the app-server logs. Populate the action parameters for this action as shown in the figure below.

{{23_Adding_LogWrite.JPG}}


  * Add EndFunction action in the end, as shown above. 


==Build &amp; Deploy the Application==

Prior to building and deploying the application, configure the "Connectivity" options between the CUAD and the CUAS.

  * Select "Tools -&gt; Options -&gt; Connectivity" from the top menu 
  * Enter the IP address and username / password for the CUAE server, then save the change. 


{{24_options.JPG}}


To both build and deploy the application, select "Build -&gt; Deploy" from the top menu (to Build without deploying, select "Build -&gt; Build Project").

**Note:**


//
  * The status of the build and deployment is displayed in the "Ouput" pane at the bottom of the CUAD. 
  * In the case that this is not you first deployment to the CUAE server you will be present with a pop-up prompt to select "Upgrade" or "Reinstall".// 
 

To view the status of the application in the CUAE Admin console. Log into the CUAE management console and select applications from the menu list.


===Adding A Trigger===

  * Select "Applications -&gt; Find/List Triggers" to generate a list of applications and their associated triggers. 
  * Select the application "CatPluginClient in the list. 
  * Enter "name" and "cat". Select "Add Parameter". 

{{25_trigger.JPG}}

==Running the Application==

The application should now be triggered automatically by the running CatPlugin.</description>
      <pubDate>Fri, 30 Jul 2010 23:20:32 GMT</pubDate>
      <guid isPermaLink="false">http://developer.cisco.com/web/cuae/wikidocs?p_p_auth=BrzK1CFb&amp;p_p_id=36&amp;p_p_lifecycle=0&amp;p_r_p_185834411_nodeId=8398769&amp;p_r_p_185834411_title=&amp;CatPluginClient-Designer</guid>
      <dc:creator>Bhuvaneswari Rajamanickam</dc:creator>
      <dc:date>2010-07-30T23:20:32Z</dc:date>
    </item>
    <item>
      <title>GatherDigitsTortureChamber-Java 1.9</title>
      <link>http://developer.cisco.com/web/cuae/wikidocs?p_p_auth=BrzK1CFb&amp;p_p_id=36&amp;p_p_lifecycle=0&amp;p_r_p_185834411_nodeId=8398769&amp;p_r_p_185834411_title=&amp;GatherDigitsTortureChamber-Java</link>
      <description>==Requirements==

The development machine where you are creating this application should have the following installed.

1. Install JDK 1.5. Version we have used is 1.5.0_15.

2. Eclipse editor. Version we have used is 3.3.2.

3. Install the CUAE Developer Tools to get the etch framework and cuae-tool.

==Create the Application Project==

1. Open a Command Prompt.

2. The cuae requires at a minimum the name of the application project, the implementation language (java or csharp), build format (ant or maven2), and the module name to get started. If the language and or the module name are omitted the tool will prompt you for them. Lets use the cuae tool to create a new application.

{{{
 C:\&gt; cd Wxp
 C:\Wxp&gt; cuae create GatherDigitsTortureChamber_Java

}}}

3. The cuae tool will ask for the type of project that you are creating. Answer application.

{{{

Project type? [application or plugin] application
}}}

4. The cuae tool will ask for the programming that we will be using for this application. Answer Java.

{{{
Programming language? [java or csharp] java
}}}

5. The cuae tool will ask for the build format that we will be using for this application. Answer Ant.

{{{
Build format? [ant or maven2] ant
}}}

6. The cuae tool will ask for the namespace that we will be using for this application. Just press Enter.
{{{
 Project namespace? [default: gatherdigitstorturechamber_java]
}}}

7. The cuae tool will ask for the application triggering event. For our application, we will be chosing the IncomingCall. Enter 4.

{{{

Available application triggering event:
   0: Skip this step
   1: cisco.uc.cuae.legacy.JTapi.JTapiIncomingCall
   2: cisco.uc.cuae.legacy.JTapi.JTapiCallInitiated
   3: cisco.uc.cuae.legacy.JTapi.JTapiCallEstablished
   4: cisco.uc.cuae.legacy.CallControl.IncomingCall
   5: cisco.uc.cuae.legacy.Http.GotRequest
   6: cisco.uc.cuae.legacy.Presence.SubscriptionTerminated
   7: cisco.uc.cuae.legacy.Presence.Notify
   8: cisco.uc.cuae.legacy.TimerFacility.TimerFire
Triggering event? [0-8] 4

}}}

8. Now the cuae tool will create the all the necessary files for this application.

{{{

 Generating:
    * application named "GatherDigitsTortureChamber_Java"
    * with namespace "gatherdigitstorturechamber_java"
    * with language "java"
    * with trigger event "cisco.uc.cuae.legacy.CallControl.IncomingCall"
    * in location C:\Wxp\
 Created project "GatherDigitsTortureChamber_Java" in directory "C:\Wxp\GatherDigitsTortureChamber_Java\"

}}}

9. Now goto C:\Wxp\GatherDigitsTortureChamber_Java folder. Open the file GatherDigitsTortureChamber_Java.etch in a notepad and add the following line "mixin cisco.uc.cuae.legacy.MediaControl" and save the file. We are adding the MediaControl mixin because the application will be playing some prompts. To play these prompts the media engine will be using TTS.

{{{

 // CUAE Application Etch Service Definition
 //
 // This service defines your application and the CUAE services that you
 // use in your application.

 // The service module namespace, this will be translated to the
 // namespace of the generated source code.
 module gatherdigitstorturechamber_java

 // The name of your service.
 service GatherDigitsTortureChamber_Java
 {
     // By default, you must always use the EtchBridge service. Do not
     // remove this mixin, otherwise your application won't work.
     mixin cisco.uc.cuae.EtchBridge

     // You may add any additional service mixins that you require. For
     // example, if you'd like to make and receive phone calls, add the
     // following line:
     //     mixin cisco.uc.cuae.legacy.CallControl
         mixin cisco.uc.cuae.legacy.CallControl
	mixin cisco.uc.cuae.legacy.MediaControl

}

}}}



10. From the cmd shell goto application directory, run "ant" command to generate source files.

11. Now open Eclipse. Click on File-&gt;New-&gt;Project

{{1_newProject.JPG}}


12. Now select "Java Project from Existing Ant BuildFile". Click Next
{{2_selectFrmExistingProj.JPG}}

13. Now Click on the Browse button and select C:\Wxp\GatherDigitsTortureChamber_Java\build.xml. Click on Open.

{{3_image.JPG}}

14. Now Click on "Finish" button to create the Java Project.

{{4_image.JPG}}

15. Basically the above steps generated all the files that are required for the development. Refresh the folder structure in Eclipse by Selecting the project and clicking F5.

{{6_image.JPG}}


16. Modify the String URI in MainGatherDigitsTortureChamber_JavaClient to match the IP address and port of the Cisco Unified Application Server. 

URI settings vary slightly between 2.5(1) Beta 1 and more recent versions of 2.5(1), as follows:

====2.5(1) and 2.5(1) Beta 2, Beta 3, Beta 4 &amp; later releases====


{{{

// TODO Change to correct URI
String uri = "tls://appserver_ipaddress:9000?TlsConnection.authReqd=false&amp;filter=KeepAlive
 &amp;KeepAlive.Count=5&amp;Packetizer.maxPktSize=102400&amp;TcpTransport.reconnectDelay=4000";

}}}


**Note:**

// In Beta 2, the Etch Bridge was updated to use [[Etch Bridge TLS|Transport Layer Security]] for encryption by default. For your applications to work, you must specify TLS as the protocol in the URI and set the authReqd parameter to false. In the example above, the [[Keep Alive]] filter and [[MaxPacketSize]] and [[Etch Connection URI | Reconnect Delay]] parameters have also been set//.
 


==== 2.5(1) Beta 1====

{{{


// TODO Change to correct URI
		String uri = "tcp://appserver_ipaddress:9000?&amp;TcpConnection.reconnect_delay=4000";

}}}

 //In addition to setting the correct IP address and port for the Cisco Unfied Application Server, the Reconnect Delay parameter should be set on all connection URIs//. 
 

17. Also write the below code where the comment "//TODO Insert Your Code Here" exists. Provide the administrator credential to access the system

{{{

// TODO Insert Your Code Here
// Register application with correct name and partition. Administrator credential required to register.

String key = server.registerApplication("GatherDigitsTortureChamber_Java", "Default", "&lt;username&gt;", "&lt;password&gt;");
System.out.println("GatherDigitsTortureChamber_Java registered with key = " + key);
System.out.println( "Hit any key to exit." );
System.in.read();

}}}

18. Now open ImplGatherDigitsTortureChamber_JavaClient.java. Write in the following methods.

{{{


// TODO insert methods here to provide implementations of GatherDigitsTortureChamber_JavaClient
// messages from the server.

@Override
public void incomingCall(String sessionId, IncomingCallOptions options)
{
	//Answer call
	AnswerCallResult acResult = server.answerCall(sessionId, options.callId, options.displayName, null);
	if (acResult.returnValue != CuaeResult.SUCCESS)
	{
		System.out.println("AnswerCall failed");
		server.removeCuaeSession(sessionId);
		return;
	}

	//Play the prompt in non-blocking fashion, pass in AnswerCallResult as state info
	String sPrompt1 = "Enter 6 digits within 6 seconds or enter the pound sign to complete this call.";
	PlayResult prResult = server.beginPlay(sessionId, sPrompt1, acResult.connectionId, null, null, null);
	if (prResult.returnValue != CuaeResult.SUCCESS)
	{
		System.out.println("beginPlay failed");
		server.removeCuaeSession(sessionId);
	}
}

@Override
public void onPlayComplete(String sessionId, PlayResult results, Object state)
{

	//Set the values for the GatherDigitsOptions.
	//Basically setting up the options for the various Termination Conditions
	GatherDigitsOptions gdOptions = new GatherDigitsOptions();

	gdOptions.setTermCondDigitPattern("#");
	gdOptions.setTermCondMaxDigits(6l);
	gdOptions.setTermCondMaxTime(6000l);

	GatherDigitsResult gdResult = server.beginGatherDigits(sessionId, results.connectionId, gdOptions, state);

	if (gdResult.returnValue != CuaeResult.SUCCESS)
	{
		System.out.println("GatherDigits failed");
		server.removeCuaeSession(sessionId);
	}
}

@Override
public void onGatherDigitsComplete(String sessionId, GatherDigitsResult results, Object state)
{
	//Play back the digits that the user has entered
	String sPrompt1 = "You have entered " + results.digits;
	PlayResult prResult = server.beginPlay(sessionId, sPrompt1, results.connectionId, null, null, null);
	if (prResult.returnValue != CuaeResult.SUCCESS)
		System.out.println("beginPlay failed");

	server.removeCuaeSession(sessionId);
}

@Override
public void startTx(String sessionId,StartTxOptions options)
{
}

@Override
public void startRx(String sessionId,StartRxOptions options)
{
}

@Override
public void stopTx(String sessionId,StopTxOptions options)
{
}

@Override
public void remoteHangup(String sessionId,RemoteHangupOptions options)
{
}

@Override
public void gotDigits(String sessionId, GotDigitsOptions options)
{
}

}}}


==Build the Application.==

1. Locate build.xml (left side application tree in IDE) R-Click on the build.xml-&gt;Run As-&gt;Ant build. You will get the following output.

{{{

Buildfile: C:\Wxp\GatherDigitsTortureChamber_Java\build.xml
compileetch:
     [exec] May 16, 2008 5:55:44 PM org.apache.velocity.runtime.log.JdkLogChute log
     [exec] INFO: FileResourceLoader : adding path '.'
     [exec] *** warning: cannot document parameter configs of logWrite
     [exec] May 16, 2008 5:55:45 PM org.apache.velocity.runtime.log.JdkLogChute log
     [exec] INFO: FileResourceLoader : adding path '.'
     [exec] *** warning: cannot document parameter configs of logWrite
copyfile:
copyfile:
   [delete] Deleting: C:\Wxp\GatherDigitsTortureChamber_Java\etch-generated\etch-src\gatherdigitstorturechamber_java\ImplGatherDigitsTortureChamber_JavaClient.java
   [delete] Deleting: C:\Wxp\GatherDigitsTortureChamber_Java\etch-generated\etch-src\gatherdigitstorturechamber_java\MainGatherDigitsTortureChamber_JavaClient.java
init:
     [copy] Copying 3 files to C:\Wxp\GatherDigitsTortureChamber_Java\bin
build:
     [echo] GatherDigitsTortureChamber_Java: C:\Wxp\GatherDigitsTortureChamber_Java\build.xml
    [javac] Compiling 62 source files to C:\Wxp\GatherDigitsTortureChamber_Java\bin
      [jar] Building jar: C:\Wxp\GatherDigitsTortureChamber_Java\dist\GatherDigitsTortureChamber_Java.jar
BUILD SUCCESSFUL
Total time: 9 seconds

}}}

2. Now goto the command prompt

{{{

 C:\&gt; cd Wxp\GatherDigitsTortureChamber_Java
 C:\Wxp\GatherDigitsTortureChamber_Java&gt;cuae package
 Created package 



file "C:\Wxp\GatherDigitsTortureChamber_Java\bin\GatherDigitsTortureChamber_Java.mca"

}}}

3. Installing The Test Application

  * To install the test application on a CUAE server, execute the **cuae install** command from a DOS command shell in test application parent directory of the test application. The cuae install command varies slightly between 2.5(1) Beta 1 and Beta 2. 


====2.5(1) Beta 2====

You are prompted to enter an IP address, username, and password (to view the help, run the **cuae install -h** command). When prompted, enter Y or N to save management settings. This will save the answers to the above three questions in the properties file and remember them the next time you go to install.


**Note:**

 //You are also prompted for the communications protocol (TCP or TLS). Select the protocol that is set on the Management Service. TLS is the default supported protocol. If you want to use TCP, follow the instructions in [[Management Service TLS | Management Service Transport Layer Security (TLS)]] to change the default URI of the Management Service before running these commands//.
 
{{{

C:\Wxp\GatherDigitsTortureChamber_Java&gt;cuae package
Created package file
"C:\Wxp\GatherDigitsTortureChamber_Java\bin\GatherDigitsTortureChamber_Java.mca"

C:\Wxp\GatherDigitsTortureChamber_Java&gt;cuae install
Enter the hostname or IP address of the management service (for example: localhost, 1.1.1.1): localhost
Protocol: tls
Generated mgmt-service uri: tls://localhost:9001?TlsConnection.authReqd=false
Enter management service login username:
Entermanagement service login password: ********
Save the amanagement settings with the project? [yes or no] no
Application : C:\Wxp\GatherDigitsTortureChamber_Java\bin\GatherDigitsTortureChamber_Java.mca
Uploading :  ===========================&gt; 100%
Application has been installed successfully

}}}

====2.5(1) Beta 1====

You are prompted to enter an IP address, username, and password (to view the help, run the **cuae install -h** command). When prompted, enter Y or N to save management settings. This will save the answers to the above three questions in the properties file and remember them the next time you go to install.

{{{

C:\Wxp\GatherDigitsTortureChamber_Java&gt;cuae package
Created package file
"C:\Wxp\GatherDigitsTortureChamber_Java\bin\GatherDigitsTortureChamber_Java.mca"

C:\Wxp\GatherDigitsTortureChamber_Java&gt;cuae install
Enter management service uri or host/IP &lt;for example: localhost, tcp://1.1.1.1.:4001&gt;:
Enter management service login username:
Entermanagement service login password: ********
Save the amanagement settings with the project? [YyNn] n
Application : C:\Wxp\GatherDigitsTortureChamber_Java\bin\GatherDigitsTortureChamber_Java.mca
Uploading :  ===========================&gt; 100%
Application ahas been installed successfully

}}}

==Run the Application.==

1. TO run the application, goto the eclipse editor and R-Click on MainGatherDigitsTortureChamber_JavaClient.java and Select "Run As" -&gt; "Java Application".


{{7_runApplication.JPG}}

At this point the application will remain registered and running until either you stop your application or the application loses connectivity to the Unified Application server.

Place an incomming call to cuae to trigger the application.</description>
      <pubDate>Fri, 30 Jul 2010 23:10:09 GMT</pubDate>
      <guid isPermaLink="false">http://developer.cisco.com/web/cuae/wikidocs?p_p_auth=BrzK1CFb&amp;p_p_id=36&amp;p_p_lifecycle=0&amp;p_r_p_185834411_nodeId=8398769&amp;p_r_p_185834411_title=&amp;GatherDigitsTortureChamber-Java</guid>
      <dc:creator>Bhuvaneswari Rajamanickam</dc:creator>
      <dc:date>2010-07-30T23:10:09Z</dc:date>
    </item>
    <item>
      <title>BasicExtensionMobility-Java 2.2</title>
      <link>http://developer.cisco.com/web/cuae/wikidocs?p_p_auth=BrzK1CFb&amp;p_p_id=36&amp;p_p_lifecycle=0&amp;p_r_p_185834411_nodeId=8398769&amp;p_r_p_185834411_title=&amp;BasicExtensionMobility-Java</link>
      <description>==About Application==

BasicExtensionMobility

You would need to create a extension mobility device profile for the specific device you are applying the profile on. Also, you would need to create a phone service in communications manager and point to the CUAE server hosting this particular application.

==Create the Application project==


1. Open a command shell

2. The cuae requires at a minimum the name of the application project, the
implementation language and the module name in the java to get started. If the
language and or the module name are omitted the tool will prompt the you for
them. Lets use the cuae tool to create a new application.
{{{
cuae create BasicExtensionMobility
}}}

3. First the tool will ask you if you are building an application or a
plugin. Answer application:
{{{

Project Type? [application or plugin] application
}}}

4. Next the tool will ask you to specify the programming language. Answer
java:
{{{
Programming language? [java or csharp] java
}}}
5. Next the tool will ask you to specify the build format. Answer
ant:
{{{
Build format? [ant or maven2] ant
}}}

6. Next the tool will ask you for the namespace for the application. You can provide a name or accept the default. Let's accept the default for this sample application basicextensionmobility:
{{{
Project namespace? [default: basicextensionmobility] &lt;Return&gt;
}}}

7. Finally the tool will ask if you would like to specify a triggering event.
All CUAE applications will need to register against at least one triggering
event. You can specify the triggering event now or wait and specify the
triggering event later. You can also change the triggering event during
development. Again since we know that this application needs to be triggered on
an Http request, lets go ahead and specify the triggering event now. Select
cisco.uc.cuae.legacy.Http.GotRequest (option 5):

{{{

Available application triggering event:
  0: Skip this step
  1: cisco.uc.cuae.legacy.JTapi.JTapiIncomingCall
  2: cisco.uc.cuae.legacy.JTapi.JTapiCallInitiated
  3: cisco.uc.cuae.legacy.JTapi.JTapiCallEstablished
  4: cisco.uc.cuae.legacy.CallControl.IncomingCall
  5: cisco.uc.cuae.legacy.Http.GotRequest
  6: cisco.uc.cuae.legacy.Presence.SubscriptionTerminated
  7: cisco.uc.cuae.legacy.Presence.Notify
  8: cisco.uc.cuae.legacy.TimerFacility.TimerFire
Triggering event? [0-8] 5
}}}

The tool now has enough information to generate the project template.

{{{

Generating:
   * application named "BasicExtensionMobility"
   * with namespace "BasicExtensionMobility"
   * with laguage "java"
   * with trigger event "cisco.uc.cuae.legacy.CallControl.Http.GotRequest"
   * in location C:\workspace\
Created project "BasicExtensionMobility" in directory
"C:\workspace\BasicExtensionMobility\"
}}}

===Mixin services===

The first step in building an Etch-based CUAE application is identifying which
services the application requires and updating the .etch file to mixin those
services into the application. For this application we will want to service an incoming HTTP request and display miscellaneous menus on the phone screen. 
The default etch file already has a mixin for Http as we selected it as the triggering event:
{{{
  mixin cisco.uc.cuae.legacy.Http
}}}

So we need to add a mixin declaration for CiscoIpPhone and CiscoExtensionMobility:

{{{
    mixin cisco.uc.cuae.legacy.CiscoIpPhone
    mixin cisco.uc.cuae.legacy.CiscoExtensionMobility
}}}

===Config Runtime Parameter===

Some parameters are passed in to the program at runtime. These are specified through config.yaml file as follows:

{{{
configuration:
    - name: deviceName
      displayName: Device Name
      format: String

    - name: callManagerAdmin
      displayName: Call Manager Administrator
      format: String
 
    - name: callManagerAdminPassword
      format: String
      displayName: Call Manager Admin Password

    - name: callManagerHost
      format: String
      displayName: Call Manager Host

    - name: diviceProfile
      format: String
      displayName: Extension Mobility Device Profile
      
    - name: deviceIP
      format: String
      displayName: Device IP
}}}

===Generate Sources - ant===

  * To use "ant" to generate the source file templates for this application and a build.xml file, enter the following command from the application directory
BasicExtensionMobility&gt; ant 

===Making a connection to the listener===

  * Two items need to be done inside main() function of MainBasicExtensionMobilityClient to enable the client application register to the CUAE server. First, modify the String URI to match the IP address and port of the Cisco Unified Application Server. 
URI settings vary slightly between 2.5(1) Beta 1 and more recent versions of 2.5(1), as follows:


====2.5(1) and 2.5(1) Beta 2, Beta 3, Beta 4 &amp; later releases====
{{{
// TODO Change to correct URI
String uri = "tls://appserver_ipaddress:9000?TlsConnection.authReqd=false&amp;filter=KeepAlive
 &amp;KeepAlive.Count=5&amp;Packetizer.maxPktSize=102400&amp;TcpTransport.reconnectDelay=4000;
}}}

**Note:**

 //In Beta 2, the Etch Bridge was updated to use [[Etch Bridge TLS|Transport Layer Security]] for encryption by default. For your applications to work, you must specify TLS as the protocol in the URI and set the authReqd parameter to false. In the example above, the [[Keep Alive]] filter and [[MaxPacketSize]] and [[Etch Connection URI | Reconnect Delay]] parameters have also been set//.

 
Secondly, call server.registerApplication() to do the actual registration.
Place the code after "// TODO Insert Your Code Here"

{{{

String key = server.registerApplication("BasicExtensionMobility", "Default", "&lt;username&gt;", "&lt;password&gt;");
System.out.println("BasicExtensionMobility registered: " + key);
System.in.read();
}}}

** Note:**

//At this point the application will remain registered and running until either you stop your application or the application looses connectivity to the cuae server//.

====2.5(1) Beta 1====
{{{ 

// TODO Change to correct URI
		String uri = "tcp://appserver_ipaddress:9000?&amp;TcpConnection.reconnect_delay=4000";
}}}
**Note:**

// In addition to setting the correct IP address and port for the Cisco Unfied Application Server, the Reconnect Delay parameter should be set on all connection URIs//. 
 
Secondly, call server.registerApplication() to do the actual registration.
Place the code after "// TODO Insert Your Code Here"

{{{
String key = server.registerApplication("BasicExtensionMobility", "Default", "&lt;username&gt;", "&lt;password&gt;");
System.out.println("BasicExtensionMobility registered: " + key);
System.in.read();
}}}

** Note**

//At this point the application will remain registered and running until either you stop your application or the application looses connectivity to the cuae server//.
  

===Servicing incoming triggering event===

  * We need to call a specific function to service incoming gotRequest event. This is achieved by calling gotRequest() function. Inside this function, parse options.url object to access the incoming parameters and perform various actions accordingly. Idea is to format an xml object based on end user choices and pass itback to the phone that activated the service. Implement the following methods in ImplBasicExtensionMobility.java file. 

====Code Sample====
{{{
	// TODO insert methods here to provide implementations of
	// BasicExtensionMobilityClient
	// messages from the server.

	private String deviceName, deviceIP, callManagerIP, pushUserName,
		pushUserPassword,deviceProfile;

	public void gotRequest( String sessionId, GotRequestOptions options )
	{
		// TODO Auto-generated method stub
		// super.gotRequest(sessionId, options);
		ConfigEntry[] configs = null;
		try
		{
			configs = server.getConfig( "Default" );
		}
		catch ( Exception e )
		{
			System.out
				.println( "Failed to get config entries for partition Default" );
			server.removeCuaeSession( sessionId );
			return;
		}

		try
		{
			for (int i = 0; i &lt; configs.length; i++)
			{
				if (configs[i].name.matches( "deviceName" ))
					deviceName = configs[i].configValue.toString();
				else if (configs[i].name.matches( "deviceIP" ))
					deviceIP = configs[i].configValue.toString();
				else if (configs[i].name.matches( "callManagerAdmin" ))
					pushUserName = configs[i].configValue.toString();
				else if (configs[i].name.matches( "callManagerAdminPassword" ))
					pushUserPassword = configs[i].configValue.toString();
				else if (configs[i].name.matches( "callManagerHost" ))
					callManagerIP = configs[i].configValue.toString();
                                else if (configs[i].name.matches( "deviceProfile" ))
					deviceProfile = configs[i].configValue.toString();
			}
		}
		catch ( Exception e )
		{
			System.out.println( "Error reading application configs: "
				+ e.getMessage() );
		}

		if (options.url.startsWith( "/mobilitySelection" ))
		{
			// extract query params
			System.out.println( "/processUserinput String: " + options.query );
			int userIndex = options.query.indexOf( "userID=" );
			int pinIndex = options.query.indexOf( "userPin=" );
			int valueIndex = options.query.indexOf( "value=" );
			String queryUserID = options.query.substring( (userIndex + 7),
				(pinIndex - 1) );
			String queryUserPin = options.query.substring( (pinIndex + 8),
				(options.query.length()) );
			String queryValue = options.query.substring( (valueIndex + 6),
				(userIndex - 1) );

			// send a log indicating ongoing "logging in" process
			server.sendResponse( sessionId, options.remoteHost, 200,
				"text/html", queryUserID + " is logging in ...", "OK", null );

			// check if user requested 'login' or 'logout'
			if (queryValue.equals( "Login" ))
			{
				System.out.println( "Calling Login now" );
				LoginOptions lio = new LoginOptions();
				lio.deviceProfile = deviceProfile;
				LoginResult lir = server.login( sessionId, queryUserID,
					deviceName, callManagerIP,
					Version.V6, pushUserName,
					pushUserPassword, lio );

				if (lir.returnValue.equals( "success" ))
					System.out.println( "Login successful" );

				// CreateExecute
				CreateExecuteOptions ceo = new CreateExecuteOptions();
				ceo.url1 = "Init:Services";

				CreateExecuteResult cer = server.createExecute( sessionId, ceo );

				if (!cer.returnValue.equalsIgnoreCase( "success" ))
				{
					System.out.println( "cer failed" );
				}
				else
				{
					// SendExecute
					System.out.println( "cer passed" );
					SendExecuteOptions seo = new SendExecuteOptions();
					seo.username = queryUserID;
					seo.password = queryUserPin;
					SendExecuteResult ser = server.sendExecute( sessionId,
						cer.xmlObject, deviceIP, seo );
					if (!ser.returnValue.equalsIgnoreCase( "success" ))
						server.sendResponse( sessionId, options.remoteHost,
							200, "text/plain", "SendExecute failed!", "OK",
							null );
					else
						server.sendResponse( sessionId, options.remoteHost,
							200, "text/plain", "Done!", "OK", null );
				}
			}
			else if (queryValue.equals( "Logout" ))
			{
				// logout
				LogoutResult lor = server.logout( sessionId, deviceName,
					callManagerIP, Version.V6,
					pushUserName, pushUserPassword, null );

				if (lor.returnValue.equals( "success" ))
					System.out.println( "Logout successful" );
			}
		}
		if (options.url.startsWith( "/processUserInput" ))
		{

			System.out.println( "/processUserinput String: " + options.query );
			int userIndex = options.query.indexOf( "userID=" );
			int pinIndex = options.query.indexOf( "userPin=" );
			String queryUserID = options.query.substring( (userIndex + 7),
				(pinIndex - 1) );
			String queryUserPin = options.query.substring( (pinIndex + 8),
				(options.query.length()) );

			CreateMenuOptions cmo = new CreateMenuOptions();
			cmo.prompt = "Please make a selection";
			cmo.title = "Extension mobility";

			CreateMenuResult cmr = server.createMenu( sessionId, cmo );

			// Add menu item for "login"
			AddMenuItemOptions amio1 = new AddMenuItemOptions();
			amio1.name = "Login";
			amio1.uRL = "http://" + options.host
				+ "/mobilitySelection?metreosSessionId=" + sessionId
				+ "&amp;value=Login" + "&amp;userID=" + queryUserID + "&amp;userPin="
				+ queryUserPin;

			AddMenuItemResult amir1 = server.addMenuItemToMenu( sessionId,
				amio1 );

			// Add menu item for "logout"
			AddMenuItemOptions amio2 = new AddMenuItemOptions();
			amio2.name = "Logout";
			amio2.uRL = "http://" + options.host
				+ "/mobilitySelection?metreosSessionId=" + sessionId
				+ "&amp;value=Logout" + "&amp;userID=" + queryUserID + "&amp;userPin="
				+ queryUserPin;
			amio2.xmlObject = amir1.xmlObject;

			AddMenuItemResult amir2 = server.addMenuItemToMenu( sessionId,
				amio2 );

			server.sendResponse( sessionId, options.remoteHost, 200,
				"text/xml", amir2.xmlObject, "OK", null );

		}
		else
		{
			CreateInputOptions cio = new CreateInputOptions();
			cio.title = "Extension Mobility";
			cio.uRL = "http://" + options.host
				+ "/processUserInput?metreosSessionId=" + sessionId;

			CreateInputResult cir = server.createInput( sessionId, cio );

			AddInputItemOptions aiio = new AddInputItemOptions();
			aiio.xmlObject = cir.xmlObject;
			aiio.displayName = "User";
			aiio.inputFlags = "A";
			aiio.queryStringParam = "userID";

			AddInputItemResult aiir = server.addInputItem( sessionId, aiio );

			AddInputItemOptions aiio2 = new AddInputItemOptions();
			aiio2.xmlObject = aiir.xmlObject;
			aiio2.displayName = "Pin";
			aiio2.inputFlags = "A";
			aiio2.queryStringParam = "userPin";

			AddInputItemResult aiir2 = server.addInputItem( sessionId, aiio2 );

			server.sendResponse( sessionId, options.remoteHost, 200,
				"text/xml", aiir2.xmlObject, "OK", null );
		}
		// End Script
		server.removeCuaeSession( sessionId );
	}

}}}

===Packaging The Test Application===

#Execute a successful build request for you test application within your IDE 
#To package the JAVA application, run execute the "cuae package" command
from a DOS command shell in test application parent directory of the test application. 
{{{

C:\workspace\BasicExtensionMobility&gt;cuae package
Created package file
"C:\workspace\BasicExtensionMobility\bin\BasicExtensionMobility.mca"
}}}

===Installing The Test Application===

 *To install the test application on a CUAE server, execute the **cuae install** command from a DOS command shell in test application parent directory of the test application. The **cuae install** command varies slightly between 2.5(1) Beta 1 and Beta 2. 

====2.5(1) Beta 2====


You are prompted to enter an IP address, username, and password (to view the help, run the cuae install -h command). When prompted, enter Y or N to save management settings. This will save the answers to the above three questions in the properties file and remember them the next time you go to install.


**Note:**

 //You are also prompted for the communications protocol (TCP or TLS). Select the protocol that is set on the Management Service. TLS is the default supported protocol. If you want to use TCP, follow the instructions in [[Management Service TLS | Management Service Transport Layer Security (TLS))]] to change the default URI of the Management Service before running these commands//.
 
{{{
C:\workspace\BasicExtensionMobility&gt;cuae package
Created package file
"C:\workspace\BasicExtensionMobility\bin\BasicExtensionMobility.mca"

C:\workspace\BasicExtensionMobility&gt;cuae install
Enter the hostname or IP address of the management service (for example: localhost, 1.1.1.1): localhost
Protocol: tls
Generated mgmt-service uri: tls://localhost:9001?TlsConnection.authReqd=false
Enter management service login username:
Entermanagement service login password: ********
Save the amanagement settings with the project? [yes or no] no
Application : C:\workspace\BasicExtensionMobility\bin\BasicExtensionMobility.mca
Uploading :  ===========================&gt; 100%
Application has been installed successfully

}}}

====2.5(1) Beta 1====
**Note:**

//You are prompted to enter an IP address, username, and password (to view the help, run the **cuae install -h** command). When prompted, enter Y or N to save management settings. This will save the answers to the above three questions in the properties file and remember them the next time you go to install//.

{{{
C:\workspace\BasicExtensionMobility&gt;cuae package
Created package file
"C:\workspace\BasicExtensionMobility_JAVA\bin\BasicExtensionMobility.mca"

C:\workspace\BasicExtensionMobility&gt;cuae install
Enter management service uri or host/IP &lt;for example: localhost, tcp://1.1.1.1.:4001&gt;:
Enter management service login username:
Entermanagement service login password: ********
Save the amanagement settings with the project? [YyNn] n
Application : C:\workspace\BasicExtensionMobility\bin\BasicExtensionMobility.mca
Uploading :  ===========================&gt; 100%
Application ahas been installed successfully

}}}

===Executing the application.===

  * Once the client application is installed on the server, the phone service is created on the CCM, and the service is pointing to the CUAE server, the client application can be invoked. Once the client application is invoked (through console or from within your IDE), it is ready to service the incoming triggers from the CUAE server. 

  * You need to add trigger parameters. Goto Applications -&gt; List triggers, Click on BasicExtensionMobility link and add following different url as parameters and its values. 

{{{
  * http://&lt;cuae-server&gt;:8000/&lt;Your application trigger&gt; 
  * http://&lt;cuae-server&gt;:8000/processUserInput 
  * http://&lt;cuae-server&gt;:8000/mobilitySelection
}}}</description>
      <pubDate>Fri, 30 Jul 2010 22:59:05 GMT</pubDate>
      <guid isPermaLink="false">http://developer.cisco.com/web/cuae/wikidocs?p_p_auth=BrzK1CFb&amp;p_p_id=36&amp;p_p_lifecycle=0&amp;p_r_p_185834411_nodeId=8398769&amp;p_r_p_185834411_title=&amp;BasicExtensionMobility-Java</guid>
      <dc:creator>Bhuvaneswari Rajamanickam</dc:creator>
      <dc:date>2010-07-30T22:59:05Z</dc:date>
    </item>
    <item>
      <title>SimpleJtapiPhoneMonitor-Java 1.5</title>
      <link>http://developer.cisco.com/web/cuae/wikidocs?p_p_auth=BrzK1CFb&amp;p_p_id=36&amp;p_p_lifecycle=0&amp;p_r_p_185834411_nodeId=8398769&amp;p_r_p_185834411_title=&amp;SimpleJtapiPhoneMonitor-Java</link>
      <description>==About Application==

SimpleJtapiPhoneMonitor

===Create the Application project===

1. Open a command shell

2. The cuae requires at a minimum the name of the application project, the
implementation language and the module name in the java to get started. If the
language and or the module name are omitted the tool will prompt the you for
them. Lets use the cuae tool to create a new application.
{{{
cuae create SimpleJtapiPhoneMonitor
}}}

3. First the tool will ask you if you are building an application or a
plugin. Answer application:
{{{
Project Type? [application or plugin] application
}}}

4. Next the tool will ask you to specify the programming language. Answer
java:
{{{
Programming language? [java or csharp] java
}}}
5. Next the tool will ask you to specify the build format. Answer
ant:
{{{
Build format? [ant or maven2] ant
}}}

6. Next the tool will ask you for the namespace for the application. You can provide a name or accept the default. Let's accept the default for this sample application SimpleIpPhoneMenuTree:
{{{
Project namespace? [default: simplejtapiphonemonitor] &lt;Return&gt;
}}}

7. Finally the tool will ask if you would like to specify a triggering event. All CUAE applications will need to register against at least one triggering event. You can specify the triggering event now or wait and specify the triggering event later. You can also change the triggering event during development. Again since we know that this application needs to be triggered on an Http request, lets go ahead and specify the triggering event now. Select cisco.uc.cuae.legacy.JTapi.JTapiCallInitiated (option 2):

{{{
Available application triggering event:
  0: Skip this step
  1: cisco.uc.cuae.legacy.JTapi.JTapiIncomingCall
  2: cisco.uc.cuae.legacy.JTapi.JTapiCallInitiated
  3: cisco.uc.cuae.legacy.JTapi.JTapiCallEstablished
  4: cisco.uc.cuae.legacy.CallControl.IncomingCall
  5: cisco.uc.cuae.legacy.Http.GotRequest
  6: cisco.uc.cuae.legacy.Presence.SubscriptionTerminated
  7: cisco.uc.cuae.legacy.Presence.Notify
  8: cisco.uc.cuae.legacy.TimerFacility.TimerFire
Triggering event? [0-8] 2
}}}

The tool now has enough information to generate the project template.
{{{
Generating:
   * application named "SimpleJtapiPhoneMonitor"
   * with namespace "simplejtapiphonemonitor"
   * with laguage "java"
   * with trigger event "cisco.uc.cuae.legacy.JTapi.JTapiCallInitiated"
   * in location C:\Development\Java\workspace\
Created project "SimpleJtapiPhoneMonitor" in directory
"C:\Development\Java\workspace\SimpleJtapiPhoneMonitor\"
}}}

===Mixin services===

The first step in building an Etch-based CUAE application is identifying which services the application requires and updating the .etch file to mixin those
services into the application. For this application we will want to service an JTapi events. The default etch file already has a mixin for Jtapias we selected it as the triggering event:
{{{
 mixin cisco.uc.cuae.legacy.JTapi
}}}

===Generate Sources - ant===

  * To use "ant" to generate the source file templates for this application and a build.xml file, enter the following command from the application directory
SimpleJtapiPhoneMonitor&gt; ant 

===Making a connection to the listener===

====Code Sample====

{{{

public static void main( String[] args ) throws Exception
{
	// TODO Change to correct URI
	String uri = "tcp://localhost:4001";
		
	RemoteSimpleJtapiPhoneMonitorServer server = SimpleJtapiPhoneMonitorHelper.newServer( uri, null,
		new MainSimpleJtapiPhoneMonitorClient() );

	// Connect to the service
	server._startAndWaitUp( 4000 );

	// TODO Insert Your Code Here
	String key = server.registerApplication("SimpleJtapiPhoneMonitor", "Default", "Administrator", "metreos");
	System.out.println("SimpleJtapiPhoneMonitor registered: " + key);
	System.in.read();

	// Disconnect from the service
	server._stopAndWaitDown( 4000 );
}
}}}

Two items need to be done inside main() function to enable the client application register to the CUAE server. First, call server.registerApplication() to do the actual registration.

1. To make a connection to the listener, add a server.registerApplication() request after the line "// TODO Insert Your Code Here"

{{{

String key = server.registerApplication("SimpleJtapiMonitor", "Default", "&lt;username&gt;", "&lt;password&gt;");
System.out.println("SimpleJtapiMonitor registered: " + key);
System.in.read();
}}}

2. Modify the String URI to match the IP address and port of the Cisco Unified Application Server. 

URI settings vary slightly between 2.5(1) Beta 1 and more recent versions of 2.5(1), as follows:

====2.5(1) and 2.5(1) Beta 2, Beta 3, Beta 4 &amp; later releases====



{{{

// TODO Change to correct URI
String uri = "tls://appserver_ipaddress:9000?TlsConnection.authReqd=false&amp;filter=KeepAlive
 &amp;KeepAlive.Count=5&amp;Packetizer.maxPktSize=102400&amp;TcpTransport.reconnectDelay=4000";

}}}

 
//In Beta 2, the Etch Bridge was updated to use [[Etch Bridge TLS|Transport Layer Security]] for encryption by default. For your applications to work, you must specify TLS as the protocol in the URI and set the authReqd parameter to false. In the example above, the [[Keep Alive]] filter and [[MaxPacketSize]] and [[Etch Connection URI | Reconnect Delay]] parameters have also been set//.
 

==== 2.5(1) Beta 1====
{{{
// TODO Change to correct URI
		String uri = "tcp://appserver_ipaddress:9000?&amp;TcpConnection.reconnect_delay=4000";

}}}

// In addition to setting the correct IP address and port for the Cisco Unfied Application Server, the Reconnect Delay parameter should be set on all connection URIs//. 
 

===Servicing incoming triggering event===

  * We need to call a number of specific function to service incoming JTapi events. Implement JTAPI events in ImplSimpleJtapiPhoneMonitorClient.java file. Write the following code after the lines 

~// TODO insert methods here to provide implementations of SimpleJtapiPhoneMonitorClient
~// messages from the server.

====Code Sample====
{{{

	@Override
	public void jTapiCallInitiated(String sessionId, JTapiCallInitiatedOptions options) {
		// TODO Auto-generated method stub
		//super.jTapiCallInitiated(sessionId, options);	
		
		server.logWrite( LogLevel.INFO, "Call Initiated \n\n***** SimpleJtapiPhoneMonitor Received OnJTapiCallInitiated Event *****\n\n" );

	}
	
	@Override
	public void jTapiCallActive(String sessionId, JTapiCallActiveOptions options) {
		// TODO Auto-generated method stub
		//super.jTapiCallActive(sessionId, options);
		
		server.logWrite( LogLevel.INFO, "Call Active \n\n***** SimpleJtapiPhoneMonitor Received OnJTapiCallActive Event *****\n\n" );

	}
	
	@Override
	public void jTapiGotDigits(String sessionId, JTapiGotDigitsOptions options) {
		// TODO Auto-generated method stub
		//super.jTapiGotDigits(sessionId, options);
		
		 server.logWrite( LogLevel.INFO, "Call GotDigits \n\n***** SimpleJtapiPhoneMonitor Received OnJTapiGotDigits Event *****\n"
	                + "***** Digit(s): " + options.digits + " From Device: " + options.deviceName + " *****\n\n" );

	}
	
	@Override
	public void jTapiIncomingCall(String sessionId,
			JTapiIncomingCallOptions options) {
		// TODO Auto-generated method stub
		//super.jTapiIncomingCall(sessionId, options);
		
		server.logWrite( LogLevel.INFO, "Incoming call \n\n***** SimpleJtapiPhoneMonitor Received OnJTapiIncomingCall Event from " +
                "phone: " + options.from + " *****\n\n" );

	}
	
	@Override
	public void jTapiHangupCall(String sessionId, JTapiHangupCallOptions options) {
		// TODO Auto-generated method stub
		//super.jTapiHangupCall(sessionId, options);	
		server.logWrite( LogLevel.INFO, "hangup call \n\n***** SimpleJtapiPhoneMonitor Received JtapiHangupCall event *****\n\n" );
	}
	
	@Override
	public void jTapiCallEstablished(String sessionId,
			JTapiCallEstablishedOptions options) {
		// TODO Auto-generated method stub
		//super.jTapiCallEstablished(sessionId, options);
		
		server.logWrite( LogLevel.INFO, "Call Established \n\n***** SimpleJtapiPhoneMonitor Received CallEstablished event *****\n\n" );

	}

}}}

===Packaging The Test Application===

#Execute a successful build request for you test applcation within your IDE 
#To package the JAVA application, run execute the "cuae package" command
from a DOS command shell in test application parent directory of the test application. 
{{{

C:\Development\Java\workspace\SimpleJtapiPhoneMonitor&gt;cuae package
Created package file
"C:\Development\Java\workspace\SimpleJtapiPhoneMonitor\bin\SimpleJtapiPhoneMonitor.mca"
}}}

===Installing The Test Application===

  * To install the test application on a CUAE server, execute the **cuae install** command from a DOS command shell in test application parent directory of the test application. The cuae install command varies slightly between 2.5(1) Beta 1 and Beta 2. 

====2.5(1) Beta 2===



You are prompted to enter an IP address, username, and password (to view the help, run the **cuae install -h** command). When prompted, enter Y or N to save management settings. This will save the answers to the above three questions in the properties file and remember them the next time you go to install.

**Note**

// You are also prompted for the communications protocol (TCP or TLS). Select the protocol that is set on the Management Service. TLS is the default supported protocol. If you want to use TCP, follow the instructions in [[Management Service TLS | Management Service Transport Layer Security (TLS)]] to change the default URI of the Management Service before running these commands//.
 

C:\Development\Java\workspace\SimpleJtapiPhoneMonitor&gt;cuae package
Created package file
"C:\Development\Java\workspace\SimpleJtapiPhoneMonitor\bin\SimpleJtapiPhoneMonitor.mca"

{{{

C:\Development\Java\workspace\SimpleJtapiPhoneMonitor&gt;cuae install
Enter the hostname or IP address of the management service (for example: localhost, 1.1.1.1): localhost
Protocol: tls
Generated mgmt-service uri: tls://localhost:9001?TlsConnection.authReqd=false
Enter management service login username:
Entermanagement service login password: ********
Save the amanagement settings with the project? [yes or no] no
Application : C:\Development\Java\workspace\SimpleJtapiPhoneMonitor\bin\SimpleJtapiPhoneMonitor.mca
Uploading :  ===========================&gt; 100%
Application has been installed successfully

}}}

==== 2.5(1) Beta 1====
 
You are prompted to enter an IP address, username, and password (to view the help, run the **cuae install -h** command). When prompted, enter Y or N to save management settings. This will save the answers to the above three questions in the properties file and remember them the next time you go to install.

{{{

C:\Development\Java\workspace\SimpleJtapiPhoneMonitor&gt;cuae package
Created package file
"C:\Development\Java\workspace\SimpleJtapiPhoneMonitor\bin\SimpleJtapiPhoneMonitor.mca"

C:\Development\Java\workspace\SimpleJtapiPhoneMonitor&gt;cuae install
Enter management service uri or host/IP &lt;for example: localhost, tcp://1.1.1.1.:4001&gt;:
Enter management service login username:
Entermanagement service login password: ********
Save the amanagement settings with the project? [YyNn] n
Application : C:\Development\Java\workspace\SimpleJtapiPhoneMonitor\bin\SimpleJtapiPhoneMonitor.mca
Uploading :  ===========================&gt; 100%
Application ahas been installed successfully

}}}

===Executing the application.===

Once the client application is installed on the server, and the service is pointing to the CUAE server, the client application can be invoked. Once the client application is invoked (through console or from within your IDE), it is ready to service the incoming triggers from the CUAE server. Since this is a jtapi monitoring application, the test phone needs to be added to monitord device pool under the telephony Manager section of cuaeadmin console page. App Server logs will show the details of various jtapi events being generated with the monitored phone.</description>
      <pubDate>Fri, 30 Jul 2010 21:31:21 GMT</pubDate>
      <guid isPermaLink="false">http://developer.cisco.com/web/cuae/wikidocs?p_p_auth=BrzK1CFb&amp;p_p_id=36&amp;p_p_lifecycle=0&amp;p_r_p_185834411_nodeId=8398769&amp;p_r_p_185834411_title=&amp;SimpleJtapiPhoneMonitor-Java</guid>
      <dc:creator>Bhuvaneswari Rajamanickam</dc:creator>
      <dc:date>2010-07-30T21:31:21Z</dc:date>
    </item>
    <item>
      <title>SimpleJtapiPhoneMonitor-Designer 1.7</title>
      <link>http://developer.cisco.com/web/cuae/wikidocs?p_p_auth=BrzK1CFb&amp;p_p_id=36&amp;p_p_lifecycle=0&amp;p_r_p_185834411_nodeId=8398769&amp;p_r_p_185834411_title=&amp;SimpleJtapiPhoneMonitor-Designer</link>
      <description>===Create a new project and select JtapiCallInitiated as the triggering event.===

To create a project:

#Launch the Cisco Unified Application Designer 
#Select the File -&gt; New Project option and enter the Project Name and Location in the "New Application Designer Project". 

{{1_projectAdd.JPG}}

**Figure 1. Adding a Project**


===Define The New Application Script and Trigger Event===

The next step in the creation of a project is to define the application script trigger. In the case of an application which should be invoked by an incoming JtapiCallInitiated event, the script will be triggered by the Metreos.Providers.Jtapi.JtapiCallInitiatedevent. The image below shows that the application's triggering event is OnJtapiCallInitiated. 
{{2_scriptTriggerEvent.JPG}}


Since we are interested in multiple other jtapi events, these events could be added to the script by simply dragging these events from the Jtapi toolbox (right pane) and dropping anywhere under the Functions and Events tree. All these dragged events are non triggering type. A function tab will be created for each of these dragged events.

{{triggerEvent.jpg}}

**Figure 2. Add An Application Script and Trigger/NonTriggering Events**

===Processing The Events===

Each of the events is represented by a function tab of its own. Following are the function tabs corresponding to each of the events we are servicing through the application. OnJtapiCallInitiated tab services the call initiated event. The image below shows it is using LogWrite to write the notification to the app server logs.


{{3_processingEvent.JPG}}

OnJtapiCallActive tab services the call active event. The image below shows it is using LogWrite to write the notification to the app server logs.

{{4_JtapiCall.JPG}}


You would note that the above image shows the LogWrite is using a variable toPhone. It is a local variable and is initialized as shown below

{{5_JtapiCallActive.JPG}}

OnJtapiGotDigits tab services the JtapiGotDigits event (when digits are entered on phone pad). The image below shows it is using LogWrite to write the notification to the app server logs. 

{{6_jtaptGotDigits.JPG}}

There are two local variables shown on the image as well. The initialization of these 2 variables is shown below:

{{7_setVariable.bmp}}
{{image108.JPG}}

The code to print the digits is shown below:

{{8_sampleCode.JPG}}

OnJtapiCallInActive tab services the call inactive event. The image below shows it is using LogWrite to write the notification to the app server logs.

{{9_onJatiInactive.JPG}}

OnJtapiHangup tab services the hangup event. The image below shows it is using LogWrite to write the notification to the app server logs.

{{10_jatpiHangUp.JPG}}

This concludes the application. it could be build and deployed to the CUAE server. The test phone needs to be added to the monitored device pool under Telephony Manager section in cuaeadmin console page.

===Running the application===

Place an outbound call from the phone which was added to the monitored device pool. The outbound call triggers the application and verify the server logs to verify each of the action in phone is captured by CUAE through the application.</description>
      <pubDate>Fri, 30 Jul 2010 21:25:25 GMT</pubDate>
      <guid isPermaLink="false">http://developer.cisco.com/web/cuae/wikidocs?p_p_auth=BrzK1CFb&amp;p_p_id=36&amp;p_p_lifecycle=0&amp;p_r_p_185834411_nodeId=8398769&amp;p_r_p_185834411_title=&amp;SimpleJtapiPhoneMonitor-Designer</guid>
      <dc:creator>Bhuvaneswari Rajamanickam</dc:creator>
      <dc:date>2010-07-30T21:25:25Z</dc:date>
    </item>
    <item>
      <title>SimpleIpPhoneExecute-Csharp 1.5</title>
      <link>http://developer.cisco.com/web/cuae/wikidocs?p_p_auth=BrzK1CFb&amp;p_p_id=36&amp;p_p_lifecycle=0&amp;p_r_p_185834411_nodeId=8398769&amp;p_r_p_185834411_title=&amp;SimpleIpPhoneExecute-Csharp</link>
      <description>==About the Application==

The application triggers on http got request, queries the CUCM for the Ip address of the Iphone using device name. Create and send a command to be executed by the Ip phone. The command **Dial:&lt;phonenumber&gt;** i.e. **"Dial:101064"** when executed by the Ip phone makes a call to the Ip phone with phone number **&lt;phonenumber&gt;** i.e. **101064** mentioned in the command.


**Note:**//The Ip phone that executes the command has to be associated with an end user in the call manager. The UserName and Password used in SendExecute are that of the end user.//
 

==Creating the Application Project==

1. Open a Command Prompt window.

2. Navigate to the directory you want to use as your workspace. To use the CUAE command-line tool to create a new application, type the cuae create command and the name of the application project.

{{{c:&gt; cd \workspace
c:\workspace&gt; cuae create SimpleIpPhoneExecute_csharp}}}

The tool then prompts you for additional information.

**Note:** //Once you are more familiar with the options, you can type the full command rather than answering the prompts by using the following syntax://

cuae create -l language -m namespace -t project type ~[options~] projectname
 

3. First the tool prompts you to choose between building an application or a plugin. In this example, the correct choice is application:

{{{Project Type? [application or plugin] application}}}

4. Next the tool prompts you to specify the programming language. In this example, the correct choice is csharp:

{{{Programming language? [java or csharp] csharp}}}

5. The tool asks you for the namespace for the application. A program might want to use a fully qualified namespace like com.company.simpleipphoneexecute_csharp or something simple like simpleipphoneexecute_csharp. The tool offers you a simple namespace based on the project name. Let's accept the tool's suggestion for now and use simpleipphoneexecute_csharp

{{{Project namespace? [default: simpleipphoneexecute_csharp] &lt;Return&gt;}}}

6. Finally, the tool asks if you would like to specify a triggering event. All applications need to register against at least one triggering event. You can specify the triggering event now or wait and specify the triggering event later. You can also change the triggering event during development. Again, since we know that this application needs to be triggered on an http request, let's go ahead and specify the triggering event now. Select option 5:

{{{ Available application triggering event:
   0: Skip this step
   1: cisco.uc.cuae.legacy.JTapi.JTapiIncomingCall
   2: cisco.uc.cuae.legacy.JTapi.JTapiCallInitiated
   3: cisco.uc.cuae.legacy.JTapi.JTapiCallEstablished
   4: cisco.uc.cuae.legacy.CallControl.IncomingCall
   5: cisco.uc.cuae.legacy.Http.GotRequest
   6: cisco.uc.cuae.legacy.Presence.SubscriptionTerminated
   7: cisco.uc.cuae.legacy.Presence.Notify
   8: cisco.uc.cuae.legacy.TimerFacility.TimerFire
 Triggering event? [0-8] 5}}}


The tool now has enough information to generate the project template.

{{{   Generating:
   * application named "SimpleIpPhoneExecute_csharp"
   * with namespace "simpleipphoneexecute_csharp"
   * with laguage "csharp"
   * with trigger event "cisco.uc.cuae.legacy.Http.GotRequest"
   * in location C:\workspace\
Created project "SimpleIpPhoneExecute_csharp" in directory
 "C:\workspace\SimpleIpPhoneExecute_csharp\"}}}


Here is the whole sequence again with all of the steps together:

{{{c:/workspace&gt; cuae create SimpleIpPhoneExecute_csharp
Project type? [application or plugin] application
Programming language? [java or csharp] csharp
Project namespace? [default: simpleipphoneexecute_csharp]
Available application triggering event:
   0: Skip this step
   1: cisco.uc.cuae.legacy.JTapi.JTapiIncomingCall
   2: cisco.uc.cuae.legacy.JTapi.JTapiCallInitiated
   3: cisco.uc.cuae.legacy.JTapi.JTapiCallEstablished
   4: cisco.uc.cuae.legacy.CallControl.IncomingCall
   5: cisco.uc.cuae.legacy.Http.GotRequest
   6: cisco.uc.cuae.legacy.Presence.SubscriptionTerminated
   7: cisco.uc.cuae.legacy.Presence.Notify
   8: cisco.uc.cuae.legacy.TimerFacility.TimerFire
Triggering event? [0-8] 5
Generating:
   * application named "SimpleIpPhoneExecute_csharp"
   * with namespace "simpleipphoneexecute_csharp"
   * with laguage "csharp"
   * with trigger event "cisco.uc.cuae.legacy.Http.GotRequest"
   * in location C:\workspace\
Created project "SimpleIpPhoneExecute_csharp" in directory
 "C:\workspace\SimpleIpPhoneExecute_csharp\"}}}


==Inspecting the Generated Project==

Let's inspect the files that were generated by the CUAE command-line tool. It created an SimpleIpPhoneExecute_csharp directory in the directory from which you ran the cuae create command. The SimpleIpPhoneExecute_csharp directory contains the following files and directories:

* SimpleIpPhoneExecute_csharp.etch 
* SimpleIpPhoneExecute_csharp.properties 
* SimpleIpPhoneExecute_csharp.csproj 
* cuae-resources/ 
* README.txt 
* src/ 

The most important of which, for your purposes, are:

* **SimpleIpPhoneExecute_csharp.etch** -- CUAE application Etch service definition. Edit this file to use additional CUAE services in your project. 
* **SimpleIpPhoneExecute_csharp.csproj** -- CSharp project file 
* **cuae-resources/** -- CUAE application resource directory. 
* **src/** -- Generated application source files. 

==Declaring Services==

The first step in building an Etch-based application is identifying which [[Hosted CUAE Services | Cisco Unified Application Environment hosted services]] the application requires and then editing the .etch file to declare the names of those services into the application.

 
**Note:** //Once you identify the services you need, you can familiarize yourself with them by visiting the [[API Reference | API reference]] for the version of the Unified Application Environment you are using.// 


The following snippet is the default content of the .etch file that the CUAE command-line tool generates. We use the **mixin** command to declare the appropriate services. 


{{{// CUAE Application Etch Service Definition
//
// This service defines your application and the CUAE services that you
// use in your application.

// The service module namespace, this will be translated to the
// namespace of the generated source code.
module SimpleIpPhoneExecute_csharp

// The name of your service.
service SimpleIpPhoneExecute_csharp
{
    // By default, you must always use the EtchBridge service. Do not
    // remove this mixin, otherwise your application won't work.
    mixin cisco.uc.cuae.EtchBridge

    // You may add any additional service mixins that you require. For
    // example, if you'd like to make and receive phone calls, add the
    // following line:
    //     mixin cisco.uc.cuae.legacy.CallControl
    mixin cisco.uc.cuae.legacy.Http

}
}}}

Because this application will answer an push objects to a phone on an http request, we need to utilize the Http and CiscoIpPhone services. It also looks up a device by the device name, which is a CiscoDeviceList service. The default etch file already has a mixin for Http because of the triggering event you selected when creating the application project.

{{{ mixin cisco.uc.cuae.legacy.Http}}}

We need to add a declaration for the CiscoIpPhone and CiscoDeviceList services, using the full namespaces. Add the following lines right after the mixin for Http but before the final "}":

{{{  mixin cisco.uc.cuae.legacy.CiscoIpPhone
  mixin cisco.uc.cuae.legacy.CiscoDeviceList}}}

The new SimpleIpPhoneExecute_csharp.etch file should look like this:


{{{// CUAE Application Etch Service Definition
//
// This service defines your application and the CUAE services that you
// use in your application.

// The service module namespace, this will be translated to the
// namespace of the generated source code.
module SimpleIpPhoneExecute_csharp

// The name of your service.
service SimpleIpPhoneExecute_csharp
{
    // By default, you must always use the EtchBridge service. Do not
    // remove this mixin, otherwise your application won't work.
    mixin cisco.uc.cuae.EtchBridge

    // You may add any additional service mixins that you require. For
    // example, if you'd like to make and receive phone calls, add the
    // following line:
    //     mixin cisco.uc.cuae.legacy.CallControl
    mixin cisco.uc.cuae.legacy.Http
    mixin cisco.uc.cuae.legacy.CiscoIpPhone
    mixin cisco.uc.cuae.legacy.CiscoDeviceList

}
}}}

==Building the Application==

After declaring the services you need, you must build the application to generate source files.
  
1. Open a Command Prompt and navigate to the application directory.

2. Run the msbuild command to generate source files.

{{{c:\workspace\SimpleIpPhoneExecute_csharp&gt;msbuild}}}

The following source file templates are then created in the directory src\ simpleipphoneexecute_csharp:

* MainSimpleIpPhoneExecute_csharpClient.cs 
* ImplSimpleIpPhoneExecute_csharpClient.cs 

==Creating Configuration Items==

YAML is the file format for Unified Application Environment application configuration (config.yaml) and metadata definitions (project_name.yaml).

All application configuration items are written in the config.yaml file, which is located in the cuae-resources directory.

Configuration items follow a specific syntax, as follows.

{{{-name:
[display name:]
format:
[description:]
[minvalue:]
[maxvalue:]
[defaultvalue:]
[readonly:]
[required]
}}}


*Items in square brackets ~[~] are optional

The default config.yaml file contains the following information:

{{{# CUAE Application Configuration Definition
#
# You only need to edit this file if you want to expose configuration to
# the administrator through cuaeadmin.
#
# This file was auto-generated from a template but will never be
# overwritten. You should edit this file directly if required.

configuration:
  # Indicates the name of your configuration item. It will be how you
  # reference this configuration item from code.
  #- name: myConfValue

    # Controls how the visible label of the configuration value. For
    # example, if 'name' was defined as: myConfValue, you may choose to
    # define 'displayName' as: My Config Value. Think of it as a friendly
    # name. This field is optional.
    #displayName: My Config Value

    # Defines the format of the configuration item's value. This will
    # control how cuaeadmin renders and validates the value. Possible
    # values for the 'format' field are: String, Bool, Number, IP_Address,
    # Array, HashTable, Password.
    #format: String

    # A description of the configuration item that will be displayed to
    # the administrator in cuadmin. This field is optional.
    #description: Some description here.

    # For configuration items that are formatted as numbers, the
    # 'minValue' and 'maxValue' configuration items define the acceptable
    # range of input for the item. These fields are optional.
    #minValue:
    #maxValue:

    # Defines the default value of the configuration. This field is
    # optional.
    #defaultValue:

    # Inidicates whether the configuration item is editable. If
    # 'readOnly' is set to true, the administrator will not be able to
    # edit it in cuaeadmin, but will be able to view it. The default is
    # false, and this field is optional.
    #readOnly:

    # Indicates whether the configuration item is required. If required,
    # the administrator will have to set a value before the application
    # will run. The default is false, and this field is optional.
    #required: false
}}}

In this example, the application has nine configuration items. Add the following block to the config.yaml file in the configuration section:

===Code Sample===

{{{  - name: DeviceName
    format: String
    displayName: DeviceName

  - name: Priority1
    format: String
    displayName: Priority1

  - name: Priority2
    format: String
    displayName: Priority2

  - name: Priority3
    format: String
    displayName: Priority3

  - name: URL1
    format: String
    displayName: URL1

  - name: URL2
    format: String
    displayName: URL2

  - name: URL3
    format: String
    displayName: URL3

  - name: UserName
    format: String
    displayName: UserName

  - name: Password
    format: String
    displayName: Password
}}}

==Writing Application Code==

This section provides instructions and code samples for writing the application logic.

===Import the Project into your IDE===

1. Open Visual Studio (or another IDE of your preference).

2. Create a new CSharp project from the existing project file by selecting **File -&gt; Open -&gt; Project/Solution** and selecting the SimpleIpPhoneExecute_csharp.csproj file from the SimpleIpPhoneExecute_csharp directory.

===First example code snippet===

We need to handle the Http request and query the CUCM for IP address an Ip phone using the name of the phone specified in the application configuration on CUAE. We also need to create a Metreos.Types.CiscoIpPhone.CiscoIPPhoneExecuteType object using createExecute, this object contains a commands to be executed by the IP phone. These commands are set while configuring application on CUAE. Finally send the command to the IPphone using sendExecute. The user name and password of the application user needed. The IP phone that executes the command is registered to this application user in CUCM. The UserName and Password are set while configuring application on CUAE.

===Code Sample===

You need to import Collection package to use Dictinary class

{{{using System.Collections.Generic;}}}

{{{private Dictionary&lt;String, ConfigEntry&gt; conf;

        public override void gotRequest(string sessionId, GotRequestOptions options)
        {
            // Retrieve application partition configuration 
            ConfigEntry[] configs = null; 
            try { 
                configs = server.getConfig("Default"); 
            }
            catch (Exception e) 
            { 
                Console.WriteLine("Failed to get config entries for partition Default"); 
                server.removeCuaeSession(sessionId); 
                return; 
            } 

            conf = new Dictionary&lt;string, ConfigEntry&gt;();
            for (int i = 0; i &lt; configs.Length; i++)
            {
                conf.Add(configs[i].name.ToString(), configs[i]);
            }

            // Query  
            ConfigEntry config = null;
            config = conf["DeviceName"];
            QueryOptions qo = new QueryOptions();
            qo.name = config.configValue.ToString();
            QueryResult qr = server.query(sessionId, qo);
            if (qr.count == 0 || qr.resultData == null)
            {
                server.sendResponse(sessionId, options.remoteHost, 200, "text/plain", "No device found!", "OK", null);
                server.removeCuaeSession(sessionId);
                return;
            }
            // Find the calling device by name 
            Device callingDevice = null;
            for (int i = 0; i &lt; qr.resultData.devices.Length; i++)
            {
                Device d = qr.resultData.devices[i];
                if (d.name != null &amp;&amp; d.name == config.configValue.ToString())
                {
                    callingDevice = d;
                    break;
                }
            }
            if (callingDevice == null)
            {
                string msg = "Device " + config.ToString() + " not found!";
                server.sendResponse(sessionId, options.remoteHost, 200, "text/plain", msg, "OK", null);
                server.removeCuaeSession(sessionId);
                return;
            }
            // Create execute 
            config = null;
            config = conf["URL1"];
            CreateExecuteOptions ceo = new CreateExecuteOptions();
            ceo.url1 = config.configValue.ToString();
            CreateExecuteResult cer = server.createExecute(sessionId, ceo);
            if (!cer.returnValue.Equals("success", StringComparison.CurrentCultureIgnoreCase))
            {
                server.sendResponse(sessionId, options.remoteHost, 200, "text/plain", "createExecute failed!", "OK", null);
                server.removeCuaeSession(sessionId);
                return;
            }
            // Send execute 
            config = null;
            config = conf["UserName"];
            SendExecuteOptions seo = new SendExecuteOptions();
            seo.username = config.configValue.ToString();

            config = null;
            config = conf["Password"];
            seo.password = config.configValue.ToString();
            SendExecuteResult ser = server.sendExecute(sessionId, cer.xmlObject, callingDevice.deviceIp, seo);
            if (!ser.returnValue.Equals("success", StringComparison.CurrentCultureIgnoreCase))
                server.sendResponse(sessionId, options.remoteHost, 200, "text/plain", "SendExecute failed!", "OK", null);
            else
                server.sendResponse(sessionId, options.remoteHost, 200, "text/plain", "Done!", "OK", null);

            server.removeCuaeSession(sessionId);
        }
}}}

==Registering the Application==

The previous steps completed the core logic of the example applications, but before any Etch-based API calls can actually be made, we must register the application with the Cisco Unified Application Server. To register your application, follow these steps:

1. Open the MainSimpleIpPhoneExecute_csharpClient file in the /src directory. It contains the following content by default:

{{{public static void Main(String[] args)
{
	// TODO: Change to correct URI
        string uri = "tcp://localhost:9000";
			
	RemoteSimpleIpPhoneExecute_csharpServer server = SimpleIpPhoneExecute_csharpHelper.NewServer( uri, null, new MainSimpleIpPhoneExecute_csharpClient());
		
        // Connect to the service
	server._StartAndWaitUp( 4000 );

	// TODO: Insert Your Code Here
        
	// Disconnect from the service
	server._StopAndWaitDown( 4000 );			
}
}}}

2. To make a connection to the listener, add a server.registerApplication() request.

{{{string key = server.registerApplication( "SimpleIpPhoneExecute_csharp", "Default", "&lt;username&gt;", "&lt;password&gt;" );
Console.WriteLine( "CUAE application registered with key : " + key );
Console.WriteLine( "Hit any key to exit. " );
Console.ReadLine();
}}}

3. Modify the String URI to match the IP address and port of the Cisco Unified Application Server. 

URI settings vary slightly between 2.5(1) Beta 1 and more recent versions of 2.5(1), as follows:

====2.5(1) and 2.5(1) Beta 2, Beta 3, Beta 4 and later releases====

{{{// TODO Change to correct URI
String uri = "tls://appserver_ipaddress:9000?TlsConnection.authReqd=false&amp;filter=KeepAlive
&amp;KeepAlive.Count=5&amp;Packetizer.maxPktSize=102400&amp;TcpTransport.reconnectDelay=4000";}}}
 
**Note:** //In Beta 2, the Etch Bridge was updated to use [[Etch Bridge TLS | Transport Layer Security]] for encryption by default. For your applications to work, you must specify TLS as the protocol in the URI and set the authReqd parameter to false. In the example above, the [[Keep Alive | KeepAlive]] filter and [[MaxPacketSize | Max Packet Size]] and [[Etch Connection URI | Reconnect Delay]] parameters have also been set.//

====2.5(1) Beta 1====

{{{// TODO Change to correct URI
		String uri = "tcp://appserver_ipaddress:9000?&amp;TcpConnection.reconnect_delay=4000";}}}

 In addition to setting the correct IP address and port for the Cisco Unfied Application Server, the Reconnect Delay parameter should be set on all connection URIs. 

==Packaging The Test Application===

1. Execute a successful build request for your test application within your IDE.

2. To package the application, execute the "cuae package" command from a DOS command shell in the parent directory of the test application.

{{{C:\workspace\SimpleIpPhoneExecute_csharp&gt;cuae package
Created package file
"C:\workspace\SimpleIpPhoneExecute_csharp\bin\SimpleIpPhoneExecute_csharp.mca"}}}

The following files will be added to the "\bin" sub-directory:

* SimpleIpPhoneExecute_csharp.mca (application bundle to be uploaded into the application server) 
* INSTALLER.xml - (contains the config items in config.yaml) 
* MANIFEST.xml - (bundle details for the package comamnd) 

==Installing The Test Application==

To install the test application on a CUAE server, execute the **cuae install** command from a DOS command shell in test application parent directory of the test application. The cuae install command varies slightly between 2.5(1) Beta 1 and Beta 2. 

====2.5(1) Beta 2====

You are prompted to enter an IP address, username, and password (to view the help, run the **cuae install -h** command). When prompted, enter Y or N to save management settings. This will save the answers to the above three questions in the properties file and remember them the next time you go to install.

**Note:** //You are also prompted for the communications protocol (TCP or TLS). Select the protocol that is set on the Management Service. TLS is the default supported protocol. If you want to use TCP, follow the instructions in [[Management Service TLS | Management Service Transport Layer Security (TLS)]] to change the default URI of the Management Service before running these commands.//
 

{{{C:\workspace\SimpleIpPhoneExecute&gt;cuae package
Created package file
"C:\workspace\SimpleIpPhoneExecute\bin\SimpleIpPhoneExecute.mca"

C:\workspace\SimpleIpPhoneExecute&gt;cuae install
Enter the hostname or IP address of the management service (for example: localhost, 1.1.1.1): localhost
Protocol: tls
Generated mgmt-service uri: tls://localhost:9001?TlsConnection.authReqd=false
Enter management service login username:
Entermanagement service login password: ********
Save the amanagement settings with the project? [yes or no] n
Application : C:\workspace\SimpleIpPhoneExecute\bin\SimpleIpPhoneExecute.mca
Uploading :  ===========================&gt; 100%
Application has been installed successfully}}}

====2.5(1) Beta 1====

You are prompted to enter an IP address, username, and password (to view the help, run the **cuae install -h** command). When prompted, enter Y or N to save management settings. This will save the answers to the above three questions in the properties file and remember them the next time you go to install.

{{{C:\workspace\SimpleIpPhoneExecute&gt;cuae package
Created package file
"C:\workspace\SimpleIpPhoneExecute\bin\SimpleIpPhoneExecute.mca"

C:\workspace\SimpleIpPhoneExecute&gt;cuae install
Enter management service uri or host/IP &lt;for example: localhost, tcp://1.1.1.1.:4001&gt;:
Enter management service login username:
Entermanagement service login password: ********
Save the amanagement settings with the project? [YyNn] n
Application : C:\workspace\SimpleIpPhoneExecute\bin\SimpleIpPhoneExecute.mca
Uploading :  ===========================&gt; 100%
Application ahas been installed successfully
}}}

==Configuring the Application in the Administration Interface==

===Adding a trigger===

1. Log in to the Administration interface.

2. Click **Applications&gt;Find/List Triggers** to generate a list of applications and their associated triggers.

3. Select the application SimpleIpPhoneExecute_csharp in the list.

4. Enter "url" and "/SimpleIpPhoneExecute_csharp".

5. Click **Add Parameter**.

===Initializing the Config Items===

1. Log in to the Administrattion interface.

2. Click **Application&gt;List Applictions** to generate a list of applications.

3. Select the application SimpleIpPhoneExecute_csharp in the list.

4. Specify the DeviceName (the MAC address beginning with "SEP"), URL1 (set to "Dial:Phone#"), and the username and password (associated with the end user for the phone). 

==Running the Application==

1. Run the class SimpleIpPhoneExecute_csharp.MainSimpleIpPhoneExecute_csharpClient to register the application.

At this point the application will remain registered and running until either you stop your application or the application loses connectivity to the Unified Application server.

2. Run the program by accessing [[http://localhost:8000/SimpleIpPhoneExecute_csharp]] in a web browser.</description>
      <pubDate>Fri, 30 Jul 2010 21:07:37 GMT</pubDate>
      <guid isPermaLink="false">http://developer.cisco.com/web/cuae/wikidocs?p_p_auth=BrzK1CFb&amp;p_p_id=36&amp;p_p_lifecycle=0&amp;p_r_p_185834411_nodeId=8398769&amp;p_r_p_185834411_title=&amp;SimpleIpPhoneExecute-Csharp</guid>
      <dc:creator>Bhuvaneswari Rajamanickam</dc:creator>
      <dc:date>2010-07-30T21:07:37Z</dc:date>
    </item>
    <item>
      <title>AnswerAndPlay-Java 2.7</title>
      <link>http://developer.cisco.com/web/cuae/wikidocs?p_p_auth=BrzK1CFb&amp;p_p_id=36&amp;p_p_lifecycle=0&amp;p_r_p_185834411_nodeId=8398769&amp;p_r_p_185834411_title=&amp;AnswerAndPlay-Java</link>
      <description>==About the Application==

This application is triggered by an incoming phone call. When triggered, the application answers the call and plays a prompt back using various mechanisms (Text-to-Speech and pre-recorded WAV files). Once the prompt has completed the application will then hang up the call.

==Creating the Application Project==

1. Open a Command Prompt window.

2. Navigate to the directory you want to use as your workspace. To use the CUAE command-line tool to create a new application, type the **cuae create** command and the name of the application project.

{{{

c:&gt; cd \workspace
c:\workspace&gt; cuae create AnswerAndPlay
}}}

The tool then prompts you for additional information.

**Note:**

// Once you are more familiar with the options, you can type the full command rather than answering the prompts. For example://

//cuae create -l language -m module -t string ~[options~] projectname//

// **cuae create** -l java -m MakeCall -t app AnswerAndPlay//
 

3. First the tool prompts you  to choose between building an application or a plugin. In this example, the correct choice is application:
{{{
Project Type? [application or plugin] application
}}}

4. Next the tool prompts you to specify the programming language. In this example, the correct choice is java:
{{{

Programming language? [java or csharp] java
}}}

5. The tool prompts you to choose the build format you prefer. In this example we are using ant.
{{{
Build format? [ant or maven2] ant
}}}

6. The tool asks you for the namespace for the application. A Java program might want to use a fully qualified namespace like com.company.answerandplay or something simple like answerandplay. The tool offers you a simple namespace based on the project name. Let's accept the tool's suggestion for now and use answerandplay:
{{{

Project namespace? [default: answerandplay] &lt;Return&gt;
}}}

7. Finally, the tool asks if you would like to specify a triggering event. All applications need to register against at least one triggering event. You can specify the triggering event now or wait and specify the
triggering event later. You can also change the triggering event during development. Again, since we know that this application needs to be triggered on an incoming call, let's go ahead and specify the triggering event now. Select option 4:

{{{

 Available application triggering event:
   0: Skip this step
   1: cisco.uc.cuae.legacy.JTapi.JTapiIncomingCall
   2: cisco.uc.cuae.legacy.JTapi.JTapiCallInitiated
   3: cisco.uc.cuae.legacy.JTapi.JTapiCallEstablished
   4: cisco.uc.cuae.legacy.CallControl.IncomingCall
   5: cisco.uc.cuae.legacy.Http.GotRequest
   6: cisco.uc.cuae.legacy.Presence.SubscriptionTerminated
   7: cisco.uc.cuae.legacy.Presence.Notify
   8: cisco.uc.cuae.legacy.TimerFacility.TimerFire
 Triggering event? [0-8] 4
}}}


The tool now has enough information to generate the project template.
{{{

Generating:
   * application named "AnswerAndPlay"
   * with namespace "answerandplay"
   * with laguage "java"
   * with trigger event "cisco.uc.cuae.legacy.CallControl.IncomingCall"
   * in location C:\workspace\
Created project "AnswerAndPlay" in directory
"C:\workspace\AnswerAndPlay\"
}}}

Here is the whole sequence again with all of the steps together: 
{{{


wxp&gt; cuae create AnswerAndPlay
Project type? [application or plugin] application
Programming language? [java or csharp] java
Build format? [ant or maven2] ant
Project namespace? [default: answerandplay]
Available application triggering event:
   0: Skip this step
   1: cisco.uc.cuae.legacy.JTapi.JTapiIncomingCall
   2: cisco.uc.cuae.legacy.JTapi.JTapiCallInitiated
   3: cisco.uc.cuae.legacy.JTapi.JTapiCallEstablished
   4: cisco.uc.cuae.legacy.CallControl.IncomingCall
   5: cisco.uc.cuae.legacy.Http.GotRequest
   6: cisco.uc.cuae.legacy.Presence.SubscriptionTerminated
   7: cisco.uc.cuae.legacy.Presence.Notify
   8: cisco.uc.cuae.legacy.TimerFacility.TimerFire
Triggering event? [0-8] 4
Generating:
   * application named "AnswerAndPlay"
   * with namespace "answerandplay"
   * with laguage "java"
   * with trigger event "cisco.uc.cuae.legacy.CallControl.IncomingCall"
   * in location C:\workspace\
Created project "AnswerAndPlay" in directory
 "C:\workspace\AnswerAndPlay\"

}}}

==Inspecting the Generated Project==

Let's inspect the files that were generated by the CUAE command-line tool. It created an AnswerAndPlay directory in the directory from which you ran the **cuae create **command. The AnswerAndPlay directory contains the following files and directories:

  * AnswerAndPlay.etch 
  * AnswerAndPlay.properties 
  * build.xml 
  * cuae-resources/ 
  * README.txt 
  * src/ 

The most important of which, for your purposes, are:

  * **AnswerAndPlay.etch**--CUAE application Etch service definition. Edit this file to use additional CUAE services in your project. 
  * **build.xml**--Ant build script file with predefined targets for managing the lifecycle of your CUAE project. 
  * **cuae-resources/**--CUAE application resource directory. 
  * **src/**--Generated application source files. 

==Declaring Services==

The first step in building an Etch-based application is identifying which[[Hosted CUAE Services | Cisco Unified Application Environment hosted services]] the application requires and then editing the .etch file to declare the names of those services into the application.

**Note:**

// Once you identify the services you need, you can familiarize yourself with them by visiting the [[API Reference]] for the version of the Unified Application Environment you are using//.
 

The following snippet is the default content of the .etch file that the CUAE command-line tool generates. We use the **mixin** command to declare the appropriate services.

{{{

// CUAE Application Etch Service Definition
//
// This service defines your application and the CUAE services that you
// use in your application.

// The service module namespace, this will be translated to the
// namespace of the generated source code.
module AnswerAndPlay

// The name of your service.
service AnswerAndPlay
{
    // By default, you must always use the EtchBridge service. Do not
    // remove this mixin, otherwise your application won't work.
    mixin cisco.uc.cuae.EtchBridge

    // You may add any additional service mixins that you require. For
    // example, if you'd like to make and receive phone calls, add the
    // following line:
    //     mixin cisco.uc.cuae.legacy.CallControl
    mixin cisco.uc.cuae.legacy.CallControl

}

}}}

Because this application will answer an incoming phone call and play a media stream back to the caller, we need to utilize the CallControl and MediaControl services. The default etch file already has a mixin for Call Control because of the triggering event you selected when creating the application project. 


{{{ mixin cisco.uc.cuae.legacy.CallControl}}}

We need to add a declaration for the MediaControl service, using the full namespace. Add the following line right after the mixin for CallControl but before the final "}":

{{{ mixin cisco.uc.cuae.legacy.MediaControl}}}

The new AnswerAndPlay.etch file should look like this: 
{{{

// CUAE Application Etch Service Definition
//
// This service defines your application and the CUAE services that you
// use in your application.

// The service module namespace, this will be translated to the
// namespace of the generated source code.
module AnswerAndPlay

// The name of your service.
service AnswerAndPlay
{
    // By default, you must always use the EtchBridge service. Do not
    // remove this mixin, otherwise your application won't work.
    mixin cisco.uc.cuae.EtchBridge

    // You may add any additional service mixins that you require. For
    // example, if you'd like to make and receive phone calls, add the
    // following line:
    //     mixin cisco.uc.cuae.legacy.CallControl
    mixin cisco.uc.cuae.legacy.CallControl
    mixin cisco.uc.cuae.legacy.MediaControl

}

}}}

==Building the Application==

After declaring the services you need, you must build the application to generate source files.  

1. Open a Command Prompt and navigate to the application directory.

2. Run the **ant** command to generate source files.

{{{
c:\workspace&gt; cd AnswerAndPlay
c:\workspace\AnswerAndPlay&gt; ant
}}}

The following source file templates are then created in the directory src\answerandplay:

  * MainAnswerAndPlayClient.java 
  * ImplAnswerAndPlayClient.java 

==Creating Configuration Items==

YAML is the file format for Unified Application Environment application configuration (config.yaml) and metadata definitions project_name.yaml).

All application configuration items are written in the config.yaml file, which is located in the cuae-resources directory.

Configuration items follow a specific syntax, as follows.

{{{-name:

[display name:]

format:

[description:]

[minvalue:]

[maxvalue:]

[defaultvalue:]

[readonly:]

[required]}}}


* Items in square brackets ~[~] are optional


The default config.yaml file contains the following information:
{{{

# CUAE Application Configuration Definition
#
# You only need to edit this file if you want to expose configuration to
# the administrator through cuaeadmin.
#
# This file was auto-generated from a template but will never be
# overwritten. You should edit this file directly if required.

configuration:
  # Indicates the name of your configuration item. It will be how you
  # reference this configuration item from code.
  #- name: myConfValue

    # Controls how the visible label of the configuration value. For
    # example, if 'name' was defined as: myConfValue, you may choose to
    # define 'displayName' as: My Config Value. Think of it as a friendly
    # name. This field is optional.
    #displayName: My Config Value

    # Defines the format of the configuration item's value. This will
    # control how cuaeadmin renders and validates the value. Possible
    # values for the 'format' field are: String, Bool, Number, IP_Address,
    # Array, HashTable, Password.
    #format: String

    # A description of the configuration item that will be displayed to
    # the administrator in cuadmin. This field is optional.
    #description: Some description here.

    # For configuration items that are formatted as numbers, the
    # 'minValue' and 'maxValue' configuration items define the acceptable
    # range of input for the item. These fields are optional.
    #minValue:
    #maxValue:

    # Defines the default value of the configuration. This field is
    # optional.
    #defaultValue:

    # Inidicates whether the configuration item is editable. If
    # 'readOnly' is set to true, the administrator will not be able to
    # edit it in cuaeadmin, but will be able to view it. The default is
    # false, and this field is optional.
    #readOnly:

    # Indicates whether the configuration item is required. If required,
    # the administrator will have to set a value before the application
    # will run. The default is false, and this field is optional.
    #required: false

}}}


In this example, the application has one configuration item, the content of the rendering text. Add the following block to the config.yaml file in the configuration section:

===Code Sample===
{{{
- name: TTSMessage
  format: String
  displayName: TTSMessage
  defaultValue: Hello, welcome to answer and play demo application
}}}

==Writing the Application Code==

This section provides instructions and code samples for writing the application logic.

===Importing the Project into your IDE===

1. Open Eclipse (or another IDE of your preference).

2. Create a new Java project from an existing Ant buildfile by choosing **File** -&gt; **New** -&gt; **Other** -&gt; **Java Project from an existing Ant buildfile**.

3. Click **Next**.

4. Browse to C:\workspace\AnswerAndPlay\ and select the **build.xml** file.

5. Click **Open**.

6. Select **"javac" task found in target "build~[default~]**". 


===Reading Application Configurations===

The CUAE application receives the current application configurations from CUAE server using method server.getConfig("partition name") in incomingcall event handler in the ImplAnswerAndPlayClient.java file. The developer can iterate through the configurations array and parse the configuration item based on its type.

===Handling the incomingCall triggering event===

You should write a method to handle the event of the incoming call trigger to answer the call and begin playing the message.

===Importing the Java Util package===

As you are using Java Util's HashMap class you should import this class. Write the following statement right after "package answerandplay;"
{{{
import java.util.HashMap;
}}}

====Code Sample====
{{{
@Override
public void incomingCall(String sessionId, IncomingCallOptions options)
{
    CuaeResult suc = null;

    HashMap&lt;String, String&gt; configVal = new HashMap&lt;String, String&gt;();

    AnswerCallResult acr = server.answerCall(sessionId, options.callId, null, null);
    ConfigEntry[] config =null;

    try
    {
        config = server.getConfig("Default");

	// Display configs to console
	if(config.length &gt; 0)
	{
	    for(int i = 0; i &lt; config.length; i++)
	    {
		if(config[i].name.equals("TTSMessage"))
		{
		    System.out.println(config[i].configValue.toString());
		}
	    }
        }
    }
    catch (BridgeException e)
    {
        e.printStackTrace();
	server.removeCuaeSession(sessionId);
	return;
    }

    configVal.put("sTTSMessage", config[0].configValue.toString());

    try 
    {
        suc = server.beginPlay(sessionId,configVal.get("sTTSMessage"), acr.connectionId, null, null, acr.callId).returnValue;

    } 
    catch (Exception e) 
    {
        e.printStackTrace();
        server.removeCuaeSession(sessionId);
    }

    if(suc != CuaeResult.SUCCESS)
    {
        System.out.println("beginPlay failed");
	server.hangup(sessionId, acr.callId, null);
	server.removeCuaeSession(sessionId);
    }
}

}}}

==Completing the onPlayComplete function==

When using the "Play" action (above), you should follow-up with the "onPlayComplete" function:

===Code Sample===

{{{

@Override
public void onPlayComplete(String sessionId, PlayResult results, Object state)
{
    System.out.println("Play completed..");

    String callId = (String) state;

    System.out.println("\nHangup..");
    if (server.hangup(sessionId, callId, null).returnValue != CuaeResult.SUCCESS)
    {
         System.out.println("Hangup failed");
    }

    System.out.println("\nEndScript");
    server.removeCuaeSession(sessionId);
}
}}}

==Handle startTx event==

Event occuers to indicate the transmit audio channel has been established.
{{{
@Override
public void startTx(String sessionId, StartTxOptions options)
{
		
}
}}}
==Handle startRx event==

The application server has established the receive audio channel and communicated the Rx info to the remote endpoint on the underlying call control protocol
{{{

@Override
public void startRx(String sessionId, StartRxOptions options)
{
		
}
}}}
==Handle stopTx Event==

Indicates that the transmit audio channel has been closed.
{{{
@Override
public void stopTx(String sessionId, StopTxOptions options)
{
		
}
}}}

==Handle remoteHangUp Event==

Indicates that call has been terminated by the remote endpoint
{{{

@Override
public void remoteHangup(String sessionId,RemoteHangupOptions options)
{

}
}}}

==Registering the Application==

The previous steps completed the core logic of the example applications, but before any Etch-based API calls can actually be made, we must register the application with the Cisco Unified Application Server. To register your application, follow these steps: 1. Open the MainAnswerAndPlayClient file in the /src directory. It contains the following content by default:
{{{

// Generated by:
// 0.95.0 (ETCH-TRUNK-840) / java 0.95.0 (ETCH-TRUNK-840)
// Sun Jun 08 22:47:33 CDT 2008

package answerandplay;

/**
 * Main program for AnswerAndPlayClient. This program makes a connection to the
 * listener created by MainAnswerAndPlayListener.
 */
public class MainAnswerAndPlayClient implements AnswerAndPlayHelper.AnswerAndPlayClientFactory
{
    /**
     * Main program for AnswerAndPlayClient.
     *
     * @param args command line arguments.
     * @throws Exception
     */
    public static void main( String[] args ) throws Exception
    {
        // TODO Change to correct URI
        String uri = "tls://localhost:4001";
        RemoteAnswerAndPlayServer server = AnswerAndPlayHelper.newServer( uri, null,
        new MainAnswerAndPlayClient());

        // Connect to the service
        server._startAndWaitUp( 4000 );

        // TODO Insert Your Code Here

        // Disconnect from the service
        server._stopAndWaitDown( 4000 );
    }

    public AnswerAndPlayClient newAnswerAndPlayClient( RemoteAnswerAndPlayServer server )
        throws Exception
    {
        return new ImplAnswerAndPlayClient( server );
    }
}
}}}

2. To make a connection to the listener, add a server.registerApplication() request.

{{{

// TODO Insert Your Code Here
String key = server.registerApplication("AnswerAndPlay", "Default", "username", "password");
System.out.println("AnswerAndPlay is registered: " + key);
System.in.read();

}}}

3. Modify the String URI to match the IP address and port of the Cisco Unified Application Server.

URI settings vary slightly between 2.5(1) Beta 1 and more recent versions of 2.5(1), as follows:

====2.5(1) and 2.5(1) Beta 2, Beta 3, Beta 4 &amp; later release===

{{{
// TODO Change to correct URI
String uri = "tls://appserver_ipaddress:9000?TlsConnection.authReqd=false&amp;filter=KeepAlive
 &amp;KeepAlive.Count=5&amp;Packetizer.maxPktSize=102400&amp;TcpTransport.reconnectDelay=400;
}}}

**Note:**

 //In Beta 2, the Etch Bridge was updated to use [[Etch Bridge TLS|Transport Layer Security]] for encryption by default. For your applications to work, you must specify TLS as the protocol in the URI and set the authReqd parameter to false. In the example above, the [[Keep Alive]] filter and [[MaxPacketSize]] and [[Etch Connection URI | Reconnect Delay]] parameters have also been set//.

====2.5(1) Beta 1 ====
{{{
 

// TODO Change to correct URI
		String uri = "tcp://appserver_ipaddress:9000?&amp;TcpConnection.reconnect_delay=4000";
}}}

**Note:**

// In addition to setting the correct IP address and port for the Cisco Unfied Application Server, the Reconnect Delay parameter should be set on all connection URIs//. 
 

==Packaging The Test Application==

1. Execute a successful build request for your test application within your IDE.

2. To package the JAVA application, execute the "cuae package" command from a DOS command shell in the parent directory of the test application.

{{{
C:\workspace\AnswerAndPlay&gt;cuae package
Created package file
"C:\workspace\AnswerAndPlay\bin\AnswerAndPlay.mca"
}}}

The following files will be added to the "\bin" sub-directory:

* AnswerAndPlay.mca (application bundle to be uploaded into the CUAE server) 
* INSTALLER.xml - (contains the config items in config.yaml) 
* MANIFEST.xml - (bundle details for the package comamnd) 

===Installing The Test Application===

To install the test application on a CUAE server, execute the **cuae install** command from a DOS command shell in test application parent directory of the test application. The **cuae install** command varies slightly between 2.5(1) Beta 1 and Beta 2. 


====2.5(1) Beta 2====


You are prompted to enter an IP address, username, and password (to view the help, run the **cuae install -h** command). When prompted, enter Y or N to save management settings. This will save the answers to the above three questions in the properties file and remember them the next time you go to install.

**Note:**

// You are also prompted for the communications protocol (TCP or TLS). Select the protocol that is set on the Management Service. TLS is the default supported protocol. If you want to use TCP, follow the instructions in [[Management Service TLS | Management Service Transport Layer Security (TLS)]] to change the default URI of the Management Service before running these commands///.
 
{{{

C:\workspace\AnswerAndPlay&gt;cuae package
Created package file
"C:\workspace\AnswerAndPlay_JAVA\bin\AnswerAndPlay.mca"

C:\workspace\AnswerAndPlay&gt;cuae install
Enter the hostname or IP address of the management service (for example: localhost, 1.1.1.1): localhost
Protocol: tls
Generated mgmt-service uri: tls://localhost:9001?TlsConnection.authReqd=false
Enter management service login username:
Entermanagement service login password: ********
Save the amanagement settings with the project? [yes or no] no
Application : C:\workspace\AnswerAndPlay\bin\AnswerAndPlay.mca
Uploading :  ===========================&gt; 100%
Application has been installed successfully

}}}

====2.5(1) Beta 1 ====

*Note:**

//
You are prompted to enter an IP address, username, and password (to view the help, run the **cuae install -h** command). When prompted, enter Y or N to save management settings. This will save the answers to the above three questions in the properties file and remember them the next time you go to install//.

{{{
C:\workspace\AnswerAndPlay&gt;cuae package
Created package file
"C:\workspace\AnswerAndPlay_JAVA\bin\AnswerAndPlay.mca"

C:\workspace\AnswerAndPlay&gt;cuae install
Enter management service uri or host/IP &lt;for example: localhost, tcp://1.1.1.1.:4001&gt;:
Enter management service login username:
Entermanagement service login password: ********
Save the amanagement settings with the project? [YyNn] n
Application : C:\workspace\AnswerAndPlay\bin\AnswerAndPlay.mca
Uploading :  ===========================&gt; 100%
Application ahas been installed successfully

}}}

==Configuring the Application in the Administration Interface==

===Adding a trigger===

1. Log in to the Administration interface.

2. Click **Applications** -&gt; **Find/List Triggers** to generate a list of applications and their associated triggers.

3. Select the application AnswerAndPlay in the list.

4.  Enter "to" and the number that will be used to trigger the application.

5. Click **Add Parameter**.

{{config-admn-intface.jpg}}

==Running the Application==

1. Run the class AnswerAndPlay.MainAnswerAndPlayClient to register the application.

At this point the application will remain registered and running until either you stop your application or the application loses connectivity to the Unified Application server.

2. Run the program by dialing the number you specified as the trigger. 

Children   Hide Children  |  View in Hierarchy 
 CUAE Services</description>
      <pubDate>Fri, 30 Jul 2010 21:03:05 GMT</pubDate>
      <guid isPermaLink="false">http://developer.cisco.com/web/cuae/wikidocs?p_p_auth=BrzK1CFb&amp;p_p_id=36&amp;p_p_lifecycle=0&amp;p_r_p_185834411_nodeId=8398769&amp;p_r_p_185834411_title=&amp;AnswerAndPlay-Java</guid>
      <dc:creator>Bhuvaneswari Rajamanickam</dc:creator>
      <dc:date>2010-07-30T21:03:05Z</dc:date>
    </item>
    <item>
      <title>AnswerAndPlay-Designer 2.1</title>
      <link>http://developer.cisco.com/web/cuae/wikidocs?p_p_auth=BrzK1CFb&amp;p_p_id=36&amp;p_p_lifecycle=0&amp;p_r_p_185834411_nodeId=8398769&amp;p_r_p_185834411_title=&amp;AnswerAndPlay-Designer</link>
      <description>Designer implementation of AnswerAndPlay

==Build the Project==

===Create the Project===

1. Open the Designer and Create a new project:

{{createProject.JPG}}

2. Create a project named "AnswerAndPlay":
{{ansAndPlay.JPG}}

3. When creating a new project, the Designer will prompt you to name first script and to select a triggering event for that script. For this example we will just go ahead and keep the default script name 'script1', but we are going to select a specific triggering event. For this application select the 'Metreos.CallControl.IncomingCall'event:
{{ansNPlayTriggerEvent.JPG}}


===Handle 'OnIncomingCall'===

Developing applications in the CUAD is an exercise in implementing handlers for various generated events. When you add new triggers or actions to your CUAD application, the Designer automatically inspects those triggers and actions and determines which events need to be handled.

These events will appear as 'tabs' above the Designer's canvas. To implement handlers for these events, you click on a tab and drag into the canvas new actions to be executed.

The first, and for now only event, we have in this application is the 'OnIncomingCall' event. This is the event that is associated with the 'Metreos.CallControl.IncomingCall' trigger that we specified at application creation.

We must now handle the 'OnIncomingCall' event:

1. Click on the 'OnIncomingCall' tab to highlight a canvas for this event:
{{OnIncomingCall_canvas.JPG}}

2. When we receive a new incoming call, the first thing we want to do is to answer it. To implement answering a call, we need to drag an 'AnswerCall' action from the 'Toolbox' onto the canvas for 'OnIncomingCall'.

Find the "Call Control" section in the 'Toolbox'. You may need to expand the window.
{{find_toolbox.JPG}}

Click and hold AnswerCall and drag AnswerCall onto the canvas. The Designer will automatically connect the Start node to the new AnswerCall action.
{{drag_answercall.JPG}}

===About Variables===

The actions on the Designer canvas need to have options set to have any effect. For the AnswerCall action, we need to tell the action which call to answer (since many calls could be incoming at one time).

To tell the AnswerCall action which call to answer, we need to pass to the AnswerCall action the "CallId" of the incoming call.

Argument passing in Designer is done through variables. There are three types of variables:

  * Script variables 
  * Event variables 
  * Local variables 

The OnIncomingCall event carries with it the value of the incoming call CallId. To capture this value and pass it to the AnswerCall action. We need to create a local variable in the event handler for the CallId. Once we have the CallId in a local variable we need to set the CallId parameter of the AnswerCall action to read the 'callId' from this variable.

===Passing OnIncomingCall-CallId to the action AnswerCall===

====Saving OnIncomingCall-CallId as local variable callId====

1. The first thing we need to do is to reveal the Variable Tray in the Designer Canvas. To reveal the Variable Tray, click on View -&gt; Variable Tray in the Designer menu.
{{show_variables_tray.jpg}}

2. Now that the Variable Tray is revealed, we can add a new variable. To add a new variable, move the cursor to the variable tray and right-click and select add new item. Set the name of the new variable to callId.

{{variable_additem.jpg}}
 
3. To initialize the value of the new local variable callId to the event variable CallId, move the mouse to the properties frame. For the new callId variable click on the drop-down select button next to InitializeWith and select the event variable CallId.

{{init_callId.jpg}}

The variable callId is now initialized. Now it can be used by the AnswerCall action.


====Passing local variable callId to AnswerCall====

1. To pass a local variable to the AnswerCall action, first click on AnswerCall. When you have selected it the icon will have a green box around it.

{{select_answercall.jpg}}

2. Selecting AnswerCall will bring up the properties of AnswerCall in the properties frame in the lower right-hand corner of the Designer. The very first parameter under the Action Parameters set in AnswerCall is the parameter CallId. To bind the CallId parameter to the callId local variable expand the CallId parameter by clicking on the + to the left of CallId. This will open the properties for the parameter. For the User Type set the property to variable. For the VAR name select callId.

{{change_type.jpg}}

{{11b_bind_to_callId.jpg}}
 
===Adding a Play action===

We are now ready to add a Play action to the OnIncomingCall event handler.

1. Find the Media Control group in the tool box:
{{find_mediacontrol.jpg}}

2. Drag the Play action onto the canvas. Notice that when the Play action is dropped onto the canvas, two new events are added to the project: OnPlay_Complete and OnPlay_Failed. We will need to implement handlers for these events shortly.

{{drag_drop_play.jpg}}

===Passing control from AnswerCall to Play===

Now that we have a Play action, we need to indicate how program flow moves from the AnswerCall action to the Play action. In Designer, this is done by connecting the actions together with a directed line.

To connect the AnswerCall action to the Play action, move your cursor to the AnswerCall icon. When your cursor approachs the center of the icon a 'dot' will appear in the center of the icon and your cursor will turn into a 'hand' **insert hand icon here**. Once your cursor has become a 'hand', click and drag the cursor from the AnswerCall action to the Play action.
{{highlight_answercall.jpg}}

{{15_dragto_play.jpg}}
 
There will now be a line from the AnswerCall action to the Play action labeled default. This means that once the AnswerCall action completes, the default conditional-step is to invoke the Play action.

Hmm, that is probably not quite what we want. The real world is messy and prone to failure. We cannot assume that every time the script answers an incoming call that the call will connect and someone will be on the other side. What we should probably do is to only pass control to the Play action if the AnswerCall action completes and returns a Success state.

To do that we need to change the meaning of the line between AnswerCall and Play to only pass control on Success rather than by default.

To change the line, click on the default label. A drop-down will appear. Select the Success label.

{{select_success.jpg}}

Now we have to handle the non-Success condition. If the AnswerCall does not succeed, all the script should do is terminate. To tell the script to terminate, we add an EndScript action to the event handler.

To add an EndScript action find the Application Components section of the Toolbox:
{{find_endscript.jpg}}

Then drag the EndScript action to the canvas underneath the AnswerCall action and then connect the AnswerCall and EndScript actions.

{{add_endscript.jpg}}

===Configuring the Play action===

Now lets configure the Play action to play the desired prompt.

The Play action requires at least two pieces of information to execute successfully: 1. the connection to play media onto, and 2. the media to play.

Like the CallId parameter to AnswerCall, the ConnectionId parameter for Play needs to be passed to the Play action through a local variable. But there is no local variable the corresponds to the connectionId yet... so lets create one.

====Saving connectionId as a local variable====

When AnswerCall completes successfully a new connection identified by a unique ConnectionId is defined. This ConnectionId is available as a Result Parameter of the AnswerCall action. To use this parameter in other actions, we need to save the ConnectionId result parameter into a local variable. We need to modify the AnswerCall action to do this.

1. The first thing we need to do is to create a new local variable to hold the connectionId. Right-click on the Variable Tray and select Add New Item. Name the variable connectionId but do not initialize it.

{{add_connectionId.jpg}}

2. Next click on the AnswerCall icon in the canvas. Move your cursor to the properties box in the lower right-hand side of the Designer and scroll down to the Result Data section of the box until you reach the ConnectionId parameter. Click once in the field to the right of the ConnectionId parameter to reveal the drop-down icon and then click on the drop-down icon to reveal the variable selection list. Select the connectionId variable.

{{bind_connectionId_to_resultdata.jpg}}

====Passing connectionId to Play====

Now that connectionId is defined as a variable, we can set the ConnectionId action parameter for the Play action. Click on the Play icon in the canvas and then associate the ConnectionId parameter with the connectionId local variable.

1. You will need to first change the default type of the parameter from literal to variable. To do this expand the properties of the ConnectionId parameter. On the User Type property, click on literal and in the dialog select variable as the new User Type.
{{set_usertype.jpg}}

2. Now bind the ConnectionId action parameter to the connectionId local variable.
{{bind_connectionId.jpg}}

===Setting the Prompt in Play===

Now let's specify what to actually play when the call is answered by the application. The Play action has the ability to play both static media files (.WAV) as well as generate dynamic media using the CUME's embedded Text-to-speech engine.

We will discuss adding static media later, for now let's have the application speak the words: "Hello World" to the caller.

To do this select the **Action Parameter ** named Prompt1. It should be immediately below the ConnectionId action parameter in the Play Properties box.

Click into the text-field to the right of the parameter name and type the string Hello World.
{{helloworld.jpg}}

The Play action is now configured.

===Handling exit conditions of the Play action===

When we wired up the Play action to AnswerCall we created two paths for the application flow. The first path was from AnswerCall to Play when AnswerCall succeeded and the second path was to an EndScript action if AnswerCall was not sucessfull.

Similarly we need to now handle the exit conditions of the Play action. However, unlike AnswerCall, the Play action is an asynchronous action. When Play is called what is really happening is a play request is being issued by the CUAS to the CUME. If the request is accepted, then some time after being accepted, actual media streaming will be initiated by the CUME to the specified ConnectionId. We know that Play is an asynchronous action because when we dropped Play onto the canvas, two new event handler functions were initialized: OnPlay_Complete and OnPlay_Failed. These event handler functions are also visible as annotations on the Play icon in the canvas.

So to properly handle the exit conditions **and** events that Play generates we need to understand that there are really several possible outcomes to the Play action:

  * Play action completes successfully indicating that the play request was received and accepted by the CUME 
  *Play action fails indicating that the play request was rejected by the CUME or failed to be delivered 
  * OnPlay_Complete event is raised indicating that the CUME has completed the requested media streaming to the ConnectionId 
  * OnPlay_Failed event is raised indicating that the media streaming to the ConnectionId failed to complete or initiate. 

For the first two conditions, we need to add actions to the OnIncomingCall event handler function and sequence them after the Play action, similar to what we did for the non-success condition of AnswerCall. For the last two conditions, we need to implement the OnPlay_Complete and OnPlay_Failed event handler functions.

Lets finish what needs to be done in OnIncomingCall first and then we can move on to the other event handler functions.

====Play action success====

If the Play action succeeds, it means that the play request to the CUME was delivered successfully. When that happens the OnIncomingCall event handler function is done. To implement this correctly we need to add an EndFunction action on Success of Play. Select Application Components in the Toolbox and drag an EndScript action onto the canvas and place it to the right of the Play action and link them together with a Success wire.

{{add_endfunction.jpg}}

====Play action failure====

If the Play action does not succeed, it mean the play request to the CUME was rejected or otherwise failed to be delivered. When this happens we need to hangup on our caller and terminate the application. To hangup we need to add a HangUp action on non-success of play and then after Hangup and EndScript action to terminate the application.

1. From the Call Control section of the Toolbox drag a Hangup action to the canvas.

2. Connect the default condition from Play to Hangup

{{add_hangup.jpg}}
3. Drag an EndScript action from the Application Components section of Toolbox onto the canvas.

4. Connect the default condition from Hangup to the new EndScript action.
{{add_endscripts.jpg}}

====Configure Hangup====

Like Play and AnswerCall the Hangup action needs to be configured. Hangup needs to know the CallId that should be terminated.

Since we already have a local variable with this information, callId, all we have to do is to select the Hangup icon in the canvas and bind the CallId Action Parameter to the callId local variable.

As with the ConnectionId parameter in the Play action, you will need to first set the User Type of the parameter to variable before you can bind the callId variable.

{{set_usertypes.jpg}}

{{28b_bind_callId.jpg}}

 
====A note on Designer Coding Style====
Instead of adding a second EndScript to the OnIncomingCall event handler function, it is also possible to directly link the Hangup action to the same EndScript action that the non-success condition of AnswerCall flows to:

{{hangup_to_endscripts.jpg}}

This is perfectly legal, but in the opinion of the CUAE engineering team is not recommended as a coding style. The recommend orientation of Designer functions is to advance program flow from left to right and to handle exception conditions from top to bottom. This is purely our convention and by no means implies any sort of religous truth, merely our convention. Other teams are quite happy with different conventions.

===Handle 'OnPlay_Complete'===

When the CUME completes it media streaming, it will raise an OnPlay_Complete event. The application needs to handle this event by hanging-up the call and terminating the script.

To handle this event, start by clicking the OnPlay_Complete tab on the canvas.

{{click_onplay_complete.jpg}}

This event handler function will be much simpler than the OnIncomingCall handler. The only thing this function needs to do is to Hangup and EndScript.

So lets add a Hangup action and a EndScript action to this function and wire them up.

{{onplayCompletes.jpg}}

Now all we need to do is pass the correct CallId to the Hangup action and this event handler function is complete.

Because OnPlay_Complete is a new event handler function, it does not have access to the local variables we defined in the OnIncomingCall event handler function. Furthermore the OnPlay_Complete event does not have any knowledge of the CallId. The event only knows about the ConnectionId because the event is a consequence of the Play action and not the AnswerCall action or the Metreos.CallControll.IncomingCall trigger.

So before we can complete the OnPlay_Complete event handler function, we need to define a global variable in our main script script1 and then set that global variable in the AnswerCall action. Once we do this then we can reference the global variable in our Hangup action in the OnPlay_Complete event handler function.

====Define the global variable g_callId====

1. To define a global variable select the script1 tab in the canvas.
{{select_script1.jpg}}

2. Right-click on the variables folder and select Add New Item
{{add_new_item.jpg}}

3. Set the name of the variable to g_callId

{{set_caller_id.jpg}}
**Note:**

// On variable naming it is the CUAE engineering team convention to prefix global variable names with a 'g_'//. 

====Initialize the global variable g_callId====

Now that the variable g_callId is defined, it needs to be initalized.

1. Select the OnIncomingCall event handler function and click on the AnswerCall action.
{{answerCall.jpg}}

2. Now bind the AnswerCall **Result Data** property CallId to the global variable g_callId.

{{answercall_result.jpg}}

====Configure OnPlay_Complete's Hangup====

Now that the global variable has been defined and initialized, we can complete the configuration of the OnPlay_Complete's Hangup action and complete the event handler function implementation.

1. Go back to the OnPlay_Complete handler function and select Hangup.

{{onplaycomplete_hangUp.jpg}}
2. Change the User Type attribute of the CallId property of Hangup to variable and then bind the g_callId variable to CallId.

{{hangup_g_callId.jpg}}
OnPlay_Complete is now complete.

====Handle 'OnPlay_Fail'====

The OnPlay_Fail event is handled exactly link the OnPlay_Complete event. So for this implementation, lets just copy-n-paste the actions from OnPlay_Complete into OnPlay_Fail.

1. Select the OnPlay_Complete event handler function.

2. Click on the canvas and drag a selection box around the Hangup and EndScript actions. Use Ctrl+C or the Edit-&gt;Copy menu to copy the selection into the buffer.

{{select_onplay_complete.jpg}}

3. Select the OnPlay_Fail event handler and use either Ctrl+V or Edit-&gt;Paste to paste the buffer into the canvas. 

{{on_play_failed.jpg}}
4. Wire the Start node to the Hangup action.

{{on_ply_failed_hangup.jpg}}

OnPlay_Fail is now complete.

====Other Events 'OnRemoteHangup'====

During the execution of the test application the script has the ability to process known provider event triggers.
In the case of this application, the event trigger that we need to process is RemoteHangup.

  * To add the event to the script: 

#Select the script1 tab 
#Drag the "RemoteHangup" event from the "Toolbox - Call Control" item list and under the "Events and Functions" folder on the canvas" 
#Finalize the "OnRemoteHangup" function for the RemoteHangup event by adding an "EndScript" action to the function and connecting the start with a branch condition connector to the "EndScript" action. 

{{onRemote_hangup.jpg}}

===Build &amp; Deploy the Application===

Prior to building and deploying the application, configure the "Connectivity" options between the CUAD and the CUAS.

  * Select "Tools -&gt; Options -&gt; Connectivity" from the top menu 
  * Enter the IP address and username / password for the CUAE server, then save the change. 

{{connectivityAction.jpg}}

To both build and deploy the application, select "Build -&gt; Deploy" from the top menu (to Build without deploying, select "Build -&gt; Build Project").

**Note**

//The status of the build and deployment is displayed in the "Ouput" pane at the bottom of the CUAD. 
In the case that this is not you first deployment to the CUAE server you will be present with a pop-up prompt to select "Upgrade" or "Reinstall"//. 
 

To view the status of the application in the CUAE Admin console. Log into the CUAE management console and select applications from the menu list.

===Adding A Trigger===

  * Select "Applications -&gt; Find/List Triggers" to generate a list of applications and their associated triggers. 
  * Select the application "AnswerAndPlay" in the list. 
  * Enter "to" and the number that will be used to trigger the application. Select "Add Parameter". 

{{addTrigger.jpg}}

===Running the Application===

You should now be able to run the program by calling the specified trigger above.</description>
      <pubDate>Fri, 30 Jul 2010 20:53:35 GMT</pubDate>
      <guid isPermaLink="false">http://developer.cisco.com/web/cuae/wikidocs?p_p_auth=BrzK1CFb&amp;p_p_id=36&amp;p_p_lifecycle=0&amp;p_r_p_185834411_nodeId=8398769&amp;p_r_p_185834411_title=&amp;AnswerAndPlay-Designer</guid>
      <dc:creator>Bhuvaneswari Rajamanickam</dc:creator>
      <dc:date>2010-07-30T20:53:35Z</dc:date>
    </item>
    <item>
      <title>AnswerAndPlay-Csharp 1.9</title>
      <link>http://developer.cisco.com/web/cuae/wikidocs?p_p_auth=BrzK1CFb&amp;p_p_id=36&amp;p_p_lifecycle=0&amp;p_r_p_185834411_nodeId=8398769&amp;p_r_p_185834411_title=&amp;AnswerAndPlay-Csharp</link>
      <description>==About the Application==

This application is triggered by an incoming phone call. When triggered, the application answers the call and plays a prompt back using various mechanisms (Text-to-Speech and pre-recorded WAV files). Once the prompt has completed the application will then hang up the call.

==Creating the Application Project==

1. Open a Command Prompt window.

2. Navigate to the directory you want to use as your workspace. To use the CUAE command-line tool to create a new application, type the **cuae create** command and the name of the application project.

{{{c:&gt; cd \workspace
c:\workspace&gt; cuae create AnswerAndPlay
}}}

The tool then prompts you for additional information.

**Note:** //Once you are more familiar with the options, you can type the full command rather than answering the prompts. For example://

// **cuae create** -l language -m module -t string ~[options~] projectname//

// **cuae create** -l csharp -m MakeCall -t app AnswerAndPlay//


3. First the tool prompts you  to choose between building an application or a plugin. In this example, the correct choice is application:

{{{Project Type? [application or plugin] application}}}

4. Next the tool prompts you to specify the programming language. In this example, the correct choice is csharp:

{{{Programming language? [java or csharp] csharp}}}

5. The tool asks you for the namespace for the application. A Java program might want to use a fully qualified namespace like com.company.answerandplay or something simple like answerandplay. The tool offers you a simple namespace based on the project name. Let's accept the tool's suggestion for now and use answerandplay:

{{{Project namespace? [default: answerandplay] &lt;Return&gt;}}}

6. Finally, the tool asks if you would like to specify a triggering event. All applications need to register against at least one triggering event. You can specify the triggering event now or wait and specify the triggering event later. You can also change the triggering event during development. Again, since we know that this application needs to be triggered on an incoming call, let's go ahead and specify the triggering event now. Select option 4:

{{{ Available application triggering event:
   0: Skip this step
   1: cisco.uc.cuae.legacy.JTapi.JTapiIncomingCall
   2: cisco.uc.cuae.legacy.JTapi.JTapiCallInitiated
   3: cisco.uc.cuae.legacy.JTapi.JTapiCallEstablished
   4: cisco.uc.cuae.legacy.CallControl.IncomingCall
   5: cisco.uc.cuae.legacy.Http.GotRequest
   6: cisco.uc.cuae.legacy.Presence.SubscriptionTerminated
   7: cisco.uc.cuae.legacy.Presence.Notify
   8: cisco.uc.cuae.legacy.TimerFacility.TimerFire
 Triggering event? [0-8] 4}}}

The tool now has enough information to generate the project template.

{{{Generating:
   * application named "AnswerAndPlay"
   * with namespace "answerandplay"
   * with laguage "csharp"
   * with trigger event "cisco.uc.cuae.legacy.CallControl.IncomingCall"
   * in location C:\workspace\
Created project "AnswerAndPlay" in directory
"C:\workspace\AnswerAndPlay\"}}}

Here is the whole sequence again with all of the steps together: 


{{{wxp&gt; cuae create AnswerAndPlay
Project type? [application or plugin] application
Programming language? [java or csharp] csharp
Project namespace? [default: answerandplay]
Available application triggering event:
   0: Skip this step
   1: cisco.uc.cuae.legacy.JTapi.JTapiIncomingCall
   2: cisco.uc.cuae.legacy.JTapi.JTapiCallInitiated
   3: cisco.uc.cuae.legacy.JTapi.JTapiCallEstablished
   4: cisco.uc.cuae.legacy.CallControl.IncomingCall
   5: cisco.uc.cuae.legacy.Http.GotRequest
   6: cisco.uc.cuae.legacy.Presence.SubscriptionTerminated
   7: cisco.uc.cuae.legacy.Presence.Notify
   8: cisco.uc.cuae.legacy.TimerFacility.TimerFire
Triggering event? [0-8] 4
Generating:
   * application named "AnswerAndPlay"
   * with namespace "answerandplay"
   * with laguage "csharp"
   * with trigger event "cisco.uc.cuae.legacy.CallControl.IncomingCall"
   * in location C:\workspace\
Created project "AnswerAndPlay" in directory
 "C:\workspace\AnswerAndPlay\"}}}


==Inspecting the Generated Project==

Let's inspect the files that were generated by the CUAE command-line tool. It created an AnswerAndPlay directory in the directory from which you ran the cuae create command. The AnswerAndPlay directory contains the following files and directories:

* AnswerAndPlay.etch 
* AnswerAndPlay.properties 
* AnswerAndPlay.csproj 
* cuae-resources/ 
* README.txt 
* src/ 

The most important of which, for your purposes, are:

* **AnswerAndPlay.etch** -- CUAE application Etch service definition. Edit this file to use additional CUAE services in your project. 
* **AnswerAndPlay.csproj** -- C# project file. 
* **cuae-resources/** -- CUAE application resource directory. 
* **src/** -- Generated application source files. 

==Declaring Services==

The first step in building an Etch-based application is identifying which [[Hosted CUAE Services | Cisco Unified Application Environment hosted services]] the application requires and then editing the .etch file to declare the names of those services into the application.

**Tips:** //Once you identify the services you need, you can familiarize yourself with them by visiting the [[API Reference | API reference]] for the version of the Unified Application Environment you are using.//
 

The following snippet is the default content of the .etch file that the CUAE command-line tool generates. We use the **mixin** command to declare the appropriate services.

{{{// CUAE Application Etch Service Definition
//
// This service defines your application and the CUAE services that you
// use in your application.

// The service module namespace, this will be translated to the
// namespace of the generated source code.
module AnswerAndPlay

// The name of your service.
service AnswerAndPlay
{
    // By default, you must always use the EtchBridge service. Do not
    // remove this mixin, otherwise your application won't work.
    mixin cisco.uc.cuae.EtchBridge

    // You may add any additional service mixins that you require. For
    // example, if you'd like to make and receive phone calls, add the
    // following line:
    //     mixin cisco.uc.cuae.legacy.CallControl
    mixin cisco.uc.cuae.legacy.CallControl
}
}}}

Because this application will answer an incoming phone call and play a media stream back to the caller, we need to utilize the CallControl and MediaControl services. The default etch file already has a mixin for Call Control because of the triggering event you selected when creating the application project. 


{{{  mixin cisco.uc.cuae.legacy.CallControl}}}

We need to add a declaration for the MediaControl service, using the full namespace. Add the following line right after the mixin for CallControl but before the final "}":

{{{  mixin cisco.uc.cuae.legacy.MediaControl}}}

The new AnswerAndPlay.etch file should look like this: 


{{{// CUAE Application Etch Service Definition
//
// This service defines your application and the CUAE services that you
// use in your application.

// The service module namespace, this will be translated to the
// namespace of the generated source code.
module AnswerAndPlay

// The name of your service.
service AnswerAndPlay
{
    // By default, you must always use the EtchBridge service. Do not
    // remove this mixin, otherwise your application won't work.
    mixin cisco.uc.cuae.EtchBridge

    // You may add any additional service mixins that you require. For
    // example, if you'd like to make and receive phone calls, add the
    // following line:
    //     mixin cisco.uc.cuae.legacy.CallControl
    mixin cisco.uc.cuae.legacy.CallControl
    mixin cisco.uc.cuae.legacy.MediaControl
}
}}}

==Building the Application==

After declaring the services you need, you must build the application to generate source files.  

1. Open a Command Prompt and navigate to the application directory.

2. Run the **msbuild** command to generate source files.

{{{c:\workspace&gt; cd AnswerAndPlay
c:\workspace\AnswerAndPlay&gt; msbuild}}}

The following source file templates are then created in the directory src\answerandplay:

* MainHttpMakeCallClient.cs 
* ImplHttpMakeCallClient.cs 

==Creating Configuration Items==

YAML is the file format for Unified Application Environment application configuration (config.yaml) and metadata definitions project_name.yaml).

All application configuration items are written in the config.yaml file, which is located in the cuae-resources directory.

Configuration items follow a specific syntax, as follows.

{{{-name:
[display name:]
format:
[description:]
[minvalue:]
[maxvalue:]
[defaultvalue:]
[readonly:]
[required]}}}

*Items in square brackets ~[~] are optional

The default config.yaml file contains the following information:

{{{# CUAE Application Configuration Definition
#
# You only need to edit this file if you want to expose configuration to
# the administrator through cuaeadmin.
#
# This file was auto-generated from a template but will never be
# overwritten. You should edit this file directly if required.

configuration:
  # Indicates the name of your configuration item. It will be how you
  # reference this configuration item from code.
  #- name: myConfValue

    # Controls how the visible label of the configuration value. For
    # example, if 'name' was defined as: myConfValue, you may choose to
    # define 'displayName' as: My Config Value. Think of it as a friendly
    # name. This field is optional.
    #displayName: My Config Value

    # Defines the format of the configuration item's value. This will
    # control how cuaeadmin renders and validates the value. Possible
    # values for the 'format' field are: String, Bool, Number, IP_Address,
    # Array, HashTable, Password.
    #format: String

    # A description of the configuration item that will be displayed to
    # the administrator in cuadmin. This field is optional.
    #description: Some description here.

    # For configuration items that are formatted as numbers, the
    # 'minValue' and 'maxValue' configuration items define the acceptable
    # range of input for the item. These fields are optional.
    #minValue:
    #maxValue:

    # Defines the default value of the configuration. This field is
    # optional.
    #defaultValue:

    # Inidicates whether the configuration item is editable. If
    # 'readOnly' is set to true, the administrator will not be able to
    # edit it in cuaeadmin, but will be able to view it. The default is
    # false, and this field is optional.
    #readOnly:

    # Indicates whether the configuration item is required. If required,
    # the administrator will have to set a value before the application
    # will run. The default is false, and this field is optional.
    #required: false
}}}

In this example, the application has one configuration item, the content of the rendering text. Add the following block to the config.yaml file in the configuration section:

===Code Sample===

{{{- name: TTSMessage
  format: String
  displayName: TTSMessage
  defaultValue: Hello, welcome to answer and play demo application}}}

==Writing the Application Code==

This section provides instructions and code samples for writing the application logic.

===Importing the Project into Your IDE===

1. Open Visual Studio (or another IDE of your preference).

2. Create a new CSharp project from the existing project file by choosing **File -&gt; Open -&gt; Project/Solution**.

3. Browse to the AnswerAndPlay directory and choose **AnswerAndPlay.csproj**.

===Reading Application Configurations===

The CUAE application receives the current application configurations from CUAE server using method server.getConfig("partition name") in incomingcall event handler in the ImplAnswerAndPlayClient.cs file. The developer can iterate through the configurations array and parse the configuration item based on its type.

===Handling the incomingCall Triggering Event===

You should write a method to handle the event of the incoming call trigger to answer the call and begin playing the message.

You will need to add the following declaration to ImplAnswerAndPlayClient.cs in order to use CuaeResult:

{{{using cisco.uc.cuae.legacy.types.CuaeCommon;}}}

===Code Sample===

{{{// Handle incoming call
        String sTTSMessage = "";

        public override void incomingCall(String sessionId, IncomingCallOptions options)
        {
            PlayResult pResult = null;
            AnswerCallResult acr = server.answerCall(sessionId, options.callId, null, null);
            ConfigEntry[] config = null;

            try
            {
                config = server.getConfig("Default");

                // Display configs to console
                if(config.Length &gt; 0)
                {
                    for(int i = 0; i &lt; config.Length; i++)
                    {
                        if(config[i].name.Equals("TTSMessage"))
                        {
                            sTTSMessage = Convert.ToString(config[i].configValue);
                            Console.WriteLine("TTSMessage: " + sTTSMessage);
                        }
                    }
                }
            }
            catch(BridgeException e)
            {
                Console.WriteLine(e);
                server.removeCuaeSession(sessionId);
                return;
            }

            try
            {
                pResult = server.beginPlay(sessionId, sTTSMessage, acr.connectionId, null, null, acr.callId);
            }
            catch(Exception e)
            {
                Console.WriteLine(e);
                server.removeCuaeSession(sessionId);
                return;
            }
            if(pResult.returnValue != CuaeResult.SUCCESS)
            {
                Console.WriteLine("beginPlay failed");
                server.hangup(sessionId, acr.callId, null);
                server.removeCuaeSession(sessionId);
            }
        }
}}}

===Completing the onPlayComplete Function===

When using the "Play" action (above), you should follow-up with the "onPlayComplete" function:

===Code Sample===

{{{
// Handle play complete
        public override void onPlayComplete(String sessionId, PlayResult results, Object state)
        {
            Console.WriteLine("Play completed..");
            String callId = (String) state;

            Console.WriteLine("\nLocal Hangup..");
            if(server.hangup(sessionId, callId, null).returnValue != CuaeResult.SUCCESS)
                Console.WriteLine("Hangup failed");

            Console.WriteLine("\nEndScript");
            server.removeCuaeSession(sessionId);
        }
}}}


==Handle startTx event==

Event occurs to indicate the transmit audio channel has been established.

{{{public override void startTx(String sessionId, StartTxOptions options)
{
		
}
}}}

==Handle startRx event==

The application server has established the receive audio channel and communicated the Rx info to the remote endpoint on the underlying call control protocol

{{{public override void startRx(String sessionId, StartRxOptions options)
{
		
}
}}}

==Handle stopTx Event==

Indicates that the transmit audio channel has been closed.

{{{public override void stopTx(String sessionId, StopTxOptions options)
{
		
}
}}}

==Handle remoteHangup Event==

Indicates that call has been terminated by the remote endpoint.

{{{public override void remoteHangup(String sessionId,RemoteHangupOptions options)
{

}
}}}

==Registering the Application==

The previous steps completed the core logic of the example applications, but before any Etch-based API calls can actually be made, we must register the application with the Cisco Unified Application Server. To register your application, follow these steps: 1. Open the MainAnswerAndPlayClient file in the /src directory. It contains the following content by default:

{{{// Generated by:
// 0.95.0 (ETCH-TRUNK-840) / java 0.95.0 (ETCH-TRUNK-840)
// Sun Jun 08 22:47:33 CDT 2008

package answerandplay;

/**
 * Main program for AnswerAndPlayClient. This program makes a connection to the
 * listener created by MainAnswerAndPlayListener.
 */
public class MainAnswerAndPlayClient implements AnswerAndPlayHelper.AnswerAndPlayClientFactory

{
    /**
     * Main program for AnswerAndPlayClient.
     *
     * @param args command line arguments.
     * @throws Exception
    */
    public static void main( String[] args ) throws Exception
    {
	// TODO Change to correct URI
	string uri = "tcp://localhost:4001";
	RemoteAnswerAndPlayServer server = AnswerAndPlayHelper.newServer( uri, null,
	    new MainAnswerAndPlayClient() );

	// Connect to the service
	server._startAndWaitUp( 4000 );

	// TODO Insert Your Code Here

	// Disconnect from the service
	server._stopAndWaitDown( 4000 );
    }

    public AnswerAndPlayClient newAnswerAndPlayClient( RemoteAnswerAndPlayServer server )
        throws Exception
    {
	return new ImplAnswerAndPlayClient( server );
    }
}
}}}

2. To make a connection to the listener, add a server.registerApplication() request.

{{{// TODO Insert Your Code Here
     String key = server.registerApplication("AnswerAndPlay", "Default", "&lt;username&gt;", "&lt;password&gt;");
     Console.WriteLine("AnswerAndPlay application registered with key: " + key);

     Console.WriteLine("Hit any key to exit.");
     Console.ReadLine();
}}}

3. Modify the String URI to match the IP address and port of the Cisco Unified Application Server.

URI settings vary slightly between 2.5(1) Beta 1 and more recent versions of 2.5(1), as follows:

====2.5(1) and 2.5(1) Beta 2, Beta 3, Beta 4 and later releases====

{{{// TODO Change to correct URI
String uri = "tls://appserver_ipaddress:9000?TlsConnection.authReqd=false&amp;filter=KeepAlive
 &amp;KeepAlive.Count=5&amp;Packetizer.maxPktSize=102400&amp;TcpTransport.reconnectDelay=4000";
}}}

 In Beta 2, the Etch Bridge was updated to use [[Etch Bridge TLS | Transport Layer Security]] for encryption by default. For your applications to work, you must specify TLS as the protocol in the URI and set the authReqd parameter to false. In the example above, the [[Keep Alive | KeepAlive]] filter and [[MaxPacketSize | Max Packet Size]] and [[Etch Connection URI | Reconnect Delay]]parameters have also been set.

====2.5(1) Beta 1====

{{{// TODO Change to correct URI
		String uri = "tcp://appserver_ipaddress:9000?&amp;TcpConnection.reconnect_delay=4000";
}}}

**Note:** //In addition to setting the correct IP address and port for the Cisco Unfied Application Server, the Reconnect Delay parameter should be set on all connection URIs.//

==Packaging the Test Application==

1. Execute a successful build request for your test application within your IDE.

2. To package the JAVA application, execute the "cuae package" command from a DOS command shell in the parent directory of the test application.

{{{C:\workspace\AnswerAndPlay&gt;cuae package
Created package file
"C:\workspace\AnswerAndPlay\bin\AnswerAndPlay.mca"}}}

The following files will be added to the "\bin" sub-directory:

* AnswerAndPlay.mca (application bundle to be uploaded into the CUAE server) 
* INSTALLER.xml - (contains the config items in config.yaml) 
* MANIFEST.xml - (bundle details for the package comamnd) 

==Installing the Test Application==

To install the test application on a CUAE server, execute the **cuae install** command from a DOS command shell in test application parent directory of the test application. The **cuae install** command varies slightly between 2.5(1) Beta 1 and Beta 2. 

====2.5(1) Beta 2====

You are prompted to enter an IP address, username, and password (to view the help, run the **cuae install -h** command). When prompted, enter Y or N to save management settings. This will save the answers to the above three questions in the properties file and remember them the next time you go to install.

**Note:** //You are also prompted for the communications protocol (TCP or TLS). Select the protocol that is set on the Management Service. TLS is the default supported protocol. If you want to use TCP, follow the instructions in [[Management Service TLS | Management Service Transport Layer Security (TLS)]] to change the default URI of the Management Service before running these commands.//

{{{C:\workspace\AnswerAndPlay&gt;cuae package
Created package file
"C:\workspace\AnswerAndPlay\bin\AnswerAndPlay.mca"

C:\workspace\AnswerAndPlay&gt;cuae install
Enter the hostname or IP address of the management service (for example: localhost, 1.1.1.1): localhost
Protocol: tls
Generated mgmt-service uri: tls://localhost:9001?TlsConnection.authReqd=false
Enter management service login username:
Entermanagement service login password: ********
Save the amanagement settings with the project? [yes or no] no
Application : C:\workspace\AnswerAndPlay\bin\AnswerAndPlay.mca
Uploading :  ===========================&gt; 100%
Application has been installed successfully}}}

====2.5(1) Beta 1====

You are prompted to enter an IP address, username, and password (to view the help, run the **cuae install -h** command). When prompted, enter Y or N to save management settings. This will save the answers to the above three questions in the properties file and remember them the next time you go to install.

{{{C:\workspace\AnswerAndPlay&gt;cuae package
Created package file
"C:\workspace\AnswerAndPlay\bin\AnswerAndPlay.mca"

C:\workspace\AnswerAndPlay&gt;cuae install
Enter management service uri or host/IP &lt;for example: localhost, tcp://1.1.1.1.:4001&gt;:
Enter management service login username:
Entermanagement service login password: ********
Save the amanagement settings with the project? [YyNn] n
Application : C:\workspace\AnswerAndPlay\bin\AnswerAndPlay.mca
Uploading :  ===========================&gt; 100%
Application ahas been installed successfully}}}

Configuring the Application in the Administration Interface

===Adding a Trigger===

1. Log in to the Administration interface.

2. Click **Applications -&gt; Find/List Triggers** to generate a list of applications and their associated triggers.

3. Select the application AnswerAndPlay in the list.

4.  Enter "to" and the number that will be used to trigger the application.

5. Click **Add Parameter**.

{{Trigger-Details.JPG}}

==Running the Application==

1. Run the class AnswerAndPlay.MainAnswerAndPlayClient to register the application.

At this point the application will remain registered and running until either you stop your application or the application loses connectivity to the Unified Application server.

2. Run the program by dialing the number you specified as the trigger.</description>
      <pubDate>Fri, 30 Jul 2010 20:06:50 GMT</pubDate>
      <guid isPermaLink="false">http://developer.cisco.com/web/cuae/wikidocs?p_p_auth=BrzK1CFb&amp;p_p_id=36&amp;p_p_lifecycle=0&amp;p_r_p_185834411_nodeId=8398769&amp;p_r_p_185834411_title=&amp;AnswerAndPlay-Csharp</guid>
      <dc:creator>Bhuvaneswari Rajamanickam</dc:creator>
      <dc:date>2010-07-30T20:06:50Z</dc:date>
    </item>
    <item>
      <title>SimpleIpPhoneMenuTree-Csharp 1.8</title>
      <link>http://developer.cisco.com/web/cuae/wikidocs?p_p_auth=BrzK1CFb&amp;p_p_id=36&amp;p_p_lifecycle=0&amp;p_r_p_185834411_nodeId=8398769&amp;p_r_p_185834411_title=&amp;SimpleIpPhoneMenuTree-Csharp</link>
      <description>==About the Application==

This application implements a simple food ordering form through a phone service.

==Creating the Application Project==

1. Open a Command Prompt window.

2. Navigate to the directory you want to use as your workspace.
 
To use the CUAE command-line tool to create a new application, type the **cuae create** command and the name of the application project.

{{{c:&gt; cd \workspace
c:\workspace&gt; cuae create SimpleIpPhoneMenuTree}}}

The tool then prompts you for additional information.

**Tips:** //Once you are more familiar with the options, you can type the full command rather than answering the prompts by using the following syntax:

cuae create -l language -m namespace -t project type ~[options~] projectname//


3. First the tool prompts you to choose between building an application or a plugin. In this example, the correct choice is application:

{{{Project Type? [application or plugin] application}}}

4. Next the tool prompts you to specify the programming language. In this example, the correct choice is csharp:

{{{Programming language? [java or csharp] csharp}}}

5. The tool asks you for the namespace for the application. A program might want to use a fully qualified namespace such as
com.company.simpleipphonemenutree or something simple like simpleipphonemenutree. 

The tool offers you a simple namespace based on the project name. Let's accept the tool's suggestion for now and use simpleipphonemenutree

{{{Project namespace? [default: simpleipphonemenutree] &lt;Return&gt;}}}

6. Finally, the tool asks if you would like to specify a triggering event. All applications need to register against at least one triggering event. 

You can specify the triggering event now or wait and specify the triggering event later. You can also change the triggering event during development.

Again, since we know that this application needs to be triggered on an http request, let's go ahead and specify the triggering event now. Select option 5:

{{{ Available application triggering event:
   0: Skip this step
   1: cisco.uc.cuae.legacy.JTapi.JTapiIncomingCall
   2: cisco.uc.cuae.legacy.JTapi.JTapiCallInitiated
   3: cisco.uc.cuae.legacy.JTapi.JTapiCallEstablished
   4: cisco.uc.cuae.legacy.CallControl.IncomingCall
   5: cisco.uc.cuae.legacy.Http.GotRequest
   6: cisco.uc.cuae.legacy.Presence.SubscriptionTerminated
   7: cisco.uc.cuae.legacy.Presence.Notify
   8: cisco.uc.cuae.legacy.TimerFacility.TimerFire
 Triggering event? [0-8] 5}}}

The tool now has enough information to generate the project template.

{{{   Generating:
   * application named "SimpleIpPhoneMenuTree"
   * with namespace "simpleipphonemenutree"
   * with laguage "csharp"
   * with trigger event "cisco.uc.cuae.legacy.Http.GotRequest"
   * in location C:\workspace\
Created project "SimpleIpPhoneMenuTree" in directory
 "C:\workspace\SimpleIpPhoneMenuTree\"}}}

Here is the whole sequence again with all of the steps together:

{{{
c:/workspace&gt; cuae create SimpleIpPhoneMenuTree
Project type? [application or plugin] application
Programming language? [java or csharp] csharp
Project namespace? [default: simpleipphonemenutree]
Available application triggering event:
   0: Skip this step
   1: cisco.uc.cuae.legacy.JTapi.JTapiIncomingCall
   2: cisco.uc.cuae.legacy.JTapi.JTapiCallInitiated
   3: cisco.uc.cuae.legacy.JTapi.JTapiCallEstablished
   4: cisco.uc.cuae.legacy.CallControl.IncomingCall
   5: cisco.uc.cuae.legacy.Http.GotRequest
   6: cisco.uc.cuae.legacy.Presence.SubscriptionTerminated
   7: cisco.uc.cuae.legacy.Presence.Notify
   8: cisco.uc.cuae.legacy.TimerFacility.TimerFire
Triggering event? [0-8] 5
Generating:
   * application named "SimpleIpPhoneMenuTree"
   * with namespace "simpleipphonemenutree"
   * with laguage "csharp"
   * with trigger event "cisco.uc.cuae.legacy.Http.GotRequest"
   * in location C:\workspace\
Created project "SimpleIpPhoneMenuTree" in directory
 "C:\workspace\SimpleIpPhoneMenuTree\"
}}}


==Inspecting the Generated Project==

Let's inspect the files that were generated by the CUAE command-line tool. 

It created an SimpleIpPhoneMenuTree directory in the directory from which you ran the **cuae create** command. 

The SimpleIpPhoneMenuTree directory contains the following files and directories:

* SimpleIpPhoneMenuTree.etch 
* SimpleIpPhoneMenuTree.properties 
* SimpleIpPhoneMenuTree.csproj 
* cuae-resources/ 
* README.txt 
* src/ 


The most important of which, for your purposes, are:

* **SimpleIpPhoneMenuTree.etch** -- CUAE application Etch service definition. Edit this file to use additional CUAE services in your project. 
* **SimpleIpPhoneMenuTree.csproj** -- C# project file. 
* **cuae-resources/ -- CUAE application resource directory. 
* **src/** -- Generated application source files. 

==Declaring Services==

The first step in building an Etch-based application is identifying which [[Hosted CUAE Services | Cisco Unified Application Environment hosted services]] the application requires and then editing the .etch file to declare the names of those services into the application.

**Tips:** //Once you identify the services you need, you can familiarize yourself with them by visiting the [[API Reference | API reference]] for the version of the Unified Application Environment you are using.//


The following snippet is the default content of the .etch file that the CUAE command-line tool generates. 

We use the **mixin** command to declare the appropriate services. 


{{{// CUAE Application Etch Service Definition
//
// This service defines your application and the CUAE services that you
// use in your application.

// The service module namespace, this will be translated to the
// namespace of the generated source code.
module SimpleIpPhoneMenuTree

// The name of your service.
service SimpleIpPhoneMenuTree
{
    // By default, you must always use the EtchBridge service. Do not
    // remove this mixin, otherwise your application won't work.
    mixin cisco.uc.cuae.EtchBridge

    // You may add any additional service mixins that you require. For
    // example, if you'd like to make and receive phone calls, add the
    // following line:
    //     mixin cisco.uc.cuae.legacy.CallControl
    mixin cisco.uc.cuae.legacy.Http

}
}}}

Because this application will answer an push objects to a phone on an http request, we need to utilize the Http and CiscoIpPhone services. The default etch file already has a mixin for Http because of the triggering event you selected when creating the application project.

{{{ mixin cisco.uc.cuae.legacy.Http}}}

We need to add a declaration for the CiscoIpPhone service, using the full namespace. Add the following line right after the mixin for Http but before the final "}":

{{{  mixin cisco.uc.cuae.legacy.CiscoIpPhone}}}

The new SimpleIpPhoneMenuTree.etch file should look like this:

{{{// CUAE Application Etch Service Definition
//
// This service defines your application and the CUAE services that you
// use in your application.

// The service module namespace, this will be translated to the
// namespace of the generated source code.
module SimpleIpPhoneMenuTree

// The name of your service.
service SimpleIpPhoneMenuTree
{
    // By default, you must always use the EtchBridge service. Do not
    // remove this mixin, otherwise your application won't work.
    mixin cisco.uc.cuae.EtchBridge

    // You may add any additional service mixins that you require. For
    // example, if you'd like to make and receive phone calls, add the
    // following line:
    //     mixin cisco.uc.cuae.legacy.CallControl
    mixin cisco.uc.cuae.legacy.Http
    mixin cisco.uc.cuae.legacy.CiscoIpPhone

}
}}}

==Building the Application==

After declaring the services you need, you must build the application to generate source files.


1. Open a Command Prompt and navigate to the application directory.

2. Run the msbuild command to generate source files.

{{{c:\workspace\SimpleIpPhoneMenuTree&gt;msbuild}}}

The following source file templates are then created in the directory src\ simpleipphonemenutree:

* MainSimpleIpPhoneMenuTreeClient.cs 
* ImplSimpleIpPhoneMenuTreeClient.cs 

==Writing Application Code==

This section provides instructions and code samples for writing the application logic.

===Import the Project into your IDE===

1. Open Visual Studio (or another IDE of your preference).

2. Create a new CSharp project from the existing project file by selecting **File -&gt; Open -&gt; Project/Solution** and selecting the SimpleIpPhoneMenuTree.csproj file from the SimpleIpPhoneMenuTree directory.

===First example code snippet===

We need to call a specific function to service incoming gotRequest event. This is achieved by calling gotRequest() function. Inside this function, parse options.url object to access the incoming parameters and perform various actions accordingly. 

Idea is to format an xml object based on end user choices and pass it back to the phone that activated the service.

===Code Sample===

{{{public override void gotRequest( string sessionId, GotRequestOptions options )
{

            //
            // check the url in order for proper switching
            //
            if ( options.url.StartsWith( "/showMenu" ) )
            {

                // extract whether requested value is "Breakfast" or "Lunch"
                string queryValue = options.query.Substring( options.query.IndexOf( "value=" ) + 6 );

                // create menu
                CreateMenuOptions cmo = new CreateMenuOptions();
                cmo.prompt = "Please make a selection";
                cmo.title = queryValue + "Menu";

                CreateMenuResult cmr = server.createMenu( sessionId, cmo );
                AddMenuItemResult amir2 = new AddMenuItemResult();

                if ( queryValue.Equals( "Breakfast" ) )
                {
                    AddMenuItemOptions amio1 = new AddMenuItemOptions();
                    amio1.xmlObject = cmr.xmlObject;
                    amio1.name = "Pancakes";
                    amio1.uRL = "http://" + options.host + "/menuSelection?metreosSessionId=" + sessionId + "&amp;value=Pancakes";
                    AddMenuItemResult amir1 = server.addMenuItemToMenu( sessionId, amio1 );

                    AddMenuItemOptions amio2 = new AddMenuItemOptions();
                    amio2.xmlObject = amir1.xmlObject;
                    amio2.name = "Eggs";
                    amio2.uRL = "http://" + options.host + "/menuSelection?metreosSessionId=" + sessionId + "&amp;value=Eggs";

                    amir2 = server.addMenuItemToMenu( sessionId, amio2 );
                }
                else if ( queryValue.Equals( "Lunch" ) )
                {
                    AddMenuItemOptions amio1 = new AddMenuItemOptions();
                    amio1.xmlObject = cmr.xmlObject;
                    amio1.name = "Pizza";
                    amio1.uRL = "http://" + options.host + "/menuSelection?metreosSessionId=" + sessionId + "&amp;value=Pizza";

                    AddMenuItemResult amir1 = server.addMenuItemToMenu( sessionId, amio1 );

                    AddMenuItemOptions amio2 = new AddMenuItemOptions();
                    amio2.xmlObject = amir1.xmlObject;
                    amio2.name = "Burger";
                    amio2.uRL = "http://" + options.host + "/menuSelection?metreosSessionId=" + sessionId + "&amp;value=Burger";

                    amir2 = server.addMenuItemToMenu( sessionId, amio2 );
                }

                // http sendresponse
                server.sendResponse( sessionId, options.remoteHost, 200, "text/xml", amir2.xmlObject, "OK", null );
            }

            else if ( options.url.StartsWith( "/menuSelection" ) )
            {
                // add menu item
                string queryValue = options.query.Substring( options.query.IndexOf( "value=") + 6 );

                AddMenuItemOptions amio = new AddMenuItemOptions();
                amio.name = "Thanks! Your " + queryValue.ToLower() + " will be ready shortly.";

                AddMenuItemResult amir = server.addMenuItemToMenu( sessionId, amio );

                // http send response
                server.sendResponse( sessionId, options.remoteHost, 200, "text/xml", amir.xmlObject, "OK", null );

                // end script
                server.removeCuaeSession( sessionId );
            }

            else
            {
                // first create text
                CreateTextOptions cto = new CreateTextOptions();
                cto.prompt = "Choose an option";
                cto.text = "Welcome to the deli";
                cto.title = "Lunch Menu";

                CreateTextResult ctr = server.createText( sessionId, cto );

                // add a soft key
                AddSoftKeyItemOptions askio1 = new AddSoftKeyItemOptions();
                askio1.name = "Breakfast";
                askio1.position = 2;
                askio1.xmlObject = ctr.xmlObject;
                askio1.uRL = "http://" + options.host + "/showMenu?metreosSessionId=" + sessionId +"&amp;value=Breakfast";

                AddSoftKeyItemResult askir1 = server.addSoftKeyItemToText( sessionId, askio1 );

                // add another soft key
                AddSoftKeyItemOptions askio2 = new AddSoftKeyItemOptions();
                askio2.name = "Lunch";
                askio2.position = 3;
                askio2.xmlObject = askir1.xmlObject;
                askio2.uRL = "http://" + options.host + "/showMenu?metreosSessionId=" + sessionId +"&amp;value=Lunch";

                AddSoftKeyItemResult askir2 = server.addSoftKeyItemToText( sessionId, askio2 );

                // Http SendResponse
                server.sendResponse( sessionId, options.remoteHost, 200, "text/xml", askir2.xmlObject, "OK", null );
            }
}

public override void sessionExpired( string sessionId, SessionExpiredOptions options )
{
            server.removeCuaeSession( sessionId );
}
}}}

==Registering the Application==

The previous steps completed the core logic of the example applications, but before any Etch-based API calls can actually be made, we must register the application with the Cisco Unified Application Server. To register your application, follow these steps:

1. Open the MainSimpleIpPhoneMenuTreeClient file in the /src directory. It contains the following content by default:

{{{public static void Main(String[] args)
{
	// TODO: Change to correct URI
        string uri = "tcp://localhost:9000";

	RemoteSimpleIpPhoneMenuTreeServer server = SimpleIpPhoneMenuTreeHelper.NewServer( uri, null, new MainSimpleIpPhoneMenuTreeClient());

        // Connect to the service
	server._StartAndWaitUp( 4000 );

	// TODO: Insert Your Code Here

	// Disconnect from the service
	server._StopAndWaitDown( 4000 );
}
}}}

2. To make a connection to the listener, add a server.registerApplication() request.

{{{string key = server.registerApplication( "SimpleIpPhoneMenuTree", "Default", "&lt;username&gt;", "&lt;password&gt;" );
Console.WriteLine( "CUAE application registered with key : " + key );
Console.WriteLine( "Hit any key to exit. " );
Console.ReadLine();
}}}

3. Modify the String URI to match the IP address and port of the Cisco Unified Application Server. 

URI settings vary slightly between 2.5(1) Beta 1 and more recent versions of 2.5(1), as follows:

====2.5(1) and 2.5(1) Beta 2, Beta 3, Beta 4 and later releases====

{{{// TODO Change to correct URI
String uri = "tls://appserver_ipaddress:9000?TlsConnection.authReqd=false&amp;filter=KeepAlive
 &amp;KeepAlive.Count=5&amp;Packetizer.maxPktSize=102400&amp;TcpTransport.reconnectDelay=4000";}}}

**Note:** //In Beta 2, the Etch Bridge was updated to use [[Etch Bridge TLS | Transport Layer Security]] for encryption by default. For your applications to work, you must specify TLS as the protocol in the URI and set the authReqd parameter to false. In the example above, the [[Keep Alive | KeepAlive]] filter and [[MaxPacketSize | Max Packet Size]] and [[Etch Connection URI | Reconnect Delay]] parameters have also been set.//

====2.5(1) Beta 1====

{{{// TODO Change to correct URI
		String uri = "tcp://appserver_ipaddress:9000?&amp;TcpConnection.reconnect_delay=4000";}}}


**Note:** //In addition to setting the correct IP address and port for the Cisco Unfied Application Server, the Reconnect Delay parameter should be set on all connection URIs.//

==Packaging The Test Application==

1. Execute a successful build request for your test application within your IDE.

2. To package the application, execute the "cuae package" command from a DOS command shell in the parent directory of the test application.

{{{C:\workspace\SimpleIpPhoneMenuTree&gt;cuae package
Created package file
"C:\workspace\SimpleIpPhoneMenuTree\bin\SimpleIpPhoneMenuTree.mca"}}}

The following files will be added to the "\bin" sub-directory:

* SimpleIpPhoneMenuTree.mca (application bundle to be uploaded into the application server) 
* INSTALLER.xml - (contains the config items in config.yaml) 
* MANIFEST.xml - (bundle details for the package comamnd) 

==Installing The Test Application==

To install the test application on a CUAE server, execute the **cuae install** command from a DOS command shell in test application parent directory of the test application. The **cuae install** command varies slightly between 2.5(1) Beta 1 and Beta 2. 

====2.5(1) Beta 2====

You are prompted to enter an IP address, username, and password (to view the help, run the **cuae install -h** command). When prompted, enter Y or N to save management settings. This will save the answers to the above three questions in the properties file and remember them the next time you go to install.

**Note:** //You are also prompted for the communications protocol (TCP or TLS). Select the protocol that is set on the Management Service. TLS is the default supported protocol. If you want to use TCP, follow the instructions in [[Management Service TLS | Management Service Transport Layer Security (TLS)]] to change the default URI of the Management Service before running these commands.//
 

{{{C:\workspace\SimpleIpPhoneMenuTree&gt;cuae package
Created package file
"C:\Development\CSHARP\workspace\SimpleIpPhoneMenuTree_JAVA\bin\SimpleIpPhoneMenuTree.mca"

C:\workspace\SimpleIpPhoneMenuTree&gt;cuae install
Enter the hostname or IP address of the management service (for example: localhost, 1.1.1.1): localhost
Protocol: tls
Generated mgmt-service uri: tls://localhost:9001?TlsConnection.authReqd=false
Enter management service login username:
Entermanagement service login password: ********
Save the amanagement settings with the project? [yes or no] no
Application : C:\workspace\SimpleIpPhoneMenuTree\bin\SimpleIpPhoneMenuTree.mca
Uploading :  ===========================&gt; 100%
Application has been installed successfully}}}

==Configuring the Application in the Administration Interface==

===Adding a trigger===

1. Log in to the Administration interface.

2. Click **Applications&gt;Find/List Triggers** to generate a list of applications and their associated triggers.

3. Select the application SimpleIpPhoneMenuTree in the list.

4. Enter "url" and "/lunchOrder".

5. Click **Add Parameter**.

==Running the Application==

===Adding the Phone Service===

1. We want to add this application as a phone service. To do this, first login to the call manager of your phone. Go to Device&gt; Device Settings&gt; Phone Services. Click **Find** and then **Add New**. Set both the Service Name and ASCII Service Name to "Lunch Order". Set the service URL to [[http://localhost:8000/lunchOrder]]. Save the changes.

2. To add the service to your particular IP Phone, lookup your phone under Device&gt;Phone. 
Under the Related Links drop-down list at the top, select **Subscribe/Unsubscribe Services** and Go. Select **Lunch Order** from the drop-down and select **Next** and then **Subscribe**. You will have to reset your phone now for the changes to take effect.

===Registering the Application===

Run the class SimpleIpPhoneMenuTree.MainSimpleIpPhoneMenuTreeClient to register the application.

At this point the application will remain registered and running until either you stop your application or the application loses connectivity to the Unified Application server.

===Executing the Application===

Now that the service has been applied to the phone, you can access the lunch menu by pressing the Services key on your phone. Select the Lunch Order softkey and the menu should load.</description>
      <pubDate>Fri, 30 Jul 2010 20:02:41 GMT</pubDate>
      <guid isPermaLink="false">http://developer.cisco.com/web/cuae/wikidocs?p_p_auth=BrzK1CFb&amp;p_p_id=36&amp;p_p_lifecycle=0&amp;p_r_p_185834411_nodeId=8398769&amp;p_r_p_185834411_title=&amp;SimpleIpPhoneMenuTree-Csharp</guid>
      <dc:creator>Bhuvaneswari Rajamanickam</dc:creator>
      <dc:date>2010-07-30T20:02:41Z</dc:date>
    </item>
    <item>
      <title>SimpleIpPhoneMenuTree-Java 1.9</title>
      <link>http://developer.cisco.com/web/cuae/wikidocs?p_p_auth=BrzK1CFb&amp;p_p_id=36&amp;p_p_lifecycle=0&amp;p_r_p_185834411_nodeId=8398769&amp;p_r_p_185834411_title=&amp;SimpleIpPhoneMenuTree-Java</link>
      <description>==About the Application==
This application implements a simple food ordering form through a phone service.

==Creating the Application Project==

1. Open a Command Prompt window.

2. Navigate to the directory you want to use as your workspace. To use the CUAE command-line tool to create a new application, type the **cuae create** command and the name of the application project.

{{{
c:&gt; cd \workspace
c:\workspace&gt; cuae create SimpleIpPhoneMenuTree
}}}

The tool then prompts you for additional information.

**Note:**

// Once you are more familiar with the options, you can type the full command rather than answering the prompts by using the following syntax://

 //cuae create -l language -m namespace -t project type ~[options~] projectname//
 


3. First the tool prompts you to choose between building an application or a plugin. In this example, the correct choice is application:
{{{
Project Type? [application or plugin] application
}}}

4. Next the tool prompts you to specify the programming language. In this example, the correct choice is java:
{{{
Programming language? [java or csharp] java
}}}

5. The tool prompts you to choose the build format you prefer. In this example we are using ant.
{{{
Build format? [ant or maven2] ant
}}}

6. The tool asks you for the namespace for the application. A program might want to use a fully qualified namespace like com.company.simpleipphonemenutree or something simple like simpleipphonemenutree. The tool offers you a simple namespace based on the project name. Let's accept the tool's suggestion for now and use simpleipphonemenutree
{{{
Project namespace? [default: simpleipphonemenutree] &lt;Return&gt;
}}}
7. Finally, the tool asks if you would like to specify a triggering event. All applications need to register against at least one triggering event. You can specify the triggering event now or wait and specify the
triggering event later. You can also change the triggering event during development. Again, since we know that this application needs to be triggered on an http request, let's go ahead and specify the triggering event now. Select option 5:

{{{
 Available application triggering event:
   0: Skip this step
   1: cisco.uc.cuae.legacy.JTapi.JTapiIncomingCall
   2: cisco.uc.cuae.legacy.JTapi.JTapiCallInitiated
   3: cisco.uc.cuae.legacy.JTapi.JTapiCallEstablished
   4: cisco.uc.cuae.legacy.CallControl.IncomingCall
   5: cisco.uc.cuae.legacy.Http.GotRequest
   6: cisco.uc.cuae.legacy.Presence.SubscriptionTerminated
   7: cisco.uc.cuae.legacy.Presence.Notify
   8: cisco.uc.cuae.legacy.TimerFacility.TimerFire
 Triggering event? [0-8] 5
}}}


The tool now has enough information to generate the project template.
{{{
   Generating:
   * application named "SimpleIpPhoneMenuTree"
   * with namespace "simpleipphonemenutree"
   * with laguage "java"
   * with trigger event "cisco.uc.cuae.legacy.Http.GotRequest"
   * in location C:\workspace\
Created project "SimpleIpPhoneMenuTree" in directory
 "C:\workspace\SimpleIpPhoneMenuTree\"
}}}

Here is the whole sequence again with all of the steps together:

{{{
c:/workspace&gt; cuae create SimpleIpPhoneMenuTree
Project type? [application or plugin] application
Programming language? [java or csharp] java
Build format? [ant or maven2] ant
Project namespace? [default: simpleipphonemenutree]
Available application triggering event:
   0: Skip this step
   1: cisco.uc.cuae.legacy.JTapi.JTapiIncomingCall
   2: cisco.uc.cuae.legacy.JTapi.JTapiCallInitiated
   3: cisco.uc.cuae.legacy.JTapi.JTapiCallEstablished
   4: cisco.uc.cuae.legacy.CallControl.IncomingCall
   5: cisco.uc.cuae.legacy.Http.GotRequest
   6: cisco.uc.cuae.legacy.Presence.SubscriptionTerminated
   7: cisco.uc.cuae.legacy.Presence.Notify
   8: cisco.uc.cuae.legacy.TimerFacility.TimerFire
Triggering event? [0-8] 5
Generating:
   * application named "SimpleIpPhoneMenuTree"
   * with namespace "simpleipphonemenutree"
   * with laguage "java"
   * with trigger event "cisco.uc.cuae.legacy.Http.GotRequest"
   * in location C:\workspace\
Created project "SimpleIpPhoneMenuTree" in directory
 "C:\workspace\SimpleIpPhoneMenuTree\"

}}}


==Inspecting the Generated Project==

Let's inspect the files that were generated by the CUAE command-line tool. It created an SimpleIpPhoneMenuTree directory in the directory from which you ran the **cuae create** command. The SimpleIpPhoneMenuTree directory contains the following files and directories:

  * SimpleIpPhoneMenuTree .etch 
  * SimpleIpPhoneMenuTree .properties 
  * build.xml 
  * cuae-resources/ 
  * README.txt 
  * src/ 
The most important of which, for your purposes, are:


  * **SimpleIpPhoneMenuTree.etch**--CUAE application Etch service definition. Edit this file to use additional CUAE services in your project. 
  * **build.xml**--Ant build script file with predefined targets for managing the lifecycle of your CUAE project. 
  * **cuae-resources/**--CUAE application resource directory. 
  * **src/**--Generated application source files. 


==Declaring Services==

The first step in building an Etch-based application is identifying which [[Hosted CUAE Services | Cisco Unified Application Environment hosted services]] the application requires and then editing the .etch file to declare the names of those services into the application.

**Note:** 

//Once you identify the services you need, you can familiarize yourself with them by visiting the [[API Reference]] for the version of the Unified Application Environment you are using//. 


The following snippet is the default content of the .etch file that the CUAE command-line tool generates. We use the **mixin** command to declare the appropriate services. 

{{{

// CUAE Application Etch Service Definition
//
// This service defines your application and the CUAE services that you
// use in your application.

// The service module namespace, this will be translated to the
// namespace of the generated source code.
module SimpleIpPhoneMenuTree

// The name of your service.
service SimpleIpPhoneMenuTree
{
    // By default, you must always use the EtchBridge service. Do not
    // remove this mixin, otherwise your application won't work.
    mixin cisco.uc.cuae.EtchBridge

    // You may add any additional service mixins that you require. For
    // example, if you'd like to make and receive phone calls, add the
    // following line:
    //     mixin cisco.uc.cuae.legacy.CallControl
    mixin cisco.uc.cuae.legacy.Http

}

}}}

Because this application will answer an push objects to a phone on an http request, we need to utilize the Http and CiscoIpPhone services. The default etch file already has a mixin for Http because of the triggering event you selected when creating the application project.

{{{mixin cisco.uc.cuae.legacy.Http}}}

We need to add a declaration for the CiscoIpPhone service, using the full namespace. Add the following line right after the mixin for Http but before the final "}":


{{{mixin cisco.uc.cuae.legacy.CiscoIpPhone}}}

The new SimpleIpPhoneMenuTree.etch file should look like this:

{{{

// CUAE Application Etch Service Definition
//
// This service defines your application and the CUAE services that you
// use in your application.

// The service module namespace, this will be translated to the
// namespace of the generated source code.
module SimpleIpPhoneMenuTree

// The name of your service.
service SimpleIpPhoneMenuTree
{
    // By default, you must always use the EtchBridge service. Do not
    // remove this mixin, otherwise your application won't work.
    mixin cisco.uc.cuae.EtchBridge

    // You may add any additional service mixins that you require. For
    // example, if you'd like to make and receive phone calls, add the
    // following line:
    //     mixin cisco.uc.cuae.legacy.CallControl
    mixin cisco.uc.cuae.legacy.Http
    mixin cisco.uc.cuae.legacy.CiscoIpPhone

}

}}}


==Building the Application==

After declaring the services you need, you must build the application to generate source files.  

1. Open a Command Prompt and navigate to the application directory.

2. Run the ant command to generate source files.

{{{

c:\workspace\SimpleIpPhoneMenuTree&gt;ant
}}}

The following source file templates are then created in the directory src\simpleipphonemenutree:

  * MainSimpleIpPhoneMenuTreeClient.java 
  * ImplSimpleIpPhoneMenuTreeClient.java 


==Writing Application Code==

This section provides instructions and code samples for writing the application logic.

===Import the Project into your IDE===

1. Open Eclipse (or another IDE of your preference).
2. Create a new Java project from an existing Ant buildfile by selecting **File** -&gt; **New** -&gt; **Other** -&gt; **Java Project from an existing Ant buildfile** and selecting the build.xml file from the SimpleIpPhoneMenuTree directory.

3. Click **Next**.

4. Browse to C:\workspace\SimpleIpPhoneMenuTree\ and select the **build.xml** file.

5. Click **Open**.

6. Select **"javac" task found in target "build~[default~]"**.

===First example code snippet===

We need to call a specific function to service incoming gotRequest event. This is achieved by calling gotRequest() function. Inside this function, parse options.url object to access the incoming parameters and perform various actions accordingly. Idea is to format an xml object based on end user choices and pass it back to the phone that activated the service.

To Service incoming request implement the methods as shown below. Start below shown code after the lines 
" ~// TODO insert methods here to provide implementations of SimpleIpPhoneMenuTreeClient
 messages from the server."

===Code Sample===

{{{
@Override
public void gotRequest(String sessionId, GotRequestOptions options)
{
    // check the url in order for proper switching
    //
    if (options.url.startsWith("/showMenu"))
    {
           // extract whether requested value is "Breakfast" or "Lunch"
            String queryValue = options.query.substring(options.query.indexOf("value=") + 6);

            // create menu
            CreateMenuOptions cmo = new CreateMenuOptions();
            cmo.prompt = "Please make a selection";
            cmo.title = queryValue + "Menu";

            CreateMenuResult cmr = server.createMenu(sessionId, cmo);
            AddMenuItemResult amir2 = new AddMenuItemResult();

            if (queryValue.equals("Breakfast"))
            {
                AddMenuItemOptions amio1 = new AddMenuItemOptions();
                amio1.xmlObject = cmr.xmlObject;
                amio1.name = "Pancakes";
                amio1.uRL = "http://" + options.host + "/menuSelection?metreosSessionId=" + sessionId + "&amp;value=Pancakes";
                AddMenuItemResult amir1 = server.addMenuItemToMenu(sessionId, amio1);

                AddMenuItemOptions amio2 = new AddMenuItemOptions();
                amio2.xmlObject = amir1.xmlObject;
                amio2.name = "Eggs";
                amio2.uRL = "http://" + options.host + "/menuSelection?metreosSessionId=" + sessionId + "&amp;value=Eggs";

                amir2 = server.addMenuItemToMenu(sessionId, amio2);
            }
            else if (queryValue.equals("Lunch"))
            {
                AddMenuItemOptions amio1 = new AddMenuItemOptions();
                amio1.xmlObject = cmr.xmlObject;
                amio1.name = "Pizza";
                amio1.uRL = "http://" + options.host + "/menuSelection?metreosSessionId=" + sessionId + "&amp;value=Pizza";

                AddMenuItemResult amir1 = server.addMenuItemToMenu(sessionId, amio1);
                AddMenuItemOptions amio2 = new AddMenuItemOptions();
                amio2.xmlObject = amir1.xmlObject;
                amio2.name = "Burger";
                amio2.uRL = "http://" + options.host + "/menuSelection?metreosSessionId=" + sessionId + "&amp;value=Burger";

                amir2 = server.addMenuItemToMenu(sessionId, amio2);
            }

            // http sendresponse
            server.sendResponse(sessionId, options.remoteHost, 200, "text/xml", amir2.xmlObject, "OK", null);
        }
        else if (options.url.startsWith("/menuSelection"))
        {
            // add menu item
            String queryValue = options.query.substring(options.query.indexOf("value=") + 6);

            AddMenuItemOptions amio = new AddMenuItemOptions();
            amio.name = "Thanks! Your " + queryValue.toLowerCase() + " will be ready shortly.";

            AddMenuItemResult amir = server.addMenuItemToMenu(sessionId, amio);

            // http send response
            server.sendResponse(sessionId, options.remoteHost, 200, "text/xml", amir.xmlObject, "OK", null);

            // end script
            server.removeCuaeSession(sessionId);
        }
        else
        {
            // first create text
            CreateTextOptions cto = new CreateTextOptions();
            cto.prompt = "Choose an option";
            cto.text = "Welcome to the deli";
            cto.title = "Lunch Menu";

            CreateTextResult ctr = server.createText(sessionId, cto);

            // add a soft key
            AddSoftKeyItemOptions askio1 = new AddSoftKeyItemOptions();
            askio1.name = "Breakfast";
            askio1.position = 2;
            askio1.xmlObject = ctr.xmlObject;
            askio1.uRL = "http://" + options.host + "/showMenu?metreosSessionId=" + sessionId + "&amp;value=Breakfast";

            AddSoftKeyItemResult askir1 = server.addSoftKeyItemToText(sessionId, askio1);

            // add another soft key
            AddSoftKeyItemOptions askio2 = new AddSoftKeyItemOptions();
            askio2.name = "Lunch";
            askio2.position = 3;
            askio2.xmlObject = askir1.xmlObject;
            askio2.uRL = "http://" + options.host + "/showMenu?metreosSessionId=" + sessionId + "&amp;value=Lunch";

            AddSoftKeyItemResult askir2 = server.addSoftKeyItemToText(sessionId, askio2);

            // Http SendResponse
            server.sendResponse(sessionId, options.remoteHost, 200, "text/xml", askir2.xmlObject, "OK", null);
      }
 }

}}}

==Registering the Application==

The previous steps completed the core logic of the example applications, but before any Etch-based API calls can actually be made, we must register the application with the Cisco Unified Application Server. To register your application, follow these steps:

1. Open the MainSimpleIpPhoneMenuTreeClient file in the /src directory. It contains the following content by default:

{{{

public static void main( String[] args ) throws Exception
{
	// TODO Change to correct URI
	String uri = "tcp://localhost:9000";
		
	RemoteSimpleIpPhoneMenuTreeServer server = SimpleIpPhoneMenuTreeHelper.newServer( uri, null,
		new MainSimpleIpPhoneMenuTreeClient() );

	// Connect to the service
	server._startAndWaitUp( 4000 );

	// TODO Insert Your Code Here

	// Disconnect from the service
	server._stopAndWaitDown( 4000 );
}

}}}

2. To make a connection to the listener, add a server.registerApplication() request after the line "// TODO Insert Your Code Here"

{{{

String key = server.registerApplication("SimpleIpPhoneMenuTree", "Default", "&lt;username&gt;", "&lt;password&gt;");
System.out.println("SimpleIpPhoneMenuTree registered: " + key);
System.in.read();
}}}

3. Modify the String URI to match the IP address and port of the Cisco Unified Application Server. 

URI settings vary slightly between 2.5(1) Beta 1 and more recent versions of 2.5(1), as follows:

====2.5(1) and 2.5(1) Beta 2, Beta 3, Beta 4 &amp; later releases====
{{{

// TODO Change to correct URI
String uri = "tls://appserver_ipaddress:9000?TlsConnection.authReqd=false&amp;filter=KeepAlive
 &amp;KeepAlive.Count=5&amp;Packetizer.maxPktSize=102400&amp;TcpTransport.reconnectDelay=4000";

}}}

**Note:**

// In Beta 2, the Etch Bridge was updated to use [[Etch Bridge TLS|Transport Layer Security ]] for encryption by default. For your applications to work, you must specify TLS as the protocol in the URI and set the authReqd parameter to false. In the example above, the  [[ Keep Alive ]] filter and [[MaxPacketSize]] and [[Etch Connection URI|Reconnect Delay]]parameters have also been set//.
 

====2.5(1) Beta 1====

{{{

// TODO Change to correct URI
		String uri = "tcp://appserver_ipaddress:9000?&amp;TcpConnection.reconnect_delay=4000";

}}}

**Note:**
//
 In addition to setting the correct IP address and port for the Cisco Unfied Application Server, the Reconnect Delay parameter should be set on all connection URIs//. 
 


==Packaging The Test Application==

1. Execute a successful build request for your test application within your IDE.

2. To package the application, execute the "cuae package" command from a DOS command shell in the parent directory of the test application.

{{{

C:\workspace\SimpleIpPhoneMenuTree&gt;cuae package
Created package file
"C:\workspace\SimpleIpPhoneMenuTree\bin\SimpleIpPhoneMenuTree.mca"

}}}

The following files will be added to the "\bin" sub-directory:

  * SimpleIpPhoneMenuTree.mca (application bundle to be uploaded into the application server) 
  * INSTALLER.xml - (contains the config items in config.yaml) 
  * MANIFEST.xml - (bundle details for the package comamnd) 

Installing The Test Application


* To install the test application on a CUAE server, execute the **cuae install** command from a DOS command shell in test application parent directory of the test application. The **cuae install** command varies slightly between 2.5(1) Beta 1 and Beta 2. 

====2.5(1) Beta 2====

**Note**
//
You are prompted to enter an IP address, username, and password (to view the help, run the **cuae install -h** command). When prompted, enter Y or N to save management settings. This will save the answers to the above three questions in the properties file and remember them the next time you go to install//.

**Tip:**
//
 You are also prompted for the communications protocol (TCP or TLS). Select the protocol that is set on the Management Service. TLS is the default supported protocol. If you want to use TCP, follow the instructions in [[ Management Service TLS | Management Service Transport Layer Security (TLS)]] to change the default URI of the Management Service before running these commands//.
 

C:\workspace\SimpleIpPhoneMenuTree&gt;cuae package
Created package file
"C:\Development\CSHARP\workspace\SimpleIpPhoneMenuTree_JAVA\bin\SimpleIpPhoneMenuTree.mca"

{{{

C:\workspace\SimpleIpPhoneMenuTree&gt;cuae install
Enter the hostname or IP address of the management service (for example: localhost, 1.1.1.1): localhost
Protocol: tls
Generated mgmt-service uri: tls://localhost:9001?TlsConnection.authReqd=false
Enter management service login username:
Entermanagement service login password: ********
Save the amanagement settings with the project? [yes or no] no
Application : C:\workspace\SimpleIpPhoneMenuTree\bin\SimpleIpPhoneMenuTree.mca
Uploading :  ===========================&gt; 100%
Application has been installed successfully

}}}

====2.5(1) Beta 1 ====

You are prompted to enter an IP address, username, and password (to view the help, run the **cuae install -h** command). When prompted, enter Y or N to save management settings. This will save the answers to the above three questions in the properties file and remember them the next time you go to install.

{{{

C:\workspace\SimpleIpPhoneMenuTree&gt;cuae package
Created package file
"C:\Development\CSHARP\workspace\SimpleIpPhoneMenuTree_JAVA\bin\SimpleIpPhoneMenuTree.mca"

C:\workspace\SimpleIpPhoneMenuTree&gt;cuae install
Enter management service uri or host/IP &lt;for example: localhost, tcp://1.1.1.1.:4001&gt;:
Enter management service login username:
Entermanagement service login password: ********
Save the amanagement settings with the project? [YyNn] n
Application : C:\workspace\SimpleIpPhoneMenuTree\bin\SimpleIpPhoneMenuTree.mca
Uploading :  ===========================&gt; 100%
Application ahas been installed successfully

}}}

==Configuring the Application in the Administration Interface==

===Adding a trigger===

1. Log in to the Administration interface.

2. Click **Applications**&gt;**List Triggers** to generate a list of applications and their associated triggers.

3. Select the application SimpleIpPhoneMenuTree in the list.

4. Enter "url" and "/lunchOrder".

5. Click **Add Parameter**.

==Running the Application==

===Adding the Phone Service===

1. We want to add this application as a phone service. To do this, first login to the call manager of your phone. Go to Device&gt; Device Settings&gt; Phone Services. Click **Find** and then **Add New**. Set both the Service Name and ASCII Service Name to "Lunch Order". Set the service URL to {{{http://&lt;cuae-server-ip&gt;:8000/lunchOrder}}}. Save the changes.

2. To add the service to your particular IP Phone, lookup your phone under Device&gt;Phone. Under the Related Links drop-down list at the top, select **Subscribe/Unsubscribe Services** and **Go**. Select **Lunch Order** from the drop-down and select **Next** and then **Subscribe**. You will have to reset your phone now for the changes to take effect.

===Registering the Application===

1. Run the class SimpleIpPhoneMenuTree.MainSimpleIpPhoneMenuTreeClient to register the application.

At this point the application will remain registered and running until either you stop your application or the application loses connectivity to the Unified Application server.

===Executing the Application===
Now that the service has been applied to the phone, you can access the lunch menu by pressing the Services key on your phone. Select the Lunch Order softkey and the menu should load.</description>
      <pubDate>Fri, 30 Jul 2010 19:55:24 GMT</pubDate>
      <guid isPermaLink="false">http://developer.cisco.com/web/cuae/wikidocs?p_p_auth=BrzK1CFb&amp;p_p_id=36&amp;p_p_lifecycle=0&amp;p_r_p_185834411_nodeId=8398769&amp;p_r_p_185834411_title=&amp;SimpleIpPhoneMenuTree-Java</guid>
      <dc:creator>Bhuvaneswari Rajamanickam</dc:creator>
      <dc:date>2010-07-30T19:55:24Z</dc:date>
    </item>
  </channel>
</rss>

