asterisk_ari/apis/endpoints/
params.rs

1use derive_new::new;
2use derive_setters::Setters;
3use serde::Serialize;
4
5#[derive(Clone, Debug, Serialize, new, Setters)]
6#[setters(prefix = "with_")]
7#[setters(into, strip_option)]
8pub struct ReferRequest {
9    /// The endpoint resource or technology specific URI to send the message to. Valid resources are pjsip, and xmpp.
10    #[setters(skip)]
11    #[new(into)]
12    pub(crate) to: String,
13
14    /// The endpoint resource or technology specific identity to send this message from. Valid resources are pjsip, and xmpp.
15    #[setters(skip)]
16    #[new(into)]
17    pub(crate) from: String,
18
19    /// The endpoint resource or technology specific URI to refer to.
20    #[setters(skip)]
21    #[new(into)]
22    pub(crate) refer_to: String,
23
24    /// If true and "refer_to" refers to an Asterisk endpoint, the "refer_to" value is set to point to this Asterisk endpoint - so the referee is referred to Asterisk. Otherwise, use the contact URI associated with the endpoint.
25    #[serde(rename = "to_self", skip_serializing_if = "Option::is_none")]
26    #[new(default)]
27    pub(crate) to_self: Option<bool>,
28
29    /// The "variables" key in the body object holds technology specific key/value pairs to append to the message.
30    ///
31    /// These can be interpreted and used by the various resource types;
32    /// for example, the pjsip resource type will add the key/value pairs as SIP headers.
33    /// The "display_name" key is used by the PJSIP technology.
34    /// Its value will be prepended as a display name to the Refer-To URI.
35    #[serde(skip_serializing)]
36    #[new(default)]
37    pub(crate) variables: Option<serde_json::Value>,
38}
39
40#[derive(Clone, Debug, Serialize, new, Setters)]
41#[setters(prefix = "with_")]
42#[setters(into, strip_option)]
43pub struct SendMessageRequest {
44    /// The endpoint resource or technology specific URI to send the message to. Valid resources are pjsip, and xmpp.
45    #[setters(skip)]
46    #[new(into)]
47    pub(crate) to: String,
48
49    /// The endpoint resource or technology specific identity to send this message from. Valid resources are pjsip, and xmpp.
50    #[setters(skip)]
51    #[new(into)]
52    pub(crate) from: String,
53
54    /// The body of the message.
55    #[serde(rename = "body", skip_serializing_if = "Option::is_none")]
56    #[new(default)]
57    pub(crate) body: Option<String>,
58
59    /// The "variables" key in the body object holds technology specific key/value pairs to append to the message.
60    ///
61    /// These can be interpreted and used by the various resource types;
62    /// for example, the pjsip resource type will add the key/value pairs as SIP headers.
63    /// The "display_name" key is used by the PJSIP technology.
64    /// Its value will be prepended as a display name to the Refer-To URI.
65    #[serde(skip)]
66    #[new(default)]
67    pub(crate) variables: Option<serde_json::Value>,
68}
69
70#[derive(Clone, Debug, Serialize, new, Setters)]
71#[setters(prefix = "with_")]
72#[setters(into, strip_option)]
73pub struct SendMessageToEndpointRequest {
74    /// Technology of the endpoint
75    #[serde(skip_serializing)]
76    #[setters(skip)]
77    #[new(into)]
78    pub(crate) tech: String,
79
80    /// ID of the endpoint
81    #[serde(skip_serializing)]
82    #[setters(skip)]
83    #[new(into)]
84    pub(crate) resource: String,
85
86    /// The endpoint resource or technology specific identity to send this message from. Valid resources are pjsip, and xmpp.
87    #[setters(skip)]
88    #[new(into)]
89    pub(crate) from: String,
90
91    /// The body of the message.
92    #[serde(rename = "body", skip_serializing_if = "Option::is_none")]
93    #[new(default)]
94    pub(crate) body: Option<String>,
95
96    /// The "variables" key in the body object holds technology specific key/value pairs to append to the message.
97    ///
98    /// These can be interpreted and used by the various resource types;
99    /// for example, the pjsip resource type will add the key/value pairs as SIP headers.
100    /// The "display_name" key is used by the PJSIP technology.
101    /// Its value will be prepended as a display name to the Refer-To URI.
102    #[serde(skip)]
103    #[new(default)]
104    pub(crate) variables: Option<serde_json::Value>,
105}
106
107#[derive(Clone, Debug, Serialize, new, Setters)]
108#[setters(prefix = "with_")]
109#[setters(into, strip_option)]
110pub struct ReferToEndpointRequest {
111    /// Technology of the endpoint
112    #[serde(skip_serializing)]
113    #[setters(skip)]
114    #[new(into)]
115    pub(crate) tech: String,
116
117    /// ID of the endpoint
118    #[serde(skip_serializing)]
119    #[setters(skip)]
120    #[new(into)]
121    pub(crate) resource: String,
122
123    /// The endpoint resource or technology specific identity to send this message from.
124    ///
125    /// Valid resources are pjsip, and xmpp.
126    #[setters(skip)]
127    #[new(into)]
128    from: String,
129
130    /// The endpoint resource or technology specific URI to refer to.
131    #[setters(skip)]
132    #[new(into)]
133    refer_to: String,
134
135    /// If true and "refer_to" refers to an Asterisk endpoint,
136    /// the "refer_to" value is set to point to this Asterisk endpoint - so the referee is referred to Asterisk.
137    /// Otherwise, use the contact URI associated with the endpoint.
138    #[serde(skip_serializing_if = "Option::is_none")]
139    #[new(default)]
140    to_self: Option<bool>,
141
142    /// The "variables" key in the body object holds technology specific key/value pairs to append to the message.
143    ///
144    /// These can be interpreted and used by the various resource types;
145    /// for example, the pjsip resource type will add the key/value pairs as SIP headers.
146    /// The "display_name" key is used by the PJSIP technology.
147    /// Its value will be prepended as a display name to the Refer-To URI.
148    #[serde(skip_serializing)]
149    #[new(default)]
150    pub(crate) variables: Option<serde_json::Value>,
151}