CatPluginClient-Designer - Wiki
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>New Project)
2. Create a project named "CatPluginClient":
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.
4. To add the reference, R-click on the CatPluginClient project in the Explorer window. Select Add Reference.
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>New Script.
7. We will accept the default script name "script1". For the triggering event, select "catplugin.CatPlugin.triggerOnImageUpdate". Hit OK.
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:
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...".
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.
3. Drag and drop the getImageLink action onto the canvas.
The Start node will automatically be connected to the new action.
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.
The variable tray can be viewed by either R-clicking on the canvas and selecting "Variable Tray", or by going to View>Variable Tray. These actions will toggle the variable tray between being displayed and hidden.
2. Right click on the variable tray at the bottom of the canvas. Select "Add new item". Call the new variable imgURL.
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> result. Select imgURL.
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.
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.
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".
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.
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.
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.
2.Set the parameters for SendExecute in the Properties box. Message will be the variable lolCat, and password, phoneIp, and username are all strings.
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.
Adding a new function to get a status update if any provider goes down while executing this application.#
1. Adding the function
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:
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.
- Add EndFunction action in the end, as shown above.
Build & Deploy the Application#
Prior to building and deploying the application, configure the "Connectivity" options between the CUAD and the CUAS.
- Select "Tools -> Options -> Connectivity" from the top menu
- Enter the IP address and username / password for the CUAE server, then save the change.
To both build and deploy the application, select "Build -> Deploy" from the top menu (to Build without deploying, select "Build -> Build Project").
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 -> 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".
Running the Application#
The application should now be triggered automatically by the running CatPlugin.