utils.c 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * Asterisk -- An open source telephony toolkit.
  3. *
  4. * Copyright (C) 1999 - 2012, Digium, Inc.
  5. *
  6. * See http://www.asterisk.org for more information about
  7. * the Asterisk project. Please do not directly contact
  8. * any of the maintainers of this project for assistance;
  9. * the project provides a web site, mailing lists and IRC
  10. * channels for your use.
  11. *
  12. * This program is free software, distributed under the terms of
  13. * the GNU General Public License Version 2. See the LICENSE file
  14. * at the top of the source tree.
  15. */
  16. /*!
  17. * \file
  18. * \brief Utility functions for chan_sip
  19. *
  20. * \author Terry Wilson <twilson@digium.com>
  21. */
  22. /*** MODULEINFO
  23. <support_level>extended</support_level>
  24. ***/
  25. #include "asterisk.h"
  26. #include "asterisk/utils.h"
  27. #include "asterisk/cli.h"
  28. #include "include/sip.h"
  29. #include "include/sip_utils.h"
  30. const char *force_rport_string(struct ast_flags *flags)
  31. {
  32. if (ast_test_flag(&flags[2], SIP_PAGE3_NAT_AUTO_RPORT)) {
  33. return ast_test_flag(&flags[0], SIP_NAT_FORCE_RPORT) ? "Auto (Yes)" : "Auto (No)";
  34. }
  35. return AST_CLI_YESNO(ast_test_flag(&flags[0], SIP_NAT_FORCE_RPORT));
  36. }
  37. const char *comedia_string(struct ast_flags *flags)
  38. {
  39. if (ast_test_flag(&flags[2], SIP_PAGE3_NAT_AUTO_COMEDIA)) {
  40. return ast_test_flag(&flags[1], SIP_PAGE2_SYMMETRICRTP) ? "Auto (Yes)" : "Auto (No)";
  41. }
  42. return AST_CLI_YESNO(ast_test_flag(&flags[1], SIP_PAGE2_SYMMETRICRTP));
  43. }