Step 2: Adding Outbound Calls
This is the last 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 the Outbound Calls
Add CodeActivity and OutboundCallActivity activities to create two different outbound calls on the IfElse branches.
To create outbound calls
In the Microsoft Visual Studio development system Toolbox, expand Unified Communications Workflow to display workflow activities. Drag and drop an OutboundCall activity into the ifElseBranchAVCall pane. Rename outboundCallActivity1 to outboundCallIM.
In the Visual Studio Toolbox, expand Windows Workflow to display the core workflow activities. Drag and drop a Code activity into the ifElseBranchAVCall pane above outboundCallIM. Rename codeActivity1 to codeIMCall.
Right-click codeIMCall and then click Generate Handler.
In the Code window, add a statement that sets the target of the outbound call.
this.outboundCallIM.CalledParty = new RealTimeAddress(this.acceptCallActivity1.CallProvider.Call.RemoteEndPoint.Participant.Uri);
Following the instructions in steps 1 and 2, add CodeActivity and OutboundCallActivity activities to the ifElseBranchIMCall pane.
Rename codeActivity1 to codeAVCall.
Rename outboundCallActivity1 to outboundCallAV.
Following the instructions in steps 3 and 4, add a statement to set the CalledParty property on outboundCallAV.
this.outboundCallAV.CalledParty = new RealTimeAddress(this.acceptCallActivity1.CallProvider.Call.RemoteEndPoint.Participant.Uri);
Switch Context to the Outbound Calls
In each of the two IfElse branches, add a CommunicationsSequenceActivity activity as a call context that the workflow can use to answer the outbound call.
To answer the outbound calls
In the Toolbox, expand Unified Communications Workflow to display workflow activities. Drag and drop a CommunicationsSequence activity into the ifElseBranchAVCall pane between outboundCallIM and disconnectCallActivity1. Rename communicationsSequenceActivity1 to outgoingIMCSA.
Select outgoingIMCSA, and then in the Properties window select the CallProvider property and browse to the outBoundCallIM.CallProvider property.
Tip
To locate outBoundCallIM.CallProvider, begin at incomingCallCSA and then browse to CallProvider.
Following the instructions in steps 1 and 2, add a CommunicationsSequenceActivity to the ifElseBranchIMCall pane between outboundCallAV and disconnectCallActivity1, rename it to outgoingAVCSA, and then set outboundCallAV as the value of the CallProvider property.
Drag and drop a InstantMessagingStatement activity onto outgoingIMCSA. Rename instantMessagingStatementActivity1 to IMConfirmation. Set the MainPrompt property to Instant messaging call is made.
Drag and drop a SpeechStatement activity onto outgoingAVCSA. Rename speechStatementActivity1 to AVConfirmation. Set the MainPrompt property to Speech call is made.
Drag and drop a DisconnectCall activity onto outgoingIMCSA below IMConfirmation. Rename disconnectCallActivity2 to disconnectIMCall.
Drag and drop a DisconnectCall activity onto outgoingAVCSA below AVConfirmation. Rename disconnectCallActivity2 to disconnectAVCall.
Compare your work to the following illustration.
Debug the Application
To build and debug the application
Create a debugging environment. For information about creating a debugging environment, see Provision and Deploy a UCMA Workflow Application.
Update the default code added to Program.cs by the new project template. For more information, in Walkthrough: Hello World, see "Update Template Code."
Debug the application. For information about debugging applications, see Walkthrough: Debugging a Communications Workflow Application.