Querying and modifying information related to channels is similar to dealing with clients. The functions to query channel information are:
unsigned int ts3client_getChannelVariableAsInt( | serverConnectionHandlerID, | |
channelID, | ||
flag, | ||
result) ; |
uint64 serverConnectionHandlerID
;uint64 channelID
;ChannelProperties flag
;int* result
;
unsigned int ts3client_getChannelVariableAsUInt64( | serverConnectionHandlerID, | |
channelID, | ||
flag, | ||
result) ; |
uint64 serverConnectionHandlerID
;uint64 channelID
;ChannelProperties flag
;uint64* result
;
unsigned int ts3client_getChannelVariableAsString( | serverConnectionHandlerID, | |
channelID, | ||
flag, | ||
result) ; |
uint64 serverConnectionHandlerID
;uint64 channelID
;ChannelProperties flag
;char* result
;
serverConnectionHandlerID
ID of the server connection handler on which the information for the specified channel is requested.
channelID
ID of the channel whose property is queried.
flag
Channel propery to query, see below.
result
Address of a variable which receives the result value of type int, uint64 or string, depending on which function is used. In case of a string, memory must be released using ts3client_freeMemory
, unless an error occured.
Returns ERROR_ok
on success, otherwise an error code as defined in public_errors.h
. For the string version: If an error has occured, the result string is uninitialized and must not be released.
The parameter flag
specifies the type of queried information. It is defined by the enum ChannelProperties:
enum ChannelProperties { CHANNEL_NAME = 0, //Available for all channels that are "in view", always up-to-date CHANNEL_TOPIC, //Available for all channels that are "in view", always up-to-date CHANNEL_DESCRIPTION, //Must be requested (=> requestChannelDescription) CHANNEL_PASSWORD, //not available client side CHANNEL_CODEC, //Available for all channels that are "in view", always up-to-date CHANNEL_CODEC_QUALITY, //Available for all channels that are "in view", always up-to-date CHANNEL_MAXCLIENTS, //Available for all channels that are "in view", always up-to-date CHANNEL_MAXFAMILYCLIENTS, //Available for all channels that are "in view", always up-to-date CHANNEL_ORDER, //Available for all channels that are "in view", always up-to-date CHANNEL_FLAG_PERMANENT, //Available for all channels that are "in view", always up-to-date CHANNEL_FLAG_SEMI_PERMANENT, //Available for all channels that are "in view", always up-to-date CHANNEL_FLAG_DEFAULT, //Available for all channels that are "in view", always up-to-date CHANNEL_FLAG_PASSWORD, //Available for all channels that are "in view", always up-to-date CHANNEL_CODEC_LATENCY_FACTOR, //Available for all channels that are "in view", always up-to-date CHANNEL_CODEC_IS_UNENCRYPTED, //Available for all channels that are "in view", always up-to-date CHANNEL_SECURITY_SALT, //Sets the options+salt for security hash (SDK only) CHANNEL_DELETE_DELAY, //How many seconds to wait before deleting this channel CHANNEL_ENDMARKER, };
CHANNEL_NAME
String: Name of the channel.
CHANNEL_TOPIC
String: Single-line channel topic.
CHANNEL_DESCRIPTION
String: Optional channel description. Can have multiple lines. Clients need to request updating this variable for a specified channel using:
unsigned int ts3client_requestChannelDescription( | serverConnectionHandlerID, | |
channelID, | ||
returnCode) ; |
uint64 serverConnectionHandlerID
;uint64 channelID
;const char* returnCode
;
CHANNEL_PASSWORD
String: Optional password for password-protected channels.
![]() | Note |
---|---|
Clients can only set this value, but not query it. |
If a password is set or removed by modifying this field, CHANNEL_FLAG_PASSWORD
will be automatically adjusted.
CHANNEL_CODEC
Int: Codec used for this channel:
0 - Speex Narrowband (8 kHz)
1 - Speex Wideband (16 kHz)
2 - Speex Ultra-Wideband (32 kHz)
3 - Celt (Mono, 48kHz)
4 - Opus Voice (Mono, 48khz)
5 - Opus Music (Stereo, 48khz)
See Sound codecs.
CHANNEL_CODEC_QUALITY
Int (0-10): Quality of channel codec of this channel. Valid values range from 0 to 10, default is 7. Higher values result in better speech quality but more bandwidth usage.
See Encoder options.
CHANNEL_MAXCLIENTS
Int: Number of maximum clients who can join this channel.
CHANNEL_MAXFAMILYCLIENTS
Int: Number of maximum clients who can join this channel and all subchannels.
CHANNEL_ORDER
Int: Defines how channels are sorted in the GUI. Channel order is the ID of the predecessor channel after which this channel is to be sorted. If 0, the channel is sorted at the top of its hirarchy.
For more information please see the chapter Channel sorting.
CHANNEL_FLAG_PERMANENT
/ CHANNEL_FLAG_SEMI_PERMANENT
Concerning channel durability, there are three types of channels:
Temporary
Temporary channels have neither the CHANNEL_FLAG_PERMANENT
nor CHANNEL_FLAG_SEMI_PERMANENT
flag set. Temporary channels are automatically deleted by the server after the last user has left and the channel is empty. They will not be restored when the server restarts.
Semi-permanent / Permanent
Semi-permanent and permanent channels are not automatically deleted when the last user left. As SDK servers are not persistant over restart, there is no effective difference between these two in the SDK.
CHANNEL_FLAG_DEFAULT
Int (0/1): Channel is the default channel. There can only be one default channel per server. New users who did not configure a channel to join on login in ts3client_startConnection
will automatically join the default channel.
CHANNEL_FLAG_PASSWORD
Int (0/1): If set, channel is password protected. The password itself is stored in CHANNEL_PASSWORD
.
CHANNEL_CODEC_LATENCY_FACTOR
(Int: 1-10): Latency of this channel. This allows to increase the packet size resulting in less bandwidth usage at the cost of higher latency. A value of 1 (default) is the best setting for lowest latency and best quality. If bandwidth or network quality are restricted, increasing the latency factor can help stabilize the connection. Higher latency values are only possible for low-quality codec and codec quality settings.
For best voice quality a low latency factor is recommended.
CHANNEL_CODEC_IS_UNENCRYPTED
Int (0/1): If 1, this channel is not using encrypted voice data. If 0, voice data is encrypted for this channel. Note that channel voice data encryption can be globally disabled or enabled for the virtual server. Changing this flag makes only sense if global voice data encryption is set to be configured per channel as CODEC_ENCRYPTION_PER_CHANNEL
(the default behaviour).
CHANNEL_SECURITY_SALT
Contains the channels security salt (optional feature). When a client connects, the clients hash value in CLIENT_SECURITY_HASH
is check against the channel salt to allow or deny the client to join this channel. Motivation is to enforce clients joining a server with the specific identity, nickname and metadata.
Please see the chapter “Security salts and hashes” in the Server SDK documentation for details.
CHANNEL_DELETE_DELAY
This parameter defines how many seconds the server waits until a temporary channel is deleted when empty.
When a temporary channel is created, a timer is started. If a user joins the channel before the countdown is finished, the channel is not deleted. After the last person has left the channel, the countdown starts again. CHANNEL_DELETE_DELAY
defines the length of this countdown in seconds.
The time since the last client has left the temporary channel can be queried with ts3client_getChannelEmptySecs
.
To modify channel data use
unsigned int ts3client_setChannelVariableAsInt( | serverConnectionHandlerID, | |
channelID, | ||
flag, | ||
value) ; |
uint64 serverConnectionHandlerID
;uint64 channelID
;ChannelProperties flag
;int value
;
unsigned int ts3client_setChannelVariableAsUInt64( | serverConnectionHandlerID, | |
channelID, | ||
flag, | ||
value) ; |
uint64 serverConnectionHandlerID
;uint64 channelID
;ChannelProperties flag
;uint64 value
;
unsigned int ts3client_setChannelVariableAsString( | serverConnectionHandlerID, | |
channelID, | ||
flag, | ||
value) ; |
uint64 serverConnectionHandlerID
;uint64 channelID
;ChannelProperties flag
;const char* value
;
serverConnectionHandlerID
ID of the server connection handler on which the information for the specified channel should be changed.
channelID
ID of the channel whoses property should be changed.
flag
Channel propery to change, see above.
value
Value the channel property should be changed to. Depending on which function is used, the value can be of type int, uint64 or string.
Returns ERROR_ok
on success, otherwise an error code as defined in public_errors.h
.
![]() | Important | |||||
---|---|---|---|---|---|---|
After modifying one or more channel variables, you have to flush the changes to the server.
uint64 serverConnectionHandlerID ;uint64 channelID ;
|
As example, to change the channel name and topic:
/* Modify data 1 */ if(ts3client_setChannelVariableAsString(scHandlerID, channelID, CHANNEL_NAME, "Other channel name") != ERROR_ok) { printf("Error setting channel name\n"); return; } /* Modify data 2 */ if(ts3client_setChannelVariableAsString(scHandlerID, channelID, CHANNEL_TOPIC, "Other channel topic") != ERROR_ok) { printf("Error setting channel topic\n"); return; } /* Flush changes */ if(ts3client_flushChannelUpdates(scHandlerID, channelID) != ERROR_ok) { printf("Error flushing channel updates\n"); return; }
After a channel was edited using ts3client_setChannelVariableAsInt
or ts3client_setChannelVariableAsString
and the changes were flushed to the server, the edit is announced with the event:
void onUpdateChannelEditedEvent( | serverConnectionHandlerID, | |
channelID, | ||
invokerID, | ||
invokerName, | ||
invokerUniqueIdentifier) ; |
uint64 serverConnectionHandlerID
;uint64 channelID
;anyID invokerID
;const char* invokerName
;const char* invokerUniqueIdentifier
;serverConnectionHandlerID
ID of the server connection handler on which the channel has been edited.
channelID
ID of edited channel.
invokerID
ID of the client who edited the channel.
invokerName
String with the name of the client who edited the channel.
invokerUniqueIdentifier
String with the unique ID of the client who edited the channel.
To find the channel ID from a channels path:
unsigned int ts3client_getChannelIDFromChannelNames( | serverConnectionHandlerID, | |
channelNameArray, | ||
result) ; |
uint64 serverConnectionHandlerID
;char** channelNameArray
;uint64* result
;
serverConnectionHandlerID
ID of the server connection handler on which the channel ID is queried.
channelNameArray
Array defining the position of the channel: "grandparent", "parent", "channel", "". The array is terminated by an empty string.
result
Address of a variable which receives the queried channel ID.
Returns ERROR_ok
on success, otherwise an error code as defined in public_errors.h
.
Voice data can be encrypted or unencrypted. Encryption will increase CPU load, so should be used only when required. Encryption can be configured per channel (the default) or globally enabled or disabled for the whole virtual server. By default channels are sending voice data unencrypted, newly created channels would need to be set to encrypted if required.
To configure the global virtual server encryption settings, modify the virtual server property VIRTUALSERVER_CODEC_ENCRYPTION_MODE
to one of the following values:
enum CodecEncryptionMode { CODEC_ENCRYPTION_PER_CHANNEL = 0, // Default CODEC_ENCRYPTION_FORCED_OFF, CODEC_ENCRYPTION_FORCED_ON, };
Voice data encryption per channel can be configured by setting the channel property CHANNEL_CODEC_IS_UNENCRYPTED
to 0 (encrypted) or 1 (unencrypted) if global encryption mode is CODEC_ENCRYPTION_PER_CHANNEL
. If encryption is forced on or off globally, the channel property will be automatically set by the server.