[Home]

Summary:ASTERISK-16355: [patch] Chanspy Keeps using G729 Encoder licenses even after the spying channel hangs up.
Reporter:manvirr (manvirr)Labels:
Date Opened:2010-07-12 09:02:33Date Closed:2010-07-29 14:18:50
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Applications/app_chanspy
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) encoder_fix.diff
Description:Hi,

We are using Asterisk 1.6.2.9 and running on Cent OS 5.4 x86_64 kernel 2.6.18-194.3.1.el5

We are using G729 for our sip trunks. Our extensions use G729 as well. When I try to spy on a channel with chanspy, I observe that the G729 licenses keep getting used up but do not get freed up even when I hang up the Spy / Spying Extension.

Is there any way we can free up the licenses when the spying of a channel is over?

When I do g729 show licenses I get the following output.. And with every channel that is spied on, the encoder count keeps increasing but with every call that is hung up, the encoder count does not decrease.

2/0 encoders/decoders of 16 licensed channels are currently in use

Licenses Found:
File: G729-REMOVED.lic -- Key: G729-REMOVED -- Host-ID: REMOVED -- Channels: 11 (Expires: 2030-07-01) (OK)
File: G729-REMOVED.lic -- Key: G729-REMOVED -- Host-ID: REMOVED -- Channels: 5 (Expires: 2030-06-28) (OK)
Comments:By: Leif Madsen (lmadsen) 2010-07-12 11:26:01

Can you show the dialplan you're using along with some console outputs showing the channels totally cleared from memory? Thanks!

By: manvirr (manvirr) 2010-07-12 11:37:15

Console output with channels totally cleared......

AGI-ASTM1*CLI> sip show channels
Peer             User/ANR         Call ID          Format           Hold     Last Message    Expiry
0 active SIP dialogs
AGI-ASTM1*CLI> g729 show licenses
1/0 encoders/decoders of 16 licensed channels are currently in use

Licenses Found:
File: G729-REMOVED.lic -- Key: G729-REMOVED -- Host-ID: REMOVED -- Channels: 11 (Expires: 2030-07-01) (OK)
File: G729-REMOVED.lic -- Key: G729-REMOVED -- Host-ID: REMOVED -- Channels: 5 (Expires: 2030-06-28) (OK)

AGI-ASTM1*CLI>


Dialplan: Not sure... do you want the entire dial plan or chanspy dial plan... I can attach the config directory if you want.



By: manvirr (manvirr) 2010-07-12 11:43:25

Dialplan for Chanspy is

[app-chanspy]
include => app-chanspy-custom
exten => 555,1,Macro(user-callerid,)
exten => 555,n,Answer
exten => 555,n,Wait(1)
exten => 555,n,ChanSpy()
exten => 555,n,Hangup

; end of [app-chanspy]

By: Leif Madsen (lmadsen) 2010-07-12 15:16:33

Great thanks! I just wanted some dialplan that you were using to reproduce the issue.

By: manvirr (manvirr) 2010-07-14 07:35:09

Just a question.... Not sure if i should ask it here. Why would there be a need for G729 license for chanspy when the spied channel and spying channel both are using and bridged on g729.

By: Jason Parker (jparker) 2010-07-14 10:21:49

Please mask your key and host-id next time you post logs...

By: manvirr (manvirr) 2010-07-14 10:27:40

Thanks.... Will keep this in mind....

By: Leif Madsen (lmadsen) 2010-07-14 13:45:32

manvirr: see the related issue, which should help explain why G.729 is used even when both end points are G.729.

By: Digium Subversion (svnbot) 2010-07-27 15:33:39

Repository: asterisk
Revision: 279945

U   branches/1.4/include/asterisk/audiohook.h
U   branches/1.4/main/audiohook.c
U   branches/1.4/main/channel.c

------------------------------------------------------------------------
r279945 | dvossel | 2010-07-27 15:33:39 -0500 (Tue, 27 Jul 2010) | 19 lines

remove empty audiohook write list on channel

If a channel has an audiohook write list created on it, that
list stays on the channel until the channel is destroyed.  There
is no reason to keep that list on the channel if it becomes empty.
If it is empty that just means we are doing needless translating
for every ast_read and ast_write.  This patch removes the audiohook
list from the channel once it is detected to be empty on either a
read or write.  If a audiohook is added back to the channel after
this list is destroyed, the list just gets recreated as if it never
existed to begin with.

(closes issue ASTERISK-16355)
Reported by: manvirr

Review: https://reviewboard.asterisk.org/r/799/



------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=279945

By: Digium Subversion (svnbot) 2010-07-27 15:54:30

Repository: asterisk
Revision: 279946

_U  branches/1.6.2/
U   branches/1.6.2/include/asterisk/audiohook.h
U   branches/1.6.2/main/audiohook.c
U   branches/1.6.2/main/channel.c

------------------------------------------------------------------------
r279946 | dvossel | 2010-07-27 15:54:30 -0500 (Tue, 27 Jul 2010) | 24 lines

Merged revisions 279945 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
 r279945 | dvossel | 2010-07-27 15:33:40 -0500 (Tue, 27 Jul 2010) | 19 lines
 
 remove empty audiohook write list on channel
 
 If a channel has an audiohook write list created on it, that
 list stays on the channel until the channel is destroyed.  There
 is no reason to keep that list on the channel if it becomes empty.
 If it is empty that just means we are doing needless translating
 for every ast_read and ast_write.  This patch removes the audiohook
 list from the channel once it is detected to be empty on either a
 read or write.  If a audiohook is added back to the channel after
 this list is destroyed, the list just gets recreated as if it never
 existed to begin with.
 
 (closes issue ASTERISK-16355)
 Reported by: manvirr
 
 Review: https://reviewboard.asterisk.org/r/799/
........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=279946

By: Digium Subversion (svnbot) 2010-07-27 15:56:59

Repository: asterisk
Revision: 279949

_U  branches/1.8/
U   branches/1.8/include/asterisk/audiohook.h
U   branches/1.8/main/audiohook.c
U   branches/1.8/main/channel.c

------------------------------------------------------------------------
r279949 | dvossel | 2010-07-27 15:56:59 -0500 (Tue, 27 Jul 2010) | 31 lines

Merged revisions 279946 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.6.2

................
 r279946 | dvossel | 2010-07-27 15:54:32 -0500 (Tue, 27 Jul 2010) | 24 lines
 
 Merged revisions 279945 via svnmerge from
 https://origsvn.digium.com/svn/asterisk/branches/1.4
 
 ........
   r279945 | dvossel | 2010-07-27 15:33:40 -0500 (Tue, 27 Jul 2010) | 19 lines
   
   remove empty audiohook write list on channel
   
   If a channel has an audiohook write list created on it, that
   list stays on the channel until the channel is destroyed.  There
   is no reason to keep that list on the channel if it becomes empty.
   If it is empty that just means we are doing needless translating
   for every ast_read and ast_write.  This patch removes the audiohook
   list from the channel once it is detected to be empty on either a
   read or write.  If a audiohook is added back to the channel after
   this list is destroyed, the list just gets recreated as if it never
   existed to begin with.
   
   (closes issue ASTERISK-16355)
   Reported by: manvirr
   
   Review: https://reviewboard.asterisk.org/r/799/
 ........
................

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=279949

By: Digium Subversion (svnbot) 2010-07-27 15:59:15

Repository: asterisk
Revision: 279951

_U  trunk/
U   trunk/include/asterisk/audiohook.h
U   trunk/main/audiohook.c
U   trunk/main/channel.c

------------------------------------------------------------------------
r279951 | dvossel | 2010-07-27 15:59:15 -0500 (Tue, 27 Jul 2010) | 38 lines

Merged revisions 279949 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

................
 r279949 | dvossel | 2010-07-27 15:57:00 -0500 (Tue, 27 Jul 2010) | 31 lines
 
 Merged revisions 279946 via svnmerge from
 https://origsvn.digium.com/svn/asterisk/branches/1.6.2
 
 ................
   r279946 | dvossel | 2010-07-27 15:54:32 -0500 (Tue, 27 Jul 2010) | 24 lines
   
   Merged revisions 279945 via svnmerge from
   https://origsvn.digium.com/svn/asterisk/branches/1.4
   
   ........
     r279945 | dvossel | 2010-07-27 15:33:40 -0500 (Tue, 27 Jul 2010) | 19 lines
     
     remove empty audiohook write list on channel
     
     If a channel has an audiohook write list created on it, that
     list stays on the channel until the channel is destroyed.  There
     is no reason to keep that list on the channel if it becomes empty.
     If it is empty that just means we are doing needless translating
     for every ast_read and ast_write.  This patch removes the audiohook
     list from the channel once it is detected to be empty on either a
     read or write.  If a audiohook is added back to the channel after
     this list is destroyed, the list just gets recreated as if it never
     existed to begin with.
     
     (closes issue ASTERISK-16355)
     Reported by: manvirr
     
     Review: https://reviewboard.asterisk.org/r/799/
   ........
 ................
................

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=279951

By: manvirr (manvirr) 2010-07-28 10:32:45

Hi I tried downloading the SVN Branch mentioned, compiled and deployed asterisk from this svn branch. The issue does not resolve. I still have the encoder license count increasing with every call spied but the count never decreases with spying/spied channel hangup.

By: manvirr (manvirr) 2010-07-28 11:27:44

Another update. Now the licenses Increase by 2 instead of 1 for each spied call

By: manvirr (manvirr) 2010-07-28 12:48:17

Just recompiled asterisk 1.4 and installed it. This problem is not there on Asterisk 1.4. I guess will be using 1.4 for the production build for the time being

By: David Vossel (dvossel) 2010-07-28 14:21:18

Please provide cli output demonstrating this with an up to date svn version of what ever branch you are using.

I would like to see a 'core show channels' output coupled with the g729 usage before and after using chanspy.

By: manvirr (manvirr) 2010-07-29 06:48:09

Before the call

g729 show licenses
0/0 encoders/decoders of 10 licensed channels are currently in use

Licenses Found:
File: G729-REMOVED.lic -- Key: G729-REMOVED -- Host-ID: REMOVED -- Channels: 10 (Expires: 2029-06-17) (OK)


During the call

0/0 encoders/decoders of 10 licensed channels are currently in use

Licenses Found:
File: G729-REMOVED.lic -- Key: G729-REMOVED -- Host-ID: REMOVED -- Channels: 10 (Expires: 2029-06-17) (OK)


During Chanspy on this call

g729 show licenses
2/4 encoders/decoders of 10 licensed channels are currently in use

Licenses Found:
File: G729-REMOVED.lic -- Key: G729-REMOVED -- Host-ID: REMOVED -- Channels: 10 (Expires: 2029-06-17) (OK)

After Channels hangup

E94LocalTerm*CLI> core show channe
channel       channels      channeltypes  channeltype
E94LocalTerm*CLI> core show channels verbose
Channel              Context              Extension        Prio State   Application  Data                      CallerID        Duration Accountcode BridgedTo
0 active channels
0 active calls
2 calls processed
E94LocalTerm*CLI> g729 show licenses
2/0 encoders/decoders of 10 licensed channels are currently in use

Licenses Found:
File: G729-REMOVED.lic -- Key: G729-REMOVED -- Host-ID: REMOVED -- Channels: 10 (Expires: 2029-06-17) (OK)

By: manvirr (manvirr) 2010-07-29 06:48:54

Asterisk Core Show Version status

core show version
Asterisk SVN-branch-1.6.2-r279946M built by root @ E94LocalTerm on a x86_64 running Linux on 2010-07-28 16:02:19 UTC

By: David Vossel (dvossel) 2010-07-29 09:43:58

Thank you for the feedback, I am investigating this further.

By: David Vossel (dvossel) 2010-07-29 10:41:58

I am able to reproduce this as well now even with the patch.  I should have a solution shortly.

By: David Vossel (dvossel) 2010-07-29 12:07:15

Please test the patch I have attached to this issue.

By: manvirr (manvirr) 2010-07-29 13:12:10

Excellent ..... This patch works like a charm...... :).... Channels are freeing up.... :)

By: David Vossel (dvossel) 2010-07-29 13:57:31

nice, that was a tricky one.  Thanks for testing it.

By: Digium Subversion (svnbot) 2010-07-29 14:04:22

Repository: asterisk
Revision: 280448

U   branches/1.4/main/channel.c

------------------------------------------------------------------------
r280448 | dvossel | 2010-07-29 14:04:22 -0500 (Thu, 29 Jul 2010) | 12 lines

fixes issue with translator frame not getting freed

A translator frame even if it local storage so the translation path
can be freed.  This issue prevented g729 licenses from being freed up.

(closes issue ASTERISK-16355)
Reported by: manvirr
Patches:
     encoder_fix.diff uploaded by dvossel (license 671)
Tested by: manvirr, dvossel


------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=280448

By: Digium Subversion (svnbot) 2010-07-29 14:05:24

Repository: asterisk
Revision: 280449

_U  branches/1.6.2/
U   branches/1.6.2/main/channel.c

------------------------------------------------------------------------
r280449 | dvossel | 2010-07-29 14:05:23 -0500 (Thu, 29 Jul 2010) | 18 lines

Merged revisions 280448 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
 r280448 | dvossel | 2010-07-29 14:04:23 -0500 (Thu, 29 Jul 2010) | 12 lines
 
 fixes issue with translator frame not getting freed
 
 A translator frame even if it local storage so the translation path
 can be freed.  This issue prevented g729 licenses from being freed up.
 
 (closes issue ASTERISK-16355)
 Reported by: manvirr
 Patches:
       encoder_fix.diff uploaded by dvossel (license 671)
 Tested by: manvirr, dvossel
........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=280449

By: Digium Subversion (svnbot) 2010-07-29 14:13:26

Repository: asterisk
Revision: 280450

_U  branches/1.8/
U   branches/1.8/main/channel.c

------------------------------------------------------------------------
r280450 | dvossel | 2010-07-29 14:13:25 -0500 (Thu, 29 Jul 2010) | 25 lines

Merged revisions 280449 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.6.2

................
 r280449 | dvossel | 2010-07-29 14:05:25 -0500 (Thu, 29 Jul 2010) | 18 lines
 
 Merged revisions 280448 via svnmerge from
 https://origsvn.digium.com/svn/asterisk/branches/1.4
 
 ........
   r280448 | dvossel | 2010-07-29 14:04:23 -0500 (Thu, 29 Jul 2010) | 12 lines
   
   fixes issue with translator frame not getting freed
   
   A translator frame even if it local storage so the translation path
   can be freed.  This issue prevented g729 licenses from being freed up.
   
   (closes issue ASTERISK-16355)
   Reported by: manvirr
   Patches:
         encoder_fix.diff uploaded by dvossel (license 671)
   Tested by: manvirr, dvossel
 ........
................

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=280450

By: Digium Subversion (svnbot) 2010-07-29 14:18:49

Repository: asterisk
Revision: 280459

_U  trunk/
U   trunk/main/channel.c

------------------------------------------------------------------------
r280459 | dvossel | 2010-07-29 14:18:49 -0500 (Thu, 29 Jul 2010) | 32 lines

Merged revisions 280450 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

................
 r280450 | dvossel | 2010-07-29 14:13:27 -0500 (Thu, 29 Jul 2010) | 25 lines
 
 Merged revisions 280449 via svnmerge from
 https://origsvn.digium.com/svn/asterisk/branches/1.6.2
 
 ................
   r280449 | dvossel | 2010-07-29 14:05:25 -0500 (Thu, 29 Jul 2010) | 18 lines
   
   Merged revisions 280448 via svnmerge from
   https://origsvn.digium.com/svn/asterisk/branches/1.4
   
   ........
     r280448 | dvossel | 2010-07-29 14:04:23 -0500 (Thu, 29 Jul 2010) | 12 lines
     
     fixes issue with translator frame not getting freed
     
     A translator frame even if it local storage so the translation path
     can be freed.  This issue prevented g729 licenses from being freed up.
     
     (closes issue ASTERISK-16355)
     Reported by: manvirr
     Patches:
           encoder_fix.diff uploaded by dvossel (license 671)
     Tested by: manvirr, dvossel
   ........
 ................
................

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=280459