[Home]

Summary:ASTERISK-00227: SetMusicOnHold does not appear to change Zap channel MOH outbound
Reporter:John Todd (jtodd)Labels:
Date Opened:2003-09-06 02:06:52Date Closed:2004-09-25 02:40:13
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Core/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:SIP -> Zap channels do not seem to respect the SetMusicOnHold setting.  When a "default" class exists in musiconhold.conf, things work quite well and I get MOH on the Zap line when I hit "Hold" on my SIP phone.  However, if I use SetMusicOnHold to specify a different class for the exact same type of call, it fails, and no MOH is heard on the Zap line upon Hold activation.

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


Text of an IRC session.   Jump to bottom to get to chan_zap clues.

[10:52:59]  bkw_: yes
[10:53:03]  jtodd: Thanks.
[10:53:06]  bkw_: np
[10:53:11]  bkw_: what are you trying to do?
[10:53:16]  jtodd: I'm having a bitch of a time getting anything other than "default =>" lines working.
[10:53:24]  bkw_: ah
[10:53:25]  bkw_: ok
[10:53:27]  bkw_: tis simple
[10:53:34]  bkw_: paste me your music conf file
[10:53:44]  jtodd: Well, maybe not quite as simple as you think.  :-)  I've spent some head-banging time on this one.
[10:53:46]  jtodd: Here ya go...
[10:53:51]  jtodd: [classes]
[10:53:51]  jtodd: ;default => quietmp3:/var/lib/asterisk/mohmp3/country,-z
[10:53:51]  jtodd: dance => quietmp3:/var/lib/asterisk/mohmp3/dance,-z
[10:54:08]  jtodd: If I rename "dance" to "default" (ignore the commented-out line) then things work.
[10:54:19]  jtodd: My dialplan has this successfully running:
[10:54:19]  bkw_: ok setup exten=> 1234,1,MusicOnHold(dance)
[10:54:29]  bkw_: let me do one really fast on mine
[10:55:34]  jtodd: -- Executing SetMusicOnHold("SIP/2403659750-ed6d", "dance") in new stack
[10:55:52]  bkw_: ps aux show two mpg123's per hold music class
[10:56:11]  jtodd: Yep, there is.
[10:56:47]  jtodd: It almost appears that SIP -> Zap  channels are not recognizing anything the SetMusicOnHold setting, and if "default" isn't specified, they don't play anything at all.
[10:57:19]  bkw_:     -- Executing MusicOnHold("SIP/phone1-92b0", "dance") in new stack
[10:57:19]  bkw_:     -- Started music on hold, class 'dance', on SIP/phone1-92b0
[10:57:30]  bkw_: works here from sip
[10:57:47]  bkw_: zap channels are set from zapata.conf
[10:58:01]  jtodd: Zap channels are set inbound or outbound or both?
[10:58:16]  bkw_: not sure..
[10:58:18]  bkw_: let me see
[10:58:35]  jtodd: And that can't be right, since I have a PRI, and each caller isn't allocated to a particular "channel" on the Zap interface.  
[10:58:49]  jtodd: Unless Zap can only have one possible MOH selection, which would seem strange.
[10:59:07]  bkw_: let me test this and see
[10:59:11]  jtodd: ok.
[10:59:13]  jtodd: thx.
[10:59:41]  bkw_: yes zapata.conf sets the moh for inbound calls that say are parked or put on hold
[11:00:13]  bkw_: but you can change that via a setmusiconhold before you do something with the call
[11:00:21]  jtodd: Right.  That doesn't seem to be working.
[11:00:22]  bkw_: er should be able to
[11:00:30]  bkw_: "should" is the keyword
[11:00:31]  jtodd: At least, for me it's not.
[11:00:32]  jtodd: :)
[11:00:43]  bkw_: let me try a set MusicOnHold
[11:01:42]  bkw_: ok it works
[11:01:48]  bkw_: just do a setmusiconhold before you do an answer
[11:01:57]  bkw_: ; If they have callerid then lets
[11:01:57]  bkw_: exten => s,1,SetMusicOnHold(dance)
[11:01:57]  bkw_: exten => s,2,Answer
[11:01:59]  jtodd: Yes, that's what I'm doing.  I pasted it in above.  
[11:02:08]  bkw_: hrm
[11:02:10]  jtodd: Well, I'm not Answering - I'm sending out to a Dial.
[11:02:18]  bkw_: let me try that
[11:02:21]  jtodd: OK.
[11:03:49]  bkw_: doh can't for outbound
[11:03:55]  bkw_: it goes with the default
[11:03:59]  jtodd: Crappo.
[11:04:16]  bkw_: let me see something
[11:04:34]  bkw_: inbound can be setup like that.. but let me test something
[11:05:23]  bkw_: damn it uses default no matter what I do on zap channels
[11:05:29]  bkw_: think we have a bug here boyz!
[11:05:45]  jtodd: Yeah, I seem to be stumbling across them at a frightening pace in the last day or so.
[11:06:03]  jtodd: That's sort of what I was afraid of, but I wanted someone else to peek at it.
[11:06:27]  bkw_: let me see if I can fix this really fast
[11:06:32]  bkw_: it shouldn't be that hard
[11:06:36]  jtodd: OK, that would be cool.  
[11:07:39]  bkw_: let me start in debug mode here and watch it for a few seconds to pin point it
[11:07:48]  jtodd: no rush...
[11:09:31]  bkw_: hrm
[11:13:35]  bkw_: I think this is chan_zap
[11:15:13]  jtodd: Sounds like the right place.  My outbound calls are heading out Zap channels.
[11:15:26]  bkw_: yep
[11:15:42]  bkw_: its set to use the musiconhold in zapata.conf no matter what
[11:15:52]  bkw_: but I think I can fix this
[11:16:08]  bkw_: if(chan->musicclass) blah blah blah
[11:16:23]  bkw_: because I see no place where it checks to see if thats set
[11:16:47]  jtodd: That seems like an obvious thing that should have been nabbed a while ago, you'd think. The whole point of SetMusicOnHold was to get around that static limitation.... or so I thought.
[11:18:07]  bkw_: ya
[11:18:13]  bkw_: but it appears its there but not correctly done
[11:18:20]  jtodd: :)
[11:20:20]  bkw_: tmp->musicclass is setup but it looks like the conf file overrides it
[11:20:31]  jtodd: Hmm...
[11:21:00]  jtodd: I have no moh defined in zapata.conf...
[11:21:12]  jtodd: So I have no idea where it's getting the default value.
[11:28:49]  bkw_: lien 413 in res_musiconhold.c
[11:28:52]  bkw_: line 413 in res_musiconhold.c
[11:29:00]  bkw_:         if (class)
[11:29:00]  bkw_:                 res = mohalloc(class);
[11:29:00]  bkw_:         else {
[11:29:00]  bkw_:                 if (strcasecmp(params, "default"))
[11:29:00]  bkw_:                         ast_log(LOG_WARNING, "No class: %s\n", (char *)params);
[11:29:01]  bkw_:                 res = NULL;
[11:29:03]  bkw_:         }
[11:29:17]  bkw_: I think that needs to check for chan->musicclass
[11:29:46]  jtodd: Greek to me.  I'm C-illiterate, but I know enough to be dangerous.
[11:30:56]  jtodd: Where is "params" set?  Is that the right question to ask?
[11:31:18]  jtodd: I didn't look at my WARNING log to see if that message is being fired off...
[11:31:37]  bkw_: i'm noseeing the warning either
[11:33:56]  bkw_: I will talk with mark about that.. I see where its doing that
[11:34:01]  bkw_: but I can't see where to override it
[11:34:25]  bkw_: int ast_moh_start(struct ast_channel *chan, char *class)
[11:34:25]  bkw_: {
[11:34:25]  bkw_:         if (!class || !strlen(class))
[11:34:25]  bkw_:                 class = chan->musicclass;
[11:34:25]  bkw_:         if (!class || !strlen(class))
[11:34:25]  bkw_:                 class = "default";
[11:34:27]  bkw_:         return ast_activate_generator(chan, &mohgen, class);
[11:34:29]  bkw_: }
[11:34:31]  bkw_: um thats not good
[11:35:23]  bkw_: yep its in chan_zap has to be

Comments:By: John Todd (jtodd) 2003-09-06 02:12:09

I have no musiconhold= configured in my zapata.conf.  

If I have a "default" class specified in musiconhold.conf, then that is what is _always_ used on outbound Zap channels.  If I remove "default" from musiconhold.conf, there is no hold music and no indication that hold music is started, even during a "Hold" event on the SIP phone.

.
.
.
   -- Executing SetMusicOnHold("SIP/2403659999-057f", "dance") in new stack
   -- Executing DBput("SIP/2403659999-057f", "2403659999/FEAT/LASTCALLED=14109850123") in new stack
   -- DBput: family=2403659999, key=FEAT/LASTCALLED, value=14109850123
   -- Executing Dial("SIP/2403659999-057f", "Zap/g1/14109850123") in new stack
   -- Called g1/14109850123
   -- Zap/1-1 is ringing
   -- Zap/1-1 answered SIP/2403659999-057f
   -- Started music on hold, class 'default', on Zap/1-1
   -- Channel 1, span 1 got hangup
   -- Stopped music on hold on Zap/1-1
   -- Hungup 'Zap/1-1'
 == Spawn extension (from-customer13, 14109850123, 3) exited non-zero on 'SIP/2403659999-057f'
   -- Executing Hangup("SIP/2403659999-057f", "") in new stack
 == Spawn extension (from-customer13, h, 1) exited non-zero on 'SIP/2403659999-057f'
localhost*CLI>


My musiconhold.conf

;
; Music on hold class definitions
;
[classes]
default => quietmp3:/var/lib/asterisk/mohmp3/country,-z
dance => quietmp3:/home/robb/moh/09-dance,-z

By: Mark Spencer (markster) 2003-09-06 13:38:43

I'll probably have to ssh in and look.  I don't see anything glaringly wrong.  You could help by doing some printf debugging around ast_moh_start and also by verifying that if you use MusicOnHold(dance) that you do in fact hear dance music in order to confirm there isn't some sort of a problem with the mp3's playing

By: John Todd (jtodd) 2003-09-06 14:12:43

It's not a problem with the config file; I checked that by swapping "default" and "dance".  Sure enough, if musiconhold.conf looks like this, I hear dance music:

;
; Music on hold class definitions
;
[classes]
;default => quietmp3:/var/lib/asterisk/mohmp3/country,-z
default => quietmp3:/home/robb/moh/09-dance,-z

So it seems that "default" is the only group that can be selected, despite use of the SetMusicOnHold.  I'd be happy to let you ssh in to watch; find me on IRC.

By: Mark Spencer (markster) 2003-09-06 14:30:54

Fixed in CVS