resource_events.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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. /*! Subscribe to all Asterisk events. If provided, the applications listed will be subscribed to all events, effectively disabling the application specific subscriptions. Default is 'false'. */
  46. int subscribe_all;
  47. };
  48. /*!
  49. * \brief WebSocket connection for events.
  50. *
  51. * \param ser HTTP TCP/TLS Server Session
  52. * \param headers HTTP headers
  53. * \param args Swagger parameters
  54. *
  55. * \retval 0 success
  56. * \retval non-zero error
  57. */
  58. int ast_ari_websocket_events_event_websocket_attempted(struct ast_tcptls_session_instance *ser, struct ast_variable *headers, struct ast_ari_events_event_websocket_args *args);
  59. /*!
  60. * \brief WebSocket connection for events.
  61. *
  62. * \param session ARI WebSocket.
  63. * \param headers HTTP headers.
  64. * \param args Swagger parameters.
  65. */
  66. void ast_ari_websocket_events_event_websocket_established(struct ast_ari_websocket_session *session, struct ast_variable *headers, struct ast_ari_events_event_websocket_args *args);
  67. /*! Argument struct for ast_ari_events_user_event() */
  68. struct ast_ari_events_user_event_args {
  69. /*! Event name */
  70. const char *event_name;
  71. /*! The name of the application that will receive this event */
  72. const char *application;
  73. /*! Array of URI for event source (channel:{channelId}, bridge:{bridgeId}, endpoint:{tech}/{resource}, deviceState:{deviceName} */
  74. const char **source;
  75. /*! Length of source array. */
  76. size_t source_count;
  77. /*! Parsing context for source. */
  78. char *source_parse;
  79. /*! The "variables" key in the body object holds custom key/value pairs to add to the user event. Ex. { "variables": { "key": "value" } } */
  80. struct ast_json *variables;
  81. };
  82. /*!
  83. * \brief Body parsing function for /events/user/{eventName}.
  84. * \param body The JSON body from which to parse parameters.
  85. * \param[out] args The args structure to parse into.
  86. * \retval zero on success
  87. * \retval non-zero on failure
  88. */
  89. int ast_ari_events_user_event_parse_body(
  90. struct ast_json *body,
  91. struct ast_ari_events_user_event_args *args);
  92. /*!
  93. * \brief Generate a user event.
  94. *
  95. * \param headers HTTP headers
  96. * \param args Swagger parameters
  97. * \param[out] response HTTP response
  98. */
  99. void ast_ari_events_user_event(struct ast_variable *headers, struct ast_ari_events_user_event_args *args, struct ast_ari_response *response);
  100. #endif /* _ASTERISK_RESOURCE_EVENTS_H */