[asterisk-commits] mmichelson: branch mmichelson/rls-notify r418137 - in /team/mmichelson/rls-no...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Jul 7 13:55:23 CDT 2014
Author: mmichelson
Date: Mon Jul 7 13:55:16 2014
New Revision: 418137
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=418137
Log:
Resolve conflict in res_pjsip_exten_state.c and reset automerge.
Added:
team/mmichelson/rls-notify/res/res_pjsip_dialog_info_body_generator.c
- copied unchanged from r418117, trunk/res/res_pjsip_dialog_info_body_generator.c
Modified:
team/mmichelson/rls-notify/ (props changed)
team/mmichelson/rls-notify/include/asterisk/res_pjsip_body_generator_types.h
team/mmichelson/rls-notify/include/asterisk/res_pjsip_presence_xml.h
team/mmichelson/rls-notify/res/res_pjsip/presence_xml.c
team/mmichelson/rls-notify/res/res_pjsip_exten_state.c
Propchange: team/mmichelson/rls-notify/
------------------------------------------------------------------------------
automerge = *
Propchange: team/mmichelson/rls-notify/
------------------------------------------------------------------------------
Binary property 'branch-12-merged' - no diff available.
Propchange: team/mmichelson/rls-notify/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon Jul 7 13:55:16 2014
@@ -1,1 +1,1 @@
-/trunk:1-418092
+/trunk:1-418136
Modified: team/mmichelson/rls-notify/include/asterisk/res_pjsip_body_generator_types.h
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/rls-notify/include/asterisk/res_pjsip_body_generator_types.h?view=diff&rev=418137&r1=418136&r2=418137
==============================================================================
--- team/mmichelson/rls-notify/include/asterisk/res_pjsip_body_generator_types.h (original)
+++ team/mmichelson/rls-notify/include/asterisk/res_pjsip_body_generator_types.h Mon Jul 7 13:55:16 2014
@@ -28,6 +28,7 @@
* \li application/pidf+xml
* \li application/xpidf+xml
* \li application/cpim-pidf+xml
+ * \li application/dialog-info+xml
*/
struct ast_sip_exten_state_data {
/*! The extension of the current state change */
@@ -48,6 +49,8 @@
char local[PJSIP_MAX_URL_SIZE];
/*! Remote dialog URI */
char remote[PJSIP_MAX_URL_SIZE];
+ /*! Optional subscription */
+ struct ast_sip_subscription *sub;
/*! Allocation pool */
pj_pool_t *pool;
};
Modified: team/mmichelson/rls-notify/include/asterisk/res_pjsip_presence_xml.h
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/rls-notify/include/asterisk/res_pjsip_presence_xml.h?view=diff&rev=418137&r1=418136&r2=418137
==============================================================================
--- team/mmichelson/rls-notify/include/asterisk/res_pjsip_presence_xml.h (original)
+++ team/mmichelson/rls-notify/include/asterisk/res_pjsip_presence_xml.h Mon Jul 7 13:55:16 2014
@@ -72,7 +72,7 @@
* \brief Create XML node
*
* \param pool Allocation pool
- * \param parent Node that will be parent to the created node
+ * \param parent Optional node that will be parent to the created node
* \param name The name for the new node
* \return The created node
*/
Modified: team/mmichelson/rls-notify/res/res_pjsip/presence_xml.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/rls-notify/res/res_pjsip/presence_xml.c?view=diff&rev=418137&r1=418136&r2=418137
==============================================================================
--- team/mmichelson/rls-notify/res/res_pjsip/presence_xml.c (original)
+++ team/mmichelson/rls-notify/res/res_pjsip/presence_xml.c Mon Jul 7 13:55:16 2014
@@ -152,7 +152,10 @@
node->content.ptr = NULL;
node->content.slen = 0;
- pj_xml_add_node(parent, node);
+ if (parent) {
+ pj_xml_add_node(parent, node);
+ }
+
return node;
}
Modified: team/mmichelson/rls-notify/res/res_pjsip_exten_state.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/rls-notify/res/res_pjsip_exten_state.c?view=diff&rev=418137&r1=418136&r2=418137
==============================================================================
--- team/mmichelson/rls-notify/res/res_pjsip_exten_state.c (original)
+++ team/mmichelson/rls-notify/res/res_pjsip_exten_state.c Mon Jul 7 13:55:16 2014
@@ -66,6 +66,7 @@
};
#define DEFAULT_PRESENCE_BODY "application/pidf+xml"
+#define DEFAULT_DIALOG_BODY "application/dialog-info+xml"
static void subscription_shutdown(struct ast_sip_subscription *sub);
static int new_subscribe(struct ast_sip_endpoint *endpoint, const char *resource);
@@ -81,12 +82,27 @@
.get_notify_data = get_notify_data,
};
+struct ast_sip_notifier dialog_notifier = {
+ .default_accept = DEFAULT_DIALOG_BODY,
+ .new_subscribe = new_subscribe,
+ .subscription_established = subscription_established,
+ .get_notify_data = get_notify_data,
+};
+
struct ast_sip_subscription_handler presence_handler = {
.event_name = "presence",
.accept = { DEFAULT_PRESENCE_BODY, },
.subscription_shutdown = subscription_shutdown,
.to_ami = to_ami,
.notifier = &presence_notifier,
+};
+
+struct ast_sip_subscription_handler dialog_handler = {
+ .event_name = "dialog",
+ .accept = { DEFAULT_DIALOG_BODY, },
+ .subscription_shutdown = subscription_shutdown,
+ .to_ami = to_ami,
+ .notifier = &dialog_notifier,
};
static void exten_state_subscription_destructor(void *obj)
@@ -185,6 +201,7 @@
task_data->exten_state_data.presence_message = ast_strdup(info->presence_message);
task_data->exten_state_data.user_agent = ast_strdup(exten_state_sub->user_agent);
task_data->exten_state_data.device_state_info = info->device_state_info;
+ task_data->exten_state_data.sub = exten_state_sub->sip_sub;
if (task_data->exten_state_data.device_state_info) {
ao2_ref(task_data->exten_state_data.device_state_info, +1);
@@ -212,6 +229,8 @@
/* Pool allocation has to happen here so that we allocate within a PJLIB thread */
task_data->exten_state_data.pool = pjsip_endpt_create_pool(ast_sip_get_pjsip_endpoint(),
"exten_state", 1024, 1024);
+
+ task_data->exten_state_data.sub = task_data->exten_state_sub->sip_sub;
ast_sip_subscription_notify(task_data->exten_state_sub->sip_sub, &task_data->exten_state_data,
task_data->terminate);
@@ -393,6 +412,7 @@
sizeof(exten_state_data->local));
ast_sip_subscription_get_remote_uri(sip_sub, exten_state_data->remote,
sizeof(exten_state_data->remote));
+ exten_state_data->sub = sip_sub;
if ((exten_state_data->exten_state = ast_extension_state_extended(
NULL, exten_state_sub->context, exten_state_sub->exten, &info)) < 0) {
@@ -438,11 +458,20 @@
presence_handler.event_name);
return AST_MODULE_LOAD_DECLINE;
}
+
+ if (ast_sip_register_subscription_handler(&dialog_handler)) {
+ ast_log(LOG_WARNING, "Unable to register subscription handler %s\n",
+ dialog_handler.event_name);
+ ast_sip_unregister_subscription_handler(&presence_handler);
+ return AST_MODULE_LOAD_DECLINE;
+ }
+
return AST_MODULE_LOAD_SUCCESS;
}
static int unload_module(void)
{
+ ast_sip_unregister_subscription_handler(&dialog_handler);
ast_sip_unregister_subscription_handler(&presence_handler);
return 0;
}
More information about the asterisk-commits
mailing list