Guest User

Untitled

a guest
Apr 21st, 2018
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.85 KB | None | 0 0
  1. Index: apps/app_chanspy.c
  2. ===================================================================
  3. --- apps/app_chanspy.c (revision 347057)
  4. +++ apps/app_chanspy.c (working copy)
  5. @@ -168,7 +168,12 @@
  6. name of the last channel that was spied on will be stored
  7. in the <variable>SPY_CHANNEL</variable> variable.</para>
  8. </option>
  9. - </optionlist>
  10. + <option name="1">
  11. + <para>Put ChanSpy in single channel mode. <literal>chanprefix</literal> must be
  12. + the full name of a channel that exists or ChanSpy will exit immediately. Also
  13. + causes ChanSpy to exit if the spied channel ends.</para>
  14. + </option>
  15. + </optionlist>
  16. </parameter>
  17. </syntax>
  18. <description>
  19. @@ -367,6 +372,7 @@
  20. OPTION_DAHDI_SCAN = (1 << 16), /* Scan groups in DAHDIScan mode */
  21. OPTION_STOP = (1 << 17),
  22. OPTION_EXITONHANGUP = (1 << 18), /* Hang up when the spied-on channel hangs up. */
  23. + OPTION_SINGLE_CHANNEL = (1 << 19), /* Single channel mode */
  24. };
  25.  
  26. enum {
  27. @@ -399,6 +405,7 @@
  28. AST_APP_OPTION('W', OPTION_PRIVATE),
  29. AST_APP_OPTION_ARG('x', OPTION_DTMF_EXIT, OPT_ARG_EXIT),
  30. AST_APP_OPTION('X', OPTION_EXIT),
  31. + AST_APP_OPTION('1', OPTION_SINGLE_CHANNEL),
  32. });
  33.  
  34. struct chanspy_translation_helper {
  35. @@ -765,6 +772,9 @@
  36. ast_channel_unlock(chan);
  37. }
  38.  
  39. + if (ast_test_flag(flags, OPTION_SINGLE_CHANNEL))
  40. + ast_set_flag(flags, OPTION_EXITONHANGUP);
  41. +
  42. if (chan->_state != AST_STATE_UP)
  43. ast_answer(chan);
  44.  
  45. @@ -797,7 +807,9 @@
  46.  
  47. /* Set up the iterator we'll be using during this call */
  48. if (!ast_strlen_zero(spec)) {
  49. - iter = ast_channel_iterator_by_name_new(spec, strlen(spec));
  50. + iter = ast_channel_iterator_by_name_new(
  51. + spec,
  52. + ast_test_flag(flags, OPTION_SINGLE_CHANNEL) ? 0 : strlen(spec));
  53. } else if (!ast_strlen_zero(exten)) {
  54. iter = ast_channel_iterator_by_exten_new(exten, context);
  55. } else {
Add Comment
Please, Sign In to add comment