Asterisk - The Open Source Telephony Project  21.4.1
res_geolocation.c
1 /*
2  * Asterisk -- An open source telephony toolkit.
3  *
4  * Copyright (C) 2022, Sangoma Technologies Corporation
5  *
6  * George Joseph <gjoseph@sangoma.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 
19 /*** MODULEINFO
20  <depend>libxml2</depend>
21  <depend>libxslt</depend>
22  <support_level>core</support_level>
23  ***/
24 
25 
26 #include "asterisk.h"
27 #define AST_API_MODULE
28 #include "asterisk/res_geolocation.h"
29 #include "res_geolocation/geoloc_private.h"
30 
31 static int reload_module(void)
32 {
33  int res = 0;
34 
35  res = geoloc_civicaddr_reload();
36  if (res) {
38  }
39  res = geoloc_gml_reload();
40  if (res) {
42  }
43  res = geoloc_config_reload();
44  if (res) {
46  }
47  res = geoloc_eprofile_reload();
48  if (res) {
50  }
51  res = geoloc_dialplan_reload();
52  if (res) {
54  }
55  res = geoloc_channel_reload();
56  if (res) {
58  }
59 
61 }
62 
63 static int unload_module(void)
64 {
65  int res = 0;
66 
67  res += geoloc_channel_unload();
68  res += geoloc_dialplan_unload();
69  res += geoloc_eprofile_unload();
70  res += geoloc_config_unload();
71  res += geoloc_gml_unload();
72  res += geoloc_civicaddr_unload();
73 
74  return (res != 0);
75 }
76 
77 static int load_module(void)
78 {
79  int res = 0;
80 
81  res = geoloc_civicaddr_load();
82  if (res) {
83  unload_module();
85  }
86 
87  res = geoloc_gml_load();
88  if (res) {
90  }
91 
92  res = geoloc_config_load();
93  if (res) {
94  unload_module();
96  }
97 
98  res = geoloc_eprofile_load();
99  if (res) {
100  unload_module();
102  }
103 
104  res = geoloc_dialplan_load();
105  if (res) {
106  unload_module();
108  }
109 
110  res = geoloc_channel_load();
111  if (res) {
112  unload_module();
114  }
115 
117 }
118 
119 AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS | AST_MODFLAG_LOAD_ORDER, "res_geolocation Module for Asterisk",
120  .support_level = AST_MODULE_SUPPORT_CORE,
121  .load = load_module,
122  .unload = unload_module,
123  .reload = reload_module,
124  .load_pri = AST_MODPRI_CHANNEL_DEPEND - 10,
125 );
Asterisk main include file. File version handling, generic pbx functions.
Module has failed to load, may be in an inconsistent state.
Definition: module.h:78
#define ASTERISK_GPL_KEY
The text the key() function should return.
Definition: module.h:46