Table of Contents

API : PBX : Call test result

Introduction

Returns the result of a session's call. Used to poll after Finish answered PENDING. Unlike Finish, this endpoint reads once and answers immediately - the client is the one polling, so making the poll endpoint wait as well would multiply the cost of the very behaviour it asks for.

Readable until the session record expires, 30 minutes after it was created, which outlives the phone on purpose.

Request

URL https://api.telecomx.dk/pbx/calltest/session/SESSION_ID/result
Method GET
Access level None - unauthenticated
Param SESSION_ID String The sessionId returned by Session: exactly 32 hex characters.

Response

Json object
status String READY, PENDING or NO_CALL. See below.
sessionId String The public session token this result belongs to. Never the phone's id.
call Object Timings and outcome. Absent only on NO_CALL.
audio Object RTP counters. Present on READY only, and then only when there are counters to report.
quality Object The analyser's verdict. Present exactly when audio is.
retryAfterMs Number How long to wait before asking again. Only ever set on PENDING.

status

Value Meaning
READY Final answer. Nothing further is coming. It does not mean the call went well - read call.answered.
PENDING The CDR is there and its RTP counters may still arrive. Poll again.
NO_CALL No call was ever placed with these credentials.

READY arrives with no audio and no quality whenever there are no counters to report - a call that was never answered, or one whose counters never landed within a minute of it ending. Check for audio before reading it, and read call.answered to tell those two cases apart.

call

Field Type Description
startedAt String ISO timestamp of when the call started.
answeredAt String ISO timestamp of when the call was answered, null when it never was.
endedAt String ISO timestamp of when the call ended.
durationMs Number Milliseconds between answer and hangup. 0 for a call that was never answered.
answered Boolean True when the call was answered at all. The playback item answers, so false here is a fault.
terminatedBy String Who ended the call: A (the browser), B (the callee) or S (the system).
terminatedReason String Why the call ended: HANGUP, CANCEL, BUSY, UNREACHABLE, ERROR, BLOCKED, NOT_FOUND.

audio

Field Type Description
inbound Object Browser → PBX. Always measured by Asterisk itself, so always meaningful.
outbound Object PBX → browser. Its lost, jitterMs and mes are only real when remoteReported is true.
mediaMs Number Milliseconds of media the counters cover. Null when the leg's answer time was not known.
rttMs Number Round-trip time in milliseconds. Null when the far end reported no usable RTCP.
remoteReported Boolean False means the browser sent no RTCP at all, so the outbound loss, jitter and MES are unknown - NOT zero.
bothDirections Boolean Both directions carried packets. The plain answer to “was this one-way audio?”.

Each direction carries:

Field Type Description
packets Number RTP audio packets counted in this direction.
packetsPerSecond Number Packets per second over the measured media time. About 50 is healthy at 20 ms packetisation. Null when no media time was recorded.
lost Number Packets lost in this direction. Null when unknown.
jitterMs Number Jitter in milliseconds. Null when unknown.
mes Number Media Experience Score, 0-100, higher is better. Null when unknown.

quality

Produced by the same analyser as the call quality API, asked to measure a system-answered call and to accept a media floor of 5 seconds instead of the usual 10.

Field Type Description
verdict String Worst verdict across the call. Never render an unmeasured call as if it were OK.
measured Boolean True when anything at all could be judged.
severity Number Numeric rank of verdict, for sorting only.
reason String Why nothing could be judged, when measured is false.
findings Array Findings, worst first, each with code, verdict, direction and values.

Errors

Error code Message Description
404 session No such session, or it has expired.
422 validation The session id is not 32 hex characters.
500 internal_error <Unspecified>