GatherDigitsTortureChamber-Designer - Wiki
Wiki
GatherDigitsTortureChamber-Designer
Create a New Project#
To create a project:
1. Launch the Cisco Unified Application Designer
2. On the top menu bar, Select File->New Project option and enter the Project Name and Location in the "New Application Designer Project".
Define the New Application Script and Trigger Event#
Making an application on CUAD consists of Script. The Script consists of Events, Functions and variables. These event and functions get executed whenever the application is triggered. Triggering Event is the event which causes the CUAE to trigger an application. In this application the triaggering event which we are chosing is IncomingCall event.
1. The next stage is to define the application script trigger. In case of GatherDigitsTortureChamber_CUAD application the script will be triggered by the Metreos.CallControl.IncomingCall event.
2. The CUAD canvas now contains both the script and OnIncomingCall tabs.
Define two Global Variables for the project#
Here we will be adding two global variables e.g. g_CallId and g_ConnId. As we start working on the application at various stages we will be in the need of passing ConnectionId and CallId to various actions like Play action, GatherDigits action etc for their function. Hence it becomes important to store the ConnectionId and CallId into Global variables.
1. Add a global variables by R-Clicking on the "Variables" in the canvas and selecting "Add New Item".
2. It will create a variable named as "Variable1" and you can rename it as g_CallId.
3. If you are unable to rename it then you can R-Click on the "Variable1" and select rename option.
4. Simillarly with the above steps create another global variable "g_ConnId".
Process the OnIncomingCall Event#
This is the event which is going to execute whenever the OnIncomingCall Event is triggered. Hence all our main application logic will be in this event. Whenever a IncomingCall event is triggered we will be getting a CallId. We will be storing that callId in a local variable and later on we will assign to the global variable.
1. Now click on the OnIncomingCall tab in the canvas. Click near the bottom of the canvas and R-Click and select "Variables Tray"
2. Now R-Click in the Tray section and select "Add new Item".
3. Here create a local variable named l_callId. If its already created with the name "Variable1" you can rename it by R-Click and renaming as l_callId.
4. Once the local variable l_callId is created, select that variable in the tray. On the Basic Properties window Select the property "InitializeWith" and provide the value from the drop down as "CallId".
5. The CallId which is generated is stored in the l_CallId and now we will store it into the global variable g_CallId. Click on the Application Components in the Toolbox section. It will list down a set of actions.
6. Select the Assign action from the toolbox which is below the Application components section and drag it to the canvas and drop it near the "Start" icon.
7. You will find that the "Start" icon and "Assign" icon are connected by an arrow.
8. Select the Assign icon and in the Action Parameters window Select the parameter "Value" and changed its type to Variable as shown below
9. From the drop down select l_callId.
10. Now in the ResultData parameter select from the drop down g_CallId. In this way we are assigning the value of l_callId to g_Callid
11. Once the CallId is stored in the global variable g_CallId we need to answer the Call which is incoming. Click on the Call Control in the Toolbox section. Select the AnswerCall action and drag and drop it to the canvas.
12. Now we will connect the action Assign with the AnswerCall. So basically after the Assign action we would like to have the AnswerCall action to take place. Take your mouse to the Assign icon till you see a hand symbol. L-Click and drag your mouse to the AnswerCall
13. Now select the AnswerCall icon. In the Properties window set the following settings which are similar to the above steps:-
a. Set the CallId Action parameter as type "Var" and select the value from the drop down "l_callId".
b. Set the Conference Action parameter with value as "false".
c. Set the CallId in Result data with value selected from the drop down as g_CallId.
d. Set the ConnectionId in Result data with value selected from the drop down as g_ConnId.
14. Once the call is answered we need to play a prompt to the user. Click on the Media Control in the Toolbox section. Select the Play action and drag and drop it to the canvas. You will found OnPlay_Complete and OnPlay_Failed tabs in the canvas.
15. Take your mouse to the AnswerCall icon till you see a hand symbol. L-Click and drag your mouse to the Play icon.
Now select the Play icon on the canvas. In the Properties window set the following settings:-
a. Select the ConnectionId action parameter and set the type as "VAR" and from the drop down select g_ConnId.
b. Select the prompt1 action parameter and set the value as "Enter 6 digits within 6 seconds or enter the pound sign to complete this call."
17. Now Click on the default which is above the link between AnswerCall and Play icon. Change the Default to "Success" by selecting it from the drop down. So only when the AnswerCall is successful the Play action will be executed.
18. Click on the Application Components in the toolbox and scroll down to find "End Function" action. Drag it and drop it besides Play icon. Join the Play icon and EndFunction with a link. Since Play is asynchronous action hence we are using EndFuction because the OnPlay_Complete will be in execution condition once the Play action is executed.
19. Simillarly choose "End Script" from application components and place it below AnswerCall action. Join them with a link and choose "Failure" instead of Default. So if AnswerCall fails then it will end the script execution. Here we are doing End Script because we do not want to execute anything if the AnswerCall fails. So this will end the execution of the whole application.
Process the OnPlay_Complete Action#
Once the above prompt is played successfully it will come to OnPlay_Complete Action. Here we will gather the digits which the user has pressed based on the various terminating conditions.
1. On the canvas click on the "OnPlay_Complete". You will find that the Start action is already there.
2. Click on the Media Control in the toolbox and scroll down to select the GatherDigits. Drag it and drop it in the canvas and join it with Start action. Set the following settings in the action parameters of the GatherDigits.
a. Set the ConnectionId action parameter type as "VAR" and from the drop down select the value as g_ConnId.
b. Set the TermCondDigitPattern action parameter as "#"
c. Set the TermCondDigitMaxDigits action parameter as "6"
d. Set the TermCondDigitMaxTime action parameter as "6000"
e. Leave the rest of the settings as is.
f. You will also notice that there are two events added up in the canvas OnGatherDigits_Complete and OnGatherDigits_Failed.
3. Click on the Application Components and select End Function action. Drag and drop it to canvas besides GatherDigits. Join them with the default link.
Process the OnPlay_Failed Action#
1. On the canvas click on the "OnPlay_Failed". You will find that the Start action is already there.
2. Click on the Application Components and select the "End Script". Drag and drop it in the canvas and join it with Start.
Process the OnGatherDigits_Complete Action#
1. On the canvas click on the "OnGatherDigits_Complete". You will find that the Start action is already there.
2. Here on the bottom of the canvas R-Click on the canvas and get the Variables Tray option selected.
3. Now create a local variable in the Variables tray by R-clicking and selecting "Add new item". Rename the variable as l_digits.
4. Now Select the l_digits and in the properties windows set the InitializeWith property with Digits.
5. Click on the Media Control and scroll to find the Play action. Drag and Drop the play action on the canvas and connect it with the Start action. Set the following settings for the Play action.
a. Set the ConnectionId action parameter type as "VAR" and from the drop down select the value as g_ConnId.
b. Set the Prompt1 action parameter with the value as "You have entered".
c. Set the Prompt2 action parameter type as "VAR" and from the drop down select the value as l_digits.
d. Leave the rest of the parameters as is.
6. Click on the Application components and select the "End Script". Drag and drop it in the canvas and join it with Play action.
Process the OnGatherDigits_Failed Action#
1. On the canvas click on the "OnGatherDigits_Failed". You will find that the Start action is already there.
2. Click on the Application Components and select the "End Script". Drag and drop it in the canvas and join it with Start.
Handling OnRemoteHangup, StartTx, StartRx, StopTx Events#
1.Click in script1 tab and add RemoteHangup, StartTx, StartRx, StopTx events from call control tools. Each will automatically create OnRemotehangup, OnStartTx, OnStartRx, and OnStopTx tabs respectively.
2. Click on OnRemoteHangup tab, place a HangUp event from callcontrol tool. Keep the connector's condition as "default" .
- Configure HangUp event's CallId with g_CallId.
- Place an EndScript event from Application Components and draw a connector with condition "default" between HangUp and EndScript events.
3.Place an EndFunction action in each of StartTx, StartRx, StopTx events that will automatically be connected with Start.
Process to Build the Application#
1. On the Top menu of the Designer Click on Build->Build Project. This will start building the project.
2. Look at the output window for the output.
Run the Application#
1. To run the application, we need to first upload the application in the application server. Open the web-console of the app server in an explorer. Go to application ->Find/list Applications. Click on the Browse button to browse to the bin folder and find GatherDigitsTortureChamber_CUAD.mca. Click on upload to upload the file.
Trigger the Application#
1. To set a trigger for the application, go to Applications -> Find/List Triggers. Enter "To" and the route pattern for the application. Select "Add Parameter".