[Home]

Summary:ASTERISK-10055: MOH wierdness
Reporter:mustardman (mustardman)Labels:
Date Opened:2007-08-09 12:40:05Date Closed:2007-08-27 10:58:47
Priority:MinorRegression?No
Status:Closed/CompleteComponents:PBX/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) asterisk-mohposition.diff.txt
Description:CentOS 5 FreePBX 2.3 b2 Asterisk 1.4.10 Zaptel 1.4.4

With Random Play disabled it always starts at the beginning of the first song so random play seems like the logical choice. However, with random play enabled it randomly starts one of the 3 (for example) songs but if I take the call and then put them on hold again it often goes to the beginning of the next song. But if I do it again it will stay on that second song and progress through it as it should.

The MOH always starting at the beginning of a song when a call is first put on hold is also annoying but I guess that is just the way it is designed.

However, there is something else wierd going on



****** ADDITIONAL INFORMATION ******

I read people complaining about similar issues using Asterisk 1.2.x so I don't think it is specific to Asterisk 1.4.x
Comments:By: Steve Murphy (murf) 2007-08-09 15:04:52

Could you show me how your MOH is configured? What files in the /var/lib/sounds moh dirs; what settings you use in your extensions.conf; that sort of thing. I can either determine that something needs to be fixed, or at least be definitive when I determine that the way it's working is "right".

By: mustardman (mustardman) 2007-08-11 17:22:20

[root@centos5 mohmp3]# dir
fpm-calm-river.wav  
fpm-world-mix.wav
fpm-sunshine.wav    
LICENSE-asterisk-moh-freeplay-wav


Not sure what you need to see in extensions.conf as FreePBX adds all sorts of macros.  Hopefully these are the relevant entries.
.
.
[macro-dial]
exten => s,1,GotoIf($["${MOHCLASS}" = ""]?dial)
exten => s,2,SetMusicOnHold(${MOHCLASS})
exten => s,3(dial),AGI(dialparties.agi)
exten => s,4,NoOp(Returned from dialparties with no extensions to call and DIALSTATUS: ${DIALSTATUS})
.
.
; Back to normal processing, whether intracompany or not.
; But add the macro-setmusic if we don't want music on this outbound call
;
exten => s,n,GotoIf($[$["${MOHCLASS}" = "default"] | $["foo${MOHCLASS}" = "foo"]]?gocall) ; Set to YES if we should pump silence
exten => s,n,Set(DIAL_TRUNK_OPTIONS=M(setmusic^${MOHCLASS})${DIAL_TRUNK_OPTIONS}) ; set MoH or off
.
.
.
;------------------------------------------------------------------------
; [macro-setmusic]
;------------------------------------------------------------------------
; CONTEXT:      macro-setmusic
; PURPOSE:      to turn off moh on routes where it is not desired
;
;------------------------------------------------------------------------
[macro-setmusic]
exten => s,1,NoOp(Setting Outbound Route MoH To: ${ARG1})
exten => s,2,SetMusicOnHold(${ARG1})
.
.
.

By: mustardman (mustardman) 2007-08-11 17:28:32

The way I see it, MOH should NEVER reset to the beginning of the music as the incoming caller is transferred around and put on hold or into queues or whatever.  It should progress through the music starting from where it left off after they were previously removed from MOH.  

Currently the behaviour is not consistent in that way.  Sometimes it starts where it left off and sometimes it resets to the beginning of the music and sometimes (as is the case with random play) it resets to the beginning of a new song when they are put on hold a second time and then progresses through that second song as they are transferred or put on hold again or whatever.

By: Joshua C. Colp (jcolp) 2007-08-16 13:15:45

Can you please provide one call flow scenario that this happens with for sure? I want to confirm the steps involved.

By: mustardman (mustardman) 2007-08-17 19:00:59

The most basic scenario of all is what I have tested.  No calls in or out.  Call comes in on Zaptel.  One SIP extension rings on incoming calls.  No queues, nothing.  Extension answers call then puts call on hold.  Caller hears music start.  Extension answers holding caller and then puts them on hold again, wierdness begins.



By: mustardman (mustardman) 2007-08-17 21:13:50

This is my musiconhold.conf:

[default]
mode=files
directory=/var/lib/asterisk/mohmp3/
random=yes
[none]
mode=files
directory=/dev/null

By: Joshua C. Colp (jcolp) 2007-08-19 19:57:31

That wasn't a complete description, did you perform an attended transfer?

By: mustardman (mustardman) 2007-08-24 14:30:28

No.  If I did I would have said that.  I answer the call, press the hold button, answer the call.  That is ALL I do!

By: James Golovich (jamesgolovich) 2007-08-25 00:53:51

The attached patch (to SVN trunk though it should work on 1.4.x just fine) fixes this and 2 other bugs.  

Extra bug #1 was not decreasing the inuse counter unless the channel would be deleted, so reversing the order of operations fixes that

Extra bug #2 was limiting the number of files moh would use in order to 255 since state->pos and state->save_pos were unsigned chars

By: Digium Subversion (svnbot) 2007-08-27 10:58:16

Repository: asterisk
Revision: 81042

------------------------------------------------------------------------
r81042 | russell | 2007-08-27 10:58:15 -0500 (Mon, 27 Aug 2007) | 11 lines

(closes issue ASTERISK-10055)
Reported by: mustardman
Patches:
     asterisk-mohposition.diff.txt uploaded by jamesgolovich (license 176)

This patch fixes a few problems with music on hold.
* Fix issues with starting at the beginning of a file when it shouldn't.
* Fix the inuse counter to be decremented even if the class had not been
  set to be deleted when not in use anymore
* Don't arbitrarily limit the number of MOH files to 255

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

By: Digium Subversion (svnbot) 2007-08-27 10:58:47

Repository: asterisk
Revision: 81043

------------------------------------------------------------------------
r81043 | russell | 2007-08-27 10:58:47 -0500 (Mon, 27 Aug 2007) | 19 lines

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

........
r81042 | russell | 2007-08-27 11:16:25 -0500 (Mon, 27 Aug 2007) | 11 lines

(closes issue ASTERISK-10055)
Reported by: mustardman
Patches:
     asterisk-mohposition.diff.txt uploaded by jamesgolovich (license 176)

This patch fixes a few problems with music on hold.
* Fix issues with starting at the beginning of a file when it shouldn't.
* Fix the inuse counter to be decremented even if the class had not been
  set to be deleted when not in use anymore
* Don't arbitrarily limit the number of MOH files to 255

........

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