Commit Graph

8 Commits

Author SHA1 Message Date
Tilghman Lesher e7a5fb5459 Make all of the various rtpqos parameters in this branch available from the CHANNEL function.
Also includes a test for retrieving rtpqos parameters, including a NULL RTP
driver.  Additionally, some further separation of the SIP internal API into
headers was necessary.

(closes issue #16652)
 Reported by: kkm
 Patches: 
       20100204__issue16652.diff.txt uploaded by tilghman (license 14)
 
Review: https://reviewboard.asterisk.org/r/501/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@247124 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-02-17 06:25:15 +00:00
David Vossel 2003243947 chan_sip parse code refactoring plus two new unit tests
Code Refactoring Changes
- read_to_parts() moved to reqresp_parser.c and has been renamed as
  get_name_and_number()
- get_in_brackets() moved to reqresp_parser.c
- find_closing_quotes() added to sip_utils.h
Logic Changes
- get_name_and_number() now uses parse_uri() and get_calleridname()
  for parsing. Before this change only names within quotes were
  found, when names not within quotes are possible.
New Unit Tests
-sip_get_name_and_number_test
-sip_get_in_brackets_test

(closes issue #16707)
Reported by: Nick_Lewis
Patches:
      issue16706.diff uploaded by dvossel (license 671)

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@246627 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-02-15 15:45:02 +00:00
David Vossel 6d9c531237 fixes some test description formatting inconsistencies so log file looks nice
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@246338 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-02-11 21:57:37 +00:00
David Vossel f57e5150e5 additional parse_uri test and documentation
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@246249 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-02-10 23:13:49 +00:00
Russell Bryant bbed34f764 Various updates to the unit test API.
1) It occurred to me that the difference in usage between the error ast_str and
the ast_test_update_status() usage has turned out to be a bit ambiguous in
practice.  In a lot of cases, the same message was being sent to both.
In other cases, it was only sent to one or the other.  My opinion now is that
in every case, I think it makes sense to do both; we should output it to the
CLI as well as save it off for logging purposes.

This change results in most of the changes in this diff, since it required
changes to all existing unit tests.  It also allowed for some simplifications
of unit test API implementation code.

2) Update ast_test_status_update() to include the file, function, and line
number for the code providing the update.

3) There are some formatting tweaks here and there.  Hopefully they aren't too
distracting for code review purposes.  Reviewboard's diff viewer seems to do a
pretty good job of pointing out when something is a whitespace change.

4) I moved the md5_test and sha1_test into the test_utils module.  It seemed
like a better approach since these tests are so tiny.

5) I changed the number of nodes used in heap_test_2 from 1 million to
100 thousand.  The only reason for this was to reduce the time it took
for this test to run.

6) Remove an unused function prototype that was at the bottom of utils.h.

7) Simplify test_insert() using the LIST_INSERT_SORTALPHA() macro.  The one
minor difference in behavior is that it no longer checks for a test registered
with the same name.

8) Expand the code in test_alloc() to provide specific error messages for each
failure case, to clearly inform developers if they forget to set the name,
summary, description, etc.

9) Tweak the output of the "test show registered" CLI command.  I swapped the
name and category to have the category first.  It seemed more natural since
that is the sort key.

10) Don't output the status ast_str in the "test show results" CLI command.
This is going to tend to be pretty verbose, so just leave that for the
detailed test logs (test generate results).

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@245864 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-02-09 23:32:14 +00:00
Russell Bryant f199367b93 Tweak formatting and add minor updates to some comments.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@245269 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-02-07 20:57:42 +00:00
David Vossel 1810f1efff fixes issue with sip registry not having correct default expiry
default expiry was not being set correctly for a registry object.
Thanks to ebroad for reporting the issue and testing the patch.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@244924 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-02-05 16:59:06 +00:00
David Vossel a9932363a9 -----Changes -----
New files
- channels/sip/sip.h – A new header for shared #define, enum, and struct
  definitions.
- channels/sip/include/sip_utils.h – sip util functions shared among
  the all the sip APIs
- channels/sip/include/config_parser.h – sip config-parser API
- channels/sip/config_parser.c  – Contains sip.conf parsing helper functions
  with unit tests.
- channels/sip/include/reqresp_parser.h – sip request response parser API
- channels/sip/reqresp_parser.c – Contains sip request and response parsing
  helper functions with unit tests.

New Unit Tests 
- sip_parse_uri_test
- sip_parse_host_test
- sip_parse_register_line_test

Code Refactoring
- All reusable #define, enum, and struct definitions were moved out of chan_sip.c
  into sip.h. During this process formatting changes were made to comments
  in both sip.h and chan_sip.c in order to better adhere to the coding guidelines.
- The beginnings of three new sip APIs, sip-utils.h, config-parser.h,
  reqresp-parser.h using existing chan_sip.c functions.
- parse_uri() and get_calleridname() were moved from chan_sip.c to request-parser.c
  along with unit tests for both functions.
- sip_parse_host() and sip_parse_register_line() were moved from chan_sip.c to
  config-parser.c along with unit tests for both functions.

Changes to parse_uri()
-removal of the options parameter.  It was never used and did not behave correctly.
-additional check for [?header] field. When this field was present, the transport
 type was not being set correctly.

----- Overview -----
This patch is introduced with the hope that unit tests for all our sip parsing
functions will be written soon.  chan_sip is a huge file, and with the addition of
each unit test chan_sip is going to grow larger and harder to maintain.  I'm proposing
we begin refactoring chan_sip, starting with the parsing functions.  With each parsing
function we move into a separate helper file, a unit test should accompany it.  I've 
attempted to lay down the ground work for this change by creating two new parser
helper files (config-parser.c and reqresp-parser.c) and moving all shared structs,
enums, and defines from chan_sip.c into a shared sip.h file.  We can't verify everything
in Asterisk using unit tests, but string parsing is one area where unit tests make
the most sense.  By beginning to restructure the code in this way, chan_sip not only
becomes less bloated, but Asterisk as a whole will become more stable.


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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@244597 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-02-03 20:33:32 +00:00