summaryrefslogtreecommitdiff
path: root/res/res_pjsip_pidf_body_generator.c
AgeCommit message (Collapse)Author
2018-01-24Remove redundant module checks and references.Corey Farrell
This removes references that are no longer needed due to automatic references created by module dependencies. In addition this removes most calls to ast_module_check as they were checking modules which are listed as dependencies. Change-Id: I332a6e8383d4c72c8e89d988a184ab8320c4872e
2018-01-15loader: Add dependency fields to module structures.Corey Farrell
* Declare 'requires' and 'enhances' text fields on module info structure. * Rename 'nonoptreq' to 'optional_modules'. * Update doxygen comments. Still need to investigate dependencies among modules I cannot compile. Change-Id: I3ad9547a0a6442409ff4e352a6d897bef2cc04bf
2017-08-01res_pjsip_pidf_eyebeam_body_supplement: Correct status presentationSean Bright
This change fixes PIDF content generation when the underlying device state is considered in use. Previously it was incorrectly marked as closed meaning they were offline/unavailable. The code now correctly marks them as open. Additionally: * Generate an XML element for our activity instead of a using a text node. * Consider every extension state other than "unavailable" to be 'open' status. * Update the XML namespaces and structure to reflect those documented in RFC 4480 * Use 'on-the-phone' (defined in RFC 4880) instead of 'busy' as the "in use" activity. This change results in eyeBeam using the appropriate icon for the watched user. This was tested on eyeBeam 1.5.20.2 build 59030 on Windows. ASTERISK-26659 #close Reported by: Abraham Liebsch patches: ASTERISK-26659.diff submitted by snuffy (license 5024) Change-Id: I6e5ad450f91106029fb30517b8c0ea0c2058c810
2017-06-16res_pjsip: New endpoint option "notify_early_inuse_ringing"Alexei Gradinari
This option was added to control whether to notify dialog-info state 'early' or 'confirmed' on Ringing when already INUSE. The value "yes" is useful for some SIP phones (Cisco SPA) to be able to indicate and pick up ringing devices. ASTERISK-26919 #close Change-Id: Ie050bc30023543c7dfb4365c5be3ce58c738c711
2015-07-06PJSIP XML, XPIDF: Fix buffer size overwrite memory corruption error.Richard Mudgett
When res_pjsip body generator modules were generating XML or XPIDF response bodies, there was a chance that the generated body would be the exact size of the supplied buffer. Adding the nul string terminator would then write beyond the end of the buffer and potentially corrupt memory. * Fix MALLOC_DEBUG high fence violations caused by adding a nul string terminator on the end of a buffer for XML or XPIDF response bodies. * Made calls to pj_xml_print() safer if the XML prolog is requested. Due to a bug in pjproject, the return value could be -1 _or_ AST_PJSIP_XML_PROLOG_LEN if the supplied buffer is not large enough. * Updated the doxygen comment of AST_PJSIP_XML_PROLOG_LEN to describe the return value of pj_xml_print() when the supplied buffer is not large enough. ASTERISK-25168 Reported by: Carl Fortin Change-Id: Id70e1d373a6a2b2bd9e678b5cbc5e55b308981de
2015-05-13AST_MODULE_INFO: Format corrections to the usages of AST_MODULE_INFO macro.Rodrigo Ramírez Norambuena
Change-Id: Icf88f9f861c6b2a16e5f626ff25795218a6f2723
2014-10-16PJSIP: Enforce module load dependenciesKinsey Moore
This enforces that res_pjsip, res_pjsip_session, and res_pjsip_pubsub have loaded properly before attempting to load any modules that depend on them since the module loader system is not currently capable of resolving module dependencies on its own. ASTERISK-24312 #close Reported by: Dafi Ni Review: https://reviewboard.asterisk.org/r/4062/ ........ Merged revisions 425690 from http://svn.asterisk.org/svn/asterisk/branches/12 ........ Merged revisions 425691 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@425700 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-09-18res_pjsip_pubsub: Add some type safety when generating NOTIFY bodies.Mark Michelson
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
2014-08-07Add support for RFC 4662 resource list subscriptions.Mark Michelson
This commit adds the ability for a user to configure a resource list in pjsip.conf. Subscribing to this list simultaneously subscribes the subscriber to all resources listed. This has the potential to reduce the amount of SIP traffic when loads of subscribers on a system attempt to subscribe to each others' states. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@420384 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-07-29res_pjsip_pidf_body_generator / res_pjsip_xpidf_body_generator: Ensure local ↵Joshua Colp
entity is unquoted. The local entity as provided by PJSIP is quoted within '<' and '>'. As a result placing this value into XML will result in malformed XML being produced. This patch now unquotes the local entity so it can go safely into the XML. Review: https://reviewboard.asterisk.org/r/3851/ ........ Merged revisions 419750 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@419751 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-07-25Add module support level to ast_module_info structure. Print it in CLI ↵Mark Michelson
"module show" . ASTERISK-23919 #close Reported by Malcolm Davenport Review: https://reviewboard.asterisk.org/r/3802 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@419592 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-25Abstract PJSIP-specific elements from the pubsub API.Mark Michelson
This helps to pave the way for RLS work that is to come. Since this is a self-contained change and subscription tests still pass, this work is being committed directly to trunk instead of a working branch. ASTERISK-23865 #close Review: https://reviewboard.asterisk.org/r/3628 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@417233 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-17Fix string growth algorithm for XML presence bodies.Mark Michelson
pjpidf_print() does not return < 0 if there is not enough room for the document to be printed. Rather, it returns 39, the length of the XML prolog. The algorithm also had a bug in that it would return if it attempted to grow the string larger. ........ Merged revisions 416442 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@416444 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-01-31Decouple subscription handling from NOTIFY/PUBLISH body generation.Mark Michelson
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