summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Michelson <mmichelson@digium.com>2014-09-18 18:56:54 +0000
committerMark Michelson <mmichelson@digium.com>2014-09-18 18:56:54 +0000
commitde72f3edbc6385a5ff438484a6b31d5548de1caf (patch)
treec0dd35072f641e531ea628c1dc52c821935a61f3
parentac46240b6247f52db28f762037cb2ccf2795cc42 (diff)
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
-rw-r--r--res/res_pjsip_pubsub.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/res/res_pjsip_pubsub.c b/res/res_pjsip_pubsub.c
index 0611f2595..da632d877 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;