phoneprov.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. /*
  2. * Asterisk -- An open source telephony toolkit.
  3. *
  4. * Copyright (C) 2014 - Fairview 5 Engineering, LLC
  5. *
  6. * George Joseph <george.joseph@fairview5.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. #ifdef __cplusplus
  19. extern "C" {
  20. #endif
  21. #ifndef _ASTERISK_PHONEPROV_H
  22. #define _ASTERISK_PHONEPROV_H
  23. #include "asterisk.h"
  24. #include "asterisk/inline_api.h"
  25. enum ast_phoneprov_std_variables {
  26. AST_PHONEPROV_STD_MAC = 0,
  27. AST_PHONEPROV_STD_PROFILE,
  28. AST_PHONEPROV_STD_USERNAME,
  29. AST_PHONEPROV_STD_DISPLAY_NAME,
  30. AST_PHONEPROV_STD_SECRET,
  31. AST_PHONEPROV_STD_LABEL,
  32. AST_PHONEPROV_STD_CALLERID,
  33. AST_PHONEPROV_STD_TIMEZONE,
  34. AST_PHONEPROV_STD_LINENUMBER,
  35. AST_PHONEPROV_STD_LINEKEYS,
  36. AST_PHONEPROV_STD_SERVER,
  37. AST_PHONEPROV_STD_SERVER_PORT,
  38. AST_PHONEPROV_STD_SERVER_IFACE,
  39. AST_PHONEPROV_STD_VOICEMAIL_EXTEN,
  40. AST_PHONEPROV_STD_EXTENSION_LENGTH,
  41. AST_PHONEPROV_STD_TZOFFSET,
  42. AST_PHONEPROV_STD_DST_ENABLE,
  43. AST_PHONEPROV_STD_DST_START_MONTH,
  44. AST_PHONEPROV_STD_DST_START_MDAY,
  45. AST_PHONEPROV_STD_DST_START_HOUR,
  46. AST_PHONEPROV_STD_DST_END_MONTH,
  47. AST_PHONEPROV_STD_DST_END_MDAY,
  48. AST_PHONEPROV_STD_DST_END_HOUR,
  49. AST_PHONEPROV_STD_VAR_LIST_LENGTH, /* This entry must always be the last in the list */
  50. };
  51. /*!
  52. * \brief Returns the string respresentation of a phoneprov standard variable.
  53. * \param var One of enum ast_phoneprov_std_variables
  54. *
  55. * \return The string representation or NULL if not found.
  56. */
  57. const char *ast_phoneprov_std_variable_lookup(enum ast_phoneprov_std_variables var);
  58. /*!
  59. * \brief Causes the provider to load its users.
  60. *
  61. * This function is called by phoneprov in response to a
  62. * ast_phoneprov_provider_register call by the provider.
  63. * It may also be called by phoneprov to request a reload in
  64. * response to the res_phoneprov module being reloaded.
  65. *
  66. * \retval 0 if successful
  67. * \retval non-zero if failure
  68. */
  69. typedef int(*ast_phoneprov_load_users_cb)(void);
  70. /*!
  71. * \brief Registers a config provider to phoneprov.
  72. * \param provider_name The name of the provider
  73. * \param load_users Callback that gathers user variables then loads them by
  74. * calling ast_phoneprov_add_extension once for each extension.
  75. *
  76. * \retval 0 if successful
  77. * \retval non-zero if failure
  78. */
  79. int ast_phoneprov_provider_register(char *provider_name,
  80. ast_phoneprov_load_users_cb load_users);
  81. /*!
  82. * \brief Unegisters a config provider from phoneprov and frees its resources.
  83. * \param provider_name The name of the provider
  84. */
  85. void ast_phoneprov_provider_unregister(char *provider_name);
  86. /*!
  87. * \brief Adds an extension
  88. * \param provider_name The name of the provider
  89. * \param defaults An ast_vat_t linked list of the extension's variables.
  90. * The list is automatically cloned and it must contain at least MACADDRESS
  91. * and USERNAME entries.
  92. *
  93. * \retval 0 if successful
  94. * \retval non-zero if failure
  95. */
  96. int ast_phoneprov_add_extension(char *provider_name, struct varshead *vars);
  97. /*!
  98. * \brief Deletes an extension
  99. * \param provider_name The name of the provider
  100. * \param macaddress The mac address of the extension
  101. */
  102. void ast_phoneprov_delete_extension(char *provider_name, char *macaddress);
  103. /*!
  104. * \brief Deletes all extensions for this provider
  105. * \param provider_name The name of the provider
  106. */
  107. void ast_phoneprov_delete_extensions(char *provider_name);
  108. #endif /* _ASTERISK_PHONEPROV_H */
  109. #ifdef __cplusplus
  110. }
  111. #endif