[asterisk-commits] mmichelson: branch mmichelson/subscription_abstraction r416437 - /team/mmiche...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Jun 16 17:03:05 CDT 2014
Author: mmichelson
Date: Mon Jun 16 17:03:00 2014
New Revision: 416437
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=416437
Log:
Be sure not to leave a NULL sip_sub field on the exten state subscription.
The next thing that needs to be done is to figure out the User-Agent situation
for presence subscriptions since many of the tests need this.
Modified:
team/mmichelson/subscription_abstraction/res/res_pjsip_exten_state.c
Modified: team/mmichelson/subscription_abstraction/res/res_pjsip_exten_state.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/subscription_abstraction/res/res_pjsip_exten_state.c?view=diff&rev=416437&r1=416436&r2=416437
==============================================================================
--- team/mmichelson/subscription_abstraction/res/res_pjsip_exten_state.c (original)
+++ team/mmichelson/subscription_abstraction/res/res_pjsip_exten_state.c Mon Jun 16 17:03:00 2014
@@ -110,7 +110,8 @@
* Creates the underlying SIP subscription for the given request. First makes
* sure that there are registered handler and provider objects available.
*/
-static struct exten_state_subscription *exten_state_subscription_alloc(struct ast_sip_endpoint *endpoint)
+static struct exten_state_subscription *exten_state_subscription_alloc(
+ struct ast_sip_subscription *sip_sub, struct ast_sip_endpoint *endpoint)
{
struct exten_state_subscription * exten_state_sub;
@@ -119,6 +120,7 @@
return NULL;
}
+ exten_state_sub->sip_sub = ao2_bump(sip_sub);
exten_state_sub->last_exten_state = INITIAL_LAST_EXTEN_STATE;
exten_state_sub->last_presence_state = AST_PRESENCE_NOT_SET;
/* XXX TODO Previously, user agent was reaped from the rdata here and stored on the
@@ -344,7 +346,7 @@
const char *resource = ast_sip_subscription_get_resource_name(sip_sub);
struct exten_state_subscription *exten_state_sub;
- if (!(exten_state_sub = exten_state_subscription_alloc(endpoint))) {
+ if (!(exten_state_sub = exten_state_subscription_alloc(sip_sub, endpoint))) {
ao2_cleanup(endpoint);
return -1;
}
@@ -363,19 +365,20 @@
return -1;
}
+ /* Go ahead and cleanup the endpoint since we don't need it anymore */
+ ao2_cleanup(endpoint);
+
/* bump the ref since ast_extension_state_add holds a reference */
ao2_ref(exten_state_sub, +1);
if (add_datastore(exten_state_sub)) {
ast_log(LOG_WARNING, "Unable to add to subscription datastore.\n");
- ao2_cleanup(endpoint);
ao2_cleanup(exten_state_sub);
return -1;
}
send_notify(exten_state_sub);
ao2_cleanup(exten_state_sub);
- ao2_cleanup(endpoint);
return 0;
}
More information about the asterisk-commits
mailing list