twiliotwilio-apitwilio-twiml

Twilio Error: 12200 Schema validation error, Invalid content was found starting with element 'Stream'. One of '{Play


I am encountering an error from Twilio and would appreciate assistance as there is limited information on the documentation page, and the error itself is not well-detailed.

12200 Schema validation, line: 2, warning Description Invalid content was found starting with element 'Message'. One of '{Play

The Twiml is:

<?xml version="1.0" encoding="UTF-8"?>
<Response>
  <Stream name="Feature tagging Audio Stream" track="outbound_track" url="wss://test.com/ws" status="started">
      <Parameter name="scheduled_meeting_id" value="room_name"/>
      <Parameter name="call_type" value="spec"/>
      <Parameter name="category" value="internal"/>
      <Parameter name="token" value="speech_to_text_token"/>
  </Stream>
  <Connect>
    <Room participantIdentity="Some (AI Bot)">room_name</Room>
  </Connect>
</Response>

I opted not to use the <Start> verb to ensure synchronous connection. However, when I include the verb, my connection is lost within 1ms. Any assistance would be greatly appreciated


Solution

  • Twilio Support Engineer here. Please note that <Stream> is a noun and not a verb, hence it cannot be used as a child element of <Response>.

    If the use case is to stream the audio to a websocket server while asynchronously connecting the call to a Programmable Video room, you would need to use the verb with the noun. For example:

    <?xml version="1.0" encoding="UTF-8"?>
    <Response>
       <Start>
          <Stream name="Feature tagging Audio Stream" track="outbound_track" url="wss://test.com/ws" status="started">
             <Parameter name="scheduled_meeting_id" value="room_name" />
             <Parameter name="call_type" value="spec" />
             <Parameter name="category" value="internal" />
             <Parameter name="token" value="speech_to_text_token" />
          </Stream>
       </Start>
       <Connect>
          <Room participantIdentity="Some (AI Bot)">room_name</Room>
       </Connect>
    </Response>