Call Metrics

View as MarkdownOpen in Claude

Access detailed information about every call through the SDK.

Getting Recent Calls

Fetch a paginated list of calls:

1from smallestai.atoms.call import Call
2
3call = Call()
4
5calls = call.get_calls(limit=5)
6
7for log in calls["data"]["logs"]:
8 print(f"{log['callId']}: {log['status']} ({log['duration']}s)")

The response includes pagination info:

1{
2 "status": true,
3 "data": {
4 "logs": [...],
5 "pagination": {
6 "total": 94,
7 "page": 1,
8 "hasMore": true,
9 "limit": 5
10 }
11 }
12}

Filtering Calls

Narrow results using filter parameters:

1from smallestai.atoms.call import Call
2
3call = Call()
4
5# By status
6completed = call.get_calls(status="completed", limit=10)
7
8# By agent
9agent_calls = call.get_calls(agent_id="696ddd281ea16a73cb8aafbe", limit=10)
10
11# By campaign
12campaign_calls = call.get_calls(campaign_id="696ddd2a04ff172dbd8eddad", limit=10)
13
14# By call type
15outbound = call.get_calls(call_type="telephony_outbound", limit=10)
16
17# By phone number
18found = call.get_calls(search="+916366821717", limit=10)

Filter Parameters

ParameterTypeDescription
agent_idstringFilter by agent ID
campaign_idstringFilter by campaign ID
pageintPage number (default: 1)
limitintResults per page (default: 10)
statusstringcompleted, failed, in_progress, no_answer, busy
call_typestringtelephony_inbound, telephony_outbound, chat
searchstringMatch callId, fromNumber, or toNumber

Getting Single Call Details

Retrieve complete details for one call:

1from smallestai.atoms.call import Call
2
3call = Call()
4
5call_id = "CALL-1768807723178-4561d0"
6details = call.get_call(call_id)
7
8data = details["data"]
9print(f"Status: {data['status']}")
10print(f"Duration: {data['duration']} seconds")
11print(f"From: {data['from']} → To: {data['to']}")

Response Fields

FieldDescription
callIdUnique call identifier
statuscompleted, failed, in_progress, no_answer
durationLength in seconds
typetelephony_outbound, telephony_inbound, chat
from / toPhone numbers
transcriptArray of conversation messages
recordingUrlMono audio file URL
recordingDualUrlStereo audio file URL
callCostCost in credits
disconnectionReasonuser_hangup, agent_hangup, timeout
postCallAnalyticsAI summary and extracted metrics

Accessing Transcripts

The transcript is an array of messages with speaker roles:

1details = call.get_call(call_id)
2transcript = details["data"].get("transcript", [])
3
4for msg in transcript:
5 print(f"{msg['role']}: {msg['content']}")

Accessing Recordings

Recordings are available after the call completes:

1details = call.get_call(call_id)
2data = details["data"]
3
4if data.get("recordingUrl"):
5 print(f"Mono: {data['recordingUrl']}")
6
7if data.get("recordingDualUrl"):
8 print(f"Stereo: {data['recordingDualUrl']}")

Fetch multiple calls at once with search_calls():

1call_ids = ["CALL-1768807723178-4561d0", "CALL-1768807723177-4561cd"]
2result = call.search_calls(call_ids)
3
4print(f"Found {result['data']['total']} of {len(call_ids)} calls")

Maximum 100 call IDs per request.


Performance Metrics

Each call includes latency breakdowns:

1details = call.get_call(call_id)
2data = details["data"]
3
4print(f"Transcriber: {data.get('average_transcriber_latency')}ms")
5print(f"Agent (LLM): {data.get('average_agent_latency')}ms")
6print(f"Synthesizer: {data.get('average_synthesizer_latency')}ms")
MetricDescription
average_transcriber_latencySpeech-to-text processing time
average_agent_latencyLLM response generation time
average_synthesizer_latencyText-to-speech processing time

SDK Reference

MethodDescription
get_calls(...)List calls with optional filters
get_call(call_id)Get single call with all details
search_calls(call_ids)Batch fetch by call IDs

Tips

status is the outcome (completed, failed). disconnectionReason explains why it ended:

  • user_hangup — Caller hung up
  • agent_hangup — Agent ended the call
  • dial_no_answer — No pickup
  • timeout — Call timeout

Recordings generate after the call ends. They may take a few seconds to appear. Check if recordingUrl is non-empty before accessing.

Fetch calls with get_calls(), then calculate:

1calls = call.get_calls(status="completed", limit=100)
2durations = [log["duration"] for log in calls["data"]["logs"]]
3avg = sum(durations) / len(durations)

Use the search parameter:

1calls = call.get_calls(search="+916366821717")

Currently, use pagination and filter client-side by createdAt. Date range filters are coming soon.