Asterisk - The Open Source Telephony Project GIT-master-f36a736
Macros | Enumerations | Functions | Variables
geoloc_dialplan.c File Reference
#include "asterisk.h"
#include "asterisk/config.h"
#include "asterisk/cli.h"
#include "asterisk/module.h"
#include "asterisk/channel.h"
#include "asterisk/pbx.h"
#include "asterisk/strings.h"
#include "asterisk/utils.h"
#include "asterisk/app.h"
#include "geoloc_private.h"
Include dependency graph for geoloc_dialplan.c:

Go to the source code of this file.

Macros

#define RESOLVE_FOR_READ(_param)
 
#define RESOLVE_FOR_WRITE(_param)
 
#define TEST_ENUM_VALUE(_chan_name, _ep, _field, _value)
 
#define TEST_VARLIST(_chan_name, _ep, _field, _value)
 
#define VAR_LIST_REPLACE(_old, _new)
 

Enumerations

enum  my_app_option_flags { OPT_GEOLOC_RESOLVE = (1 << 0) , OPT_GEOLOC_APPEND = (1 << 1) }
 

Functions

int geoloc_dialplan_load (void)
 
int geoloc_dialplan_reload (void)
 
int geoloc_dialplan_unload (void)
 
static int geoloc_profile_read (struct ast_channel *chan, const char *cmd, char *data, struct ast_str **buf, ssize_t len)
 
static int geoloc_profile_write (struct ast_channel *chan, const char *cmd, char *data, const char *value)
 
static void varlist_to_str (struct ast_variable *list, struct ast_str **buf, size_t len)
 

Variables

static const struct ast_app_option action_options [128] = { [ 'r' ] = { .flag = OPT_GEOLOC_RESOLVE }, [ 'a' ] = { .flag = OPT_GEOLOC_APPEND }, }
 
static struct ast_custom_function geoloc_function
 

Macro Definition Documentation

◆ RESOLVE_FOR_READ

#define RESOLVE_FOR_READ (   _param)

Definition at line 39 of file geoloc_dialplan.c.

◆ RESOLVE_FOR_WRITE

#define RESOLVE_FOR_WRITE (   _param)

Definition at line 208 of file geoloc_dialplan.c.

◆ TEST_ENUM_VALUE

#define TEST_ENUM_VALUE (   _chan_name,
  _ep,
  _field,
  _value 
)

Definition at line 179 of file geoloc_dialplan.c.

◆ TEST_VARLIST

#define TEST_VARLIST (   _chan_name,
  _ep,
  _field,
  _value 
)

Definition at line 191 of file geoloc_dialplan.c.

◆ VAR_LIST_REPLACE

#define VAR_LIST_REPLACE (   _old,
  _new 
)
Value:
_old = _new;
void ast_variables_destroy(struct ast_variable *var)
Free variable list.
Definition: extconf.c:1262

Definition at line 175 of file geoloc_dialplan.c.

Enumeration Type Documentation

◆ my_app_option_flags

Enumerator
OPT_GEOLOC_RESOLVE 
OPT_GEOLOC_APPEND 

Definition at line 56 of file geoloc_dialplan.c.

56 {
57 OPT_GEOLOC_RESOLVE = (1 << 0),
58 OPT_GEOLOC_APPEND = (1 << 1),
59};
@ OPT_GEOLOC_APPEND
@ OPT_GEOLOC_RESOLVE

Function Documentation

◆ geoloc_dialplan_load()

int geoloc_dialplan_load ( void  )

Definition at line 363 of file geoloc_dialplan.c.

364{
365 int res = 0;
366
368
370}
static struct ast_custom_function geoloc_function
@ AST_MODULE_LOAD_SUCCESS
Definition: module.h:70
@ AST_MODULE_LOAD_DECLINE
Module has failed to load, may be in an inconsistent state.
Definition: module.h:78
#define ast_custom_function_register(acf)
Register a custom function.
Definition: pbx.h:1558

References ast_custom_function_register, AST_MODULE_LOAD_DECLINE, AST_MODULE_LOAD_SUCCESS, and geoloc_function.

Referenced by load_module().

◆ geoloc_dialplan_reload()

int geoloc_dialplan_reload ( void  )

Definition at line 372 of file geoloc_dialplan.c.

373{
375}

References AST_MODULE_LOAD_SUCCESS.

Referenced by reload_module().

◆ geoloc_dialplan_unload()

int geoloc_dialplan_unload ( void  )

Definition at line 356 of file geoloc_dialplan.c.

357{
359
361}
int ast_custom_function_unregister(struct ast_custom_function *acf)
Unregister a custom function.

References ast_custom_function_unregister(), AST_MODULE_LOAD_SUCCESS, and geoloc_function.

Referenced by unload_module().

◆ geoloc_profile_read()

static int geoloc_profile_read ( struct ast_channel chan,
const char *  cmd,
char *  data,
struct ast_str **  buf,
ssize_t  len 
)
static

Definition at line 67 of file geoloc_dialplan.c.

69{
70 char *parsed_data = ast_strdupa(data);
71 const char *chan_name = ast_channel_name(chan);
72 struct ast_datastore *ds;
73 struct ast_geoloc_eprofile *orig_eprofile = NULL;
74 struct ast_geoloc_eprofile *eprofile = NULL;
75 struct ast_flags opts = { 0, };
76
78 AST_APP_ARG(field);
80 );
81
82 /* Check for zero arguments */
83 if (ast_strlen_zero(parsed_data)) {
84 ast_log(LOG_ERROR, "%s: Cannot call without arguments\n", chan_name);
85 pbx_builtin_setvar_helper(chan, "GEOLOCPROFILESTATUS", "-1");
86 return 0;
87 }
88
89 AST_STANDARD_APP_ARGS(args, parsed_data);
90
91 if (ast_strlen_zero(args.field)) {
92 ast_log(LOG_ERROR, "%s: Cannot call without a field to query\n", chan_name);
93 pbx_builtin_setvar_helper(chan, "GEOLOCPROFILESTATUS", "-1");
94 return 0;
95 }
96
97 if (!ast_strlen_zero(args.options)) {
98 if (ast_app_parse_options(action_options, &opts, NULL, args.options)) {
99 ast_log(LOG_ERROR, "%s: Invalid options: %s\n", chan_name, args.options);
100 pbx_builtin_setvar_helper(chan, "GEOLOCPROFILESTATUS", "-1");
101 return 0;
102 }
103 }
104
105 ds = ast_geoloc_datastore_find(chan);
106 if (!ds) {
107 ast_log(LOG_NOTICE, "%s: There is no geoloc profile on this channel\n", chan_name);
108 pbx_builtin_setvar_helper(chan, "GEOLOCPROFILESTATUS", "-2");
109 return 0;
110 }
111
112 orig_eprofile = ast_geoloc_datastore_get_eprofile(ds, 0);
113 if (!orig_eprofile) {
114 ast_log(LOG_NOTICE, "%s: There is no geoloc profile on this channel\n", chan_name);
115 pbx_builtin_setvar_helper(chan, "GEOLOCPROFILESTATUS", "-2");
116 return 0;
117 }
118
119 eprofile = ast_geoloc_eprofile_dup(orig_eprofile);
120 ao2_ref(orig_eprofile, -1);
121 if (!eprofile) {
122 ast_log(LOG_ERROR, "%s: Unable to duplicate eprofile\n", chan_name);
123 pbx_builtin_setvar_helper(chan, "GEOLOCPROFILESTATUS", "-2");
124 return 0;
125 }
126
127 if (!eprofile->effective_location) {
129 }
130
131 pbx_builtin_setvar_helper(chan, "GEOLOCPROFILESTATUS", "0");
132 if (ast_strings_equal(args.field, "inheritable")) {
133 ast_str_append(buf, len, "%s", ds->inheritance ? "true" : "false");
134 } else if (ast_strings_equal(args.field, "id")) {
135 ast_str_append(buf, len, "%s", eprofile->id);
136 } else if (ast_strings_equal(args.field, "location_reference")) {
137 ast_str_append(buf, len, "%s", eprofile->location_reference);
138 } else if (ast_strings_equal(args.field, "method")) {
139 ast_str_append(buf, len, "%s", eprofile->method);
140 } else if (ast_strings_equal(args.field, "allow_routing_use")) {
141 ast_str_append(buf, len, "%s", eprofile->allow_routing_use ? "yes" : "no");
142 } else if (ast_strings_equal(args.field, "suppress_empty_ca_elements")) {
143 ast_str_append(buf, len, "%s", eprofile->suppress_empty_ca_elements ? "yes" : "no");
144 } else if (ast_strings_equal(args.field, "profile_precedence")) {
145 ast_str_append(buf, len, "%s", ast_geoloc_precedence_to_name(eprofile->precedence));
146 } else if (ast_strings_equal(args.field, "format")) {
147 ast_str_append(buf, len, "%s", ast_geoloc_format_to_name(eprofile->format));
148 } else if (ast_strings_equal(args.field, "pidf_element")) {
149 ast_str_append(buf, len, "%s", ast_geoloc_pidf_element_to_name(eprofile->pidf_element));
150 } else if (ast_strings_equal(args.field, "location_source")) {
151 ast_str_append(buf, len, "%s", eprofile->location_source);
152 } else if (ast_strings_equal(args.field, "notes")) {
153 ast_str_append(buf, len, "%s", eprofile->notes);
154 } else if (ast_strings_equal(args.field, "location_info")) {
155 RESOLVE_FOR_READ(location_info);
156 } else if (ast_strings_equal(args.field, "location_info_refinement")) {
157 RESOLVE_FOR_READ(location_refinement);
158 } else if (ast_strings_equal(args.field, "location_variables")) {
159 RESOLVE_FOR_READ(location_variables);
160 } else if (ast_strings_equal(args.field, "effective_location")) {
161 RESOLVE_FOR_READ(effective_location);
162 } else if (ast_strings_equal(args.field, "usage_rules")) {
163 RESOLVE_FOR_READ(usage_rules);
164 } else if (ast_strings_equal(args.field, "confidence")) {
165 varlist_to_str(eprofile->confidence, buf, len);
166 } else {
167 ast_log(LOG_ERROR, "%s: Field '%s' is not valid\n", chan_name, args.field);
168 pbx_builtin_setvar_helper(chan, "GEOLOCPROFILESTATUS", "-3");
169 }
170
171 ao2_ref(eprofile, -1);
172 return 0;
173}
#define ast_strdupa(s)
duplicate a string in memory from the stack
Definition: astmm.h:298
#define ast_log
Definition: astobj2.c:42
#define ao2_ref(o, delta)
Reference/unreference an object and return the old refcount.
Definition: astobj2.h:459
const char * ast_channel_name(const struct ast_channel *chan)
char buf[BUFSIZE]
Definition: eagi_proxy.c:66
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
static const struct ast_app_option action_options[128]
#define RESOLVE_FOR_READ(_param)
static void varlist_to_str(struct ast_variable *list, struct ast_str **buf, size_t len)
#define AST_APP_ARG(name)
Define an application argument.
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application's arguments.
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the 'standard' argument separation process for an application.
int ast_app_parse_options(const struct ast_app_option *options, struct ast_flags *flags, char **args, char *optstr)
Parses a string containing application options and sets flags/arguments.
Definition: main/app.c:3066
#define LOG_ERROR
#define LOG_NOTICE
int pbx_builtin_setvar_helper(struct ast_channel *chan, const char *name, const char *value)
Add a variable to the channel variable stack, removing the most recently set value for the same name.
int ast_geoloc_eprofile_refresh_location(struct ast_geoloc_eprofile *eprofile)
Refresh the effective profile with any changed info.
struct ast_geoloc_eprofile * ast_geoloc_eprofile_dup(struct ast_geoloc_eprofile *src)
Duplicate an effective profile.
struct ast_geoloc_eprofile * ast_geoloc_datastore_get_eprofile(struct ast_datastore *ds, int ix)
Retrieve a specific eprofile from a datastore by index.
struct ast_datastore * ast_geoloc_datastore_find(struct ast_channel *chan)
Retrieves the geoloc datastore from a channel, if any.
#define NULL
Definition: resample.c:96
int ast_str_append(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Append to a thread local dynamic string.
Definition: strings.h:1139
int ast_strings_equal(const char *str1, const char *str2)
Compare strings for equality checking for NULL.
Definition: strings.c:238
static force_inline int attribute_pure ast_strlen_zero(const char *s)
Definition: strings.h:65
Structure for a data store object.
Definition: datastore.h:64
unsigned int inheritance
Definition: datastore.h:69
Structure used to handle boolean flags.
Definition: utils.h:199
struct ast_variable * effective_location
const ast_string_field location_reference
enum ast_geoloc_format format
enum ast_geoloc_pidf_element pidf_element
const ast_string_field method
enum ast_geoloc_precedence precedence
const ast_string_field notes
const ast_string_field id
struct ast_variable * confidence
const ast_string_field location_source
const char * args
static struct test_options options

References action_options, ast_geoloc_eprofile::allow_routing_use, ao2_ref, args, AST_APP_ARG, ast_app_parse_options(), ast_channel_name(), AST_DECLARE_APP_ARGS, ast_geoloc_datastore_find(), ast_geoloc_datastore_get_eprofile(), ast_geoloc_eprofile_dup(), ast_geoloc_eprofile_refresh_location(), ast_log, AST_STANDARD_APP_ARGS, ast_str_append(), ast_strdupa, ast_strings_equal(), ast_strlen_zero(), buf, ast_geoloc_eprofile::confidence, ast_geoloc_eprofile::effective_location, ast_geoloc_eprofile::format, ast_geoloc_eprofile::id, ast_datastore::inheritance, len(), ast_geoloc_eprofile::location_reference, ast_geoloc_eprofile::location_source, LOG_ERROR, LOG_NOTICE, ast_geoloc_eprofile::method, ast_geoloc_eprofile::notes, NULL, options, pbx_builtin_setvar_helper(), ast_geoloc_eprofile::pidf_element, ast_geoloc_eprofile::precedence, RESOLVE_FOR_READ, ast_geoloc_eprofile::suppress_empty_ca_elements, and varlist_to_str().

◆ geoloc_profile_write()

static int geoloc_profile_write ( struct ast_channel chan,
const char *  cmd,
char *  data,
const char *  value 
)
static

Definition at line 222 of file geoloc_dialplan.c.

224{
225 char *parsed_data = ast_strdupa(data);
226 const char *chan_name = ast_channel_name(chan);
227 struct ast_datastore *ds; /* Reminder: datastores aren't ao2 objects */
228 RAII_VAR(struct ast_geoloc_eprofile *, eprofile, NULL, ao2_cleanup);
229 struct ast_flags opts = { 0, };
230
232 AST_APP_ARG(field);
234 );
235
236 /* Check for zero arguments */
237 if (ast_strlen_zero(parsed_data)) {
238 ast_log(LOG_ERROR, "%s: Cannot call without arguments\n", chan_name);
239 pbx_builtin_setvar_helper(chan, "GEOLOCPROFILESTATUS", "-1");
240 return 0;
241 }
242
243 AST_STANDARD_APP_ARGS(args, parsed_data);
244
245 if (ast_strlen_zero(args.field)) {
246 ast_log(LOG_ERROR, "%s: Cannot call without a field to set\n", chan_name);
247 pbx_builtin_setvar_helper(chan, "GEOLOCPROFILESTATUS", "-1");
248 return 0;
249 }
250
251 if (!ast_strlen_zero(args.options)) {
252 if (ast_app_parse_options(action_options, &opts, NULL, args.options)) {
253 ast_log(LOG_ERROR, "%s: Invalid options: %s\n", chan_name, args.options);
254 pbx_builtin_setvar_helper(chan, "GEOLOCPROFILESTATUS", "-1");
255 return 0;
256 }
257 }
258
259 ast_debug(1, "%s: name: %s value: %s options: %s append: %s resolve: %s\n", chan_name,
260 args.field, value, args.options, ast_test_flag(&opts, OPT_GEOLOC_APPEND) ? "yes" : "no",
261 ast_test_flag(&opts, OPT_GEOLOC_RESOLVE) ? "yes" : "no");
262
263 ds = ast_geoloc_datastore_find(chan);
264 if (!ds) {
266 if (!ds) {
267 ast_log(LOG_WARNING, "%s: Unable to create geolocation datastore\n", chan_name);
268 pbx_builtin_setvar_helper(chan, "GEOLOCPROFILESTATUS", "-2");
269 return 0;
270 }
272 }
273
274 eprofile = ast_geoloc_datastore_get_eprofile(ds, 0);
275 if (!eprofile) {
276 int rc;
277 eprofile = ast_geoloc_eprofile_alloc(chan_name);
278 if (!eprofile) {
279 ast_log(LOG_ERROR, "%s: Could not allocate eprofile\n", chan_name);
280 pbx_builtin_setvar_helper(chan, "GEOLOCPROFILESTATUS", "-2");
281 return 0;
282 }
283 rc = ast_geoloc_datastore_add_eprofile(ds, eprofile);
284 if (rc <= 0) {
285 ast_log(LOG_ERROR, "%s: Could not add eprofile to datastore\n", chan_name);
286 pbx_builtin_setvar_helper(chan, "GEOLOCPROFILESTATUS", "-2");
287 return 0;
288 }
289 }
290
291 if (ast_strings_equal(args.field, "inheritable")) {
293 } else if (ast_strings_equal(args.field, "id")) {
294 ast_string_field_set(eprofile, id, value);
295 } else if (ast_strings_equal(args.field, "location_reference")) {
297 ao2_cleanup(loc);
298 if (!loc) {
299 ast_log(LOG_ERROR, "%s: Location reference '%s' doesn't exist\n", chan_name, value);
300 pbx_builtin_setvar_helper(chan, "GEOLOCPROFILESTATUS", "-3");
301 return 0;
302 }
303 ast_string_field_set(eprofile, location_reference, value);
304 } else if (ast_strings_equal(args.field, "method")) {
306 } else if (ast_strings_equal(args.field, "allow_routing_use")) {
307 eprofile->allow_routing_use = ast_true(value);
308 } else if (ast_strings_equal(args.field, "suppress_empty_ca_elements")) {
309 eprofile->suppress_empty_ca_elements = ast_true(value);
310 } else if (ast_strings_equal(args.field, "profile_precedence")) {
311 TEST_ENUM_VALUE(chan_name, eprofile, precedence, value);
312 } else if (ast_strings_equal(args.field, "format")) {
313 TEST_ENUM_VALUE(chan_name, eprofile, format, value);
314 } else if (ast_strings_equal(args.field, "pidf_element")) {
315 TEST_ENUM_VALUE(chan_name, eprofile, pidf_element, value);
316 } else if (ast_strings_equal(args.field, "location_source")) {
318 } else if (ast_strings_equal(args.field, "notes")) {
319 ast_string_field_set(eprofile, notes, value);
320 } else if (ast_strings_equal(args.field, "location_info")) {
321 TEST_VARLIST(chan_name, eprofile, location_info, value);
323 } else if (ast_strings_equal(args.field, "location_info_refinement")) {
324 TEST_VARLIST(chan_name, eprofile, location_refinement, value);
325 RESOLVE_FOR_WRITE(location_refinement);
326 } else if (ast_strings_equal(args.field, "location_variables")) {
327 TEST_VARLIST(chan_name, eprofile, location_variables, value);
328 RESOLVE_FOR_WRITE(location_variables);
329 } else if (ast_strings_equal(args.field, "effective_location")) {
330 TEST_VARLIST(chan_name, eprofile, effective_location, value);
331 RESOLVE_FOR_WRITE(effective_location);
332 } else if (ast_strings_equal(args.field, "usage_rules")) {
333 TEST_VARLIST(chan_name, eprofile, usage_rules, value);
334 RESOLVE_FOR_WRITE(usage_rules);
335 } else if (ast_strings_equal(args.field, "confidence")) {
336 TEST_VARLIST(chan_name, eprofile, confidence, value);
337 } else {
338 ast_log(LOG_ERROR, "%s: Field '%s' is not valid\n", chan_name, args.field);
339 pbx_builtin_setvar_helper(chan, "GEOLOCPROFILESTATUS", "-3");
340 return 0;
341 }
342
344
345 pbx_builtin_setvar_helper(chan, "GEOLOCPROFILESTATUS", "0");
346
347 return 0;
348}
#define ao2_cleanup(obj)
Definition: astobj2.h:1934
int ast_channel_datastore_add(struct ast_channel *chan, struct ast_datastore *datastore)
Add a datastore to a channel.
Definition: channel.c:2404
#define RESOLVE_FOR_WRITE(_param)
#define TEST_ENUM_VALUE(_chan_name, _ep, _field, _value)
#define TEST_VARLIST(_chan_name, _ep, _field, _value)
#define ast_debug(level,...)
Log a DEBUG message.
#define LOG_WARNING
static int notes
Definition: pval.c:66
struct ast_datastore * ast_geoloc_datastore_create(const char *id)
Create an empty geoloc datastore.
struct ast_geoloc_eprofile * ast_geoloc_eprofile_alloc(const char *name)
Geolocation Effective Profile Functions.
struct ast_geoloc_location * ast_geoloc_get_location(const char *id)
Retrieve a geolocation location object by id.
int ast_geoloc_datastore_set_inheritance(struct ast_datastore *ds, int inherit)
Sets the inheritance flag on the datastore.
int ast_geoloc_datastore_add_eprofile(struct ast_datastore *ds, struct ast_geoloc_eprofile *eprofile)
Add an eprofile to a datastore.
const char * method
Definition: res_pjsip.c:1279
#define ast_string_field_set(x, field, data)
Set a field to a simple string value.
Definition: stringfields.h:521
int attribute_pure ast_true(const char *val)
Make sure something is true. Determine if a string containing a boolean value is "true"....
Definition: utils.c:2199
enum ast_geoloc_format format
struct ast_variable * confidence
const ast_string_field location_source
struct ast_variable * location_info
int value
Definition: syslog.c:37
#define ast_test_flag(p, flag)
Definition: utils.h:63
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
Definition: utils.h:941

References action_options, ao2_cleanup, args, AST_APP_ARG, ast_app_parse_options(), ast_channel_datastore_add(), ast_channel_name(), ast_debug, AST_DECLARE_APP_ARGS, ast_geoloc_datastore_add_eprofile(), ast_geoloc_datastore_create(), ast_geoloc_datastore_find(), ast_geoloc_datastore_get_eprofile(), ast_geoloc_datastore_set_inheritance(), ast_geoloc_eprofile_alloc(), ast_geoloc_eprofile_refresh_location(), ast_geoloc_get_location(), ast_log, AST_STANDARD_APP_ARGS, ast_strdupa, ast_string_field_set, ast_strings_equal(), ast_strlen_zero(), ast_test_flag, ast_true(), ast_geoloc_location::confidence, ast_geoloc_location::format, ast_geoloc_location::location_info, ast_geoloc_location::location_source, LOG_ERROR, LOG_WARNING, method, notes, NULL, OPT_GEOLOC_APPEND, OPT_GEOLOC_RESOLVE, options, pbx_builtin_setvar_helper(), RAII_VAR, RESOLVE_FOR_WRITE, TEST_ENUM_VALUE, TEST_VARLIST, and value.

◆ varlist_to_str()

static void varlist_to_str ( struct ast_variable list,
struct ast_str **  buf,
size_t  len 
)
static

Definition at line 30 of file geoloc_dialplan.c.

31{
32 struct ast_variable *var = list;
33
34 for (; var; var = var->next) {
35 ast_str_append(buf, len, "%s=\"%s\"%s", var->name, var->value, var->next ? "," : "");
36 }
37}
#define var
Definition: ast_expr2f.c:605
Structure for variables, used for configurations and for channel variables.

References ast_str_append(), buf, len(), and var.

Referenced by geoloc_profile_read().

Variable Documentation

◆ action_options

const struct ast_app_option action_options[128] = { [ 'r' ] = { .flag = OPT_GEOLOC_RESOLVE }, [ 'a' ] = { .flag = OPT_GEOLOC_APPEND }, }
static

Definition at line 64 of file geoloc_dialplan.c.

Referenced by geoloc_profile_read(), and geoloc_profile_write().

◆ geoloc_function

struct ast_custom_function geoloc_function
static
Initial value:
= {
.name = "GEOLOC_PROFILE",
}
static int geoloc_profile_read(struct ast_channel *chan, const char *cmd, char *data, struct ast_str **buf, ssize_t len)
static int geoloc_profile_write(struct ast_channel *chan, const char *cmd, char *data, const char *value)

Definition at line 350 of file geoloc_dialplan.c.

Referenced by geoloc_dialplan_load(), and geoloc_dialplan_unload().