Advertisement
Guest User

Untitled

a guest
Jul 26th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.77 KB | None | 0 0
  1. <?xml version="1.0" ?>
  2. <SCENARIOS version="3.0.103.16003">
  3. <SCENARIO name="AR DND forward enable cust" description="Scenario allows to enable Do not disturb mode to forward to particular number.">
  4. <STATE id="1" name="SQLQueryState" query="delete from redirectphones where number_priority=0 and id_client=${client/id-client} and client_type=${client/client-type}">
  5. <TRANSITIONS>
  6. <TRANSITION type="TransitionAlwaysTrue">
  7. <next_state_id>7</next_state_id>
  8. </TRANSITION>
  9. </TRANSITIONS>
  10. </STATE>
  11. <STATE id="7" name="SQLQueryState" result_variable="query_result" query="select if(char_length(SUBSTRING_INDEX(SUBSTRING_INDEX(&quot;${dialed-number}&quot;,&quot;*&quot;,-2),'*',1))>0,1,0);">
  12. <TRANSITIONS>
  13. <TRANSITION type="TransitionOnVariable">
  14. <next_state_id variable_name="query_result" variable_value="1" >8</next_state_id>
  15. <next_state_id variable_name="query_result" variable_value="0" >FINAL_STATE_ID</next_state_id>
  16. </TRANSITION>
  17. <TRANSITION type="TransitionAlwaysTrue">
  18. <next_state_id>8</next_state_id>
  19. </TRANSITION>
  20. </TRANSITIONS>
  21. </STATE>
  22. <STATE id="2" name="SQLQueryState" result_variable="query_result" query="select if(char_length(substring_index(&quot;${dialed-number}&quot;,&quot;*&quot;, -1))>0,1,0);">
  23. <TRANSITIONS>
  24. <TRANSITION type="TransitionOnVariable">
  25. <next_state_id variable_name="query_result" variable_value="1" >4</next_state_id>
  26. <next_state_id variable_name="query_result" variable_value="0" >3</next_state_id>
  27. </TRANSITION>
  28. <TRANSITION type="TransitionAlwaysTrue">
  29. <next_state_id>3</next_state_id>
  30. </TRANSITION>
  31. </TRANSITIONS>
  32. </STATE>
  33. <STATE id="3" name="SQLQueryState" query="insert into redirectphones(id_client, client_type, call_end_reason, follow_me_number, number_priority, did_number) VALUES (${client/id-client}, ${client/client-type}, 16, '&lt;answering_rule&gt; &lt;action type=&quot;Voicemail&quot;&gt; &lt;/action&gt;&lt;/answering_rule&gt;', 0,'${did_number}');">
  34. <TRANSITIONS>
  35. <TRANSITION type="TransitionAlwaysTrue">
  36. <next_state_id>9</next_state_id>
  37. </TRANSITION>
  38. </TRANSITIONS>
  39. </STATE>
  40. <STATE id="4" name="SQLQueryState" result_variable="forward_number" query="select substring_index(&quot;${dialed-number}&quot;,&quot;*&quot;, -1);">
  41. <TRANSITIONS>
  42. <TRANSITION type="TransitionAlwaysTrue">
  43. <next_state_id>5</next_state_id>
  44. </TRANSITION>
  45. </TRANSITIONS>
  46. </STATE>
  47. <STATE id="5" name="SQLQueryState" query="insert into redirectphones(id_client, client_type, call_end_reason, follow_me_number, number_priority) VALUES (${client/id-client}, ${client/client-type}, 16, '&lt;answering_rule&gt; &lt;action type=&quot;forward&quot;&gt; &lt;forward_to&gt;${forward_number}&lt;/forward_to&gt; &lt;/action&gt;&lt;/answering_rule&gt;', 0);">
  48. <TRANSITIONS>
  49. <TRANSITION type="TransitionAlwaysTrue">
  50. <next_state_id>6</next_state_id>
  51. </TRANSITION>
  52. </TRANSITIONS>
  53. </STATE>
  54. <STATE id="6" name="PlayWaveState" wave_name="${language-media-dirname}\beep" playing_time="1">
  55. <TRANSITIONS>
  56. <TRANSITION type="TransitionOnEvent">
  57. <next_state_id event="EndCallEvent">FINAL_STATE_ID</next_state_id>
  58. </TRANSITION>
  59. <TRANSITION type="TransitionAlwaysTrue">
  60. <next_state_id>FINAL_STATE_ID</next_state_id>
  61. </TRANSITION>
  62. </TRANSITIONS>
  63. </STATE>
  64. <STATE id="8" name="SQLQueryState" result_variable="did_number" query="select SUBSTRING_INDEX(SUBSTRING_INDEX(&quot;${dialed-number}&quot;,&quot;*&quot;,-2),'*',1));">
  65. <TRANSITIONS>
  66. <TRANSITION type="TransitionAlwaysTrue">
  67. <next_state_id>2</next_state_id>
  68. </TRANSITION>
  69. </TRANSITIONS>
  70. </STATE>
  71. <STATE id="9" name="SQLQueryState" query="update dialingplan set tech_prefix = concat(LEFT(tech_prefix, INSTR(tech_prefix,'#')), 'redirect') where telephone_number = '${did_number}' and telephone_number in (select phone_number from portal_clientdids where client_id = ${/client/id-client});">
  72. <TRANSITIONS>
  73. <TRANSITION type="TransitionAlwaysTrue">
  74. <next_state_id>6</next_state_id>
  75. </TRANSITION>
  76. </TRANSITIONS>
  77. </STATE>
  78. </SCENARIO>
  79. </SCENARIOS>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement