<Meta/>

The <Meta> sub-command is used to define custom metadata, acting as user-defined variables. These metadata values are passed to the callback URL, providing additional context or information about the call.

Examples:

Simple Examples:

<Meta name="name" value="value"/> <!-- string -->
<Meta name="is_active" value="true"/> <!-- boolean -->
<Meta name="count" value="123"/> <!-- integer -->
<Meta name="price" value="123.99"/> <!-- float -->
<Meta name="description">
  A Complex example.
  line 2
  line 3
</Meta>

Usage Example:

<Tone>
  <Meta name="category" value="music"/>
</Tone>

Attributes:

  • name (string):

    • Meta name.

  • value:

    • Meta value, which can be a string, number (integer or float), boolean, or a multiline string.

The <Meta> sub-command allows you to attach custom metadata to certain commands, enhancing the information passed to the callback URL associated with the call. This feature is useful for conveying specific details or context relevant to your application or workflow.

Suppose you have a phone directory service, and when a user calls to inquire about a contact, you want to pass additional information about the requested contact to your callback URL. You can use <Meta> to attach relevant details, such as the contact's category, company, and urgency level.

<Response>
  <Say>Please enter the contact's extension.</Say>
  <Gather>
    <!-- User enters the contact's extension -->
    <DTMF value="1234">
      <!-- Retrieve contact details from your database -->
      <Meta name="category" value="Customer Support"/>
      <Meta name="company" value="ABC Corp"/>
      <Meta name="urgency_level" value="high"/>

      <!-- Perform actions based on the contact details -->
      <Dial>
        <To>customer_support@yourcompany.com</To>
      </Dial>
    </DTMF>

    <!-- Handle cases where the entered extension is not found -->
    <Default>
      <Say>The entered extension is not valid. Please try again.</Say>
      <Hangup/>
    </Default>
  </Gather>

  <!-- Additional call flow after the Dial -->
  <Say>Thank you for using our phone directory service.</Say>
  <Hangup/>
</Response>

In this example, when a user enters the extension for a contact, <Meta> is used to attach metadata about the contact, such as its category, company, and urgency level. This information can be valuable for further processing or logging, providing a richer context to your application when handling the call.

Last updated