# ppxSetTalker

Sets a talker for a connection.

#### Prototype

DWORD ppxSetTalker ( PPXHD ppxhd, PPX_MVIP_ADDR *talker )

Argument | Description
ppxhd | Handle returned by ppxCreateConnection or by ppxOpenConnection.
talker | Pointer to a PPX_MVIP_ADDR structure. The structure is defined as follows: typedef struct { DWORD switch_number; DWORD bus; DWORD stream; DWORD timeslot; } PPX_MVIP_ADDR Refer to the Details section for a description of these fields.

#### Return values

Return value | Description
SUCCESS |
CTAERR_DRIVER_ERROR | Underlying driver retrieved an unrecognized error. Call swiGetLastError to retrieve the MVIP device error code.
CTAERR_INVALID_HANDLE | ppxhd is not a valid connection handle.
CTAERR_NOT_FOUND | talker is not defined in the PPX configuration file.
CTAERR_OUT_OF_MEMORY | Unable to allocate memory.
CTAERR_SVR_COMM | Natural Access server communication error.
PPXERR_COMM_FAILURE | Problems were encountered when communicating with the PPX server.
PPXERR_DISABLED | Specified switch number is disabled.
PPXERR_DRIVER_OPEN_FAILED | Driver open failed, or the driver DLL or device was not found.
PPXERR_INVALID_SWITCH | Switch number specified is inaccessible from the specified bus:stream:timeslot.
PPXERR_NO_PATH | Could not find a path from talker to one of the listeners assigned to the connection.
PPXERR_NOT_TALKER | Specified talker is incapable of driving the output for the connection.
SWIERR_INVALID_STREAM | One or more of the specified streams is invalid.
SWIERR_INVALID_TIMESLOT | One or more of the specified timeslots is invalid.

#### Details

ppxSetTalker sets the talker for a connection. If listeners are attached to the connection, a switch connection is made to connect the listeners to the talker. If the talker and listeners are on different boards, telephony bus timeslots are allocated to make the connection.

If a talker is already attached to the connection, the talker is disconnected before the new talker is connected.

Specifying talker = NULL removes the previous talkers to the connection. The listeners receive the default pattern.

The PPX_MVIP_ADDR structure contains the following fields:

Field | Description
--- | ---
switch_number | Switch number of the board as defined in ppx.cfg.
bus | Acceptable values are: MVIP95_MVIP_BUS MVIP95_LOCAL_BUS
stream | The stream number of the talker.
timeslot | The timeslot of the talker.

Refer to Setting the talker for a connection for more information.

#### See also

ppxAddListeners

#### Example

void WhileTheyWait( MYCONTEXT *cx )
{
DWORD e;
char ppxname [20];
DemoStartProtocol( cx->hd, cx->protocol, NULL, NULL );
/* Allocate a connection */
sprintf( ppxname, "ppxdemo%01d", cx->id );
e = ppxCreateConnection( cx->hd, ppxname, &ppx_parms,
&(ppxhd[cx->id]) );
if (e != SUCCESS)
{
printf("Unable to create a connection ; returns: %d\n",e);
exit(-1);
}
/*
* Set this port as the talker on this "Please hold...will try
* that extension now" connection
*/
talkers[cx->id].switch_number = cx->swi;
talkers[cx->id].bus = MVIP95_LOCAL_BUS;
talkers[cx->id].stream = dsp_stream;
talkers[cx->id].timeslot = cx->time_slot;
e = ppxSetTalker( ppxhd[cx->id], &talkers[cx->id] );
if( e != SUCCESS )
{
printf("Could not set talker\n");
exit(-1);
}
}