asterisk_ari/apis/endpoints/models.rs
1use serde::Deserialize;
2
3/// Endpoint : An external device that may offer/accept calls to/from Asterisk.
4///
5/// Unlike most resources, which have a single unique identifier, an endpoint is uniquely identified by the technology/resource pair.
6#[derive(Clone, Default, Debug, PartialEq, Deserialize)]
7pub struct Endpoint {
8 /// Technology of the endpoint
9 pub technology: String,
10 /// Identifier of the endpoint, specific to the given technology.
11 pub resource: String,
12 /// Endpoint's state
13 pub state: Option<State>,
14 /// Id's of channels associated with this endpoint
15 pub channel_ids: Vec<String>,
16}
17
18/// ['unknown' or 'offline' or 'online']
19#[derive(Clone, Debug, PartialEq, Deserialize, Default)]
20pub enum State {
21 #[serde(rename = "unknown")]
22 #[default]
23 Unknown,
24 #[serde(rename = "offline")]
25 Offline,
26 #[serde(rename = "online")]
27 Online,
28}
29
30/// TextMessage : A text message.
31#[derive(Clone, Default, Debug, PartialEq, Deserialize)]
32pub struct TextMessage {
33 /// A technology specific URI specifying the source of the message. For pjsip technology, any SIP URI can be specified. For xmpp, the URI must correspond to the client connection being used to send the message.
34 pub from: Option<String>,
35 /// A technology specific URI specifying the destination of the message. Valid technologies include pjsip, and xmp. The destination of a message should be an endpoint.
36 pub to: Option<String>,
37 /// The text of the message.
38 pub body: Option<String>,
39 /// Technology specific key/value pairs (JSON object) associated with the message.
40 pub variables: Option<serde_json::Value>,
41}