// Vapi Tool Definition
const tool = {
"type": "function",
"function": {
"name": "check_pii",
"url": "wss://voice.humsana.com/stream?key=voice_hum_demo123",
"description": "Stream audio here to detect credit cards."
}
}
<!-- Twilio Media Stream TwiML -->
<Response>
<Start>
<Stream url="wss://voice.humsana.com/stream"url": "wss://voice.humsana.com/stream?key=voice_hum_demo123"," />
</Start>
<Say>Humsana is now protecting this call..</Say>
<Pauselength="10" />
</Response>
# Universal WebSocket (Python Client)
import websockets
async with websockets.connect("wss://voice.humsana.com/stream?key=voice_hum_demo123") as ws:
await ws.send(json.dumps({
"audio": base64_audio_chunk,
"format": "pcm16"
}))
response = await ws.recv()
if "PII_DETECTED" in response:
mute_audio()