Open Context Protocol is live! 🚀 Read the launch post

listCall

Retrieves a collection of calls made to and from your account

Details

  • Method: GET
  • Path: /2010-04-01/Accounts/{AccountSid}/Calls.json
  • Operation ID: ListCall

Parameters

{
  "AccountSid": {
    "description": "The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Call resource(s) to read.",
    "required": true,
    "location": "path",
    "type": "string"
  },
  "To": {
    "description": "Only show calls made to this phone number, SIP address, Client identifier or SIM SID.",
    "required": false,
    "location": "query",
    "type": "string",
    "format": "phone-number"
  },
  "From": {
    "description": "Only include calls from this phone number, SIP address, Client identifier or SIM SID.",
    "required": false,
    "location": "query",
    "type": "string",
    "format": "phone-number"
  },
  "ParentCallSid": {
    "description": "Only include calls spawned by calls with this SID.",
    "required": false,
    "location": "query",
    "type": "string"
  },
  "Status": {
    "description": "The status of the calls to include. Can be: `queued`, `ringing`, `in-progress`, `canceled`, `completed`, `failed`, `busy`, or `no-answer`.",
    "required": false,
    "location": "query",
    "type": "string",
    "enum": [
      "queued",
      "ringing",
      "in-progress",
      "completed",
      "busy",
      "failed",
      "no-answer",
      "canceled"
    ]
  },
  "StartTime": {
    "description": "Only include calls that started on this date. Specify a date as `YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only calls that started on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read calls that started on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read calls that started on or after midnight of this date.",
    "required": false,
    "location": "query",
    "type": "string",
    "format": "date-time"
  },
  "StartTime<": {
    "description": "Only include calls that started on this date. Specify a date as `YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only calls that started on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read calls that started on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read calls that started on or after midnight of this date.",
    "required": false,
    "location": "query",
    "type": "string",
    "format": "date-time"
  },
  "StartTime>": {
    "description": "Only include calls that started on this date. Specify a date as `YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only calls that started on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read calls that started on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read calls that started on or after midnight of this date.",
    "required": false,
    "location": "query",
    "type": "string",
    "format": "date-time"
  },
  "EndTime": {
    "description": "Only include calls that ended on this date. Specify a date as `YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only calls that ended on this date. You can also specify an inequality, such as `EndTime<=YYYY-MM-DD`, to read calls that ended on or before midnight of this date, and `EndTime>=YYYY-MM-DD` to read calls that ended on or after midnight of this date.",
    "required": false,
    "location": "query",
    "type": "string",
    "format": "date-time"
  },
  "EndTime<": {
    "description": "Only include calls that ended on this date. Specify a date as `YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only calls that ended on this date. You can also specify an inequality, such as `EndTime<=YYYY-MM-DD`, to read calls that ended on or before midnight of this date, and `EndTime>=YYYY-MM-DD` to read calls that ended on or after midnight of this date.",
    "required": false,
    "location": "query",
    "type": "string",
    "format": "date-time"
  },
  "EndTime>": {
    "description": "Only include calls that ended on this date. Specify a date as `YYYY-MM-DD` in UTC, for example: `2009-07-06`, to read only calls that ended on this date. You can also specify an inequality, such as `EndTime<=YYYY-MM-DD`, to read calls that ended on or before midnight of this date, and `EndTime>=YYYY-MM-DD` to read calls that ended on or after midnight of this date.",
    "required": false,
    "location": "query",
    "type": "string",
    "format": "date-time"
  },
  "PageSize": {
    "description": "How many resources to return in each list page. The default is 50, and the maximum is 1000.",
    "required": false,
    "location": "query",
    "type": "integer",
    "format": "int64"
  },
  "Page": {
    "description": "The page index. This value is simply for client state.",
    "required": false,
    "location": "query",
    "type": "integer"
  },
  "PageToken": {
    "description": "The page token. This is provided by the API.",
    "required": false,
    "location": "query",
    "type": "string"
  }
}

Response Schema

{
  "title": "ListCallResponse",
  "type": "object",
  "properties": {
    "calls": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "sid": {
            "type": "string",
            "minLength": 34,
            "maxLength": 34,
            "pattern": "^CA[0-9a-fA-F]{32}$",
            "nullable": true,
            "description": "The unique string that we created to identify this Call resource."
          },
          "date_created": {
            "type": "string",
            "format": "date-time-rfc-2822",
            "nullable": true,
            "description": "The date and time in UTC that this resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format."
          },
          "date_updated": {
            "type": "string",
            "format": "date-time-rfc-2822",
            "nullable": true,
            "description": "The date and time in UTC that this resource was last updated, specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format."
          },
          "parent_call_sid": {
            "type": "string",
            "minLength": 34,
            "maxLength": 34,
            "pattern": "^CA[0-9a-fA-F]{32}$",
            "nullable": true,
            "description": "The SID that identifies the call that created this leg."
          },
          "account_sid": {
            "type": "string",
            "minLength": 34,
            "maxLength": 34,
            "pattern": "^AC[0-9a-fA-F]{32}$",
            "nullable": true,
            "description": "The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created this Call resource."
          },
          "to": {
            "type": "string",
            "nullable": true,
            "description": "The phone number, SIP address, Client identifier or SIM SID that received this call. Phone numbers are in [E.164](https://www.twilio.com/docs/glossary/what-e164) format (e.g., +16175551212). SIP addresses are formatted as `name@company.com`. Client identifiers are formatted `client:name`. SIM SIDs are formatted as `sim:sid`.",
            "x-twilio": {
              "pii": {
                "handling": "standard",
                "deleteSla": 120
              }
            }
          },
          "to_formatted": {
            "type": "string",
            "nullable": true,
            "description": "The phone number, SIP address or Client identifier that received this call. Formatted for display. Non-North American phone numbers are in [E.164](https://www.twilio.com/docs/glossary/what-e164) format (e.g., +442071838750).",
            "x-twilio": {
              "pii": {
                "handling": "standard",
                "deleteSla": 120
              }
            }
          },
          "from": {
            "type": "string",
            "nullable": true,
            "description": "The phone number, SIP address, Client identifier or SIM SID that made this call. Phone numbers are in [E.164](https://www.twilio.com/docs/glossary/what-e164) format (e.g., +16175551212). SIP addresses are formatted as `name@company.com`. Client identifiers are formatted `client:name`. SIM SIDs are formatted as `sim:sid`.",
            "x-twilio": {
              "pii": {
                "handling": "standard",
                "deleteSla": 120
              }
            }
          },
          "from_formatted": {
            "type": "string",
            "nullable": true,
            "description": "The calling phone number, SIP address, or Client identifier formatted for display. Non-North American phone numbers are in [E.164](https://www.twilio.com/docs/glossary/what-e164) format (e.g., +442071838750).",
            "x-twilio": {
              "pii": {
                "handling": "standard",
                "deleteSla": 120
              }
            }
          },
          "phone_number_sid": {
            "type": "string",
            "minLength": 34,
            "maxLength": 34,
            "pattern": "^PN[0-9a-fA-F]{32}$",
            "nullable": true,
            "description": "If the call was inbound, this is the SID of the IncomingPhoneNumber resource that received the call. If the call was outbound, it is the SID of the OutgoingCallerId resource from which the call was placed."
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "ringing",
              "in-progress",
              "completed",
              "busy",
              "failed",
              "no-answer",
              "canceled"
            ],
            "description": "The status of this call. Can be: `queued`, `ringing`, `in-progress`, `canceled`, `completed`, `failed`, `busy` or `no-answer`. See [Call Status Values](https://www.twilio.com/docs/voice/api/call-resource#call-status-values) below for more information."
          },
          "start_time": {
            "type": "string",
            "format": "date-time-rfc-2822",
            "nullable": true,
            "description": "The start time of the call, given as UTC in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. Empty if the call has not yet been dialed."
          },
          "end_time": {
            "type": "string",
            "format": "date-time-rfc-2822",
            "nullable": true,
            "description": "The time the call ended, given as UTC in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. Empty if the call did not complete successfully."
          },
          "duration": {
            "type": "string",
            "nullable": true,
            "description": "The length of the call in seconds. This value is empty for busy, failed, unanswered, or ongoing calls."
          },
          "price": {
            "type": "string",
            "nullable": true,
            "description": "The charge for this call, in the currency associated with the account. Populated after the call is completed. May not be immediately available. The price associated with a call only reflects the charge for connectivity.  Charges for other call-related features such as Answering Machine Detection, Text-To-Speech, and SIP REFER are not included in this value."
          },
          "price_unit": {
            "type": "string",
            "format": "currency",
            "nullable": true,
            "description": "The currency in which `Price` is measured, in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format (e.g., `USD`, `EUR`, `JPY`). Always capitalized for calls."
          },
          "direction": {
            "type": "string",
            "nullable": true,
            "description": "A string describing the direction of the call. Can be: `inbound` for inbound calls, `outbound-api` for calls initiated via the REST API or `outbound-dial` for calls initiated by a `<Dial>` verb. Using [Elastic SIP Trunking](https://www.twilio.com/docs/sip-trunking), the values can be [`trunking-terminating`](https://www.twilio.com/docs/sip-trunking#termination) for outgoing calls from your communications infrastructure to the PSTN or [`trunking-originating`](https://www.twilio.com/docs/sip-trunking#origination) for incoming calls to your communications infrastructure from the PSTN."
          },
          "answered_by": {
            "type": "string",
            "nullable": true,
            "description": "Either `human` or `machine` if this call was initiated with answering machine detection. Empty otherwise."
          },
          "api_version": {
            "type": "string",
            "nullable": true,
            "description": "The API version used to create the call."
          },
          "forwarded_from": {
            "type": "string",
            "nullable": true,
            "description": "The forwarding phone number if this call was an incoming call forwarded from another number (depends on carrier supporting forwarding). Otherwise, empty.",
            "x-twilio": {
              "pii": {
                "handling": "standard",
                "deleteSla": 120
              }
            }
          },
          "group_sid": {
            "type": "string",
            "minLength": 34,
            "maxLength": 34,
            "pattern": "^GP[0-9a-fA-F]{32}$",
            "nullable": true,
            "description": "The Group SID associated with this call. If no Group is associated with the call, the field is empty."
          },
          "caller_name": {
            "type": "string",
            "nullable": true,
            "description": "The caller's name if this call was an incoming call to a phone number with caller ID Lookup enabled. Otherwise, empty.",
            "x-twilio": {
              "pii": {
                "handling": "standard",
                "deleteSla": 120
              }
            }
          },
          "queue_time": {
            "type": "string",
            "nullable": true,
            "description": "The wait time in milliseconds before the call is placed."
          },
          "trunk_sid": {
            "type": "string",
            "minLength": 34,
            "maxLength": 34,
            "pattern": "^TK[0-9a-fA-F]{32}$",
            "nullable": true,
            "description": "The unique identifier of the trunk resource that was used for this call. The field is empty if the call was not made using a SIP trunk or if the call is not terminated."
          },
          "uri": {
            "type": "string",
            "nullable": true,
            "description": "The URI of this resource, relative to `https://api.twilio.com`."
          },
          "subresource_uris": {
            "type": "object",
            "format": "uri-map",
            "nullable": true,
            "description": "A list of subresources available to this call, identified by their URIs relative to `https://api.twilio.com`."
          }
        }
      }
    },
    "end": {
      "type": "integer"
    },
    "first_page_uri": {
      "format": "uri",
      "type": "string"
    },
    "next_page_uri": {
      "format": "uri",
      "nullable": true,
      "type": "string"
    },
    "page": {
      "type": "integer"
    },
    "page_size": {
      "type": "integer"
    },
    "previous_page_uri": {
      "format": "uri",
      "nullable": true,
      "type": "string"
    },
    "start": {
      "type": "integer"
    },
    "uri": {
      "format": "uri",
      "type": "string"
    }
  }
}

Usage

from ocp_agent import OCPAgent

agent = OCPAgent()
await agent.register_api('twilio')

# Call this tool
result = await agent.call_tool('listCall', {
    # Add required parameters here
})