static int mwi_subscription_established(struct ast_sip_subscription *sip_sub) { const char *resource = ast_sip_subscription_get_resource_name(sip_sub); struct mwi_subscription *sub; struct ast_sip_endpoint *endpoint = ast_sip_subscription_get_endpoint(sip_sub); /* no aor in uri? subscribe to all on endpoint */ if (ast_strlen_zero(resource)) { sub = mwi_subscribe_all(endpoint, sip_sub); } else { sub = mwi_subscribe_single(endpoint, sip_sub, resource); } if (!sub) { ao2_cleanup(endpoint); return -1; } if (!ao2_container_count(sub->stasis_subs)) { /* * We setup no MWI subscriptions so remove the MWI datastore * to break the ref loop. */ ast_sip_subscription_remove_datastore(sip_sub, MWI_DATASTORE); } ao2_cleanup(sub); ao2_cleanup(endpoint); return 0; }
static int mwi_subscription_established(struct ast_sip_subscription *sip_sub) { const char *resource = ast_sip_subscription_get_resource_name(sip_sub); struct mwi_subscription *sub; struct ast_sip_endpoint *endpoint = ast_sip_subscription_get_endpoint(sip_sub); /* no aor in uri? subscribe to all on endpoint */ if (ast_strlen_zero(resource)) { sub = mwi_subscribe_all(endpoint, sip_sub); } else { sub = mwi_subscribe_single(endpoint, sip_sub, resource); } if (!sub) { ao2_cleanup(endpoint); return -1; } ao2_cleanup(sub); ao2_cleanup(endpoint); return 0; }