Step 1: Branching the Incoming Call
This is the first of two topics describing the steps to create the Switch Call Contexts in a Workflow walkthrough application. The procedures for creating the walkthrough application build sequentially. Completing the procedures in sequence is important.
Add an IfElseActivity
Add an IfElseActivity to choose an outbound call to make, based on the type of incoming call.
To add an IfElseActivity to the workflow
In Visual Studio development system, create a new Inbound Sequential Workflow Console Application (with Code Separation) project.
In Solution Explorer, right click Program.cs and then click View Code.
In the Code window, add the following using statements to the top of Program.cs.
using Microsoft.RTC.Signaling; using Microsoft.RTC.Collaboration.AudioVideo;
On the Visual Studio design surface, click communicationsSequenceActivity1 and then rename communicationsSequenceActivity1 to incomingCallCSA.
Note
The CallProvider property specifies that the call context is set to acceptCallActivity1.
In the Visual Studio Toolbox, expand Windows Workflow to display the core workflow activities. Drag and drop an IfElse activity onto the design surface above disconnectCallActivity1.
Rename ifElseActivity1 to ifElseCallType. Rename the branch on the left as ifElseBranchAVCall, and the branch on the right as ifElseBranchIMCall.
Add a code condition to provide the branching logic in the IfElseActivity.
To add a code condition
On the Visual Studio design surface, at the top of ifElseBranchAVCall near the red exclamation mark, click the arrow and then click Property 'Condition' is not set.
In the Properties window for ifElseBranchAVCall, set the Condition property to Code Condition and then expand the Condition property. For the name of the condition, type conditionCallType.
To set the property, click the design surface adjacent to the Properties window.
In the event handler, add a statement to set the Result property to true or false based on the type of incoming call:
if(this.acceptCallActivity1.CallProvide.Call is AudioVideoCall) { e.Result = true; } else { e.Result = false; }