Asterisk - The Open Source Telephony Project GIT-master-f36a736
Macros | Functions | Variables
res_ari_recordings.c File Reference

Recording resources. More...

#include "asterisk.h"
#include "asterisk/app.h"
#include "asterisk/module.h"
#include "asterisk/stasis_app.h"
#include "ari/resource_recordings.h"
Include dependency graph for res_ari_recordings.c:

Go to the source code of this file.

Macros

#define MAX_VALS   128
 

Functions

static void __reg_module (void)
 
static void __unreg_module (void)
 
static void ast_ari_recordings_cancel_cb (struct ast_tcptls_session_instance *ser, struct ast_variable *get_params, struct ast_variable *path_vars, struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
 Parameter parsing callback for /recordings/live/{recordingName}. More...
 
static void ast_ari_recordings_copy_stored_cb (struct ast_tcptls_session_instance *ser, struct ast_variable *get_params, struct ast_variable *path_vars, struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
 Parameter parsing callback for /recordings/stored/{recordingName}/copy. More...
 
int ast_ari_recordings_copy_stored_parse_body (struct ast_json *body, struct ast_ari_recordings_copy_stored_args *args)
 Body parsing function for /recordings/stored/{recordingName}/copy. More...
 
static void ast_ari_recordings_delete_stored_cb (struct ast_tcptls_session_instance *ser, struct ast_variable *get_params, struct ast_variable *path_vars, struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
 Parameter parsing callback for /recordings/stored/{recordingName}. More...
 
static void ast_ari_recordings_get_live_cb (struct ast_tcptls_session_instance *ser, struct ast_variable *get_params, struct ast_variable *path_vars, struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
 Parameter parsing callback for /recordings/live/{recordingName}. More...
 
static void ast_ari_recordings_get_stored_cb (struct ast_tcptls_session_instance *ser, struct ast_variable *get_params, struct ast_variable *path_vars, struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
 Parameter parsing callback for /recordings/stored/{recordingName}. More...
 
static void ast_ari_recordings_get_stored_file_cb (struct ast_tcptls_session_instance *ser, struct ast_variable *get_params, struct ast_variable *path_vars, struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
 Parameter parsing callback for /recordings/stored/{recordingName}/file. More...
 
static void ast_ari_recordings_list_stored_cb (struct ast_tcptls_session_instance *ser, struct ast_variable *get_params, struct ast_variable *path_vars, struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
 Parameter parsing callback for /recordings/stored. More...
 
static void ast_ari_recordings_mute_cb (struct ast_tcptls_session_instance *ser, struct ast_variable *get_params, struct ast_variable *path_vars, struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
 Parameter parsing callback for /recordings/live/{recordingName}/mute. More...
 
static void ast_ari_recordings_pause_cb (struct ast_tcptls_session_instance *ser, struct ast_variable *get_params, struct ast_variable *path_vars, struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
 Parameter parsing callback for /recordings/live/{recordingName}/pause. More...
 
static void ast_ari_recordings_stop_cb (struct ast_tcptls_session_instance *ser, struct ast_variable *get_params, struct ast_variable *path_vars, struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
 Parameter parsing callback for /recordings/live/{recordingName}/stop. More...
 
static void ast_ari_recordings_unmute_cb (struct ast_tcptls_session_instance *ser, struct ast_variable *get_params, struct ast_variable *path_vars, struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
 Parameter parsing callback for /recordings/live/{recordingName}/mute. More...
 
static void ast_ari_recordings_unpause_cb (struct ast_tcptls_session_instance *ser, struct ast_variable *get_params, struct ast_variable *path_vars, struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
 Parameter parsing callback for /recordings/live/{recordingName}/pause. More...
 
struct ast_moduleAST_MODULE_SELF_SYM (void)
 
static int load_module (void)
 
static int unload_module (void)
 

Variables

static struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT , .description = "RESTful API module - Recording resources" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = AST_BUILDOPT_SUM, .support_level = AST_MODULE_SUPPORT_CORE, .load = load_module, .unload = unload_module, .requires = "res_ari,res_ari_model,res_stasis,res_stasis_recording", }
 
static const struct ast_module_infoast_module_info = &__mod_info
 
static struct stasis_rest_handlers recordings
 REST handler for /api-docs/recordings.json. More...
 
static struct stasis_rest_handlers recordings_live
 REST handler for /api-docs/recordings.json. More...
 
static struct stasis_rest_handlers recordings_live_recordingName
 REST handler for /api-docs/recordings.json. More...
 
static struct stasis_rest_handlers recordings_live_recordingName_mute
 REST handler for /api-docs/recordings.json. More...
 
static struct stasis_rest_handlers recordings_live_recordingName_pause
 REST handler for /api-docs/recordings.json. More...
 
static struct stasis_rest_handlers recordings_live_recordingName_stop
 REST handler for /api-docs/recordings.json. More...
 
static struct stasis_rest_handlers recordings_stored
 REST handler for /api-docs/recordings.json. More...
 
static struct stasis_rest_handlers recordings_stored_recordingName
 REST handler for /api-docs/recordings.json. More...
 
static struct stasis_rest_handlers recordings_stored_recordingName_copy
 REST handler for /api-docs/recordings.json. More...
 
static struct stasis_rest_handlers recordings_stored_recordingName_file
 REST handler for /api-docs/recordings.json. More...
 

Detailed Description

Recording resources.

Author
David M. Lee, II dlee@.nosp@m.digi.nosp@m.um.co.nosp@m.m

Definition in file res_ari_recordings.c.

Macro Definition Documentation

◆ MAX_VALS

#define MAX_VALS   128

Definition at line 52 of file res_ari_recordings.c.

Function Documentation

◆ __reg_module()

static void __reg_module ( void  )
static

Definition at line 916 of file res_ari_recordings.c.

◆ __unreg_module()

static void __unreg_module ( void  )
static

Definition at line 916 of file res_ari_recordings.c.

◆ ast_ari_recordings_cancel_cb()

static void ast_ari_recordings_cancel_cb ( struct ast_tcptls_session_instance ser,
struct ast_variable get_params,
struct ast_variable path_vars,
struct ast_variable headers,
struct ast_json body,
struct ast_ari_response response 
)
static

Parameter parsing callback for /recordings/live/{recordingName}.

Parameters
serTCP/TLS session object
get_paramsGET parameters in the HTTP request.
path_varsPath variables extracted from the request.
headersHTTP headers.
body
[out]responseResponse to the HTTP request.

Definition at line 440 of file res_ari_recordings.c.

444{
446 struct ast_variable *i;
447#if defined(AST_DEVMODE)
448 int is_valid;
449 int code;
450#endif /* AST_DEVMODE */
451
452 for (i = path_vars; i; i = i->next) {
453 if (strcmp(i->name, "recordingName") == 0) {
454 args.recording_name = (i->value);
455 } else
456 {}
457 }
458 ast_ari_recordings_cancel(headers, &args, response);
459#if defined(AST_DEVMODE)
460 code = response->response_code;
461
462 switch (code) {
463 case 0: /* Implementation is still a stub, or the code wasn't set */
464 is_valid = response->message == NULL;
465 break;
466 case 500: /* Internal Server Error */
467 case 501: /* Not Implemented */
468 case 404: /* Recording not found */
469 is_valid = 1;
470 break;
471 default:
472 if (200 <= code && code <= 299) {
473 is_valid = ast_ari_validate_void(
474 response->message);
475 } else {
476 ast_log(LOG_ERROR, "Invalid error response %d for /recordings/live/{recordingName}\n", code);
477 is_valid = 0;
478 }
479 }
480
481 if (!is_valid) {
482 ast_log(LOG_ERROR, "Response validation failed for /recordings/live/{recordingName}\n");
483 ast_ari_response_error(response, 500,
484 "Internal Server Error", "Response validation failed");
485 }
486#endif /* AST_DEVMODE */
487
488fin: __attribute__((unused))
489 return;
490}
void ast_ari_response_error(struct ast_ari_response *response, int response_code, const char *response_text, const char *message_fmt,...)
Fill in an error ast_ari_response.
Definition: res_ari.c:259
int ast_ari_validate_void(struct ast_json *json)
Validator for native Swagger void.
Definition: res_ari_model.c:91
#define ast_log
Definition: astobj2.c:42
#define LOG_ERROR
#define NULL
Definition: resample.c:96
void ast_ari_recordings_cancel(struct ast_variable *headers, struct ast_ari_recordings_cancel_args *args, struct ast_ari_response *response)
Stop a live recording and discard it.
struct ast_json * message
Definition: ari.h:94
int response_code
Definition: ari.h:99
Structure for variables, used for configurations and for channel variables.
struct ast_variable * next
const char * args

References args, ast_ari_recordings_cancel(), ast_ari_response_error(), ast_ari_validate_void(), ast_log, LOG_ERROR, ast_ari_response::message, ast_variable::name, ast_variable::next, NULL, ast_ari_response::response_code, and ast_variable::value.

◆ ast_ari_recordings_copy_stored_cb()

static void ast_ari_recordings_copy_stored_cb ( struct ast_tcptls_session_instance ser,
struct ast_variable get_params,
struct ast_variable path_vars,
struct ast_variable headers,
struct ast_json body,
struct ast_ari_response response 
)
static

Parameter parsing callback for /recordings/stored/{recordingName}/copy.

Parameters
serTCP/TLS session object
get_paramsGET parameters in the HTTP request.
path_varsPath variables extracted from the request.
headersHTTP headers.
body
[out]responseResponse to the HTTP request.

Definition at line 309 of file res_ari_recordings.c.

313{
315 struct ast_variable *i;
316#if defined(AST_DEVMODE)
317 int is_valid;
318 int code;
319#endif /* AST_DEVMODE */
320
321 for (i = get_params; i; i = i->next) {
322 if (strcmp(i->name, "destinationRecordingName") == 0) {
323 args.destination_recording_name = (i->value);
324 } else
325 {}
326 }
327 for (i = path_vars; i; i = i->next) {
328 if (strcmp(i->name, "recordingName") == 0) {
329 args.recording_name = (i->value);
330 } else
331 {}
332 }
335 goto fin;
336 }
337 ast_ari_recordings_copy_stored(headers, &args, response);
338#if defined(AST_DEVMODE)
339 code = response->response_code;
340
341 switch (code) {
342 case 0: /* Implementation is still a stub, or the code wasn't set */
343 is_valid = response->message == NULL;
344 break;
345 case 500: /* Internal Server Error */
346 case 501: /* Not Implemented */
347 case 404: /* Recording not found */
348 case 409: /* A recording with the same name already exists on the system */
349 is_valid = 1;
350 break;
351 default:
352 if (200 <= code && code <= 299) {
354 response->message);
355 } else {
356 ast_log(LOG_ERROR, "Invalid error response %d for /recordings/stored/{recordingName}/copy\n", code);
357 is_valid = 0;
358 }
359 }
360
361 if (!is_valid) {
362 ast_log(LOG_ERROR, "Response validation failed for /recordings/stored/{recordingName}/copy\n");
363 ast_ari_response_error(response, 500,
364 "Internal Server Error", "Response validation failed");
365 }
366#endif /* AST_DEVMODE */
367
368fin: __attribute__((unused))
369 return;
370}
void ast_ari_response_alloc_failed(struct ast_ari_response *response)
Fill in response with a 500 message for allocation failures.
Definition: res_ari.c:298
int ast_ari_validate_stored_recording(struct ast_json *json)
Validator for StoredRecording.
int ast_ari_recordings_copy_stored_parse_body(struct ast_json *body, struct ast_ari_recordings_copy_stored_args *args)
Body parsing function for /recordings/stored/{recordingName}/copy.
void ast_ari_recordings_copy_stored(struct ast_variable *headers, struct ast_ari_recordings_copy_stored_args *args, struct ast_ari_response *response)
Copy a stored recording.

References args, ast_ari_recordings_copy_stored(), ast_ari_recordings_copy_stored_parse_body(), ast_ari_response_alloc_failed(), ast_ari_response_error(), ast_ari_validate_stored_recording(), ast_log, LOG_ERROR, ast_ari_response::message, ast_variable::name, ast_variable::next, NULL, ast_ari_response::response_code, and ast_variable::value.

◆ ast_ari_recordings_copy_stored_parse_body()

int ast_ari_recordings_copy_stored_parse_body ( struct ast_json body,
struct ast_ari_recordings_copy_stored_args args 
)

Body parsing function for /recordings/stored/{recordingName}/copy.

Parameters
bodyThe JSON body from which to parse parameters.
[out]argsThe args structure to parse into.
Return values
zeroon success
non-zeroon failure

Definition at line 287 of file res_ari_recordings.c.

290{
291 struct ast_json *field;
292 /* Parse query parameters out of it */
293 field = ast_json_object_get(body, "destinationRecordingName");
294 if (field) {
295 args->destination_recording_name = ast_json_string_get(field);
296 }
297 return 0;
298}
const char * ast_json_string_get(const struct ast_json *string)
Get the value of a JSON string.
Definition: json.c:283
struct ast_json * ast_json_object_get(struct ast_json *object, const char *key)
Get a field from a JSON object.
Definition: json.c:407
Abstract JSON element (object, array, string, int, ...).

References args, ast_json_object_get(), and ast_json_string_get().

Referenced by ast_ari_recordings_copy_stored_cb().

◆ ast_ari_recordings_delete_stored_cb()

static void ast_ari_recordings_delete_stored_cb ( struct ast_tcptls_session_instance ser,
struct ast_variable get_params,
struct ast_variable path_vars,
struct ast_variable headers,
struct ast_json body,
struct ast_ari_response response 
)
static

Parameter parsing callback for /recordings/stored/{recordingName}.

Parameters
serTCP/TLS session object
get_paramsGET parameters in the HTTP request.
path_varsPath variables extracted from the request.
headersHTTP headers.
body
[out]responseResponse to the HTTP request.

Definition at line 175 of file res_ari_recordings.c.

179{
181 struct ast_variable *i;
182#if defined(AST_DEVMODE)
183 int is_valid;
184 int code;
185#endif /* AST_DEVMODE */
186
187 for (i = path_vars; i; i = i->next) {
188 if (strcmp(i->name, "recordingName") == 0) {
189 args.recording_name = (i->value);
190 } else
191 {}
192 }
193 ast_ari_recordings_delete_stored(headers, &args, response);
194#if defined(AST_DEVMODE)
195 code = response->response_code;
196
197 switch (code) {
198 case 0: /* Implementation is still a stub, or the code wasn't set */
199 is_valid = response->message == NULL;
200 break;
201 case 500: /* Internal Server Error */
202 case 501: /* Not Implemented */
203 case 404: /* Recording not found */
204 is_valid = 1;
205 break;
206 default:
207 if (200 <= code && code <= 299) {
208 is_valid = ast_ari_validate_void(
209 response->message);
210 } else {
211 ast_log(LOG_ERROR, "Invalid error response %d for /recordings/stored/{recordingName}\n", code);
212 is_valid = 0;
213 }
214 }
215
216 if (!is_valid) {
217 ast_log(LOG_ERROR, "Response validation failed for /recordings/stored/{recordingName}\n");
218 ast_ari_response_error(response, 500,
219 "Internal Server Error", "Response validation failed");
220 }
221#endif /* AST_DEVMODE */
222
223fin: __attribute__((unused))
224 return;
225}
void ast_ari_recordings_delete_stored(struct ast_variable *headers, struct ast_ari_recordings_delete_stored_args *args, struct ast_ari_response *response)
Delete a stored recording.

References args, ast_ari_recordings_delete_stored(), ast_ari_response_error(), ast_ari_validate_void(), ast_log, LOG_ERROR, ast_ari_response::message, ast_variable::name, ast_variable::next, NULL, ast_ari_response::response_code, and ast_variable::value.

◆ ast_ari_recordings_get_live_cb()

static void ast_ari_recordings_get_live_cb ( struct ast_tcptls_session_instance ser,
struct ast_variable get_params,
struct ast_variable path_vars,
struct ast_variable headers,
struct ast_json body,
struct ast_ari_response response 
)
static

Parameter parsing callback for /recordings/live/{recordingName}.

Parameters
serTCP/TLS session object
get_paramsGET parameters in the HTTP request.
path_varsPath variables extracted from the request.
headersHTTP headers.
body
[out]responseResponse to the HTTP request.

Definition at line 380 of file res_ari_recordings.c.

384{
386 struct ast_variable *i;
387#if defined(AST_DEVMODE)
388 int is_valid;
389 int code;
390#endif /* AST_DEVMODE */
391
392 for (i = path_vars; i; i = i->next) {
393 if (strcmp(i->name, "recordingName") == 0) {
394 args.recording_name = (i->value);
395 } else
396 {}
397 }
398 ast_ari_recordings_get_live(headers, &args, response);
399#if defined(AST_DEVMODE)
400 code = response->response_code;
401
402 switch (code) {
403 case 0: /* Implementation is still a stub, or the code wasn't set */
404 is_valid = response->message == NULL;
405 break;
406 case 500: /* Internal Server Error */
407 case 501: /* Not Implemented */
408 case 404: /* Recording not found */
409 is_valid = 1;
410 break;
411 default:
412 if (200 <= code && code <= 299) {
414 response->message);
415 } else {
416 ast_log(LOG_ERROR, "Invalid error response %d for /recordings/live/{recordingName}\n", code);
417 is_valid = 0;
418 }
419 }
420
421 if (!is_valid) {
422 ast_log(LOG_ERROR, "Response validation failed for /recordings/live/{recordingName}\n");
423 ast_ari_response_error(response, 500,
424 "Internal Server Error", "Response validation failed");
425 }
426#endif /* AST_DEVMODE */
427
428fin: __attribute__((unused))
429 return;
430}
int ast_ari_validate_live_recording(struct ast_json *json)
Validator for LiveRecording.
void ast_ari_recordings_get_live(struct ast_variable *headers, struct ast_ari_recordings_get_live_args *args, struct ast_ari_response *response)
List live recordings.

References args, ast_ari_recordings_get_live(), ast_ari_response_error(), ast_ari_validate_live_recording(), ast_log, LOG_ERROR, ast_ari_response::message, ast_variable::name, ast_variable::next, NULL, ast_ari_response::response_code, and ast_variable::value.

◆ ast_ari_recordings_get_stored_cb()

static void ast_ari_recordings_get_stored_cb ( struct ast_tcptls_session_instance ser,
struct ast_variable get_params,
struct ast_variable path_vars,
struct ast_variable headers,
struct ast_json body,
struct ast_ari_response response 
)
static

Parameter parsing callback for /recordings/stored/{recordingName}.

Parameters
serTCP/TLS session object
get_paramsGET parameters in the HTTP request.
path_varsPath variables extracted from the request.
headersHTTP headers.
body
[out]responseResponse to the HTTP request.

Definition at line 115 of file res_ari_recordings.c.

119{
121 struct ast_variable *i;
122#if defined(AST_DEVMODE)
123 int is_valid;
124 int code;
125#endif /* AST_DEVMODE */
126
127 for (i = path_vars; i; i = i->next) {
128 if (strcmp(i->name, "recordingName") == 0) {
129 args.recording_name = (i->value);
130 } else
131 {}
132 }
133 ast_ari_recordings_get_stored(headers, &args, response);
134#if defined(AST_DEVMODE)
135 code = response->response_code;
136
137 switch (code) {
138 case 0: /* Implementation is still a stub, or the code wasn't set */
139 is_valid = response->message == NULL;
140 break;
141 case 500: /* Internal Server Error */
142 case 501: /* Not Implemented */
143 case 404: /* Recording not found */
144 is_valid = 1;
145 break;
146 default:
147 if (200 <= code && code <= 299) {
149 response->message);
150 } else {
151 ast_log(LOG_ERROR, "Invalid error response %d for /recordings/stored/{recordingName}\n", code);
152 is_valid = 0;
153 }
154 }
155
156 if (!is_valid) {
157 ast_log(LOG_ERROR, "Response validation failed for /recordings/stored/{recordingName}\n");
158 ast_ari_response_error(response, 500,
159 "Internal Server Error", "Response validation failed");
160 }
161#endif /* AST_DEVMODE */
162
163fin: __attribute__((unused))
164 return;
165}
void ast_ari_recordings_get_stored(struct ast_variable *headers, struct ast_ari_recordings_get_stored_args *args, struct ast_ari_response *response)
Get a stored recording's details.

References args, ast_ari_recordings_get_stored(), ast_ari_response_error(), ast_ari_validate_stored_recording(), ast_log, LOG_ERROR, ast_ari_response::message, ast_variable::name, ast_variable::next, NULL, ast_ari_response::response_code, and ast_variable::value.

◆ ast_ari_recordings_get_stored_file_cb()

static void ast_ari_recordings_get_stored_file_cb ( struct ast_tcptls_session_instance ser,
struct ast_variable get_params,
struct ast_variable path_vars,
struct ast_variable headers,
struct ast_json body,
struct ast_ari_response response 
)
static

Parameter parsing callback for /recordings/stored/{recordingName}/file.

Parameters
serTCP/TLS session object
get_paramsGET parameters in the HTTP request.
path_varsPath variables extracted from the request.
headersHTTP headers.
body
[out]responseResponse to the HTTP request.

Definition at line 235 of file res_ari_recordings.c.

239{
241 struct ast_variable *i;
242#if defined(AST_DEVMODE)
243 int is_valid;
244 int code;
245#endif /* AST_DEVMODE */
246
247 for (i = path_vars; i; i = i->next) {
248 if (strcmp(i->name, "recordingName") == 0) {
249 args.recording_name = (i->value);
250 } else
251 {}
252 }
253 ast_ari_recordings_get_stored_file(ser, headers, &args, response);
254#if defined(AST_DEVMODE)
255 code = response->response_code;
256
257 switch (code) {
258 case 0: /* Implementation is still a stub, or the code wasn't set */
259 is_valid = response->message == NULL;
260 break;
261 case 500: /* Internal Server Error */
262 case 501: /* Not Implemented */
263 case 403: /* The recording file could not be opened */
264 case 404: /* Recording not found */
265 is_valid = 1;
266 break;
267 default:
268 if (200 <= code && code <= 299) {
269 /* No validation on a raw binary response */
270 is_valid = 1;
271 } else {
272 ast_log(LOG_ERROR, "Invalid error response %d for /recordings/stored/{recordingName}/file\n", code);
273 is_valid = 0;
274 }
275 }
276
277 if (!is_valid) {
278 ast_log(LOG_ERROR, "Response validation failed for /recordings/stored/{recordingName}/file\n");
279 ast_ari_response_error(response, 500,
280 "Internal Server Error", "Response validation failed");
281 }
282#endif /* AST_DEVMODE */
283
284fin: __attribute__((unused))
285 return;
286}
void ast_ari_recordings_get_stored_file(struct ast_tcptls_session_instance *ser, struct ast_variable *headers, struct ast_ari_recordings_get_stored_file_args *args, struct ast_ari_response *response)
Get the file associated with the stored recording.

References args, ast_ari_recordings_get_stored_file(), ast_ari_response_error(), ast_log, LOG_ERROR, ast_ari_response::message, ast_variable::name, ast_variable::next, NULL, ast_ari_response::response_code, and ast_variable::value.

◆ ast_ari_recordings_list_stored_cb()

static void ast_ari_recordings_list_stored_cb ( struct ast_tcptls_session_instance ser,
struct ast_variable get_params,
struct ast_variable path_vars,
struct ast_variable headers,
struct ast_json body,
struct ast_ari_response response 
)
static

Parameter parsing callback for /recordings/stored.

Parameters
serTCP/TLS session object
get_paramsGET parameters in the HTTP request.
path_varsPath variables extracted from the request.
headersHTTP headers.
body
[out]responseResponse to the HTTP request.

Definition at line 63 of file res_ari_recordings.c.

67{
69#if defined(AST_DEVMODE)
70 int is_valid;
71 int code;
72#endif /* AST_DEVMODE */
73
74 ast_ari_recordings_list_stored(headers, &args, response);
75#if defined(AST_DEVMODE)
76 code = response->response_code;
77
78 switch (code) {
79 case 0: /* Implementation is still a stub, or the code wasn't set */
80 is_valid = response->message == NULL;
81 break;
82 case 500: /* Internal Server Error */
83 case 501: /* Not Implemented */
84 is_valid = 1;
85 break;
86 default:
87 if (200 <= code && code <= 299) {
88 is_valid = ast_ari_validate_list(response->message,
90 } else {
91 ast_log(LOG_ERROR, "Invalid error response %d for /recordings/stored\n", code);
92 is_valid = 0;
93 }
94 }
95
96 if (!is_valid) {
97 ast_log(LOG_ERROR, "Response validation failed for /recordings/stored\n");
98 ast_ari_response_error(response, 500,
99 "Internal Server Error", "Response validation failed");
100 }
101#endif /* AST_DEVMODE */
102
103fin: __attribute__((unused))
104 return;
105}
ari_validator ast_ari_validate_stored_recording_fn(void)
Function pointer to ast_ari_validate_stored_recording().
int ast_ari_validate_list(struct ast_json *json, int(*fn)(struct ast_json *))
Validator for a Swagger List[]/JSON array.
void ast_ari_recordings_list_stored(struct ast_variable *headers, struct ast_ari_recordings_list_stored_args *args, struct ast_ari_response *response)
List recordings that are complete.

References args, ast_ari_recordings_list_stored(), ast_ari_response_error(), ast_ari_validate_list(), ast_ari_validate_stored_recording_fn(), ast_log, LOG_ERROR, ast_ari_response::message, NULL, and ast_ari_response::response_code.

◆ ast_ari_recordings_mute_cb()

static void ast_ari_recordings_mute_cb ( struct ast_tcptls_session_instance ser,
struct ast_variable get_params,
struct ast_variable path_vars,
struct ast_variable headers,
struct ast_json body,
struct ast_ari_response response 
)
static

Parameter parsing callback for /recordings/live/{recordingName}/mute.

Parameters
serTCP/TLS session object
get_paramsGET parameters in the HTTP request.
path_varsPath variables extracted from the request.
headersHTTP headers.
body
[out]responseResponse to the HTTP request.

Definition at line 682 of file res_ari_recordings.c.

686{
688 struct ast_variable *i;
689#if defined(AST_DEVMODE)
690 int is_valid;
691 int code;
692#endif /* AST_DEVMODE */
693
694 for (i = path_vars; i; i = i->next) {
695 if (strcmp(i->name, "recordingName") == 0) {
696 args.recording_name = (i->value);
697 } else
698 {}
699 }
700 ast_ari_recordings_mute(headers, &args, response);
701#if defined(AST_DEVMODE)
702 code = response->response_code;
703
704 switch (code) {
705 case 0: /* Implementation is still a stub, or the code wasn't set */
706 is_valid = response->message == NULL;
707 break;
708 case 500: /* Internal Server Error */
709 case 501: /* Not Implemented */
710 case 404: /* Recording not found */
711 case 409: /* Recording not in session */
712 is_valid = 1;
713 break;
714 default:
715 if (200 <= code && code <= 299) {
716 is_valid = ast_ari_validate_void(
717 response->message);
718 } else {
719 ast_log(LOG_ERROR, "Invalid error response %d for /recordings/live/{recordingName}/mute\n", code);
720 is_valid = 0;
721 }
722 }
723
724 if (!is_valid) {
725 ast_log(LOG_ERROR, "Response validation failed for /recordings/live/{recordingName}/mute\n");
726 ast_ari_response_error(response, 500,
727 "Internal Server Error", "Response validation failed");
728 }
729#endif /* AST_DEVMODE */
730
731fin: __attribute__((unused))
732 return;
733}
void ast_ari_recordings_mute(struct ast_variable *headers, struct ast_ari_recordings_mute_args *args, struct ast_ari_response *response)
Mute a live recording.

References args, ast_ari_recordings_mute(), ast_ari_response_error(), ast_ari_validate_void(), ast_log, LOG_ERROR, ast_ari_response::message, ast_variable::name, ast_variable::next, NULL, ast_ari_response::response_code, and ast_variable::value.

◆ ast_ari_recordings_pause_cb()

static void ast_ari_recordings_pause_cb ( struct ast_tcptls_session_instance ser,
struct ast_variable get_params,
struct ast_variable path_vars,
struct ast_variable headers,
struct ast_json body,
struct ast_ari_response response 
)
static

Parameter parsing callback for /recordings/live/{recordingName}/pause.

Parameters
serTCP/TLS session object
get_paramsGET parameters in the HTTP request.
path_varsPath variables extracted from the request.
headersHTTP headers.
body
[out]responseResponse to the HTTP request.

Definition at line 560 of file res_ari_recordings.c.

564{
566 struct ast_variable *i;
567#if defined(AST_DEVMODE)
568 int is_valid;
569 int code;
570#endif /* AST_DEVMODE */
571
572 for (i = path_vars; i; i = i->next) {
573 if (strcmp(i->name, "recordingName") == 0) {
574 args.recording_name = (i->value);
575 } else
576 {}
577 }
578 ast_ari_recordings_pause(headers, &args, response);
579#if defined(AST_DEVMODE)
580 code = response->response_code;
581
582 switch (code) {
583 case 0: /* Implementation is still a stub, or the code wasn't set */
584 is_valid = response->message == NULL;
585 break;
586 case 500: /* Internal Server Error */
587 case 501: /* Not Implemented */
588 case 404: /* Recording not found */
589 case 409: /* Recording not in session */
590 is_valid = 1;
591 break;
592 default:
593 if (200 <= code && code <= 299) {
594 is_valid = ast_ari_validate_void(
595 response->message);
596 } else {
597 ast_log(LOG_ERROR, "Invalid error response %d for /recordings/live/{recordingName}/pause\n", code);
598 is_valid = 0;
599 }
600 }
601
602 if (!is_valid) {
603 ast_log(LOG_ERROR, "Response validation failed for /recordings/live/{recordingName}/pause\n");
604 ast_ari_response_error(response, 500,
605 "Internal Server Error", "Response validation failed");
606 }
607#endif /* AST_DEVMODE */
608
609fin: __attribute__((unused))
610 return;
611}
void ast_ari_recordings_pause(struct ast_variable *headers, struct ast_ari_recordings_pause_args *args, struct ast_ari_response *response)
Pause a live recording.

References args, ast_ari_recordings_pause(), ast_ari_response_error(), ast_ari_validate_void(), ast_log, LOG_ERROR, ast_ari_response::message, ast_variable::name, ast_variable::next, NULL, ast_ari_response::response_code, and ast_variable::value.

◆ ast_ari_recordings_stop_cb()

static void ast_ari_recordings_stop_cb ( struct ast_tcptls_session_instance ser,
struct ast_variable get_params,
struct ast_variable path_vars,
struct ast_variable headers,
struct ast_json body,
struct ast_ari_response response 
)
static

Parameter parsing callback for /recordings/live/{recordingName}/stop.

Parameters
serTCP/TLS session object
get_paramsGET parameters in the HTTP request.
path_varsPath variables extracted from the request.
headersHTTP headers.
body
[out]responseResponse to the HTTP request.

Definition at line 500 of file res_ari_recordings.c.

504{
506 struct ast_variable *i;
507#if defined(AST_DEVMODE)
508 int is_valid;
509 int code;
510#endif /* AST_DEVMODE */
511
512 for (i = path_vars; i; i = i->next) {
513 if (strcmp(i->name, "recordingName") == 0) {
514 args.recording_name = (i->value);
515 } else
516 {}
517 }
518 ast_ari_recordings_stop(headers, &args, response);
519#if defined(AST_DEVMODE)
520 code = response->response_code;
521
522 switch (code) {
523 case 0: /* Implementation is still a stub, or the code wasn't set */
524 is_valid = response->message == NULL;
525 break;
526 case 500: /* Internal Server Error */
527 case 501: /* Not Implemented */
528 case 404: /* Recording not found */
529 is_valid = 1;
530 break;
531 default:
532 if (200 <= code && code <= 299) {
533 is_valid = ast_ari_validate_void(
534 response->message);
535 } else {
536 ast_log(LOG_ERROR, "Invalid error response %d for /recordings/live/{recordingName}/stop\n", code);
537 is_valid = 0;
538 }
539 }
540
541 if (!is_valid) {
542 ast_log(LOG_ERROR, "Response validation failed for /recordings/live/{recordingName}/stop\n");
543 ast_ari_response_error(response, 500,
544 "Internal Server Error", "Response validation failed");
545 }
546#endif /* AST_DEVMODE */
547
548fin: __attribute__((unused))
549 return;
550}
void ast_ari_recordings_stop(struct ast_variable *headers, struct ast_ari_recordings_stop_args *args, struct ast_ari_response *response)
Stop a live recording and store it.

References args, ast_ari_recordings_stop(), ast_ari_response_error(), ast_ari_validate_void(), ast_log, LOG_ERROR, ast_ari_response::message, ast_variable::name, ast_variable::next, NULL, ast_ari_response::response_code, and ast_variable::value.

◆ ast_ari_recordings_unmute_cb()

static void ast_ari_recordings_unmute_cb ( struct ast_tcptls_session_instance ser,
struct ast_variable get_params,
struct ast_variable path_vars,
struct ast_variable headers,
struct ast_json body,
struct ast_ari_response response 
)
static

Parameter parsing callback for /recordings/live/{recordingName}/mute.

Parameters
serTCP/TLS session object
get_paramsGET parameters in the HTTP request.
path_varsPath variables extracted from the request.
headersHTTP headers.
body
[out]responseResponse to the HTTP request.

Definition at line 743 of file res_ari_recordings.c.

747{
749 struct ast_variable *i;
750#if defined(AST_DEVMODE)
751 int is_valid;
752 int code;
753#endif /* AST_DEVMODE */
754
755 for (i = path_vars; i; i = i->next) {
756 if (strcmp(i->name, "recordingName") == 0) {
757 args.recording_name = (i->value);
758 } else
759 {}
760 }
761 ast_ari_recordings_unmute(headers, &args, response);
762#if defined(AST_DEVMODE)
763 code = response->response_code;
764
765 switch (code) {
766 case 0: /* Implementation is still a stub, or the code wasn't set */
767 is_valid = response->message == NULL;
768 break;
769 case 500: /* Internal Server Error */
770 case 501: /* Not Implemented */
771 case 404: /* Recording not found */
772 case 409: /* Recording not in session */
773 is_valid = 1;
774 break;
775 default:
776 if (200 <= code && code <= 299) {
777 is_valid = ast_ari_validate_void(
778 response->message);
779 } else {
780 ast_log(LOG_ERROR, "Invalid error response %d for /recordings/live/{recordingName}/mute\n", code);
781 is_valid = 0;
782 }
783 }
784
785 if (!is_valid) {
786 ast_log(LOG_ERROR, "Response validation failed for /recordings/live/{recordingName}/mute\n");
787 ast_ari_response_error(response, 500,
788 "Internal Server Error", "Response validation failed");
789 }
790#endif /* AST_DEVMODE */
791
792fin: __attribute__((unused))
793 return;
794}
void ast_ari_recordings_unmute(struct ast_variable *headers, struct ast_ari_recordings_unmute_args *args, struct ast_ari_response *response)
Unmute a live recording.

References args, ast_ari_recordings_unmute(), ast_ari_response_error(), ast_ari_validate_void(), ast_log, LOG_ERROR, ast_ari_response::message, ast_variable::name, ast_variable::next, NULL, ast_ari_response::response_code, and ast_variable::value.

◆ ast_ari_recordings_unpause_cb()

static void ast_ari_recordings_unpause_cb ( struct ast_tcptls_session_instance ser,
struct ast_variable get_params,
struct ast_variable path_vars,
struct ast_variable headers,
struct ast_json body,
struct ast_ari_response response 
)
static

Parameter parsing callback for /recordings/live/{recordingName}/pause.

Parameters
serTCP/TLS session object
get_paramsGET parameters in the HTTP request.
path_varsPath variables extracted from the request.
headersHTTP headers.
body
[out]responseResponse to the HTTP request.

Definition at line 621 of file res_ari_recordings.c.

625{
627 struct ast_variable *i;
628#if defined(AST_DEVMODE)
629 int is_valid;
630 int code;
631#endif /* AST_DEVMODE */
632
633 for (i = path_vars; i; i = i->next) {
634 if (strcmp(i->name, "recordingName") == 0) {
635 args.recording_name = (i->value);
636 } else
637 {}
638 }
639 ast_ari_recordings_unpause(headers, &args, response);
640#if defined(AST_DEVMODE)
641 code = response->response_code;
642
643 switch (code) {
644 case 0: /* Implementation is still a stub, or the code wasn't set */
645 is_valid = response->message == NULL;
646 break;
647 case 500: /* Internal Server Error */
648 case 501: /* Not Implemented */
649 case 404: /* Recording not found */
650 case 409: /* Recording not in session */
651 is_valid = 1;
652 break;
653 default:
654 if (200 <= code && code <= 299) {
655 is_valid = ast_ari_validate_void(
656 response->message);
657 } else {
658 ast_log(LOG_ERROR, "Invalid error response %d for /recordings/live/{recordingName}/pause\n", code);
659 is_valid = 0;
660 }
661 }
662
663 if (!is_valid) {
664 ast_log(LOG_ERROR, "Response validation failed for /recordings/live/{recordingName}/pause\n");
665 ast_ari_response_error(response, 500,
666 "Internal Server Error", "Response validation failed");
667 }
668#endif /* AST_DEVMODE */
669
670fin: __attribute__((unused))
671 return;
672}
void ast_ari_recordings_unpause(struct ast_variable *headers, struct ast_ari_recordings_unpause_args *args, struct ast_ari_response *response)
Unpause a live recording.

References args, ast_ari_recordings_unpause(), ast_ari_response_error(), ast_ari_validate_void(), ast_log, LOG_ERROR, ast_ari_response::message, ast_variable::name, ast_variable::next, NULL, ast_ari_response::response_code, and ast_variable::value.

◆ AST_MODULE_SELF_SYM()

struct ast_module * AST_MODULE_SELF_SYM ( void  )

Definition at line 916 of file res_ari_recordings.c.

◆ load_module()

static int load_module ( void  )
static

Definition at line 897 of file res_ari_recordings.c.

898{
899 int res = 0;
900
901
903 if (res) {
906 }
907
909}
int ast_ari_add_handler(struct stasis_rest_handlers *handler)
Definition: res_ari.c:179
@ AST_MODULE_LOAD_SUCCESS
Definition: module.h:70
@ AST_MODULE_LOAD_DECLINE
Module has failed to load, may be in an inconsistent state.
Definition: module.h:78
static int unload_module(void)
static struct stasis_rest_handlers recordings
REST handler for /api-docs/recordings.json.

References ast_ari_add_handler(), AST_MODULE_LOAD_DECLINE, AST_MODULE_LOAD_SUCCESS, recordings, and unload_module().

◆ unload_module()

static int unload_module ( void  )
static

Definition at line 891 of file res_ari_recordings.c.

892{
894 return 0;
895}
int ast_ari_remove_handler(struct stasis_rest_handlers *handler)
Definition: res_ari.c:202

References ast_ari_remove_handler(), and recordings.

Referenced by load_module().

Variable Documentation

◆ __mod_info

struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT , .description = "RESTful API module - Recording resources" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = AST_BUILDOPT_SUM, .support_level = AST_MODULE_SUPPORT_CORE, .load = load_module, .unload = unload_module, .requires = "res_ari,res_ari_model,res_stasis,res_stasis_recording", }
static

Definition at line 916 of file res_ari_recordings.c.

◆ ast_module_info

const struct ast_module_info* ast_module_info = &__mod_info
static

Definition at line 916 of file res_ari_recordings.c.

◆ recordings

struct stasis_rest_handlers recordings
static

REST handler for /api-docs/recordings.json.

Definition at line 883 of file res_ari_recordings.c.

Referenced by ast_ari_recordings_list_stored(), handle_scan_file(), load_module(), stasis_app_stored_recording_find_all(), and unload_module().

◆ recordings_live

struct stasis_rest_handlers recordings_live
static

REST handler for /api-docs/recordings.json.

Definition at line 875 of file res_ari_recordings.c.

◆ recordings_live_recordingName

struct stasis_rest_handlers recordings_live_recordingName
static

REST handler for /api-docs/recordings.json.

Definition at line 864 of file res_ari_recordings.c.

◆ recordings_live_recordingName_mute

struct stasis_rest_handlers recordings_live_recordingName_mute
static

REST handler for /api-docs/recordings.json.

Definition at line 854 of file res_ari_recordings.c.

◆ recordings_live_recordingName_pause

struct stasis_rest_handlers recordings_live_recordingName_pause
static

REST handler for /api-docs/recordings.json.

Definition at line 844 of file res_ari_recordings.c.

◆ recordings_live_recordingName_stop

struct stasis_rest_handlers recordings_live_recordingName_stop
static

REST handler for /api-docs/recordings.json.

Definition at line 835 of file res_ari_recordings.c.

◆ recordings_stored

struct stasis_rest_handlers recordings_stored
static

REST handler for /api-docs/recordings.json.

Definition at line 826 of file res_ari_recordings.c.

◆ recordings_stored_recordingName

struct stasis_rest_handlers recordings_stored_recordingName
static

REST handler for /api-docs/recordings.json.

Definition at line 815 of file res_ari_recordings.c.

◆ recordings_stored_recordingName_copy

struct stasis_rest_handlers recordings_stored_recordingName_copy
static

REST handler for /api-docs/recordings.json.

Definition at line 806 of file res_ari_recordings.c.

◆ recordings_stored_recordingName_file

struct stasis_rest_handlers recordings_stored_recordingName_file
static

REST handler for /api-docs/recordings.json.

Definition at line 797 of file res_ari_recordings.c.