[svn-commits] file: branch file/pimp_sip_location r382781 - in /team/file/pimp_sip_location...
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Sat Mar 9 18:25:23 CST 2013
Author: file
Date: Sat Mar 9 18:25:20 2013
New Revision: 382781
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=382781
Log:
Change static contacts to permanent internally and simply make them configurable as "contact" on the AOR.
Modified:
team/file/pimp_sip_location/include/asterisk/res_sip.h
team/file/pimp_sip_location/res/res_sip/location.c
Modified: team/file/pimp_sip_location/include/asterisk/res_sip.h
URL: http://svnview.digium.com/svn/asterisk/team/file/pimp_sip_location/include/asterisk/res_sip.h?view=diff&rev=382781&r1=382780&r2=382781
==============================================================================
--- team/file/pimp_sip_location/include/asterisk/res_sip.h (original)
+++ team/file/pimp_sip_location/include/asterisk/res_sip.h Sat Mar 9 18:25:20 2013
@@ -131,8 +131,8 @@
unsigned int default_expiration;
/*! Maximum number of external contacts, 0 to disable */
unsigned int max_contacts;
- /*! Any statically configured contacts */
- struct ao2_container *static_contacts;
+ /*! Any permanent configured contacts */
+ struct ao2_container *permanent_contacts;
};
/*!
Modified: team/file/pimp_sip_location/res/res_sip/location.c
URL: http://svnview.digium.com/svn/asterisk/team/file/pimp_sip_location/res/res_sip/location.c?view=diff&rev=382781&r1=382780&r2=382781
==============================================================================
--- team/file/pimp_sip_location/res/res_sip/location.c (original)
+++ team/file/pimp_sip_location/res/res_sip/location.c Sat Mar 9 18:25:20 2013
@@ -32,7 +32,7 @@
{
struct ast_sip_aor *aor = obj;
- ao2_cleanup(aor->static_contacts);
+ ao2_cleanup(aor->permanent_contacts);
}
/*! \brief Allocator for AOR */
@@ -110,9 +110,9 @@
/* Prune any expired contacts and delete them, we do this first because static contacts can never expire */
ao2_callback(contacts, OBJ_NOLOCK | OBJ_NODATA | OBJ_MULTIPLE | OBJ_UNLINK, contact_expire, NULL);
- /* Add any static contacts from the AOR */
- if (aor->static_contacts) {
- ao2_callback(aor->static_contacts, OBJ_NOLOCK | OBJ_NODATA, contact_link_static, contacts);
+ /* Add any permanent contacts from the AOR */
+ if (aor->permanent_contacts) {
+ ao2_callback(aor->permanent_contacts, OBJ_NOLOCK | OBJ_NODATA, contact_link_static, contacts);
}
return contacts;
@@ -164,19 +164,19 @@
return (ast_asprintf(buf, "%lu", contact->expiration_time.tv_sec) < 0) ? -1 : 0;
}
-/*! \brief Custom handler for static URIs */
-static int static_uri_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
+/*! \brief Custom handler for permanent URIs */
+static int permanent_uri_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
{
struct ast_sip_aor *aor = obj;
RAII_VAR(struct ast_sip_contact *, contact, NULL, ao2_cleanup);
- if ((!aor->static_contacts && !(aor->static_contacts = ao2_container_alloc_options(AO2_ALLOC_OPT_LOCK_NOLOCK, 1, NULL, NULL))) ||
+ if ((!aor->permanent_contacts && !(aor->permanent_contacts = ao2_container_alloc_options(AO2_ALLOC_OPT_LOCK_NOLOCK, 1, NULL, NULL))) ||
!(contact = ast_sorcery_alloc(ast_sip_get_sorcery(), "contact", NULL))) {
return -1;
}
ast_string_field_set(contact, uri, var->value);
- ao2_link_flags(aor->static_contacts, contact, OBJ_NOLOCK);
+ ao2_link_flags(aor->permanent_contacts, contact, OBJ_NOLOCK);
return 0;
}
@@ -199,7 +199,7 @@
ast_sorcery_object_field_register(sorcery, "aor", "type", "", OPT_NOOP_T, 0, 0);
ast_sorcery_object_field_register(sorcery, "aor", "default_expiration", "3600", OPT_UINT_T, 0, FLDSET(struct ast_sip_aor, default_expiration));
ast_sorcery_object_field_register(sorcery, "aor", "max_contacts", "0", OPT_UINT_T, 0, FLDSET(struct ast_sip_aor, max_contacts));
- ast_sorcery_object_field_register_custom(sorcery, "aor", "static", "", static_uri_handler, NULL, 0, 0);
+ ast_sorcery_object_field_register_custom(sorcery, "aor", "contact", "", permanent_uri_handler, NULL, 0, 0);
return 0;
}
More information about the svn-commits
mailing list