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

  1. 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.

  2. 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.

  3. Right-click codeIMCall and then click Generate Handler.

  4. 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); 
    
  5. Following the instructions in steps 1 and 2, add CodeActivity and OutboundCallActivity activities to the ifElseBranchIMCall pane.

  6. Rename codeActivity1 to codeAVCall.

  7. Rename outboundCallActivity1 to outboundCallAV.

  8. 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

  1. 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.

  2. 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.

  3. 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.

  4. Drag and drop a InstantMessagingStatement activity onto outgoingIMCSA. Rename instantMessagingStatementActivity1 to IMConfirmation. Set the MainPrompt property to Instant messaging call is made.

  5. Drag and drop a SpeechStatement activity onto outgoingAVCSA. Rename speechStatementActivity1 to AVConfirmation. Set the MainPrompt property to Speech call is made.

  6. Drag and drop a DisconnectCall activity onto outgoingIMCSA below IMConfirmation. Rename disconnectCallActivity2 to disconnectIMCall.

  7. Drag and drop a DisconnectCall activity onto outgoingAVCSA below AVConfirmation. Rename disconnectCallActivity2 to disconnectAVCall.

  8. Compare your work to the following illustration.

Hh347475.3349469c-cbdf-4860-962b-bf2d1659e8b3(en-us,office.14).jpg

Debug the Application

To build and debug the application

  1. Create a debugging environment. For information about creating a debugging environment, see Provision and Deploy a UCMA Workflow Application.

  2. Update the default code added to Program.cs by the new project template. For more information, in Walkthrough: Hello World, see "Update Template Code."

  3. Debug the application. For information about debugging applications, see Walkthrough: Debugging a Communications Workflow Application.

See Also

Concepts

Walkthrough: Switch Call Contexts in a Workflow