[asterisk-users] Stopping chanspy followup

Jim Dickenson dickenson at cfmc.com
Thu Feb 5 12:28:31 CST 2009


Here is a patch file for my change to 1.4.23.1 code

*** app_chanspy.c.orig    Fri Dec 19 07:03:02 2008
--- app_chanspy.c    Thu Feb  5 09:53:32 2009
***************
*** 76,81 ****
--- 76,82 ----
  "      'Agent/1234'.\n"
  "  Options:\n"
  "    b             - Only spy on channels involved in a bridged call.\n"
+ "    e             - Exit when no channels to spy on.\n"
  "    g(grp)        - Match only channels where their ${SPYGROUP} variable
is set to\n"
  "                    contain 'grp' in an optional : delimited list.\n"
  "    q             - Don't play a beep when beginning to spy on a channel,
or speak the\n"
***************
*** 104,109 ****
--- 105,111 ----
  "    - Dialing * will stop spying and look for another channel to spy
on.\n"
  "  Options:\n"
  "    b             - Only spy on channels involved in a bridged call.\n"
+ "    e             - Exit when no channels to spy on.\n"
  "    g(grp)        - Match only channels where their ${SPYGROUP} variable
is set to\n"
  "                    contain 'grp' in an optional : delimited list.\n"
  "    q             - Don't play a beep when beginning to spy on a channel,
or speak the\n"
***************
*** 128,133 ****
--- 130,136 ----
      OPTION_RECORD    = (1 << 4),
      OPTION_WHISPER     = (1 << 5),
      OPTION_PRIVATE   = (1 << 6),    /* Private Whisper mode */
+     OPTION_EXIT      = (1 << 7),    /* Exit when nothing to do */
  } chanspy_opt_flags;
  
  enum {
***************
*** 140,145 ****
--- 143,149 ----
  AST_APP_OPTIONS(spy_opts, {
      AST_APP_OPTION('q', OPTION_QUIET),
      AST_APP_OPTION('b', OPTION_BRIDGED),
+     AST_APP_OPTION('e', OPTION_EXIT),
      AST_APP_OPTION('w', OPTION_WHISPER),
      AST_APP_OPTION('W', OPTION_PRIVATE),
      AST_APP_OPTION_ARG('v', OPTION_VOLUME, OPT_ARG_VOLUME),
***************
*** 672,677 ****
--- 676,685 ----
          }
          if (res == -1 || ast_check_hangup(chan))
              break;
+         if (ast_test_flag(flags, OPTION_EXIT)) {
+             if (! peer_chanspy_ds)
+                 break;
+         }
      }
      
      ast_clear_flag(chan, AST_FLAG_SPYING);

-- 
Jim Dickenson
mailto:dickenson at cfmc.com

CfMC
http://www.cfmc.com/



> From: Anthony Francis <anthonyf at rockynet.com>
> Reply-To: Asterisk Users Mailing List - Non-Commercial Discussion
> <asterisk-users at lists.digium.com>
> Date: Wed, 04 Feb 2009 16:55:25 -0700
> To: Asterisk Users Mailing List - Non-Commercial Discussion
> <asterisk-users at lists.digium.com>
> Subject: Re: [asterisk-users] Stopping chanspy followup
> 
> 
> Jim Dickenson wrote:
>> I am still trying to figure out a reasonable way to exit the chanspy
>> application in a dialplan.
>> 
>> For the most part I understand how things are working and there is one
>> change I would like to propose.
>> 
>> The way the 1.4.23.1 code seems to work is that if there are no channels
>> that match the chanprefix argument the chanspy code stays in a loop waiting
>> for a new channel to come into being that matches chanprefix and spying will
>> start.
>> 
>> I would like it if there are no channels to spy on that the chanspy
>> application exit.
>> 
>> This can be done by changing line 673 of chanspy.c in the following way
>> 
>> Old:
>>                 if (res == -1 || ast_check_hangup(chan))
>> 
>> 
>> New:
>>                 if (res == -1 || ast_check_hangup(chan) || !peer_chanspy_ds)
>> 
>> Otherwise, as best I can tell, unless there is some error chanspy never
>> exits unless the channel running the chanspy application hangs up, which I
>> do not particularly want to do.
>> 
>>   
> In the interim I would recommend you make chat change and recompile.
> 
> -- 
> Thank you and have any kind of day you want,
> 
> Anthony Francis
> 
> 
> 
> _______________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
> 
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20090205/e5239c64/attachment.htm 


More information about the asterisk-users mailing list