{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/microsoft-azure-communication-services/json-schema/microsoft-azure-communication-services-recognize-request-schema.json",
  "title": "RecognizeRequest",
  "x-generated": "2026-11-05",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/microsoft-azure-communication-services-callautomation-api-openapi.yml#/components/schemas/RecognizeRequest",
  "required": [
    "recognizeInputType",
    "recognizeOptions"
  ],
  "type": "object",
  "properties": {
    "recognizeInputType": {
      "$ref": "#/$defs/RecognizeInputType"
    },
    "playPrompt": {
      "$ref": "#/$defs/PlaySource"
    },
    "playPrompts": {
      "description": "The source of the audio to be played for recognition.",
      "type": "array",
      "items": {
        "$ref": "#/$defs/PlaySource"
      }
    },
    "interruptCallMediaOperation": {
      "description": "If set recognize can barge into other existing queued-up/currently-processing requests.",
      "type": "boolean"
    },
    "recognizeOptions": {
      "$ref": "#/$defs/RecognizeOptions"
    },
    "operationContext": {
      "description": "The value to identify context of the operation.",
      "type": "string"
    },
    "operationCallbackUri": {
      "description": "Set a callback URI that overrides the default callback URI set by CreateCall/AnswerCall for this operation.\r\nThis setup is per-action. If this is not set, the default callback URI set by CreateCall/AnswerCall will be used.",
      "type": "string"
    }
  },
  "additionalProperties": false,
  "$defs": {
    "Choice": {
      "required": [
        "label",
        "phrases"
      ],
      "type": "object",
      "properties": {
        "label": {
          "description": "Identifier for a given choice",
          "type": "string"
        },
        "phrases": {
          "description": "List of phrases to recognize",
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "tone": {
          "$ref": "#/$defs/Tone"
        }
      },
      "additionalProperties": false
    },
    "CommunicationIdentifierModel": {
      "$ref": "../../../Common/stable/2025-06-30/common.json#/components/schemas/CommunicationIdentifierModel"
    },
    "DtmfOptions": {
      "description": "Options for DTMF recognition",
      "type": "object",
      "properties": {
        "interToneTimeoutInSeconds": {
          "format": "int32",
          "description": "Time to wait between DTMF inputs to stop recognizing.",
          "maximum": 60,
          "minimum": 1,
          "type": "integer"
        },
        "maxTonesToCollect": {
          "format": "int32",
          "description": "Maximum number of DTMF tones to be collected.",
          "type": "integer"
        },
        "stopTones": {
          "description": "List of tones that will stop recognizing.",
          "type": "array",
          "items": {
            "$ref": "#/$defs/Tone"
          }
        }
      },
      "additionalProperties": false
    },
    "FileSource": {
      "required": [
        "uri"
      ],
      "type": "object",
      "properties": {
        "uri": {
          "description": "Uri for the audio file to be played",
          "type": "string"
        }
      },
      "additionalProperties": false
    },
    "PlaySource": {
      "required": [
        "kind"
      ],
      "type": "object",
      "properties": {
        "kind": {
          "$ref": "#/$defs/PlaySourceType"
        },
        "playSourceCacheId": {
          "description": "Defines the identifier to be used for caching related media",
          "type": "string"
        },
        "file": {
          "$ref": "#/$defs/FileSource"
        },
        "text": {
          "$ref": "#/$defs/TextSource"
        },
        "ssml": {
          "$ref": "#/$defs/SsmlSource"
        }
      },
      "additionalProperties": false
    },
    "PlaySourceType": {
      "description": "Defines the types of play source",
      "enum": [
        "file",
        "text",
        "ssml"
      ],
      "type": "string",
      "x-ms-enum": {
        "name": "PlaySourceType",
        "modelAsString": true
      }
    },
    "RecognizeInputType": {
      "description": "Defines the type of the recognize input",
      "enum": [
        "dtmf",
        "speech",
        "speechOrDtmf",
        "choices"
      ],
      "type": "string",
      "x-ms-enum": {
        "name": "RecognizeInputType",
        "modelAsString": true
      }
    },
    "RecognizeOptions": {
      "required": [
        "targetParticipant"
      ],
      "type": "object",
      "properties": {
        "interruptPrompt": {
          "description": "Determines if we interrupt the prompt and start recognizing.",
          "type": "boolean"
        },
        "initialSilenceTimeoutInSeconds": {
          "format": "int32",
          "description": "Time to wait for first input after prompt (if any).",
          "maximum": 300,
          "minimum": 0,
          "type": "integer"
        },
        "targetParticipant": {
          "$ref": "#/$defs/CommunicationIdentifierModel"
        },
        "speechLanguage": {
          "description": "Speech language to be recognized, If not set default is en-US",
          "type": "string"
        },
        "speechRecognitionModelEndpointId": {
          "description": "Endpoint where the custom model was deployed.",
          "type": "string"
        },
        "dtmfOptions": {
          "$ref": "#/$defs/DtmfOptions"
        },
        "choices": {
          "description": "Defines Ivr choices for recognize.",
          "type": "array",
          "items": {
            "$ref": "#/$defs/Choice"
          }
        },
        "speechOptions": {
          "$ref": "#/$defs/SpeechOptions"
        }
      },
      "additionalProperties": false
    },
    "SpeechOptions": {
      "description": "Options for continuous speech recognition",
      "type": "object",
      "properties": {
        "endSilenceTimeoutInMs": {
          "format": "int64",
          "description": "The length of end silence when user stops speaking and cogservice send response.",
          "type": "integer"
        }
      },
      "additionalProperties": false
    },
    "SsmlSource": {
      "required": [
        "ssmlText"
      ],
      "type": "object",
      "properties": {
        "ssmlText": {
          "description": "Ssml string for the cognitive service to be played",
          "type": "string"
        },
        "customVoiceEndpointId": {
          "description": "Endpoint where the custom voice was deployed.",
          "type": "string"
        }
      },
      "additionalProperties": false
    },
    "TextSource": {
      "required": [
        "text"
      ],
      "type": "object",
      "properties": {
        "text": {
          "description": "Text for the cognitive service to be played",
          "type": "string"
        },
        "sourceLocale": {
          "description": "Source language locale to be played\r\nRefer to available locales here: <seealso href=\"https://learn.microsoft.com/en-us/azure/cognitive-services/speech-service/language-support?tabs=stt-tts\" />",
          "type": "string"
        },
        "voiceKind": {
          "$ref": "#/$defs/VoiceKind"
        },
        "voiceName": {
          "description": "Voice name to be played\r\nRefer to available Text-to-speech voices here: <seealso href=\"https://learn.microsoft.com/en-us/azure/cognitive-services/speech-service/language-support?tabs=stt-tts\" />",
          "type": "string"
        },
        "customVoiceEndpointId": {
          "description": "Endpoint where the custom voice was deployed.",
          "type": "string"
        }
      },
      "additionalProperties": false
    },
    "Tone": {
      "description": "List of valid stop tones",
      "enum": [
        "zero",
        "one",
        "two",
        "three",
        "four",
        "five",
        "six",
        "seven",
        "eight",
        "nine",
        "a",
        "b",
        "c",
        "d",
        "pound",
        "asterisk"
      ],
      "type": "string",
      "x-ms-enum": {
        "name": "Tone",
        "modelAsString": true
      }
    },
    "VoiceKind": {
      "description": "Audio kind type",
      "enum": [
        "male",
        "female"
      ],
      "type": "string",
      "x-ms-enum": {
        "name": "VoiceKind",
        "modelAsString": true
      }
    }
  }
}