id.h 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /*
  2. * Copyright (C) 2005 iptelorg GmbH
  3. *
  4. * This file is part of Kamailio, a free SIP server.
  5. *
  6. * Kamailio is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version
  10. *
  11. * Kamailio is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  19. *
  20. */
  21. #ifndef _ID_H
  22. #define _ID_H
  23. #include "str.h"
  24. #include "usr_avp.h"
  25. #include "parser/msg_parser.h"
  26. /*
  27. * Set From UID
  28. */
  29. int set_from_uid(str* uid);
  30. /*
  31. * Get From UID
  32. */
  33. int get_from_uid(str* uid, struct sip_msg* msg);
  34. /*
  35. * Set To UID
  36. */
  37. int set_to_uid(str* uid);
  38. /*
  39. * Ge To UID
  40. */
  41. int get_to_uid(str* uid, struct sip_msg* msg);
  42. /** Retrieves the UID of the callee. This function retrieves the UID (unique
  43. * identifier) of the party being called. The function first searches the list
  44. * of available attributes and if it finds an attribute with name "uid" then
  45. * the value of the attribute is returned. If no such attribute can be found
  46. * then the function retrieves the username from To header field of REGISTER
  47. * requests (because that is the party being registered), or the username from
  48. * the Reqeuest-URI of other requests. The username is then used as the UID
  49. * string identifying the callee. If no attribute with the UID was found and
  50. * the function successfully retrieved the UID from the SIP message then, in
  51. * addition to storing the result in the first parameter, the function will
  52. * also create the attribute named "uid" which will contain the UID. The
  53. * function is not reentrant because it uses an internal static buffer to
  54. * store the result.
  55. * @param uid A pointer to ::str variable where the result will be stored, the
  56. * pointer in the variable will be updated to point to a static
  57. * buffer in the function.
  58. * @param msg The SIP message being processed.
  59. * @return 1 is returned when the attribute with UID exists and it is used, 0
  60. * is returned when the function retrieved the UID from the SIP
  61. * message and created the attribute, -1 is returned on error.
  62. */
  63. int get_to_did(str* did, struct sip_msg* msg);
  64. /*
  65. * Return current From domain id
  66. */
  67. int get_from_did(str* did, struct sip_msg* msg);
  68. #endif /* _ID_H */