BROADCAST SERVER SDK METHOD DETAILS
This document specifies the Status and Error Code Numbers and also describes the events and functions supported by VaxVoIP BroadCast Server SDK Components:
CODE NUMBERS:
  - Error Codes
  - Status Codes
 
EVENTS:
  - OnStatusEvent
  - OnClientTextEvent
  - OnClientConnectEvent
  - OnClientDisconnectEvent
  - OnClientConnectionLostEvent
METHODS:
  - Initialize()
  - UnInitialize()
 
  - GetVaxObjectError()
  - SetLicenceKey()
  - EnableCryptography()
  - DisableCryptography()
  - GetTotalConnectedClient()
  - SetConnectionLimit()
  - SendTextToClient()
  - GetClientChatRoom()
  - DisconnectClient()
  - BlockClient()
  - UnBlockClient()
  - RejectConnection()
  - AcceptConnection()
  - GetOutBoundDataRate()
  - GetInBoundDataRate()
  - GetOutBoundTotalBytes()
  - GetInBoundTotalBytes()
ERROR CODES DETAIL:
ERROR CODES DESCRIPTION
10 VAXObject is not initialized properly, To initialize, the VaxVoIP Object Initialize method should be called.
11 Cannot open local communication port, port is invalid or is already in use. OR Provided listen IP is not valid. 
12 Provided License key is not valid.
13 Provided client IP & Port is not valid OR Client is not connected to the Server.
14 Cryptography key is not provided while initializing the VaxVoIP Object. Please see the Initialize method for further details.
15 Cannot access the input device (Microphone) OR input device is already in use.  
STATUS CODES DETAIL:
STATUS CODES DESCRIPTION
50 Voice Compression manager problem.
51 Mixing Channel problem.
52 It indicates that Encrypted data is being received from the remote end and VaxVoIP object is unable to decrypt it because Cryptography key is not provided while initializing the VaxVoIP Object. Please see the Initialize method for further details.
EVENTS:
OnStatusEvent
This Event is triggered by the VaxVoIP control to notify about the client status.
Parameters Values:
  - Status Code Number
  -  Client IP
  -  Client Port
OnClientTextEvent
Event is triggered by the VaxVoIP control to notify about the Text message sent by the client.
Parameters Values:
  - Text Message
  -  Client IP
  -  Client Port
OnClientConnectEvent
Event is triggered, when a client sends connection request or tries to connect to the Server.
Parameters Values:
  - Chat Room
  - Login
  - Password
  - User Data
  - Client IP
  - Client Port
Remarks:
Two methods  AcceptConnection() or RejectConnection() can be called to accept or reject the incoming connection.
OnClientDisconnectEvent
It notifies that client has closed the connection.
Parameters Values:
  - Chat Room
  - Client IP
  - Client Port
OnClientConnectionLostEvent
It notifies that the connection to the specific client has lost.
Parameters Values:
  - Chat Room
  - Client IP
  - Client Port
METHODS:
Initialize()
This method is called to initialize the VaxVoIP control. It requires Port Number to listen for incoming connections and/or data. After initializing, VaxVoIP control starts listening for incoming Connections.  

It also requires the cryptography key or secret words to decrypt the incoming data and/or Encrypt the outgoing Voice/Text data. BLOW FISH cryptography is used for Encryption/Decryption. 

Two methods EnableCryptography and DisableCryptography can be used to enable/disable the encryption on outbound Voice Stream and Text Messages.

Please see the sample source code for more details.

Parameters:
  - Listen Port Number
  - Listen IP (To bind the broadcast server application to a specific IP)
  - InputDeviceId (-1 = auto select)
  - CryptographyKey or Secret Words
Return Value:
Non-zero on success, otherwise 0, and an appropriate error code can be retrieved by calling GetVaxObjectError() method.
Remarks:
Listen IP is required, if the machine on which you are running proxy server application has more than one IP addresses.
Broadcast server requires single sound card in order to perform certain voice operations. It internally works with the sound card, so at-least one sound card must be present in the computer on which you are going to run the Broadcast Server application. 
Value -1 can be provided, if your computer has single sound device OR you want VaxVoIP control to select the first/default sound device capable of recording.
VaxVoIP controls use 'waveInOpen' windows API to initialize the Input device.
If you want to run multiple instances of your client software and your computer has multiple sound devices then WinMM (Windows Multimedia API) can be used to determine the device-Ids.
VaxVoIP controls use the following PCM Format to initialize the input device:
FormatTag       = 1

Channels         = 1

SamplesPerSec     = 8000
AvgBytesPerSec     = 16000
BlockAlign       = 2
BitsPerSample   = 16
cbSize           = 0
The following WinMM APIs can be used to determine the input device-Id.
  - waveInGetNumDevs()
  - waveInGetID()
  - waveInGetDevCaps()
UnInitialize()
To uninitialize the VaxVoIP control, this method can be used.
GetVaxObjectError()
Call this method, to get the error for the last operation that failed.
Return Value:
  - Error Code Number
SetLicenceKey()
Call this method, to set the License key.
Parameter:
   - License Key Provided by VaxVoIP
Return Value:
Non-zero on success, otherwise 0, and a specific error code can be retrieved by calling GetVaxObjectError() method.
Remarks:
User must pay one-time License fee in order to get the License Key. After getting the License key, you will set it using this method and it will remove the evaluation message box & expiry.
EnableCryptography()
To enable the Encryption on outgoing Voice Stream and Text data. When this method is called, VaxVoIP component starts encrypting the outbound Voice Stream and Text messages before sending it to the Remote end over the internet.

Remote end receives the encrypted Voice Stream/Text messages and decrypt it using the provided Cryptography key. So on both ends the Cryptography keys must be the same. 

BLOW FISH cryptography is used for Encryption/Decryption. 

DisableCryptography()
To disable the Cryptography feature on outgoing Voice Stream and Text data. When this method is called, VaxVoIP component stops encrypting the Voice Stream and Text messages and starts sending the plain data to the remote end over the internet.
GetTotalConnectedClient()
To get the total number of connected clients.
Return Value:
Total number of clients on success, otherwise 0.
SetConnectionLimit()
To set the connections limit.
Parameters:
  - Number of connections (0 = Unlimited)
Return Value:
Non-zero on success, otherwise 0, and an appropriate error code can be retrieved by calling GetVaxObjectError() method.
SendTextToClient()
Method to send text message to any client.
Parameters:
  - Client IP
  - Client Port
  - Text Message
Return Value:
Non-zero on success, otherwise 0, and an appropriate error code can be retrieved by calling GetVaxObjectError() method.
GetClientChatRoom()
Method to get the chat room of a specific client.
  - ClientIP
  - ClientPort
Return Value:
Chat room on success, otherwise no value, and an appropriate error code can be retrieved by calling GetVaxObjectError() method.
DisconnectClient()
Method to close connection of any client.
Parameters:
  - Client IP
  - Client Port
Return Value:
Non-zero on success, otherwise 0, and an appropriate error code can be retrieved by calling GetVaxObjectError() method.
BlockClient()
To block IP & port of a client.
Parameters:
  - Client IP
  - Client Port
Return Value:
Non-zero on success, otherwise 0, and an appropriate error code can be retrieved by calling GetVaxObjectError() method.
UnBlockClient()
To unblock IP & port of a client.
Parameters:
  - Client IP
  - Client Port
Return Value:
Non-zero on success, otherwise 0, and an appropriate error code can be retrieved by calling GetVaxObjectError() method.
AcceptConnection()
Method to accept the connection request sent by the client.
Parameters:
  - ChatRoom in which you want to add the client.
  - Client IP
  - Client Port
  - UserData (To send any text back to client)
Remarks:
Any text info that can be sent back to client with the accept connection reply and client receives that text info in OnAcceptConnectionEvent event.
Return Value:
Non-zero on success, otherwise 0, and an appropriate error code can be retrieved by calling GetVaxObjectError() method.
RejectConnection()
Method to reject the connection request sent by the client.
Parameters:
  - Client IP
  - Client Port
  - UserData  (To send any text back to client)
  - Custom Error
Remarks:
Any text info that can be sent back to the client with the reject connection reply and client receives that info in OnRejectConnectionEvent event.
You can also send any user defined error code along with the rejection and client receives that custom error code in OnRejectConnectionEvent event.
Return Value:
Non-zero on success, otherwise 0, and an appropriate error code can be retrieved by calling GetVaxObjectError() method.
GetOutBoundTotalBytes()
Total Outbound bytes, since the VaxVoIP Object is initialized.
GetInBoundTotalBytes()
Total Inbound bytes, since the VaxVoIP object is initialized.
GetOutBoundDataRate()
Outbound Bytes per second.
GetInBoundDataRate()
Inbound Bytes per second.