Complete API documentation for Sanas SDK
Introduction
Complete reference for Sanas SDK APIs:
Core Classes
RemoteSDK
Methods:
| Method | Parameters | Returns | Description |
|---|
Initialize | params: InitParams | InitSDKResult | Initialize SDK connection |
CreateAudioProcessor | audio_params: AudioParams, state_callback=None | Tuple[AudioProcessor, CreateProcessorResult] | Create an audio processor |
DestroyAudioProcessor | processor: AudioProcessor | DestroyProcessorResult | Destroy processor |
Shutdown | - | ShutdownSDKResult | Shutdown SDK |
IsInitialized | - | bool | Check initialization status |
GetActiveProcessorCount | - | int | Get active processor count |
InitParams
| Property | Type | Required | Description |
|---|
remoteEndpoint | string | Yes | SIP/RTP endpoint URL |
accountId | string | Yes | Account ID |
accountSecret | string | Yes | Account secret |
secureMedia | boolean | No | Enable encrypted audio default: false |
AudioParams
| Property | Type | Required | Description |
|---|
modelName | string | Yes | AI model name |
sampleRate | int | Yes | 8000 or 16000 Hz |
AudioProcessor
Methods:
| Method | Parameters | Returns | Description |
|---|
ProcessSamples | input_samples: List[float] | List[float] | Process 20ms audio chunk |
GetState | - | ProcessorState | Get the current processor state |
ProcessSamples expects 160 samples (8kHz) or 320 samples (16kHz).
Result Enums
InitSDKResult
| Enum | Description |
|---|
SUCCESS | Initialized successfully |
ALREADY_INITIALIZED | Already initialized |
INITIALIZATION_FAILED | Connection/credentials failed |
INVALID_PARAMETERS | Invalid parameters |
FAILED | General failure |
CreateProcessorResult
| Enum | Description |
|---|
SUCCESS | Created successfully |
SDK_NOT_INITIALIZED | SDK Initialization is pending |
INVALID_PARAMETERS | Invalid audio params |
PROCESSOR_LIMIT_REACHED | Max 300 processors |
FAILED | General failure |
DestroyProcessorResult
| Enum | Description |
|---|
SUCCESS | Destroyed successfully |
SDK_NOT_INITIALIZED | SDK not initialized |
INVALID_PROCESSOR | Invalid processor |
PROCESSOR_ALREADY_DESTROYED | Already destroyed |
FAILED | General failure |
ShutdownSDKResult
| Enum | Description |
|---|
SUCCESS | Shutdown complete |
NOT_INITIALIZED | Not initialized |
FAILED | General failure |
State Enums
ProcessorState
| Enum | Description |
|---|
INITIALIZING | Connecting to Sanas Cloud |
READY | Ready for processing |
FAILED | Processing failed |
DISCONNECTED | Connection lost |
State Callbacks
The SDK supports state callbacks that notify you when audio processor state changes:
def state_callback(state, reason):
"""
Called when processor state changes
Args:
state (int): ProcessorState enum value
reason (string): Reason for state change
"""
if state == sanas_remote_sdk.ProcessorState.READY:
print("Processor ready for audio processing")
elif state == sanas_remote_sdk.ProcessorState.FAILED:
print(f"Processor failed: {reason}")
elif state == sanas_remote_sdk.ProcessorState.DISCONNECTED:
print("Processor disconnected")
# Use callback when creating processor
processor, result = sdk.CreateAudioProcessor(audio_params, state_callback)