syntax = "proto3"; package vd.v1; // DetectorService tells whether a person or a machine answered a call, from the audio of the called side. // // Every method needs an API key in the metadata: `authorization: Bearer vd_…`, or // `x-api-key: vd_…`. service DetectorService { // Stream analyses a live call. Send a Config first, then audio in frames of any size (20 ms is // usual), and close the sending side when the call is over. The server answers Ready, then a // Result the moment each one is known, and Done before ending the call. rpc Stream(stream StreamRequest) returns (stream StreamResponse); // Detect analyses a whole recording and answers once it has been heard. rpc Detect(DetectRequest) returns (DetectResponse); } enum Encoding { ENCODING_UNSPECIFIED = 0; // 16-bit little-endian linear PCM. ENCODING_PCM16 = 1; // G.711 µ-law. ENCODING_MULAW = 2; // G.711 A-law. ENCODING_ALAW = 3; } message Config { // Required for raw audio and for streams; a WAV file sent to Detect carries its own. Encoding encoding = 1; // Hz: 8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100 or 48000; 0 means 8000. Raw audio // and streams only: a WAV file sent to Detect carries its own. uint32 sample_rate = 2; // Most audio heard before the first verdict, 1000 to 30000; 0 means 6000. uint32 decision_timeout_ms = 3; // How long to keep listening after a human verdict, up to 60000. Unset means 30000 for // streams and 0 for Detect. optional uint32 watch_ms = 4; } message StreamRequest { oneof request { // The first message, and only the first. Config config = 1; // Audio in the encoding of the Config, at most 64 KiB per message. bytes audio = 2; } } message StreamResponse { oneof response { Ready ready = 1; Result result = 2; Done done = 3; } } // Ready says the server is listening. message Ready {} // Done comes last: nothing more can change the results. message Done { int64 audio_ms = 1; // "verdict given", "end of audio" or "time limit". string reason = 2; } enum Verdict { VERDICT_UNSPECIFIED = 0; VERDICT_HUMAN = 1; VERDICT_MACHINE = 2; // The line stayed silent, or the audio ended before anything could be told. VERDICT_UNKNOWN = 3; } enum Stage { STAGE_UNSPECIFIED = 0; // The first verdict on a call. STAGE_DECISION = 1; // A later result that overturns a human verdict. STAGE_AFTER_HUMAN = 2; } message Result { Verdict verdict = 1; Stage stage = 2; // Audio heard when the result was given. int64 at_ms = 3; } message DetectRequest { Config config = 1; // A WAV file, or raw audio in the encoding of the Config. At most 8 MiB. bytes audio = 2; } message DetectResponse { // The last word: the after-human result when there is one. Verdict verdict = 1; repeated Result results = 2; // Audio analysed: it stops once nothing could change the results. int64 audio_ms = 3; }