In a webcast which I did together with Joachim Farla about Unified Communications Development For Non Professional Developers I talked about creating a UCMA workflow. It is based on the inbound/outbound sample which you can download from GotUC.net.
It is a pretty simple application; it starts a collaboration platform, registers an OCS endpoint and begins listening for incoming calls (or IMs). In this example, it uses client credentials. For production usages, take a provisioned application to do this.
At the same time it also starts a Windows Workflow runtime. When a message is received, it is passed to this workflow so it can be handled. The workflow is the standard XOML workflow of the Windows Workflow Foundation but enhanced with a communications service and OCS activities.
It will first accept the call, determines the presence of a configured SIP address and with an if/else construction choices the right branch. If the user is online, an instant message is send with a question and answer activity. if the user is offline, a outgoing voice call will be created. Using the text to speech functionality, the user will hear some text spoken to him/her and a question is being asked. After giving an answer, the call is disconnected. Meaning you can still reach the user over the phone but use IM primary when he/she is available.
You can configure the actions with your own answer/question systems, call other users, disconnect the call or use speech. There are a lot of OCS activities to pick.
Very simple, but it shows how to use the workflow to make interactive sessions with a user.
To run this sample, make sure you have Visual Studio 2008/2010 and the UCMA SDK installed. You can create an OCS test account at GotUC.net or use your own.
Please see the video for a demonstration of the code.