mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-25 14:06:27 +00:00
rfc compliant sip option parsing + new unit test
RFC 3261 section 8.2.2.3 states that if any unsupported options are found in the Require header field, a "420 (Bad Extension)" response should be sent with an Unsupported header field containing only the unsupported options. This is not currently being done correctly. Right now, if Asterisk detects any unsupported sip options in a Require header the entire list of options are returned in the Unsupported header even if some of those options are in fact supported. This patch fixes that by building an unsupported options character buffer when parsing the options that can be sent with the 420 response. A unit test verifying this functionality has been created. Some code refactoring was required. Review: https://reviewboard.asterisk.org/r/680/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@272880 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -122,4 +122,18 @@ void sip_request_parser_register_tests(void);
|
||||
*/
|
||||
void sip_request_parser_unregister_tests(void);
|
||||
|
||||
/*!
|
||||
* \brief Parse supported header in incoming packet
|
||||
*
|
||||
* \details This function parses through the options parameters and
|
||||
* builds a bit field representing all the SIP options in that field. When an
|
||||
* item is found that is not supported, it is copied to the unsupported
|
||||
* out buffer.
|
||||
*
|
||||
* \param option list
|
||||
* \param unsupported out buffer (optional)
|
||||
* \param unsupported out buffer length (optional)
|
||||
*/
|
||||
unsigned int parse_sip_options(const char *options, char *unsupported, size_t unsupported_len);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user