# Service sharing on a local server: csplayrc

Demonstrates context sharing on a local server. Use csplayrc to

- Attach and share contexts.

- Hand off Natural Access object descriptors or context names from application to application.

- Queue and receive events through shared communication contexts.

#### Usage

csplayrc [options]

where options include:

Option | Use this option to specify...
--- | ---
-m contextname | The context name for the communication context. Default: commn-cxt Note: This name must be the same communication context name as specified with incta.
-F filename | The name of the Natural Access configuration file. Default: cta.cfg

#### Featured functions

ctaAttachContext, ctaCreateContextEx, ctaQueueEvent, vceCreateFile, vceOpenFile, vcePlayList, vceRecordMessage

#### Description

csplayrc provides the same functionality as incta, but executes commands through a context shared by both csplayrc and incta. csplayrc performs voice play and record functions, while incta performs call control for incoming calls.

Note: When two applications are using a local server, an application-defined context name (specified with ctaCreateContextEx) can be used with ctaAttachContext as a substitute for an object descriptor. The object descriptor consists only of the host name and a context name.

csplayrc works with incta as described in the following table:

Step | Action
1 | When you start csplayrc, it creates and names a context (by default named commn-cxt) that is used for sharing events with incta. csplayrc uses ctaWaitEvent to listen for events on the event queue.
2 | When you start incta (specifying the -C option for server mode), it creates and names a context, and opens the Natural Call Control (NCC) service and the Voice Message (VCE) service on the context.
3 | incta uses ctaAttachContext to attach to the context created by csplayrc (commn-cxt), and uses ctaQueueEvent to send APPEVN_CONTEXT_NAME to the context's event queue. The buffer field in APPEVN_CONTEXT_NAME points to the context name used to create the context in step 2.
4 | csplayrc receives APPEVN_CONTEXT_NAME and extracts the context name from the buffer field of the event. csplayrc uses ctaAttachContext to attach to the context.
5 | When incta receives calls, it uses ctaQueueEvent to send APPEVN_RECORD_MESSAGE or APPEVN_PLAY_MESSAGE to the communication context event queue according to the input the user supplies.
6 | Depending on the type of events it receives on the event queue, csplayrc uses appropriate VCE service functions to play or record voice messages for the specified calls.

#### Procedure

Complete the following steps to run csplayrc with incta. This procedure assumes you are testing on an AG 2000 board that has a 2500-type telephone connected to one of the lines.

Note: After Step 2, this procedure is identical to that used for running incta.

Step | Action
1 | Start csplayrc by entering the following command at the prompt: csplayrc
2 | Start incta by entering the following command at the prompt: incta -C -b n -s [stream:]slot -p wnk0
3 | Specify the board and timeslot for the handset you are using.
4 | Take the handset off-hook. The wink-start is acknowledged.
5 | Enter three DTMF digits as the address.
If the first digit is... | Then the demonstration releases the call...
--- | ---
8 | By playing a reorder tone.
9 | With a busy tone.
0 | By playing a special information tone.
Otherwise, the call connects and the demonstration proceeds into the conversation state. You are prompted to record voice, play back your recorded sample, or hang up.
6 | Select the record voice option. You hear the record beep prompt.
7 | Begin speaking after the prompt. After you stop speaking, the record operation terminates, and you return to the options menu.
8 | Select the playback option. The sample you just recorded plays back, and you return to the options menu.
9 | Select the hang-up option.