/*
* Zernio API
*
* API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api Versioning and deprecation: all endpoints are versioned in the URL path (current version: /v1). Breaking changes only ship in a new path version; existing versions keep working. Deprecated operations are marked 'deprecated: true' in this spec and announced in the changelog (https://zernio.com/changelog) before removal. Errors: every 4xx/5xx response is application/json with a machine-readable 'code' and a human-readable 'error' message (see the ErrorResponse schema).
*
* The version of the OpenAPI document: 1.71.0
* Contact: support@zernio.com
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct WebhookPayloadCallEndedCall {
#[serde(rename = "id", skip_serializing_if = "Option::is_none")]
pub id: Option<String>,
#[serde(
rename = "metaCallId",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub meta_call_id: Option<Option<String>>,
#[serde(rename = "accountId", skip_serializing_if = "Option::is_none")]
pub account_id: Option<String>,
#[serde(rename = "phoneNumberId", skip_serializing_if = "Option::is_none")]
pub phone_number_id: Option<String>,
#[serde(rename = "direction", skip_serializing_if = "Option::is_none")]
pub direction: Option<Direction>,
#[serde(rename = "from", skip_serializing_if = "Option::is_none")]
pub from: Option<String>,
#[serde(rename = "to", skip_serializing_if = "Option::is_none")]
pub to: Option<String>,
#[serde(rename = "startedAt", skip_serializing_if = "Option::is_none")]
pub started_at: Option<String>,
#[serde(rename = "endedAt", skip_serializing_if = "Option::is_none")]
pub ended_at: Option<String>,
#[serde(rename = "durationSeconds", skip_serializing_if = "Option::is_none")]
pub duration_seconds: Option<i32>,
#[serde(rename = "endReason", skip_serializing_if = "Option::is_none")]
pub end_reason: Option<EndReason>,
/// Raw carrier hangup cause behind endReason (e.g. normal_clearing, call_rejected, not_found). Null when the carrier reported none.
#[serde(
rename = "hangupCause",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub hangup_cause: Option<Option<String>>,
/// SIP response code that ended the call when SIP-signalled (e.g. '403', '486', '603'). endReason collapses all three to 'rejected', so this is what separates a refused destination from a busy line. Null on non-SIP legs.
#[serde(
rename = "sipHangupCause",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub sip_hangup_cause: Option<Option<String>>,
/// True when the inbound call was handled by voicemail, whether scheduled or because the forward did not connect.
#[serde(rename = "isVoicemail", skip_serializing_if = "Option::is_none")]
pub is_voicemail: Option<bool>,
/// Failures recorded on the call up to hangup (bridge failed, dial failed, recording error). Empty on a clean call. `message` is free-form diagnostic text and is not stable, do not parse it. `code` is 0 unless a provider code is known. Errors the carrier reports after hangup appear only on GET /v1/calls/{id}.
#[serde(rename = "callErrors", skip_serializing_if = "Option::is_none")]
pub call_errors: Option<Vec<models::CallRecordCallErrorsInner>>,
#[serde(rename = "recordingUrl", skip_serializing_if = "Option::is_none")]
pub recording_url: Option<String>,
#[serde(rename = "recordingExpiresAt", skip_serializing_if = "Option::is_none")]
pub recording_expires_at: Option<String>,
#[serde(rename = "billing", skip_serializing_if = "Option::is_none")]
pub billing: Option<Box<models::WebhookPayloadCallEndedCallBilling>>,
}
impl WebhookPayloadCallEndedCall {
pub fn new() -> WebhookPayloadCallEndedCall {
WebhookPayloadCallEndedCall {
id: None,
meta_call_id: None,
account_id: None,
phone_number_id: None,
direction: None,
from: None,
to: None,
started_at: None,
ended_at: None,
duration_seconds: None,
end_reason: None,
hangup_cause: None,
sip_hangup_cause: None,
is_voicemail: None,
call_errors: None,
recording_url: None,
recording_expires_at: None,
billing: None,
}
}
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Direction {
#[serde(rename = "inbound")]
Inbound,
#[serde(rename = "outbound")]
Outbound,
}
impl Default for Direction {
fn default() -> Direction {
Self::Inbound
}
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum EndReason {
#[serde(rename = "hangup")]
Hangup,
#[serde(rename = "no_answer")]
NoAnswer,
#[serde(rename = "rejected")]
Rejected,
#[serde(rename = "error")]
Error,
}
impl Default for EndReason {
fn default() -> EndReason {
Self::Hangup
}
}