{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "#/components/schemas/SipRequestTool",
"title": "SipRequestTool",
"type": "object",
"properties": {
"messages": {
"type": "array",
"description": "These are the messages that will be spoken to the user as the tool is running.\n\nFor some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured.",
"items": {
"oneOf": [
{
"$ref": "#/components/schemas/ToolMessageStart",
"title": "ToolMessageStart"
},
{
"$ref": "#/components/schemas/ToolMessageComplete",
"title": "ToolMessageComplete"
},
{
"$ref": "#/components/schemas/ToolMessageFailed",
"title": "ToolMessageFailed"
},
{
"$ref": "#/components/schemas/ToolMessageDelayed",
"title": "ToolMessageDelayed"
}
]
}
},
"type": {
"type": "string",
"enum": [
"sipRequest"
],
"description": "The type of tool. \"sipRequest\" for SIP request tool."
},
"verb": {
"type": "string",
"enum": [
"INFO",
"MESSAGE",
"NOTIFY"
],
"description": "The SIP method to send."
},
"headers": {
"description": "JSON schema for headers the model should populate when sending the SIP request.",
"allOf": [
{
"$ref": "#/components/schemas/JsonSchema"
}
]
},
"body": {
"description": "Body to include in the SIP request. Either a literal string body, or a JSON schema describing a structured body that the model should populate.",
"oneOf": [
{
"type": "string"
},
{
"$ref": "#/components/schemas/JsonSchema"
}
]
},
"id": {
"type": "string",
"description": "This is the unique identifier for the tool."
},
"orgId": {
"type": "string",
"description": "This is the unique identifier for the organization that this tool belongs to."
},
"createdAt": {
"format": "date-time",
"type": "string",
"description": "This is the ISO 8601 date-time string of when the tool was created."
},
"updatedAt": {
"format": "date-time",
"type": "string",
"description": "This is the ISO 8601 date-time string of when the tool was last updated."
},
"rejectionPlan": {
"description": "This is the plan to reject a tool call based on the conversation state.\n\n// Example 1: Reject endCall if user didn't say goodbye\n```json\n{\n conditions: [{\n type: 'regex',\n regex: '(?i)\\\\b(bye|goodbye|farewell|see you later|take care)\\\\b',\n target: { position: -1, role: 'user' },\n negate: true // Reject if pattern does NOT match\n }]\n}\n```\n\n// Example 2: Reject transfer if user is actually asking a question\n```json\n{\n conditions: [{\n type: 'regex',\n regex: '\\\\?',\n target: { position: -1, role: 'user' }\n }]\n}\n```\n\n// Example 3: Reject transfer if user didn't mention transfer recently\n```json\n{\n conditions: [{\n type: 'liquid',\n liquid: `{% assign recentMessages = messages | last: 5 %}\n{% assign userMessages = recentMessages | where: 'role', 'user' %}\n{% assign mentioned = false %}\n{% for msg in userMessages %}\n {% if msg.content contains 'transfer' or msg.content contains 'connect' or msg.content contains 'speak to' %}\n {% assign mentioned = true %}\n {% break %}\n {% endif %}\n{% endfor %}\n{% if mentioned %}\n false\n{% else %}\n true\n{% endif %}`\n }]\n}\n```\n\n// Example 4: Reject endCall if the bot is looping and trying to exit\n```json\n{\n conditions: [{\n type: 'liquid',\n liquid: `{% assign recentMessages = messages | last: 6 %}\n{% assign userMessages = recentMessages | where: 'role', 'user' | reverse %}\n{% if userMessages.size < 3 %}\n false\n{% else %}\n {% assign msg1 = userMessages[0].content | downcase %}\n {% assign msg2 = userMessages[1].content | downcase %}\n {% assign msg3 = userMessages[2].content | downcase %}\n {% comment %} Check for repetitive messages {% endcomment %}\n {% if msg1 == msg2 or msg1 == msg3 or msg2 == msg3 %}\n true\n {% comment %} Check for common loop phrases {% endcomment %}\n {% elsif msg1 contains 'cool thanks' or msg2 contains 'cool thanks' or msg3 contains 'cool thanks' %}\n true\n {% elsif msg1 contains 'okay thanks' or msg2 contains 'okay thanks' or msg3 contains 'okay thanks' %}\n true\n {% elsif msg1 contains 'got it' or msg2 contains 'got it' or msg3 contains 'got it' %}\n true\n {% else %}\n false\n {% endif %}\n{% endif %}`\n }]\n}\n```",
"allOf": [
{
"$ref": "#/components/schemas/ToolRejectionPlan"
}
]
}
},
"required": [
"type",
"verb",
"id",
"orgId",
"createdAt",
"updatedAt"
]
}