Summary:ASTERISK-13965: [patch] hangup when the spied-on channel hangups
Reporter:Clod Patry (junky)Labels:
Date Opened:2009-04-16 00:07:50Date Closed:2009-09-16 19:59:56
Versions:Frequency of
Environment:Attachments:( 0) __20090901-spy_hangup_trunk.diff
( 1) spy_hangup_1_4_20_1_english.diff
( 2) spy_hangup_1_4_20_1.diff
( 3) spy_hangup_1_4_24_1.diff
( 4) spy_hangup_trunk_rev2.diff
( 5) spy_hangup_trunk.diff
Description:Following a thread on asterisk-dev

I decided it would be cool to have such a feature.

This is the #1 only

When the spied-on channel hangups, it stops the spying and goto the next priority in the dialplan.


I wrote it for, so if I received good feedbacks, will create the same patch for trunk.

Btw, i created the hanguped var just to be able to broke the outter loop.
There's probably a much more beautiful to do it, but it works.

Comments:By: Alec Davis (alecdavis) 2009-04-16 02:03:10

Grammar issue:
Is hangedup the correct term. Shouldn't it be hungup?

By: Amilcar S Silvestre (amilcar) 2009-04-16 06:27:33

This is very nice! I'll try the patch.

By: Clod Patry (junky) 2009-04-16 07:15:31

alecdavis: since english isnt my monther tonge, mistakes can happen :)
I will fix that, thanks.

If you try the patch, let me know how it goes.

By: Alistair Cunningham (acunningham) 2009-04-16 07:29:17

I've uploaded a new version with the English cleaned up.

By: Fernando Lujan (flujan) 2009-04-17 19:45:38

VERY NICE WORK. Please commit to trunk, this is a very nice feature. It also can be used to solve a issue that I am having. When A Chanspy B and B is answering a call from a Queue. B keeps its state as in use. I just come to report it, and found this.

By: Clod Patry (junky) 2009-04-21 23:47:27

acunningham asked me to get the patch for and

For, you can use the same patch (spy_hangup_1_4_20_1_english.diff)
and for, you can use this new one (spy_hangup_1_4_24_1.diff)

By: Clod Patry (junky) 2009-04-21 23:50:05

Just few notes for those interested:
you simply need to use ChanSpy with option h:

   -- Executing [88@default:1] ChanSpy("SIP/10-0080f3e0", "|h") in new stack
   -- <SIP/10-0080f3e0> Playing 'beep' (language 'fr')
   -- <SIP/10-0080f3e0> Playing 'spy-sip' (language 'fr')
   -- <SIP/10-0080f3e0> Playing 'digits/1' (language 'fr')
   -- <SIP/10-0080f3e0> Playing 'digits/7' (language 'fr')

 == Spying on channel SIP/17-008030c0
[Apr 21 20:46:56] NOTICE[7196]: app_chanspy.c:220 start_spying: Attaching SIP/10-0080f3e0 to SIP/17-008030c0
 == Spawn extension (default, 126, 1) exited non-zero on 'SIP/17-008030c0'
 == Done Spying on channel SIP/17-008030c0
   -- Hang up due to the spied-on channel hanging up.
   -- Executing [88@default:2] Hangup("SIP/10-0080f3e0", "") in new stack

Like you can see, the spied-on channel (SIP/17-008030c0) hanguped, so it hanguped the channel (SIP/10-0080f3e0) which started the ChanSpy.

Calling Chanspy without option h, will act like before.

By: Clod Patry (junky) 2009-04-22 00:14:00

i just included the patch for trunk.
I also re-ordered all the options to be easier to read.

By: Clod Patry (junky) 2009-05-03 22:37:36

rev2 is after the merge of astobj2, as requested by Russell on IRC.
based on Rev 191919

By: Alistair Cunningham (acunningham) 2009-06-18 04:07:09

Any chance of this getting incorporated into the Asterisk builds?

By: Amilcar S Silvestre (amilcar) 2009-07-27 05:15:18

What is missing to commit this change?

By: Leif Madsen (lmadsen) 2009-09-01 14:35:37

I've updated the patch to latest trunk, but someone will have to verify it is good. I'm going to test this. Please check specifically the enum at the top.

By: Leif Madsen (lmadsen) 2009-09-01 15:02:42

I've tested this today, and the feature works as advertised!

By: Digium Subversion (svnbot) 2009-09-16 19:59:54

Repository: asterisk
Revision: 219105

U   trunk/CHANGES
U   trunk/apps/app_chanspy.c

r219105 | tilghman | 2009-09-16 19:59:53 -0500 (Wed, 16 Sep 2009) | 10 lines

Add the 'E' option to exit ChanSpy, once the single channel it spied upon hangs up.
In addition, there's a bit of cleanup to the arguments and documentation, in which
I discovered that the last feature added to this application duplicated an option
(oops!) and changed that option so that it now works.
(closes issue ASTERISK-13965)
Reported by: junky
      __20090901-spy_hangup_trunk.diff uploaded by lmadsen (license 10)
Tested by: amilcar, junky, flujan, lmadsen