summaryrefslogtreecommitdiff
path: root/res/res_pjsip_mwi_body_generator.c
diff options
context:
space:
mode:
authorMark Michelson <mmichelson@digium.com>2014-09-18 16:09:25 +0000
committerMark Michelson <mmichelson@digium.com>2014-09-18 16:09:25 +0000
commit79eac1ffcaa419a2c21c43dc9f1c26dda92594f9 (patch)
tree1f3a9272d8a70d968e0401e9bcc2df524c7eb096 /res/res_pjsip_mwi_body_generator.c
parent126334a7aa9a8ba27e5abe02f1a07e526675aab4 (diff)
res_pjsip_pubsub: Add some type safety when generating NOTIFY bodies.
res_pjsip_pubsub has two separate checks that it makes when a SUBSCRIBE arrives. * It checks that there is a subscription handler for the Event * It checks that there are body generators for the types in the Accept header The problem is, there's nothing that ensures that these two things will actually mesh with each other. For instance, Asterisk will accept a subscription to MWI that accepts pidf+xml bodies. That doesn't make sense. With this commit, we add some type information to the mix. Subscription handlers state they generate data of type X, and body generators state that they consume data of type X. This way, Asterisk doesn't end up in some hilariously mismatched situation like the one in the previous paragraph. ASTERISK-24136 #close Reported by Mark Michelson Review: https://reviewboard.asterisk.org/r/3877 Review: https://reviewboard.asterisk.org/r/3878 ........ Merged revisions 423344 from http://svn.asterisk.org/svn/asterisk/branches/12 ........ Merged revisions 423348 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@423350 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_pjsip_mwi_body_generator.c')
-rw-r--r--res/res_pjsip_mwi_body_generator.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/res/res_pjsip_mwi_body_generator.c b/res/res_pjsip_mwi_body_generator.c
index 14c3d6216..2020e26de 100644
--- a/res/res_pjsip_mwi_body_generator.c
+++ b/res/res_pjsip_mwi_body_generator.c
@@ -85,6 +85,7 @@ static void mwi_destroy_body(void *body)
static struct ast_sip_pubsub_body_generator mwi_generator = {
.type = MWI_TYPE,
.subtype = MWI_SUBTYPE,
+ .body_type = AST_SIP_MESSAGE_ACCUMULATOR,
.allocate_body = mwi_allocate_body,
.generate_body_content = mwi_generate_body_content,
.to_string = mwi_to_string,