aboutsummaryrefslogtreecommitdiffstats
path: root/res/res_musiconhold.c
AgeCommit message (Collapse)AuthorFilesLines
2010-09-09Merged revisions 285710 via svnmerge from bbryant1-53/+71
https://origsvn.digium.com/svn/asterisk/branches/1.6.2 ........ r285710 | bbryant | 2010-09-09 14:50:13 -0400 (Thu, 09 Sep 2010) | 8 lines Fixes an issue with dialplan pattern matching where the specificity for pattern ranges and pattern special characters was inconsistent. (closes issue #16903) Reported by: Nick_Lewis Patches: pbx.c-specificity.patch uploaded by Nick Lewis (license 657) Tested by: Nick_Lewis ........ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.8@285711 f38db490-d61c-443f-a65b-d21fe96a405b
2010-07-20Add load priority order, such that preload becomes unnecessary in most casestilghman1-1/+2
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@278132 f38db490-d61c-443f-a65b-d21fe96a405b
2010-07-16Add documentation for MOH realtime fieldstilghman1-0/+3
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@277452 f38db490-d61c-443f-a65b-d21fe96a405b
2010-06-23If there is realtime configuration, it does not get re-read on reload unless ↵tilghman1-1/+5
the config file also changes. (closes issue #16982) Reported by: dmitri Patches: res_musiconhold.patch uploaded by dmitri (license 1001) Tested by: atis git-svn-id: http://svn.digium.com/svn/asterisk/trunk@272332 f38db490-d61c-443f-a65b-d21fe96a405b
2010-06-14Merged revisions 270331 via svnmerge from pabelanger1-4/+9
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r270331 | pabelanger | 2010-06-14 17:31:59 -0400 (Mon, 14 Jun 2010) | 14 lines Properly play first file in sort list. When using sort=alpha we would always skip the first file in the list first time through. We now check for that properly. (closes issue #17470) Reported by: pabelanger Patches: sort.aplha.patch uploaded by pabelanger (license 224) Tested by: lmadsen Review: https://reviewboard.asterisk.org/r/703/ ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@270332 f38db490-d61c-443f-a65b-d21fe96a405b
2010-06-09fixes crash in moh when cachertclasses flag is useddvossel1-1/+4
The result for moh_register was not verified to guarantee the mohclass as added to the container. (closes issue #16993) Reported by: dmitri Patches: res_musiconhold_rtclass2.patch uploaded by dmitri (license 1001) moh_crash2.diff uploaded by dvossel (license 671) Tested by: dmitri git-svn-id: http://svn.digium.com/svn/asterisk/trunk@269271 f38db490-d61c-443f-a65b-d21fe96a405b
2010-05-26Remove unrelated MOH change from previous commit.mmichelson1-4/+0
Thanks Kevin! git-svn-id: http://svn.digium.com/svn/asterisk/trunk@266094 f38db490-d61c-443f-a65b-d21fe96a405b
2010-05-26Fix misspelling of macro args.mmichelson1-0/+4
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@266092 f38db490-d61c-443f-a65b-d21fe96a405b
2010-04-30Merged revisions 260345 via svnmerge from mmichelson1-3/+14
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r260345 | mmichelson | 2010-04-30 15:08:15 -0500 (Fri, 30 Apr 2010) | 18 lines Fix potential crash from race condition due to accessing channel data without the channel locked. In res_musiconhold.c, there are several places where a channel's stream's existence is checked prior to calling ast_closestream on it. The issue here is that in several cases, the channel was not locked while checking the stream. The result was that if two threads checked the state of the channel's stream at approximately the same time, then there could be a situation where both threads attempt to call ast_closestream on the channel's stream. The result here is that the refcount for the stream would go below 0, resulting in a crash. I have added proper channel locking to res_musiconhold.c to ensure that we do not try to check chan->stream without the channel locked. A Digium customer has been using this patch for several weeks and has not had any crashes since applying the patch. ABE-2147 ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@260346 f38db490-d61c-443f-a65b-d21fe96a405b
2010-03-05Merged revisions 250786 via svnmerge from jpeeler1-1/+1
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r250786 | jpeeler | 2010-03-04 19:02:58 -0600 (Thu, 04 Mar 2010) | 9 lines Fix not being able to specify a URL in MOH class directory. Don't attempt to chdir on a URL! (closes issue #16875) Reported by: raarts Patches: moh-http.patch uploaded by raarts (license 937) ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@250787 f38db490-d61c-443f-a65b-d21fe96a405b
2010-01-16Get MoH building on OpenSolaris.seanbright1-0/+4
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@240667 f38db490-d61c-443f-a65b-d21fe96a405b
2010-01-08Add the class actually used in the MusicOnHold start event.tilghman1-2/+4
(closes issue #16499) Reported by: syspert Patches: mohclass.patch uploaded by syspert (license 938) git-svn-id: http://svn.digium.com/svn/asterisk/trunk@238795 f38db490-d61c-443f-a65b-d21fe96a405b
2009-12-10Missed a case that emits a WARNING where none is warranted.tilghman1-0/+3
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@234210 f38db490-d61c-443f-a65b-d21fe96a405b
2009-12-08Find another ref leak and change how we manage module references.tilghman1-75/+40
(closes issue #16388, closes issue #16279, closes issue #16390) Reported by: parisioa Patches: 20091208__issue16388.diff.txt uploaded by tilghman (license 14) Tested by: parisioa, tilghman Review: https://reviewboard.asterisk.org/r/442/ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@233718 f38db490-d61c-443f-a65b-d21fe96a405b
2009-12-03Remove debugging linetilghman1-2/+0
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@232661 f38db490-d61c-443f-a65b-d21fe96a405b
2009-12-03Fix multiple issues with musiconhold, which led to classes not getting ↵tilghman1-41/+188
destroyed properly. * Classes are now tracked past removal from the core container, and module removal is actively prevented until all references are freed. * A hanging reference stored in the channel has been removed. This could have caused a mismatch and the music state not properly cleared, if two or more reloads occurred between MOH being stopped and MOH being restarted. * In certain circumstances, duplicate classes were possible. * A race existed at reload time between a process being killed and the thread responsible for reading from the related pipe respawning that process. * Several reference counts have also been corrected. At least one could have caused deleted classes to stick around forever, consuming resources. This originally manifested as MOH external processes that were not killed at reload time. (closes issue #16279, closes issue #16207) Reported by: parisioa, dcabot Patches: 20091202__issue16279__2.diff.txt uploaded by tilghman (license 14) Tested by: parisioa, tilghman git-svn-id: http://svn.digium.com/svn/asterisk/trunk@232660 f38db490-d61c-443f-a65b-d21fe96a405b
2009-11-13Display a list of channel variables in each channel-oriented event.tilghman1-2/+2
(Closes AST-33) Reviewboard: https://reviewboard.asterisk.org/r/368/ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@230111 f38db490-d61c-443f-a65b-d21fe96a405b
2009-11-04Expand codec bitfield from 32 bits to 64 bits.tilghman1-6/+6
Reviewboard: https://reviewboard.asterisk.org/r/416/ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@227580 f38db490-d61c-443f-a65b-d21fe96a405b
2009-10-06Recorded merge of revisions 222152 via svnmerge from kpfleming1-2/+2
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r222152 | kpfleming | 2009-10-05 20:16:36 -0500 (Mon, 05 Oct 2009) | 20 lines Fix ao2_iterator API to hold references to containers being iterated. See Mantis issue for details of what prompted this change. Additional notes: This patch changes the ao2_iterator API in two ways: F_AO2I_DONTLOCK has become an enum instead of a macro, with a name that fits our naming policy; also, it is now necessary to call ao2_iterator_destroy() on any iterator that has been created. Currently this only releases the reference to the container being iterated, but in the future this could also release other resources used by the iterator, if the iterator implementation changes to use additional resources. (closes issue #15987) Reported by: kpfleming Review: https://reviewboard.asterisk.org/r/383/ ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@222176 f38db490-d61c-443f-a65b-d21fe96a405b
2009-09-10Sets the correct musicclass after an announcementmnick1-7/+3
(closes issue #15279) Reported by: mbeckwell Patches: patch.txt uploaded by mnick (license ) Tested by: mnick (closes issue #15832) Reported by: mbeckwell Patches: patch.txt uploaded by mnick (license 874) Tested by: mnick git-svn-id: http://svn.digium.com/svn/asterisk/trunk@217730 f38db490-d61c-443f-a65b-d21fe96a405b
2009-08-28Remove unnecessary define for Solaristilghman1-3/+0
(closes issue #15358) Reported by: snuffy Patches: bug_res_moh_remove_unneeded_include.diff uploaded by snuffy (license 35) git-svn-id: http://svn.digium.com/svn/asterisk/trunk@214611 f38db490-d61c-443f-a65b-d21fe96a405b
2009-08-10AST-2009-005tilghman1-1/+1
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@211539 f38db490-d61c-443f-a65b-d21fe96a405b
2009-07-27Honor channel's music class when using realtime music on hold.mmichelson1-20/+27
(closes issue #15051) Reported by: alexh Patches: 15051.patch uploaded by mmichelson (license 60) Tested by: alexh git-svn-id: http://svn.digium.com/svn/asterisk/trunk@209197 f38db490-d61c-443f-a65b-d21fe96a405b
2009-06-18Merged revisions 201600 via svnmerge from russell1-1/+2
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r201600 | russell | 2009-06-18 10:24:31 -0500 (Thu, 18 Jun 2009) | 29 lines Fix memory corruption and leakage related reloads of non files mode MoH classes. For Music on Hold classes that are not files mode, meaning that we are executing an application that will feed us audio data, we use a thread to monitor the external application and read audio from it. This thread also makes use of the MoH class object. In the MoH class destructor, we used pthread_cancel() to ask the thread to exit. Unfortunately, the code did not wait to ensure that the thread actually went away. What needed to be done is a pthread_join() to ensure that the thread fully cleans up before we proceed. By adding this one line, we resolve two significant problems: 1) Since the thread was never joined, it never fully goes away. So, on every reload of non-files mode MoH, an unused thread was sticking around. 2) There was a race condition here where the application monitoring thread could still try to access the MoH class, even though the thread executing the MoH reload has already destroyed it. (issue #15109) Reported by: jvandal (issue #15123) Reported by: axisinternet (issue #15195) Reported by: amorsen (issue AST-208) ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@201610 f38db490-d61c-443f-a65b-d21fe96a405b
2009-06-06Move music on hold related applications documentation to XML.eliel1-52/+81
Move MusicOnHold, SetMusicOnHold, StartMusicOnHold, StopMusicOnHold static documentation to the new AstXML form. (issue #15245) Reported by: eliel Patches: res_musiconhold_static_conversion.txt uploaded by lmadsen (license 10) (with some fixes and formatting by me) git-svn-id: http://svn.digium.com/svn/asterisk/trunk@199413 f38db490-d61c-443f-a65b-d21fe96a405b
2009-05-21Const-ify the world (or at least a good part of it)kpfleming1-5/+5
This patch adds 'const' tags to a number of Asterisk APIs where they are appropriate (where the API already demanded that the function argument not be modified, but the compiler was not informed of that fact). The list includes: - CLI command handlers - CLI command handler arguments - AGI command handlers - AGI command handler arguments - Dialplan application handler arguments - Speech engine API function arguments In addition, various file-scope and function-scope constant arrays got 'const' and/or 'static' qualifiers where they were missing. Review: https://reviewboard.asterisk.org/r/251/ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@196072 f38db490-d61c-443f-a65b-d21fe96a405b
2009-04-13Fix another crash related to cached realtime music on hold.mmichelson1-1/+3
This was another off-by-one problem caused by moh_register. git-svn-id: http://svn.digium.com/svn/asterisk/trunk@188102 f38db490-d61c-443f-a65b-d21fe96a405b
2009-04-09Use safe macro practices even though they really aren't necessary.mmichelson1-2/+2
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@187424 f38db490-d61c-443f-a65b-d21fe96a405b
2009-04-09Fix a crash in res_musiconhold when using cached realtime moh.mmichelson1-42/+51
The moh_register function links an mohclass and then immediately unrefs the class since the container now has a reference. The problem with using realtime music on hold is that the class is allocated, registered, and started in one fell swoop. The refcounting logic resulted in the count being off by one. The same problem did not happen when using a static config because the allocation and registration of an mohclass is a separate operation from starting moh. This also did not affect non-cached realtime moh because the classes are not registered at all. I also have modified res_musiconhold to use the _t_ variants of the ao2_ functions so that more info can be gleaned when attempting to trace the refcounts. I found this to be incredibly helpful for debugging this issue and there's no good reason to remove it. (closes issue #14661) Reported by: sum git-svn-id: http://svn.digium.com/svn/asterisk/trunk@187421 f38db490-d61c-443f-a65b-d21fe96a405b
2009-04-08Merged revisions 187045 via svnmerge from mmichelson1-3/+3
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r187045 | mmichelson | 2009-04-08 11:52:03 -0500 (Wed, 08 Apr 2009) | 10 lines Fix a small logical error when loading moh classes. We were unconditionally incrementing the number of mohclasses registered. However, we should actually only increment if the call to moh_register was successful. While this probably has never caused problems, I noticed it and decided to fix it anyway. ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@187046 f38db490-d61c-443f-a65b-d21fe96a405b
2009-03-12Merged revisions 181664 via svnmerge from file1-1/+1
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r181664 | file | 2009-03-12 13:56:20 -0300 (Thu, 12 Mar 2009) | 2 lines Fix incorrect usage of strncasecmp... I really meant to use strcasecmp. ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@181665 f38db490-d61c-443f-a65b-d21fe96a405b
2009-03-12Merged revisions 181659-181660 via svnmerge from file1-1/+1
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 #14416) Reported by: caspy ........ r181660 | file | 2009-03-12 13:52:45 -0300 (Thu, 12 Mar 2009) | 2 lines Fix logic flaw in previous commit. ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@181661 f38db490-d61c-443f-a65b-d21fe96a405b
2009-03-12Merged revisions 181655 via svnmerge from file1-2/+2
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 #14416) Reported by: caspy ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@181656 f38db490-d61c-443f-a65b-d21fe96a405b
2009-02-09Merged revisions 174218 via svnmerge from file1-9/+3
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r174218 | file | 2009-02-09 10:48:21 -0400 (Mon, 09 Feb 2009) | 4 lines Don't overwrite our pointer to the music class when music on hold stops. We will use this if it starts again to see if we can resume the music where it left off. (closes issue #14407) Reported by: mostyn ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@174219 f38db490-d61c-443f-a65b-d21fe96a405b
2009-01-09Merged revisions 168198 via svnmerge from russell1-1/+1
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r168198 | russell | 2009-01-09 16:14:38 -0600 (Fri, 09 Jan 2009) | 2 lines Make this compile for mvanbaak ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@168200 f38db490-d61c-443f-a65b-d21fe96a405b
2008-12-22Cosmetic change - don't mix struct initializer styles.russell1-1/+1
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@166436 f38db490-d61c-443f-a65b-d21fe96a405b
2008-12-22Fix a bad typo.russell1-1/+1
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@166377 f38db490-d61c-443f-a65b-d21fe96a405b
2008-12-22Re-work ref count handling of MoH classes using astobj2 to resolve crashes.russell1-371/+419
(closes issue #13566) Reported by: igorcarneiro Tested by: russell Review: http://reviewboard.digium.com/r/106/ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@166273 f38db490-d61c-443f-a65b-d21fe96a405b
2008-12-18Merged revisions 165661 via svnmerge from russell1-6/+7
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r165661 | russell | 2008-12-18 12:52:18 -0600 (Thu, 18 Dec 2008) | 7 lines Set the process group ID on the MOH process so that all children will get killed (closes issue #14099) Reported by: caspy Patches: res_musiconhold.c.patch.killpg.try2 uploaded by caspy (license 645) ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@165662 f38db490-d61c-443f-a65b-d21fe96a405b
2008-12-16Merged revisions 164605 via svnmerge from russell1-1/+1
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r164605 | russell | 2008-12-16 08:28:10 -0600 (Tue, 16 Dec 2008) | 5 lines Don't try to change working directory if a directory was not configured. (closes issue #14089) Reported by: caspy ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@164606 f38db490-d61c-443f-a65b-d21fe96a405b
2008-12-10Merged revisions 162926 via svnmerge from jpeeler1-1/+1
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r162926 | jpeeler | 2008-12-10 16:52:51 -0600 (Wed, 10 Dec 2008) | 3 lines Oops, inverted logic for a strcasecmp check. Pointed out by mmichelson, thanks! ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@162927 f38db490-d61c-443f-a65b-d21fe96a405b
2008-12-10Merged revisions 162874 via svnmerge from jpeeler1-5/+5
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r162874 | jpeeler | 2008-12-10 16:04:18 -0600 (Wed, 10 Dec 2008) | 5 lines (closes issue #13229) Reported by: clegall_proformatique Ensure that moh_generate does not return prematurely before local_ast_moh_stop is called. Also, the sleep in mp3_spawn now only occurs for http locations since it seems to have been added originally only for failing media streams. ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@162891 f38db490-d61c-443f-a65b-d21fe96a405b
2008-12-05Janitor, use ARRAY_LEN() when possible.eliel1-2/+2
(closes issue #13990) Reported by: eliel Patches: array_len.diff uploaded by eliel (license 64) git-svn-id: http://svn.digium.com/svn/asterisk/trunk@161218 f38db490-d61c-443f-a65b-d21fe96a405b
2008-11-18This change prevents a crash from occurring if res_musiconhold.sommichelson1-0/+1
is unloaded and then Asterisk is stopped. The problem was that we are not unregistering the ast_moh_destroy function at exit. (closes issue #13761) Reported by: eliel Patches: res_musiconhold.c.patch uploaded by eliel (license 64) git-svn-id: http://svn.digium.com/svn/asterisk/trunk@157592 f38db490-d61c-443f-a65b-d21fe96a405b
2008-11-02fix small bug introduced while cleaning up compiler warningskpfleming1-1/+1
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@153618 f38db490-d61c-443f-a65b-d21fe96a405b
2008-11-02bring over all the fixes for the warnings found by gcc 4.3.x from the 1.4 ↵kpfleming1-6/+18
branch, and add the ones needed for all the new code here too git-svn-id: http://svn.digium.com/svn/asterisk/trunk@153616 f38db490-d61c-443f-a65b-d21fe96a405b
2008-10-16support relative paths in musiconhold.conf, which makes moh work by default ↵kpfleming1-5/+15
when Asterisk was configured using --prefix and 'make samples' is run git-svn-id: http://svn.digium.com/svn/asterisk/trunk@149917 f38db490-d61c-443f-a65b-d21fe96a405b
2008-09-12Create a new config file status, CONFIG_STATUS_FILEINVALID for differentiatingtilghman1-1/+2
when a file is invalid from when a file is missing. This is most important when we have two configuration files. Consider the following example: Old system: sip.conf users.conf Old result New result ======== ========== ========== ========== Missing Missing SIP doesn't load SIP doesn't load Missing OK SIP doesn't load SIP doesn't load Missing Invalid SIP doesn't load SIP doesn't load OK Missing SIP loads SIP loads OK OK SIP loads SIP loads OK Invalid SIP loads incompletely SIP doesn't load Invalid Missing SIP doesn't load SIP doesn't load Invalid OK SIP doesn't load SIP doesn't load Invalid Invalid SIP doesn't load SIP doesn't load So in the case when users.conf doesn't load because there's a typo that disrupts the syntax, we may only partially load users, instead of failing with an error, which may cause some calls not to get processed. Worse yet, the old system would do this with no indication that anything was even wrong. (closes issue #10690) Reported by: dtyoo Patches: 20080716__bug10690.diff.txt uploaded by Corydon76 (license 14) git-svn-id: http://svn.digium.com/svn/asterisk/trunk@142992 f38db490-d61c-443f-a65b-d21fe96a405b
2008-08-10All of the res/ stuff (other than res_jabber) from the RSW branch.seanbright1-19/+19
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@137028 f38db490-d61c-443f-a65b-d21fe96a405b
2008-07-01Add AMI events for start/stop of MOHtilghman1-0/+13
(closes issue #12909) Reported by: chris-mac Patches: res_musiconhold-event.patch uploaded by chris-mac (license 506) git-svn-id: http://svn.digium.com/svn/asterisk/trunk@127169 f38db490-d61c-443f-a65b-d21fe96a405b