Files
go-sip/contracts/schema/mq-call-execute-result.schema.json
T

249 lines
5.5 KiB
JSON

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://go-sip.local/contracts/schema/mq-call-execute-result.schema.json",
"title": "Dispatcher to SaaS: call.execute.result final result; external SaaS compatibility unverified",
"type": "object",
"additionalProperties": false,
"required": [
"event_id",
"event_type",
"dispatcher_id",
"tenant_id",
"issued_at",
"payload"
],
"properties": {
"event_id": {
"$ref": "./common.schema.json#/$defs/event_id"
},
"event_type": {
"const": "call.execute.result"
},
"dispatcher_id": {
"$ref": "./common.schema.json#/$defs/dispatcher_id"
},
"tenant_id": {
"$ref": "./common.schema.json#/$defs/tenant_id"
},
"issued_at": {
"$ref": "./common.schema.json#/$defs/issued_at"
},
"payload": {
"type": "object",
"additionalProperties": false,
"required": [
"task_id",
"callee",
"trunk_id",
"started_at",
"ended_at",
"duration_ms",
"outcome",
"reason_code",
"status_line",
"raw",
"sip_capture_error",
"transcript",
"opt_out",
"recording"
],
"properties": {
"task_id": {
"$ref": "./common.schema.json#/$defs/task_id"
},
"callee": {
"type": "string",
"minLength": 1
},
"trunk_id": {
"type": "string",
"minLength": 1
},
"started_at": {
"$ref": "./common.schema.json#/$defs/issued_at"
},
"ended_at": {
"$ref": "./common.schema.json#/$defs/issued_at"
},
"duration_ms": {
"type": "integer",
"minimum": 0
},
"outcome": {
"enum": [
"answered",
"no_answer",
"failed"
]
},
"reason_code": {
"type": [
"integer",
"null"
],
"minimum": 100,
"maximum": 699
},
"reason_message": {
"type": "string",
"minLength": 1
},
"status_line": {
"type": [
"string",
"null"
],
"pattern": "^SIP/2\\.0 [1-6][0-9]{2} .+",
"maxLength": 256
},
"raw": {
"type": [
"string",
"null"
],
"minLength": 12,
"maxLength": 65535
},
"sip_capture_error": {
"type": [
"string",
"null"
],
"minLength": 1,
"maxLength": 256
},
"transcript": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"required": [
"turn_id",
"segment_id",
"role",
"text",
"start_ms",
"end_ms"
],
"properties": {
"turn_id": {
"type": "string",
"minLength": 1
},
"segment_id": {
"type": "string",
"minLength": 1
},
"role": {
"enum": [
"user",
"assistant"
]
},
"text": {
"type": "string"
},
"start_ms": {
"type": "integer",
"minimum": 0
},
"end_ms": {
"type": "integer",
"minimum": 0
}
}
}
},
"opt_out": {
"type": "boolean"
},
"recording": {
"oneOf": [
{
"type": "object",
"additionalProperties": false,
"maxProperties": 0
},
{
"$ref": "#/$defs/recording_uploaded"
}
]
}
},
"allOf": [
{
"if": {
"properties": {
"reason_code": {
"type": "null"
}
},
"required": [
"reason_code"
]
},
"then": {
"required": [
"reason_message"
]
}
}
]
}
},
"$defs": {
"recording_uploaded": {
"type": "object",
"additionalProperties": false,
"required": [
"status",
"bucket",
"object_key",
"format",
"channels",
"sample_rate_hz",
"duration_ms",
"size_bytes",
"checksum_sha256"
],
"properties": {
"status": {
"const": "uploaded"
},
"bucket": {
"type": "string",
"minLength": 1
},
"object_key": {
"type": "string",
"minLength": 1
},
"format": {
"type": "string",
"minLength": 1
},
"channels": {
"type": "integer",
"minimum": 1
},
"sample_rate_hz": {
"type": "integer",
"minimum": 1
},
"duration_ms": {
"type": "integer",
"minimum": 0
},
"size_bytes": {
"type": "integer",
"minimum": 0
},
"checksum_sha256": {
"type": "string",
"pattern": "^[0-9a-f]{64}$"
}
}
}
}
}