[Home]

Summary:ASTERISK-13524: [patch] streamed moh breaks if nobody listen it
Reporter:caspy (caspy)Labels:
Date Opened:2009-02-06 02:37:59.000-0600Date Closed:2009-03-12 11:55:18
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Resources/res_musiconhold
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) res_musiconhold.c.patch
Description:If i have a moh class, which plays a network stream, and when no one currently listening it, asterisk stops to receive data from player,
then in a few minutes player stops reading network stream,
and then tcp connection dropeed from server side. Bad.

I did not find any player, which can always read network, even when no one reads music from it.

I have looked what to patch, and decided, that asterisk's res_musiconhold is the easiest way.

All we need, is to check for existence of 'listeners' not just before reading music from player, but just after.
Look for code example in add.info.

With this patch, asterisk _always_ take music from player, and only then decides what to do (waste away or play for somebody).

It's work fine in my production (1.6.0.3-rc1) for two month.
Comments:By: snuffy (snuffy) 2009-02-06 03:11:02.000-0600

Please note, all code submissions must be uploaded as such.
It only takes 2 minutes to fill out the license agreement and up to 2 working days to be approved.

Only after you have submitted the code via the upload procedure can we look at your patch.

By: caspy (caspy) 2009-02-06 03:35:38.000-0600

(i posted only comments, cause patch is not fully understanable on a first sight)

now, i've download a patch. it's made on 1.6.0 branch (NOT 1.6.0.3-rc1).

By: caspy (caspy) 2009-03-03 05:31:43.000-0600

seems like bug get stuck in 'feedback' state. it's ok?

By: Digium Subversion (svnbot) 2009-03-12 11:29:19

Repository: asterisk
Revision: 181655

U   branches/1.4/res/res_musiconhold.c

------------------------------------------------------------------------
r181655 | file | 2009-03-12 11:29:19 -0500 (Thu, 12 Mar 2009) | 10 lines

Fix issue with streaming MOH failing if nobody is listening.

When a music class is setup to actually provide music on hold
from a stream we need to constantly read audio from it since it
will constantly be providing audio. This is now done despite there
being no channels listening to it.

(closes issue ASTERISK-13524)
Reported by: caspy

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

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

By: Digium Subversion (svnbot) 2009-03-12 11:32:21

Repository: asterisk
Revision: 181656

_U  trunk/
U   trunk/res/res_musiconhold.c

------------------------------------------------------------------------
r181656 | file | 2009-03-12 11:32:20 -0500 (Thu, 12 Mar 2009) | 17 lines

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

........
 r181655 | file | 2009-03-12 13:29:19 -0300 (Thu, 12 Mar 2009) | 10 lines
 
 Fix issue with streaming MOH failing if nobody is listening.
 
 When a music class is setup to actually provide music on hold
 from a stream we need to constantly read audio from it since it
 will constantly be providing audio. This is now done despite there
 being no channels listening to it.
 
 (closes issue ASTERISK-13524)
 Reported by: caspy
........

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

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

By: Digium Subversion (svnbot) 2009-03-12 11:33:48

Repository: asterisk
Revision: 181657

_U  branches/1.6.0/
U   branches/1.6.0/res/res_musiconhold.c

------------------------------------------------------------------------
r181657 | file | 2009-03-12 11:33:48 -0500 (Thu, 12 Mar 2009) | 24 lines

Merged revisions 181656 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

................
 r181656 | file | 2009-03-12 13:32:20 -0300 (Thu, 12 Mar 2009) | 17 lines
 
 Merged revisions 181655 via svnmerge from
 https://origsvn.digium.com/svn/asterisk/branches/1.4
 
 ........
   r181655 | file | 2009-03-12 13:29:19 -0300 (Thu, 12 Mar 2009) | 10 lines
   
   Fix issue with streaming MOH failing if nobody is listening.
   
   When a music class is setup to actually provide music on hold
   from a stream we need to constantly read audio from it since it
   will constantly be providing audio. This is now done despite there
   being no channels listening to it.
   
   (closes issue ASTERISK-13524)
   Reported by: caspy
 ........
................

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

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

By: Digium Subversion (svnbot) 2009-03-12 11:34:42

Repository: asterisk
Revision: 181658

_U  branches/1.6.1/
U   branches/1.6.1/res/res_musiconhold.c

------------------------------------------------------------------------
r181658 | file | 2009-03-12 11:34:42 -0500 (Thu, 12 Mar 2009) | 24 lines

Merged revisions 181656 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

................
 r181656 | file | 2009-03-12 13:32:20 -0300 (Thu, 12 Mar 2009) | 17 lines
 
 Merged revisions 181655 via svnmerge from
 https://origsvn.digium.com/svn/asterisk/branches/1.4
 
 ........
   r181655 | file | 2009-03-12 13:29:19 -0300 (Thu, 12 Mar 2009) | 10 lines
   
   Fix issue with streaming MOH failing if nobody is listening.
   
   When a music class is setup to actually provide music on hold
   from a stream we need to constantly read audio from it since it
   will constantly be providing audio. This is now done despite there
   being no channels listening to it.
   
   (closes issue ASTERISK-13524)
   Reported by: caspy
 ........
................

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

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

By: caspy (caspy) 2009-03-12 11:42:29

hmm..

doing comparation of class->dir to string "http://" is not enought.
it will be ok for single URL specified in 'directory=',
but not for 'application=' case. look for example:

[default]
mode=custom
application=/usr/local/bin/stream2asterisk

*CLI> moh show classes
Class: default
       Mode: custom
       Directory: nodir
       Application: /usr/local/bin/stream2asterisk
       Format: slin


By: Digium Subversion (svnbot) 2009-03-12 11:50:38

Repository: asterisk
Revision: 181659

U   branches/1.4/res/res_musiconhold.c

------------------------------------------------------------------------
r181659 | file | 2009-03-12 11:50:38 -0500 (Thu, 12 Mar 2009) | 8 lines

Fix another scenario where depending on configuration the stream would not get read.

For custom commands we don't know whether the audio is coming from a stream or not
so we are going to have to read the data despite no channels.

(closes issue ASTERISK-13524)
Reported by: caspy

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

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

By: Digium Subversion (svnbot) 2009-03-12 11:53:53

Repository: asterisk
Revision: 181661

_U  trunk/
U   trunk/res/res_musiconhold.c

------------------------------------------------------------------------
r181661 | file | 2009-03-12 11:53:53 -0500 (Thu, 12 Mar 2009) | 19 lines

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

........
 r181659 | file | 2009-03-12 13:50:37 -0300 (Thu, 12 Mar 2009) | 8 lines
 
 Fix another scenario where depending on configuration the stream would not get read.
 
 For custom commands we don't know whether the audio is coming from a stream or not
 so we are going to have to read the data despite no channels.
 
 (closes issue ASTERISK-13524)
 Reported by: caspy
........
 r181660 | file | 2009-03-12 13:52:45 -0300 (Thu, 12 Mar 2009) | 2 lines
 
 Fix logic flaw in previous commit.
........

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

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

By: Digium Subversion (svnbot) 2009-03-12 11:54:36

Repository: asterisk
Revision: 181662

_U  branches/1.6.0/
U   branches/1.6.0/res/res_musiconhold.c

------------------------------------------------------------------------
r181662 | file | 2009-03-12 11:54:36 -0500 (Thu, 12 Mar 2009) | 26 lines

Merged revisions 181661 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

................
 r181661 | file | 2009-03-12 13:53:52 -0300 (Thu, 12 Mar 2009) | 19 lines
 
 Merged revisions 181659-181660 via svnmerge from
 https://origsvn.digium.com/svn/asterisk/branches/1.4
 
 ........
   r181659 | file | 2009-03-12 13:50:37 -0300 (Thu, 12 Mar 2009) | 8 lines
   
   Fix another scenario where depending on configuration the stream would not get read.
   
   For custom commands we don't know whether the audio is coming from a stream or not
   so we are going to have to read the data despite no channels.
   
   (closes issue ASTERISK-13524)
   Reported by: caspy
 ........
   r181660 | file | 2009-03-12 13:52:45 -0300 (Thu, 12 Mar 2009) | 2 lines
   
   Fix logic flaw in previous commit.
 ........
................

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

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

By: Digium Subversion (svnbot) 2009-03-12 11:55:17

Repository: asterisk
Revision: 181663

_U  branches/1.6.1/
U   branches/1.6.1/res/res_musiconhold.c

------------------------------------------------------------------------
r181663 | file | 2009-03-12 11:55:17 -0500 (Thu, 12 Mar 2009) | 26 lines

Merged revisions 181661 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

................
 r181661 | file | 2009-03-12 13:53:52 -0300 (Thu, 12 Mar 2009) | 19 lines
 
 Merged revisions 181659-181660 via svnmerge from
 https://origsvn.digium.com/svn/asterisk/branches/1.4
 
 ........
   r181659 | file | 2009-03-12 13:50:37 -0300 (Thu, 12 Mar 2009) | 8 lines
   
   Fix another scenario where depending on configuration the stream would not get read.
   
   For custom commands we don't know whether the audio is coming from a stream or not
   so we are going to have to read the data despite no channels.
   
   (closes issue ASTERISK-13524)
   Reported by: caspy
 ........
   r181660 | file | 2009-03-12 13:52:45 -0300 (Thu, 12 Mar 2009) | 2 lines
   
   Fix logic flaw in previous commit.
 ........
................

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

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