From: Mark Michelson Date: Thu, 18 Sep 2014 18:56:54 +0000 (+0000) Subject: Add subscription state test events. X-Git-Tag: 14.0.0-beta1~1645 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=de72f3edbc6385a5ff438484a6b31d5548de1caf;p=thirdparty%2Fasterisk.git Add subscription state test events. These are needed for a set of batched notification RLS tests that are about to be committed to the testsuite. Review: https://reviewboard.asterisk.org/r/3967 ........ Merged revisions 423462 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@423463 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/res/res_pjsip_pubsub.c b/res/res_pjsip_pubsub.c index 0611f25953..da632d877f 100644 --- a/res/res_pjsip_pubsub.c +++ b/res/res_pjsip_pubsub.c @@ -2075,6 +2075,9 @@ static int serialized_send_notify(void *userdata) } send_notify(sub_tree, 0); + ast_test_suite_event_notify("SUBSCRIPTION_STATE_CHANGED", + "Resource: %s", + sub_tree->root->resource); sub_tree->notify_sched_id = -1; ao2_cleanup(sub_tree); return 0; @@ -2125,8 +2128,11 @@ int ast_sip_subscription_notify(struct ast_sip_subscription *sub, struct ast_sip /* See the note in pubsub_on_rx_refresh() for why sub->tree is refbumped here */ ao2_ref(sub->tree, +1); res = send_notify(sub->tree, 0); + ast_test_suite_event_notify(terminate ? "SUBSCRIPTION_TERMINATED" : "SUBSCRIPTION_STATE_CHANGED", + "Resource: %s", + sub->tree->root->resource); ao2_ref(sub->tree, -1); - + return res; } } @@ -2569,6 +2575,9 @@ static pj_bool_t pubsub_on_rx_subscribe_request(pjsip_rx_data *rdata) pjsip_evsub_terminate(sub_tree->evsub, PJ_TRUE); } send_notify(sub_tree, 1); + ast_test_suite_event_notify("SUBSCRIPTION_ESTABLISHED", + "Resource: %s", + sub_tree->root->resource); } resource_tree_destroy(&tree); @@ -3112,6 +3121,10 @@ static void pubsub_on_rx_refresh(pjsip_evsub *evsub, pjsip_rx_data *rdata, *p_st_code = 500; } + ast_test_suite_event_notify(sub_tree->root->subscription_state == PJSIP_EVSUB_STATE_TERMINATED ? + "SUBSCRIPTION_TERMINATED" : "SUBSCRIPTION_REFRESHED", + "Resource: %s", sub_tree->root->resource); + if (sub_tree->is_list) { pj_list_insert_before(res_hdr, create_require_eventlist(rdata->tp_info.pool)); } @@ -3161,6 +3174,9 @@ static int serialized_pubsub_on_server_timeout(void *userdata) set_state_terminated(sub_tree->root); send_notify(sub_tree, 1); + ast_test_suite_event_notify("SUBSCRIPTION_TERMINATED", + "Resource: %s", + sub_tree->root->resource); ao2_cleanup(sub_tree); return 0;