pi_framework.xml 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324
  1. <?xml version="1.0"?>
  2. <framework>
  3. <!-- Declare all db connections
  4. Each db connection MUST have:
  5. - an "id" to be identified by a tabe
  6. - a URL pointing to the actual database
  7. Supported databases:
  8. * berkeley
  9. * cassandra
  10. * cluster
  11. * flatstore
  12. * mysql
  13. * oracle
  14. * postgres
  15. * sqlite
  16. * text
  17. * unixodbc
  18. -->
  19. <db_url id="mysql">mysql://kamailio:kamailiorw@localhost/kamailio</db_url>
  20. <!--
  21. <db_url id="dbtext">text:///usr/local/etc/kamailio/dbtext</db_url>
  22. -->
  23. <!-- Declare all tables
  24. Each table MUST have:
  25. - an "id" to be identified by a command
  26. - a "table_name" pointing to the actual table name in the database
  27. - a "db_url_id" to identify the db connection
  28. - multiple "column" nodes with "field"i, "validation" and "type":
  29. /* type */
  30. DB1_INT, /**< represents an 32 bit integer number */
  31. DB1_BIGINT, /**< represents an 64 bit integer number */
  32. DB1_DOUBLE, /**< represents a floating point number */
  33. DB1_STRING, /**< represents a zero terminated const char* */
  34. DB1_STR, /**< represents a string of 'str' type */
  35. DB1_DATETIME, /**< represents date and time */
  36. DB1_BLOB, /**< represents a large binary object */
  37. DB1_BITMAP /**< an one-dimensional array of 32 flags */
  38. /* validation */
  39. P_HOST_PORT /**< represents [proto:]host[:port] */
  40. P_IPV4_PORT /**< represents [proto:]IPv4[:port] */
  41. IPV4 /**< represents an IPv4 */
  42. URI /**< represents a SIP URI */
  43. URI_IPV4HOST /**< represents a SIP URI w/ IPv4 as host */
  44. -->
  45. <db_table id="dispatcher"><table_name>dispatcher</table_name>
  46. <db_url_id>mysql</db_url_id>
  47. <column><field>id</field> <type>DB1_INT</type></column>
  48. <column><field>setid</field> <type>DB1_INT</type></column>
  49. <column><field>destination</field> <type>DB1_STR</type>
  50. <validate>URI_IPV4HOST</validate></column>
  51. <column><field>flags</field> <type>DB1_INT</type></column>
  52. <column><field>priority</field> <type>DB1_INT</type></column>
  53. <column><field>attrs</field> <type>DB1_STR</type></column>
  54. <column><field>description</field> <type>DB1_STR</type></column>
  55. </db_table>
  56. <db_table id="dialplan"><table_name>dialplan</table_name>
  57. <db_url_id>mysql</db_url_id>
  58. <column><field>id</field> <type>DB1_INT</type></column>
  59. <column><field>dpid</field> <type>DB1_INT</type></column>
  60. <column><field>pr</field> <type>DB1_INT</type></column>
  61. <column><field>match_op</field> <type>DB1_INT</type></column>
  62. <column><field>match_exp</field> <type>DB1_STR</type></column>
  63. <column><field>match_len</field> <type>DB1_INT</type></column>
  64. <column><field>subst_exp</field> <type>DB1_STR</type></column>
  65. <column><field>repl_exp</field> <type>DB1_STR</type></column>
  66. <column><field>attrs</field> <type>DB1_STRING</type></column>
  67. </db_table>
  68. <!-- Declare all mod
  69. Each mod must have:
  70. - a "mod_name"
  71. - at least one "cmd"
  72. Each cmd must have:
  73. - a "cmd_name"
  74. - a "db_table_id"
  75. - a "cmd_type": c q o
  76. DB1_QUERY ov m o
  77. DB1_INSERT - mv -
  78. DB1_DELETE mv - -
  79. DB1_UPDATE ov mv -
  80. DB1_REPLACE - mv -
  81. Clause cols can have the following operators:
  82. - "<" &lt;
  83. - ">" &gt;
  84. - "=" =
  85. - "<=" &lt;=
  86. - ">=" &gt;=
  87. - "!=" !=
  88. -->
  89. <!-- dispatcher provisioning -->
  90. <mod> <mod_name>dispatcher</mod_name>
  91. <cmd> <cmd_name>show_destinations_with_small_setid</cmd_name>
  92. <db_table_id>dispatcher</db_table_id>
  93. <cmd_type>DB1_QUERY</cmd_type>
  94. <clause_cols>
  95. <col><field>setid</field><operator>&lt;</operator></col>
  96. </clause_cols>
  97. <query_cols>
  98. <col><field>id</field></col>
  99. <col><field>setid</field></col>
  100. <col><field>destination</field></col>
  101. <col><field>description</field></col>
  102. </query_cols>
  103. </cmd>
  104. <cmd> <cmd_name>show_all</cmd_name>
  105. <db_table_id>dispatcher</db_table_id>
  106. <cmd_type>DB1_QUERY</cmd_type>
  107. <query_cols>
  108. <col><field>id</field></col>
  109. <col><field>setid</field></col>
  110. <col><field>destination</field></col>
  111. <col><field>flags</field></col>
  112. <col><field>priority</field></col>
  113. <col><field>attrs</field></col>
  114. <col><field>description</field></col>
  115. </query_cols>
  116. </cmd>
  117. <cmd> <cmd_name>update_setid</cmd_name>
  118. <db_table_id>dispatcher</db_table_id>
  119. <cmd_type>DB1_UPDATE</cmd_type>
  120. <clause_cols>
  121. <col><field>id</field><operator>=</operator></col>
  122. </clause_cols>
  123. <query_cols>
  124. <col><field>setid</field></col>
  125. </query_cols>
  126. </cmd>
  127. <cmd> <cmd_name>update_destination</cmd_name>
  128. <db_table_id>dispatcher</db_table_id>
  129. <cmd_type>DB1_UPDATE</cmd_type>
  130. <clause_cols>
  131. <col><field>id</field><operator>=</operator></col>
  132. </clause_cols>
  133. <query_cols>
  134. <col><field>destination</field></col>
  135. </query_cols>
  136. </cmd>
  137. <cmd> <cmd_name>update_attr</cmd_name>
  138. <db_table_id>dispatcher</db_table_id>
  139. <cmd_type>DB1_UPDATE</cmd_type>
  140. <clause_cols>
  141. <col><field>id</field><operator>=</operator></col>
  142. </clause_cols>
  143. <query_cols>
  144. <col><field>attrs</field></col>
  145. </query_cols>
  146. </cmd>
  147. <cmd> <cmd_name>update_description</cmd_name>
  148. <db_table_id>dispatcher</db_table_id>
  149. <cmd_type>DB1_UPDATE</cmd_type>
  150. <clause_cols>
  151. <col><field>id</field><operator>=</operator></col>
  152. </clause_cols>
  153. <query_cols>
  154. <col><field>description</field></col>
  155. </query_cols>
  156. </cmd>
  157. <cmd> <cmd_name>add_gw</cmd_name>
  158. <db_table_id>dispatcher</db_table_id>
  159. <cmd_type>DB1_INSERT</cmd_type>
  160. <query_cols>
  161. <col><field>setid</field></col>
  162. <col><field>destination</field></col>
  163. <!--<col><field>flags</field></col>-->
  164. <col><field>priority</field></col>
  165. <col><field>attrs</field></col>
  166. <col><field>description</field></col>
  167. </query_cols>
  168. </cmd>
  169. <cmd> <cmd_name>add_server_with_setid_100</cmd_name>
  170. <db_table_id>dispatcher</db_table_id>
  171. <cmd_type>DB1_INSERT</cmd_type>
  172. <query_cols>
  173. <col><field>setid</field>
  174. <value id="100">100</value>
  175. </col>
  176. <col><field>destination</field></col>
  177. <!--<col><field>flags</field></col>-->
  178. <col><field>priority</field></col>
  179. <col><field>attrs</field></col>
  180. <col><field>description</field></col>
  181. </query_cols>
  182. </cmd>
  183. <cmd> <cmd_name>delete_by_id</cmd_name>
  184. <db_table_id>dispatcher</db_table_id>
  185. <cmd_type>DB1_DELETE</cmd_type>
  186. <clause_cols>
  187. <col><field>id</field><operator>=</operator></col>
  188. </clause_cols>
  189. </cmd>
  190. </mod>
  191. <!-- dialplan provisioning -->
  192. <mod> <mod_name>dialplan</mod_name>
  193. <cmd> <cmd_name>show_all</cmd_name>
  194. <db_table_id>dialplan</db_table_id>
  195. <cmd_type>DB1_QUERY</cmd_type>
  196. <query_cols>
  197. <col><field>id</field></col>
  198. <col><field>dpid</field></col>
  199. <col><field>pr</field></col>
  200. <col><field>match_op</field></col>
  201. <col><field>match_exp</field></col>
  202. <!--<col><field>match_len</field></col>-->
  203. <col><field>subst_exp</field></col>
  204. <col><field>repl_exp</field></col>
  205. <col><field>attrs</field></col>
  206. </query_cols>
  207. <order_by_cols><col><field>id</field></col></order_by_cols>
  208. </cmd>
  209. <cmd> <cmd_name>show_dpid</cmd_name>
  210. <db_table_id>dialplan</db_table_id>
  211. <cmd_type>DB1_QUERY</cmd_type>
  212. <clause_cols>
  213. <col><field>dpid</field><operator>=</operator></col>
  214. </clause_cols>
  215. <query_cols>
  216. <col><field>id</field></col>
  217. <col><field>dpid</field></col>
  218. <col><field>pr</field></col>
  219. <col><field>match_op</field></col>
  220. <col><field>match_exp</field></col>
  221. <col><field>match_len</field></col>
  222. <col><field>subst_exp</field></col>
  223. <col><field>repl_exp</field></col>
  224. <col><field>attrs</field></col>
  225. </query_cols>
  226. <order_by_cols><col><field>id</field></col></order_by_cols>
  227. </cmd>
  228. <cmd> <cmd_name>show_exact_matching</cmd_name>
  229. <db_table_id>dialplan</db_table_id>
  230. <cmd_type>DB1_QUERY</cmd_type>
  231. <clause_cols>
  232. <col><field>match_op</field><operator>=</operator>
  233. <value id="equal">0</value></col>
  234. </clause_cols>
  235. <query_cols>
  236. <col><field>id</field></col>
  237. <col><field>dpid</field></col>
  238. <col><field>pr</field></col>
  239. <col><field>match_op</field></col>
  240. <col><field>match_exp</field></col>
  241. <col><field>match_len</field></col>
  242. <col><field>subst_exp</field></col>
  243. <col><field>repl_exp</field></col>
  244. <col><field>attrs</field></col>
  245. </query_cols>
  246. </cmd>
  247. <cmd> <cmd_name>show_regex_matching</cmd_name>
  248. <db_table_id>dialplan</db_table_id>
  249. <cmd_type>DB1_QUERY</cmd_type>
  250. <clause_cols>
  251. <col><field>match_op</field><operator>=</operator>
  252. <value id="regex">1</value></col>
  253. </clause_cols>
  254. <query_cols>
  255. <col><field>id</field></col>
  256. <col><field>dpid</field></col>
  257. <col><field>pr</field></col>
  258. <col><field>match_op</field></col>
  259. <col><field>match_exp</field></col>
  260. <col><field>match_len</field></col>
  261. <col><field>subst_exp</field></col>
  262. <col><field>repl_exp</field></col>
  263. <col><field>attrs</field></col>
  264. </query_cols>
  265. </cmd>
  266. <cmd> <cmd_name>add</cmd_name>
  267. <db_table_id>dialplan</db_table_id>
  268. <cmd_type>DB1_INSERT</cmd_type>
  269. <query_cols>
  270. <col><field>dpid</field></col>
  271. <col><field>pr</field></col>
  272. <col><field>match_op</field>
  273. <value id="equal">0</value>
  274. <value id="regexp">1</value>
  275. </col>
  276. <col><field>match_exp</field></col>
  277. <col><field>match_len</field></col>
  278. <col><field>attrs</field></col>
  279. </query_cols>
  280. </cmd>
  281. <cmd> <cmd_name>delete</cmd_name>
  282. <db_table_id>dialplan</db_table_id>
  283. <cmd_type>DB1_DELETE</cmd_type>
  284. <clause_cols>
  285. <col><field>id</field><operator>=</operator></col>
  286. </clause_cols>
  287. </cmd>
  288. <cmd> <cmd_name>update_attr</cmd_name>
  289. <db_table_id>dialplan</db_table_id>
  290. <cmd_type>DB1_UPDATE</cmd_type>
  291. <clause_cols>
  292. <col><field>id</field><operator>=</operator></col>
  293. </clause_cols>
  294. <query_cols>
  295. <col><field>attrs</field></col>
  296. </query_cols>
  297. </cmd>
  298. <cmd> <cmd_name>update_repl_exp</cmd_name>
  299. <db_table_id>dialplan</db_table_id>
  300. <cmd_type>DB1_UPDATE</cmd_type>
  301. <clause_cols>
  302. <col><field>id</field><operator>=</operator></col>
  303. </clause_cols>
  304. <query_cols>
  305. <col><field>repl_exp</field></col>
  306. </query_cols>
  307. </cmd>
  308. <cmd> <cmd_name>replace</cmd_name>
  309. <db_table_id>dialplan</db_table_id>
  310. <cmd_type>DB1_REPLACE</cmd_type>
  311. <query_cols>
  312. <col><field>dpid</field></col>
  313. <col><field>pr</field></col>
  314. <col><field>match_op</field></col>
  315. <col><field>match_exp</field></col>
  316. <col><field>match_len</field></col>
  317. <col><field>subst_exp</field></col>
  318. <col><field>repl_exp</field></col>
  319. <col><field>attrs</field></col>
  320. </query_cols>
  321. </cmd>
  322. </mod>
  323. </framework>