mohq.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. /*
  2. * $Id$
  3. *
  4. * Copyright (C) 2013 Robert Boisvert
  5. *
  6. * This file is part of the mohqueue module for sip-router, a free SIP server.
  7. *
  8. * The mohqueue module is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 2 of the License, or
  11. * (at your option) any later version
  12. *
  13. * The mohqueue module is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  21. *
  22. */
  23. #ifndef MOHQ_H
  24. #define MOHQ_H
  25. #include "mohq_common.h"
  26. #include "mohq_locks.h"
  27. /**********
  28. * definitions
  29. **********/
  30. #define URI_LEN 100
  31. #define USLEEP_LEN 10
  32. #define MOHDIRLEN 100
  33. #define MOHFILELEN 100
  34. /**********
  35. * structures
  36. **********/
  37. typedef struct
  38. {
  39. int ntype;
  40. char *pencode;
  41. } rtpmap;
  42. /* mohq_flags values */
  43. #define MOHQF_ACT 0x01
  44. #define MOHQF_CHK 0x02
  45. #define MOHQF_DBG 0x04
  46. typedef struct
  47. {
  48. char mohq_name [26];
  49. char mohq_uri [URI_LEN + 1];
  50. char mohq_mohdir [MOHDIRLEN + 1];
  51. char mohq_mohfile [MOHFILELEN + 1];
  52. int mohq_flags;
  53. int mohq_id;
  54. } mohq_lst;
  55. /* call_state values */
  56. #define CLSTA_ENTER 100
  57. #define CLSTA_PRACKSTRT 101
  58. #define CLSTA_PRACKRPLY 102
  59. #define CLSTA_RINGING 103
  60. #define CLSTA_INVITED 104
  61. #define CLSTA_CANCEL 105
  62. #define CLSTA_INQUEUE 200
  63. #define CLSTA_REFER 301
  64. #define CLSTA_RFRWAIT 302
  65. #define CLSTA_BYE 305
  66. typedef struct
  67. {
  68. int call_active;
  69. char call_id [101];
  70. char call_from [URI_LEN + 1];
  71. char call_referto [URI_LEN + 1];
  72. char call_contact [URI_LEN + 1];
  73. char call_tag [101];
  74. char call_via [1024];
  75. char call_addr [IP_ADDR_MAX_STR_SIZE + 4];
  76. int call_state;
  77. int call_cseq;
  78. int call_aport;
  79. mohq_lst *pmohq;
  80. time_t call_time;
  81. unsigned int call_hash;
  82. unsigned int call_label;
  83. sip_msg_t *call_pmsg;
  84. } call_lst;
  85. typedef struct
  86. {
  87. char *mohdir;
  88. str db_url;
  89. str db_ctable;
  90. str db_qtable;
  91. } mod_cfg;
  92. typedef struct
  93. {
  94. mod_cfg pcfg [1];
  95. time_t mohq_update;
  96. int mohq_cnt;
  97. mohq_lst *pmohq_lst;
  98. mohq_lock pmohq_lock [1];
  99. int call_cnt;
  100. call_lst *pcall_lst;
  101. mohq_lock pcall_lock [1];
  102. db_func_t pdb [1];
  103. tm_api_t ptm [1];
  104. sl_api_t psl [1];
  105. rr_api_t prr [1];
  106. cmd_function fn_rtp_answer;
  107. cmd_function fn_rtp_destroy;
  108. cmd_function fn_rtp_offer;
  109. cmd_function fn_rtp_stream_c;
  110. cmd_function fn_rtp_stream_s;
  111. } mod_data;
  112. /**********
  113. * global varb declarations
  114. **********/
  115. extern mod_data *pmod_data;
  116. extern rtpmap prtpmap [];
  117. #endif /* MOHQ_H */