[asterisk-commits] mmichelson: branch mmichelson/pub_sub r385115 - /team/mmichelson/pub_sub/res/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Apr 9 11:51:46 CDT 2013


Author: mmichelson
Date: Tue Apr  9 11:51:42 2013
New Revision: 385115

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=385115
Log:
Add stubs for callbacks on subscriptions.


Modified:
    team/mmichelson/pub_sub/res/res_sip_pubsub.c

Modified: team/mmichelson/pub_sub/res/res_sip_pubsub.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/pub_sub/res/res_sip_pubsub.c?view=diff&rev=385115&r1=385114&r2=385115
==============================================================================
--- team/mmichelson/pub_sub/res/res_sip_pubsub.c (original)
+++ team/mmichelson/pub_sub/res/res_sip_pubsub.c Tue Apr  9 11:51:42 2013
@@ -47,6 +47,7 @@
 	struct ast_sip_endpoint *endpoint;
 	struct ast_taskprocessor *serializer;
 	const struct ast_sip_subscription_handler *handler;
+	enum ast_sip_subscription_role role;
 	pjsip_evsub *evsub;
 };
 
@@ -82,6 +83,25 @@
 	ao2_cleanup(sub->endpoint);
 	ast_taskprocessor_unreference(sub->serializer);
 }
+
+static void pubsub_on_evsub_state(pjsip_evsub *sub, pjsip_event *event);
+static void pubsub_on_tsx_state(pjsip_evsub *sub, pjsip_transaction *tsx, pjsip_event *event);
+static void pubsub_on_rx_refresh(pjsip_evsub *sub, pjsip_rx_data *rdata,
+		int *p_st_code, pj_str_t **p_st_text, pjsip_hdr *res_hdr, pjsip_msg_body **p_body);
+static void pubsub_on_rx_notify(pjsip_evsub *sub, pjsip_rx_data *rdata, int *p_st_code,
+		pj_str_t **p_st_text, pjsip_hdr *res_hdr, pjsip_msg_body **p_body);
+static void pubsub_on_client_refresh(pjsip_evsub *sub);
+static void pubsub_on_server_timeout(pjsip_evsub *sub);
+
+
+static pjsip_evsub_user pubsub_cb = {
+	.on_evsub_state = pubsub_on_evsub_state,
+	.on_tsx_state = pubsub_on_tsx_state,
+	.on_rx_refresh = pubsub_on_rx_refresh,
+	.on_rx_notify = pubsub_on_rx_notify,
+	.on_client_refresh = pubsub_on_client_refresh,
+	.on_server_timeout = pubsub_on_server_timeout,
+};
 
 static pjsip_evsub *allocate_evsub(const char *event, enum ast_sip_subscription_role role,
 		struct ast_sip_endpoint *endpoint, pjsip_rx_data *rdata)
@@ -95,22 +115,22 @@
 	if (role == AST_SIP_NOTIFIER) {
 		pjsip_dlg_create_uas(pjsip_ua_instance(), rdata, NULL, &dlg);
 		if (!strcmp(event, "message-summary")) {
-			pjsip_mwi_create_uas(dlg, NULL, rdata, &evsub);
+			pjsip_mwi_create_uas(dlg, &pubsub_cb, rdata, &evsub);
 		} else if (!strcmp(event, "presence")) {
-			pjsip_pres_create_uas(dlg, NULL, rdata, &evsub);
+			pjsip_pres_create_uas(dlg, &pubsub_cb, rdata, &evsub);
 		} else {
-			pjsip_evsub_create_uas(dlg, NULL, rdata, 0, &evsub);
+			pjsip_evsub_create_uas(dlg, &pubsub_cb, rdata, 0, &evsub);
 		}
 	} else {
 		dlg = ast_sip_create_dialog(endpoint, NULL, NULL);
 		if (!strcmp(event, "message-summary")) {
-			pjsip_mwi_create_uac(dlg, NULL, 0, &evsub);
+			pjsip_mwi_create_uac(dlg, &pubsub_cb, 0, &evsub);
 		} else if (!strcmp(event, "presence")) {
-			pjsip_pres_create_uac(dlg, NULL, 0, &evsub);
+			pjsip_pres_create_uac(dlg, &pubsub_cb, 0, &evsub);
 		} else {
 			pj_str_t pj_event;
 			pj_cstr(&pj_event, event);
-			pjsip_evsub_create_uac(dlg, NULL, &pj_event, 0, &evsub);
+			pjsip_evsub_create_uac(dlg, &pubsub_cb, &pj_event, 0, &evsub);
 		}
 	}
 	return evsub;
@@ -344,6 +364,38 @@
 	return PJ_TRUE;
 }
 
+static void pubsub_on_evsub_state(pjsip_evsub *sub, pjsip_event *event)
+{
+	/* XXX STUB */
+}
+
+static void pubsub_on_tsx_state(pjsip_evsub *sub, pjsip_transaction *tsx, pjsip_event *event)
+{
+	/* XXX STUB */
+}
+
+static void pubsub_on_rx_refresh(pjsip_evsub *sub, pjsip_rx_data *rdata,
+		int *p_st_code, pj_str_t **p_st_text, pjsip_hdr *res_hdr, pjsip_msg_body **p_body)
+{
+	/* XXX STUB */
+}
+
+static void pubsub_on_rx_notify(pjsip_evsub *sub, pjsip_rx_data *rdata, int *p_st_code,
+		pj_str_t **p_st_text, pjsip_hdr *res_hdr, pjsip_msg_body **p_body)
+{
+	/* XXX STUB */
+}
+
+static void pubsub_on_client_refresh(pjsip_evsub *sub)
+{
+	/* XXX STUB */
+}
+
+static void pubsub_on_server_timeout(pjsip_evsub *sub)
+{
+	/* XXX STUB */
+}
+
 static int load_module(void)
 {
 	if (ast_sip_register_service(&sub_module)) {




More information about the asterisk-commits mailing list