resource_events.h 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /*
  2. * Asterisk -- An open source telephony toolkit.
  3. *
  4. * Copyright (C) 2012 - 2013, Digium, Inc.
  5. *
  6. * David M. Lee, II <dlee@digium.com>
  7. *
  8. * See http://www.asterisk.org for more information about
  9. * the Asterisk project. Please do not directly contact
  10. * any of the maintainers of this project for assistance;
  11. * the project provides a web site, mailing lists and IRC
  12. * channels for your use.
  13. *
  14. * This program is free software, distributed under the terms of
  15. * the GNU General Public License Version 2. See the LICENSE file
  16. * at the top of the source tree.
  17. */
  18. /*! \file
  19. *
  20. * \brief Generated file - declares stubs to be implemented in
  21. * res/ari/resource_events.c
  22. *
  23. * WebSocket resource
  24. *
  25. * \author David M. Lee, II <dlee@digium.com>
  26. */
  27. /*
  28. * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  29. * !!!!! DO NOT EDIT !!!!!
  30. * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  31. * This file is generated by a mustache template. Please see the original
  32. * template in rest-api-templates/ari_resource.h.mustache
  33. */
  34. #ifndef _ASTERISK_RESOURCE_EVENTS_H
  35. #define _ASTERISK_RESOURCE_EVENTS_H
  36. #include "asterisk/ari.h"
  37. /*! Argument struct for ast_ari_events_event_websocket() */
  38. struct ast_ari_events_event_websocket_args {
  39. /*! Array of Applications to subscribe to. */
  40. const char **app;
  41. /*! Length of app array. */
  42. size_t app_count;
  43. /*! Parsing context for app. */
  44. char *app_parse;
  45. };
  46. /*!
  47. * \brief WebSocket connection for events.
  48. *
  49. * \param session ARI WebSocket.
  50. * \param headers HTTP headers.
  51. * \param args Swagger parameters.
  52. */
  53. void ast_ari_websocket_events_event_websocket(struct ast_ari_websocket_session *session, struct ast_variable *headers, struct ast_ari_events_event_websocket_args *args);
  54. /*! Argument struct for ast_ari_events_user_event() */
  55. struct ast_ari_events_user_event_args {
  56. /*! Event name */
  57. const char *event_name;
  58. /*! The name of the application that will receive this event */
  59. const char *application;
  60. /*! Array of URI for event source (channel:{channelId}, bridge:{bridgeId}, endpoint:{tech}/{resource}, deviceState:{deviceName} */
  61. const char **source;
  62. /*! Length of source array. */
  63. size_t source_count;
  64. /*! Parsing context for source. */
  65. char *source_parse;
  66. /*! The "variables" key in the body object holds custom key/value pairs to add to the user event. Ex. { "variables": { "key": "value" } } */
  67. struct ast_json *variables;
  68. };
  69. /*!
  70. * \brief Body parsing function for /events/user/{eventName}.
  71. * \param body The JSON body from which to parse parameters.
  72. * \param[out] args The args structure to parse into.
  73. * \retval zero on success
  74. * \retval non-zero on failure
  75. */
  76. int ast_ari_events_user_event_parse_body(
  77. struct ast_json *body,
  78. struct ast_ari_events_user_event_args *args);
  79. /*!
  80. * \brief Generate a user event.
  81. *
  82. * \param headers HTTP headers
  83. * \param args Swagger parameters
  84. * \param[out] response HTTP response
  85. */
  86. void ast_ari_events_user_event(struct ast_variable *headers, struct ast_ari_events_user_event_args *args, struct ast_ari_response *response);
  87. #endif /* _ASTERISK_RESOURCE_EVENTS_H */