Asterisk - The Open Source Telephony Project  21.4.1
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"

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 = "da6642af068ee5e6490c5b1d2cc1d238" , .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.
 
static struct stasis_rest_handlers recordings_live
 REST handler for /api-docs/recordings.json.
 
static struct stasis_rest_handlers recordings_live_recordingName
 REST handler for /api-docs/recordings.json.
 
static struct stasis_rest_handlers recordings_live_recordingName_mute
 REST handler for /api-docs/recordings.json.
 
static struct stasis_rest_handlers recordings_live_recordingName_pause
 REST handler for /api-docs/recordings.json.
 
static struct stasis_rest_handlers recordings_live_recordingName_stop
 REST handler for /api-docs/recordings.json.
 
static struct stasis_rest_handlers recordings_stored
 REST handler for /api-docs/recordings.json.
 
static struct stasis_rest_handlers recordings_stored_recordingName
 REST handler for /api-docs/recordings.json.
 
static struct stasis_rest_handlers recordings_stored_recordingName_copy
 REST handler for /api-docs/recordings.json.
 
static struct stasis_rest_handlers recordings_stored_recordingName_file
 REST handler for /api-docs/recordings.json.
 

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.

Function Documentation

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.

References ast_ari_recordings_cancel(), ast_ari_response_error(), ast_ari_validate_void(), ast_ari_response::message, ast_variable::name, ast_variable::next, ast_ari_recordings_cancel_args::recording_name, ast_ari_response::response_code, and ast_variable::value.

444 {
445  struct ast_ari_recordings_cancel_args args = {};
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 
488 fin: __attribute__((unused))
489  return;
490 }
struct ast_variable * next
Structure for variables, used for configurations and for channel variables.
int ast_ari_validate_void(struct ast_json *json)
Validator for native Swagger void.
Definition: res_ari_model.c:91
int response_code
Definition: ari.h:99
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
struct ast_json * message
Definition: ari.h:94
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.
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.

References 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_ari_recordings_copy_stored_args::destination_recording_name, ast_ari_response::message, ast_variable::name, ast_variable::next, ast_ari_recordings_copy_stored_args::recording_name, ast_ari_response::response_code, and ast_variable::value.

313 {
314  struct ast_ari_recordings_copy_stored_args args = {};
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 
368 fin: __attribute__((unused))
369  return;
370 }
struct ast_variable * next
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.
Structure for variables, used for configurations and for channel variables.
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 response_code
Definition: ari.h:99
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
struct ast_json * message
Definition: ari.h:94
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.
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.

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.

References ast_json_object_get(), ast_json_string_get(), and ast_ari_recordings_copy_stored_args::destination_recording_name.

Referenced by ast_ari_recordings_copy_stored_cb().

290 {
291  struct ast_json *field;
292  /* Parse query parameters out of it */
293  field = ast_json_object_get(body, "destinationRecordingName");
294  if (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, ...).
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.

References ast_ari_recordings_delete_stored(), ast_ari_response_error(), ast_ari_validate_void(), ast_ari_response::message, ast_variable::name, ast_variable::next, ast_ari_recordings_delete_stored_args::recording_name, ast_ari_response::response_code, and ast_variable::value.

179 {
180  struct ast_ari_recordings_delete_stored_args args = {};
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 
223 fin: __attribute__((unused))
224  return;
225 }
struct ast_variable * next
Structure for variables, used for configurations and for channel variables.
int ast_ari_validate_void(struct ast_json *json)
Validator for native Swagger void.
Definition: res_ari_model.c:91
int response_code
Definition: ari.h:99
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.
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
struct ast_json * message
Definition: ari.h:94
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.

References ast_ari_recordings_get_live(), ast_ari_response_error(), ast_ari_validate_live_recording(), ast_ari_response::message, ast_variable::name, ast_variable::next, ast_ari_recordings_get_live_args::recording_name, ast_ari_response::response_code, and ast_variable::value.

384 {
385  struct ast_ari_recordings_get_live_args args = {};
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 
428 fin: __attribute__((unused))
429  return;
430 }
struct ast_variable * next
Structure for variables, used for configurations and for channel variables.
int response_code
Definition: ari.h:99
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_live_recording(struct ast_json *json)
Validator for LiveRecording.
struct ast_json * message
Definition: ari.h:94
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.
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.

References ast_ari_recordings_get_stored(), ast_ari_response_error(), ast_ari_validate_stored_recording(), ast_ari_response::message, ast_variable::name, ast_variable::next, ast_ari_recordings_get_stored_args::recording_name, ast_ari_response::response_code, and ast_variable::value.

119 {
120  struct ast_ari_recordings_get_stored_args args = {};
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 
163 fin: __attribute__((unused))
164  return;
165 }
struct ast_variable * next
Structure for variables, used for configurations and for channel variables.
int response_code
Definition: ari.h:99
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.
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
struct ast_json * message
Definition: ari.h:94
int ast_ari_validate_stored_recording(struct ast_json *json)
Validator for StoredRecording.
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.

References ast_ari_recordings_get_stored_file(), ast_ari_response_error(), ast_ari_response::message, ast_variable::name, ast_variable::next, ast_ari_recordings_get_stored_file_args::recording_name, ast_ari_response::response_code, and ast_variable::value.

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 
284 fin: __attribute__((unused))
285  return;
286 }
struct ast_variable * next
Structure for variables, used for configurations and for channel variables.
int response_code
Definition: ari.h:99
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
struct ast_json * message
Definition: ari.h:94
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.
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.

References ast_ari_recordings_list_stored(), ast_ari_response_error(), ast_ari_validate_list(), ast_ari_validate_stored_recording_fn(), ast_ari_response::message, and ast_ari_response::response_code.

67 {
68  struct ast_ari_recordings_list_stored_args args = {};
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 
103 fin: __attribute__((unused))
104  return;
105 }
int response_code
Definition: ari.h:99
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.
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
ari_validator ast_ari_validate_stored_recording_fn(void)
Function pointer to ast_ari_validate_stored_recording().
struct ast_json * message
Definition: ari.h:94
int ast_ari_validate_list(struct ast_json *json, int(*fn)(struct ast_json *))
Validator for a Swagger List[]/JSON array.
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.

References ast_ari_recordings_mute(), ast_ari_response_error(), ast_ari_validate_void(), ast_ari_response::message, ast_variable::name, ast_variable::next, ast_ari_recordings_mute_args::recording_name, ast_ari_response::response_code, and ast_variable::value.

686 {
687  struct ast_ari_recordings_mute_args args = {};
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 
731 fin: __attribute__((unused))
732  return;
733 }
struct ast_variable * next
Structure for variables, used for configurations and for channel variables.
int ast_ari_validate_void(struct ast_json *json)
Validator for native Swagger void.
Definition: res_ari_model.c:91
int response_code
Definition: ari.h:99
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
struct ast_json * message
Definition: ari.h:94
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.
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.

References ast_ari_recordings_pause(), ast_ari_response_error(), ast_ari_validate_void(), ast_ari_response::message, ast_variable::name, ast_variable::next, ast_ari_recordings_pause_args::recording_name, ast_ari_response::response_code, and ast_variable::value.

564 {
565  struct ast_ari_recordings_pause_args args = {};
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 
609 fin: __attribute__((unused))
610  return;
611 }
struct ast_variable * next
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.
Structure for variables, used for configurations and for channel variables.
int ast_ari_validate_void(struct ast_json *json)
Validator for native Swagger void.
Definition: res_ari_model.c:91
int response_code
Definition: ari.h:99
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
struct ast_json * message
Definition: ari.h:94
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.

References ast_ari_recordings_stop(), ast_ari_response_error(), ast_ari_validate_void(), ast_ari_response::message, ast_variable::name, ast_variable::next, ast_ari_recordings_stop_args::recording_name, ast_ari_response::response_code, and ast_variable::value.

504 {
505  struct ast_ari_recordings_stop_args args = {};
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 
548 fin: __attribute__((unused))
549  return;
550 }
struct ast_variable * next
Structure for variables, used for configurations and for channel variables.
int ast_ari_validate_void(struct ast_json *json)
Validator for native Swagger void.
Definition: res_ari_model.c:91
int response_code
Definition: ari.h:99
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.
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
struct ast_json * message
Definition: ari.h:94
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.

References ast_ari_recordings_unmute(), ast_ari_response_error(), ast_ari_validate_void(), ast_ari_response::message, ast_variable::name, ast_variable::next, ast_ari_recordings_unmute_args::recording_name, ast_ari_response::response_code, and ast_variable::value.

747 {
748  struct ast_ari_recordings_unmute_args args = {};
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 
792 fin: __attribute__((unused))
793  return;
794 }
struct ast_variable * next
Structure for variables, used for configurations and for channel variables.
int ast_ari_validate_void(struct ast_json *json)
Validator for native Swagger void.
Definition: res_ari_model.c:91
int response_code
Definition: ari.h:99
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.
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
struct ast_json * message
Definition: ari.h:94
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.

References ast_ari_recordings_unpause(), ast_ari_response_error(), ast_ari_validate_void(), ast_ari_response::message, ast_variable::name, ast_variable::next, ast_ari_recordings_unpause_args::recording_name, ast_ari_response::response_code, and ast_variable::value.

625 {
626  struct ast_ari_recordings_unpause_args args = {};
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 
670 fin: __attribute__((unused))
671  return;
672 }
struct ast_variable * next
Structure for variables, used for configurations and for channel variables.
int ast_ari_validate_void(struct ast_json *json)
Validator for native Swagger void.
Definition: res_ari_model.c:91
int response_code
Definition: ari.h:99
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
struct ast_json * message
Definition: ari.h:94
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.