asterisk/res
Mark Michelson f55abe9cf1 Decouple subscription handling from NOTIFY/PUBLISH body generation.
When the PJSIP pubsub framework was created, subscription handlers were required
to state what event they handled along with what body types they knew how to
generate. While this serves well when implementing a base RFC, it has problems
when trying to extend the body to support non-standard or proprietary body
elements. The code also was NOTIFY-specific, meaning that when the time comes
that we start writing code to send out PUBLISH requests with MWI or presence
bodies, we would likely find ourselves duplicating code that had previously been
written.

This changeset introduces the concept of body generators and body supplements. A
body generator is responsible for allocating a native structure for a given body
type, providing the primary body content, converting the native structure to a
string, and deallocating resources. A body supplement takes the primary body
content (the native structure, not a string) generated by the body generator and
adds nonstandard elements to the body. With these elements living in their own
module, it becomes easy to extend our support for body types and to re-use
resources when sending a PUBLISH request.

Body generators and body supplements register themselves with the pubsub core,
similar to how subscription and publish handlers had done. Now, subscription
handlers do not need to know what type of body content they generate, but they
still need to inform the pubsub core about what the default body type for a
given event package is. The pubsub core keeps track of what body generators and
body supplements have been registered. When a SUBSCRIBE arrives, the pubsub core
will check that there is a subscription handler for the event in the SUBSCRIBE,
then it will check that there is a body generator that can provide the content
specified in the Accept header(s).

Because of the nature of body generators and supplements, it means
res_pjsip_exten_state and res_pjsip_mwi have been completely gutted. They no
longer worry about body types, instead calling
ast_sip_pubsub_generate_body_content() when they need to generate a NOTIFY body.

Review: https://reviewboard.asterisk.org/r/3150
........

Merged revisions 407016 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@407030 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-01-31 22:27:07 +00:00
..
ael Clean up and ensure proper usage of alloca() 2012-07-31 20:21:43 +00:00
ari ARI: Support channel variables in originate 2014-01-21 14:27:21 +00:00
parking ao2_iterator: Mini-audit of the ao2_iterator loops in the new code files. 2013-12-20 20:00:50 +00:00
res_pjsip Decouple subscription handling from NOTIFY/PUBLISH body generation. 2014-01-31 22:27:07 +00:00
snmp Get the SNMP code to compile. 2013-08-02 15:01:37 +00:00
stasis res_stasis: Expose event for call forwarding and follow forwarded channel. 2013-12-14 17:19:41 +00:00
stasis_recording MALLOC_DEBUG: Fix some misuses of free() when MALLOC_DEBUG is enabled. 2013-10-02 17:12:49 +00:00
Makefile ARI: Implement /recordings/stored API's 2013-08-30 13:28:50 +00:00
ari.make ARI: Add mailboxes resource for controlling and polling external MWI 2014-01-14 23:44:57 +00:00
res_adsi.c Multiple revisions 369323-369324 2012-06-25 15:55:25 +00:00
res_ael_share.c Merged revisions 328247 via svnmerge from 2011-07-14 20:28:54 +00:00
res_ael_share.exports.in Allow symbol export filtering to work properly on platforms that have symbol prefixes. 2010-04-02 18:57:58 +00:00
res_agi.c channel locking: Add locking for channel snapshot creation 2013-12-18 20:33:37 +00:00
res_agi.exports.in Allow symbol export filtering to work properly on platforms that have symbol prefixes. 2010-04-02 18:57:58 +00:00
res_ari.c res_ari: Fix various memory leaks. 2014-01-12 22:24:27 +00:00
res_ari.exports.in Rename everything Stasis-HTTP to ARI 2013-07-27 23:11:02 +00:00
res_ari_applications.c ARI: Support channel variables in originate 2014-01-21 14:27:21 +00:00
res_ari_asterisk.c ARI: Support channel variables in originate 2014-01-21 14:27:21 +00:00
res_ari_bridges.c ARI: Support channel variables in originate 2014-01-21 14:27:21 +00:00
res_ari_channels.c ARI: Support channel variables in originate 2014-01-21 14:27:21 +00:00
res_ari_device_states.c ARI: Support channel variables in originate 2014-01-21 14:27:21 +00:00
res_ari_endpoints.c ari:Add application/json parameter support 2013-11-27 15:48:39 +00:00
res_ari_events.c ari: User better nicknames for ARI operations 2013-11-07 21:10:31 +00:00
res_ari_mailboxes.c ARI: Support channel variables in originate 2014-01-21 14:27:21 +00:00
res_ari_model.c ARI: Add subscription support 2013-10-04 16:01:48 +00:00
res_ari_model.exports.in Rename everything Stasis-HTTP to ARI 2013-07-27 23:11:02 +00:00
res_ari_playbacks.c ARI: Support channel variables in originate 2014-01-21 14:27:21 +00:00
res_ari_recordings.c ari:Add application/json parameter support 2013-11-27 15:48:39 +00:00
res_ari_sounds.c ARI: Support channel variables in originate 2014-01-21 14:27:21 +00:00
res_calendar.c channels: Return allocated channels locked. 2013-12-18 19:28:05 +00:00
res_calendar.exports.in Allow symbol export filtering to work properly on platforms that have symbol prefixes. 2010-04-02 18:57:58 +00:00
res_calendar_caldav.c Fix a variety of memory leaks 2012-05-18 14:43:44 +00:00
res_calendar_ews.c Properly extract the Body information of an EWS calendar item 2012-10-31 14:58:44 +00:00
res_calendar_exchange.c Add uuid wrapper API call ast_uuid_generate_str(). 2013-03-28 23:59:20 +00:00
res_calendar_icalendar.c Fix memory leak in res_calendar_icalendar 2013-01-30 14:19:29 +00:00
res_chan_stats.c Multiple revisions 399887,400138,400178,400180-400181 2013-09-30 18:55:27 +00:00
res_clialiases.c The UUID commit removed changes made in res_clialiases.c 2012-12-13 15:37:45 +00:00
res_clioriginate.c Cache string values of formats on ast_format_cap() to save processing. 2013-10-03 14:58:16 +00:00
res_config_curl.c Add support for a realtime sorcery module. 2013-04-27 12:01:29 +00:00
res_config_ldap.c Add support for a realtime sorcery module. 2013-04-27 12:01:29 +00:00
res_config_odbc.c Fix Finding Extensions With Patterns Using ODBC Realtime 2013-05-10 20:28:18 +00:00
res_config_pgsql.c res_config_pgsql: Fix a memory leak and use RAII_VAR for cleanup when practical 2014-01-24 21:46:54 +00:00
res_config_sqlite.c res_config_sqlite: Check for CDR unregistration failures 2013-12-08 05:59:46 +00:00
res_config_sqlite3.c Add support for a realtime sorcery module. 2013-04-27 12:01:29 +00:00
res_convert.c Merged revisions 328247 via svnmerge from 2011-07-14 20:28:54 +00:00
res_corosync.c Disable build of res_corosync until it is back in a compiling state 2013-08-18 02:55:54 +00:00
res_crypto.c Doxygen Updates - janitor work 2012-09-21 17:14:59 +00:00
res_crypto.exports.in Remove built-in AES code and use optional_api instead 2010-07-21 19:11:32 +00:00
res_curl.c Doxygen Updates - Title update 2012-10-14 21:44:27 +00:00
res_fax.c res_fax: check_modem_rate() returned incorrect rate for V.27 2014-01-16 19:13:05 +00:00
res_fax.exports.in Log spandsp's fax debug output to the FAX logger level. 2010-05-21 15:15:58 +00:00
res_fax_spandsp.c res_fax_spandsp: Always init T.38 session to avoid crashes during state change 2013-12-09 03:21:56 +00:00
res_format_attr_celt.c Add support for parsing SDP attributes, generating SDP attributes, and passing it through. 2012-07-13 16:49:40 +00:00
res_format_attr_h263.c Reduce memory consumption and add the H.264 and H.263 modules I shamefully neglected to add. 2012-07-13 18:41:07 +00:00
res_format_attr_h264.c AST-2013-001: Prevent buffer overflow through H.264 format negotiation 2013-03-27 14:28:36 +00:00
res_format_attr_opus.c Add pass through support for Opus and VP8; Opus format attribute negotiation 2013-08-23 15:42:27 +00:00
res_format_attr_silk.c Add support for parsing SDP attributes, generating SDP attributes, and passing it through. 2012-07-13 16:49:40 +00:00
res_http_post.c Avoid cppcheck warnings; removing unused vars and a bit of cleanup. 2012-04-17 18:57:40 +00:00
res_http_websocket.c ARI: Fix WebSocket response when subprotocol isn't specified 2013-09-13 14:19:19 +00:00
res_http_websocket.exports.in Shuffle RESTful URL's around. 2013-07-03 16:32:00 +00:00
res_jabber.c Voicemail: Remove mailbox identifier format (box@context) assumptions in the system. 2013-12-19 16:52:43 +00:00
res_jabber.exports.in Fix chan_jingle/gtalk load regression introduced in r346087 2011-12-05 14:47:11 +00:00
res_limit.c Doxygen Updates - Title update 2012-10-14 21:44:27 +00:00
res_monitor.c Update Asterisk's CDRs for the new bridging framework 2013-06-17 03:00:38 +00:00
res_monitor.exports.in Allow symbol export filtering to work properly on platforms that have symbol prefixes. 2010-04-02 18:57:58 +00:00
res_musiconhold.c Enable wide band audio in musiconhold streams. 2014-01-17 14:17:04 +00:00
res_mutestream.c ARI: Add support for suppressing media streams. 2013-07-18 16:03:12 +00:00
res_mwi_external.c External MWI core support. 2014-01-06 17:45:25 +00:00
res_mwi_external.exports.in External MWI core support. 2014-01-06 17:45:25 +00:00
res_mwi_external_ami.c External MWI AMI support. 2014-01-06 17:49:05 +00:00
res_odbc.c Doxygen Updates - Title update 2012-10-14 21:44:27 +00:00
res_odbc.exports.in Allow symbol export filtering to work properly on platforms that have symbol prefixes. 2010-04-02 18:57:58 +00:00
res_parking.c res_parking: Update XML documention for DTMF features after parking timeout. 2013-10-22 16:28:05 +00:00
res_phoneprov.c Doxygen Updates - Title update 2012-10-14 21:44:27 +00:00
res_pjsip.c res_pjsip: Documentation improvement for Endpoint and AOR mailbox options. 2014-01-21 21:48:15 +00:00
res_pjsip.exports.in res_pjsip: AMI commands and events. 2013-11-23 17:26:57 +00:00
res_pjsip_acl.c res_pjsip_acl: Fix another case of assuming a contact will always contain a URI. 2014-01-07 19:56:18 +00:00
res_pjsip_authenticator_digest.c res_pjsip_authenticator_digest: Fix md5 hash buffer 2014-01-03 21:13:30 +00:00
res_pjsip_caller_id.c PJSIP: Add Path header support 2014-01-15 13:16:10 +00:00
res_pjsip_diversion.c PJSIP: Add Path header support 2014-01-15 13:16:10 +00:00
res_pjsip_dtmf_info.c Prevent a crash in res_pjsip_dtmf_info.c 2013-09-03 18:09:02 +00:00
res_pjsip_endpoint_identifier_anonymous.c The large GULP->PJSIP renaming effort. 2013-07-30 18:14:50 +00:00
res_pjsip_endpoint_identifier_ip.c res_pjsip_endpoint_identifier_ip: Accept hostnames in the 'match' field. 2013-12-31 22:21:07 +00:00
res_pjsip_endpoint_identifier_user.c PJSIP: Add log messages when requests are received for non-existent endpoints 2013-10-25 17:41:38 +00:00
res_pjsip_exten_state.c Decouple subscription handling from NOTIFY/PUBLISH body generation. 2014-01-31 22:27:07 +00:00
res_pjsip_exten_state.exports.in The large GULP->PJSIP renaming effort. 2013-07-30 18:14:50 +00:00
res_pjsip_header_funcs.c PJSIP: Add Path header support 2014-01-15 13:16:10 +00:00
res_pjsip_log_forwarder.c res_pjsip: Forward PJSIP logging to Asterisk logging 2013-09-13 14:22:07 +00:00
res_pjsip_logger.c res_pjsip_logger: Add the ASTERISK_FILE_VERSION macro 2014-01-03 21:45:46 +00:00
res_pjsip_messaging.c PJSIP: Add Path header support 2014-01-15 13:16:10 +00:00
res_pjsip_mwi.c Decouple subscription handling from NOTIFY/PUBLISH body generation. 2014-01-31 22:27:07 +00:00
res_pjsip_mwi_body_generator.c Decouple subscription handling from NOTIFY/PUBLISH body generation. 2014-01-31 22:27:07 +00:00
res_pjsip_nat.c PJSIP: Fix address for ACK in NAT situations 2014-01-31 15:08:49 +00:00
res_pjsip_notify.c PJSIP: Add Path header support 2014-01-15 13:16:10 +00:00
res_pjsip_one_touch_record_info.c The large GULP->PJSIP renaming effort. 2013-07-30 18:14:50 +00:00
res_pjsip_outbound_authenticator_digest.c Switch PJSIP auth to use a vector. 2013-12-09 16:10:05 +00:00
res_pjsip_outbound_registration.c PJSIP: Handle headers in a list appropriately 2014-01-21 17:15:34 +00:00
res_pjsip_path.c PJSIP: Add Path header support 2014-01-15 13:16:10 +00:00
res_pjsip_pidf_body_generator.c Decouple subscription handling from NOTIFY/PUBLISH body generation. 2014-01-31 22:27:07 +00:00
res_pjsip_pidf_eyebeam_body_supplement.c Decouple subscription handling from NOTIFY/PUBLISH body generation. 2014-01-31 22:27:07 +00:00
res_pjsip_pubsub.c Decouple subscription handling from NOTIFY/PUBLISH body generation. 2014-01-31 22:27:07 +00:00
res_pjsip_pubsub.exports.in Decouple subscription handling from NOTIFY/PUBLISH body generation. 2014-01-31 22:27:07 +00:00
res_pjsip_refer.c PJSIP: Add Path header support 2014-01-15 13:16:10 +00:00
res_pjsip_registrar.c PJSIP: Add Path header support 2014-01-15 13:16:10 +00:00
res_pjsip_registrar_expire.c sorcery, bucket: Change observer remove calls to take const callbacks struct. 2013-12-03 17:35:54 +00:00
res_pjsip_rfc3326.c The large GULP->PJSIP renaming effort. 2013-07-30 18:14:50 +00:00
res_pjsip_sdp_rtp.c pjsip: fix support for allow=all 2014-01-17 21:33:26 +00:00
res_pjsip_session.c res_pjsip_session: Be less strict with core requested outgoing capabilities. 2014-01-26 02:11:04 +00:00
res_pjsip_session.exports.in The large GULP->PJSIP renaming effort. 2013-07-30 18:14:50 +00:00
res_pjsip_t38.c PJSIP: Add Path header support 2014-01-15 13:16:10 +00:00
res_pjsip_transport_websocket.c res_pjsip_transport_websocket: Fix security events and simplify implementation. 2013-12-01 19:58:08 +00:00
res_pjsip_xpidf_body_generator.c Decouple subscription handling from NOTIFY/PUBLISH body generation. 2014-01-31 22:27:07 +00:00
res_pktccops.c Fix compilation on gcc 4.8.1 2013-07-30 13:46:16 +00:00
res_pktccops.exports.in Allow symbol export filtering to work properly on platforms that have symbol prefixes. 2010-04-02 18:57:58 +00:00
res_realtime.c Cleanup references to sipusers and sipfriends dynamic realtime families 2011-11-01 19:53:26 +00:00
res_rtp_asterisk.c res_rtp_asterisk & udptl: fix port selection to work with SELinux restrictions 2014-01-30 20:36:21 +00:00
res_rtp_multicast.c res_rtp_multicast: Ensure SSRC is set properly 2013-10-03 18:32:59 +00:00
res_security_log.c Multiple revisions 399887,400138,400178,400180-400181 2013-09-30 18:55:27 +00:00
res_smdi.c Doxygen Updates - Title update 2012-10-14 21:44:27 +00:00
res_smdi.exports.in Allow symbol export filtering to work properly on platforms that have symbol prefixes. 2010-04-02 18:57:58 +00:00
res_snmp.c Doxygen Updates - Title update 2012-10-14 21:44:27 +00:00
res_sorcery_astdb.c Reverting regex part of -r403545 at request of file. 2013-12-09 19:24:58 +00:00
res_sorcery_config.c res_sorcery_config: Output an error message when an object can't be created. 2013-12-17 18:35:39 +00:00
res_sorcery_memory.c Pass the sorcery instance to wizards for CUD operations as well as retrieve. 2013-03-20 14:52:23 +00:00
res_sorcery_realtime.c Add support for a realtime sorcery module. 2013-04-27 12:01:29 +00:00
res_speech.c Add support for retrieving engine specific settings using the speech API and from dialplan. 2012-10-01 12:29:04 +00:00
res_speech.exports.in app_speech_utils: Fix unresolved symbol ast_speech_get_setting(). 2013-09-16 18:00:32 +00:00
res_srtp.c Use srtp_shutdown when available 2013-05-15 12:42:04 +00:00
res_srtp.exports.in Add SRTP support for Asterisk 2010-06-08 05:29:08 +00:00
res_stasis.c channel locking: Add locking for channel snapshot creation 2013-12-18 20:33:37 +00:00
res_stasis.exports.in Moved core logic from app_stasis to res_stasis 2013-04-15 16:43:47 +00:00
res_stasis_answer.c ARI: Adding a channel to a bridge while a live recording is active blocks 2013-12-13 16:38:57 +00:00
res_stasis_answer.exports.in Add missing exports file 2013-05-20 14:21:39 +00:00
res_stasis_device_state.c ARI: Make double subscribe respond with success 2014-01-28 19:19:08 +00:00
res_stasis_device_state.exports.in ARI: Implement device state API 2013-11-23 17:48:28 +00:00
res_stasis_mailbox.c ARI: Add mailboxes resource for controlling and polling external MWI 2014-01-14 23:44:57 +00:00
res_stasis_mailbox.exports.in ARI: Add mailboxes resource for controlling and polling external MWI 2014-01-14 23:44:57 +00:00
res_stasis_playback.c res_stasis_playback: Correct error argument order 2014-01-22 14:01:07 +00:00
res_stasis_playback.exports.in This patch implements the REST API's for POST /channels/{channelId}/play 2013-05-23 20:11:35 +00:00
res_stasis_recording.c ARI: Adding a channel to a bridge while a live recording is active blocks 2013-12-13 16:38:57 +00:00
res_stasis_recording.exports.in ARI - channel recording support 2013-07-03 17:58:45 +00:00
res_stasis_snoop.c channels: Return allocated channels locked. 2013-12-18 19:28:05 +00:00
res_stasis_snoop.exports.in ari: Add Snoop operation for spying/whispering on channels. 2013-11-23 12:40:46 +00:00
res_stasis_test.c Multiple revisions 399887,400138,400178,400180-400181 2013-09-30 18:55:27 +00:00
res_stasis_test.exports.in Initial support for endpoints. 2013-05-08 13:39:08 +00:00
res_statsd.c Rename everything Stasis-HTTP to ARI 2013-07-27 23:11:02 +00:00
res_statsd.exports.in Example of how to use the Stasis message bus 2013-04-26 20:05:15 +00:00
res_stun_monitor.c Move channel driver Registry manager events to core. 2013-07-08 14:42:57 +00:00
res_timing_dahdi.c Refactor ast_timer_ack to return an error and handle the error in timer users 2012-11-05 23:10:14 +00:00
res_timing_kqueue.c Refactor ast_timer_ack to return an error and handle the error in timer users 2012-11-05 23:10:14 +00:00
res_timing_pthread.c Prevent res_timing_pthread from blocking callers 2013-04-19 22:27:08 +00:00
res_timing_timerfd.c Refactor ast_timer_ack to return an error and handle the error in timer users 2012-11-05 23:10:14 +00:00
res_xmpp.c Voicemail: Remove mailbox identifier format (box@context) assumptions in the system. 2013-12-19 16:52:43 +00:00
res_xmpp.exports.in Add a new unified Jingle, Google Jingle, and Google Talk channel driver written from scratch called chan_motif. 2012-07-07 17:06:51 +00:00