[Asterisk-Users] musiconhold -vs- musicclass problems setting the
	differnt class of music 
    Ronald Hartmann 
    RHartmann at nnamtraH.com
       
    Mon Oct 31 17:58:05 MST 2005
    
    
  
Good Day list,
	I am having a bit of an issue as it relates to the musiconhold
settings in the Version 1.09 of Asterisk
Problem I am unable to set different music classes for different
extensions.
1) (default) I would like to be able to set generic music on hold for
the company, extension (2001) and any other extension not specifically
set.
2) (Sales) I would like to set music on hold for sales people to include
commerials	(extension 2002)
3) (Support) I would like to set music on hold for Support people to
include calm music followed with tech tips. (ext 2003)
In /usr/src/asterisk/configs/sip.conf.sample
	;musicclass=default 
	; Sets the default music on hold class for all SIP calls
      ; This may also be set for individual users/peers
In /usr/src/asterisk/channels/chan_sip.c
at line number ~~2054
we set the Global music on hold class using musicclass
if (!ast_strlen_zero(i->musicclass))
         strncpy(tmp->musicclass, i->musicclass,
sizeof(tmp->musicclass)-1);
at line number ~~8393
we set the individual channels music on hold class using musiconhold
} else if (!strcasecmp(v->name, "musiconhold")) {
     strncpy(user->musicclass, v->value, sizeof(user->musicclass)-1);
	
NOTE the discrepancy with musiconhold versus musicclass not sure if I am
reading this correctly but looks like we need to use both musicclass and
musiconhold
In sip.conf I set up
[general]
port = 5060           ; Port to bind to (SIP is 5060)
bindaddr = 0.0.0.0    ; Address to bind to (all addresses on machine)
disallow=all
allow=ulaw
allow=alaw
context = from-sip-external ; Send unknown SIP callers to this context
callerid = Unknown
musicclass=default
	[2001]
	username=2001
	type=friend
	secret=1234
	qualify=no
	port=5060
	nat=never
	mailbox=2001 at device
	host=dynamic
	dtmfmode=rfc2833
	context=from-internal
	canreinvite=no
	callerid="user1" <2001>
--->musiconhold=default ;set both values just to be sure
--->musicclass=default  ;set both values just to be sure
	[2002]
	username=2002
	type=friend
	secret=1234
	qualify=no
	port=5060
	nat=never
	mailbox=2002 at device
	host=dynamic
	dtmfmode=rfc2833
	context=from-internal
	canreinvite=no
	callerid="user2" <2002>
--->musiconhold=Sales ;set both values just to be sure
--->musicclass=Sales  ;set both values just to be sure
	[2003]
	username=2003
	type=friend
	secret=password
	record_out=Adhoc
	record_in=Adhoc
	qualify=no
	port=5060
	pickupgroup=1,2
	nat=never
	mailbox=2003 at device
	host=dynamic
	dtmfmode=rfc2833
	context=from-internal
	canreinvite=no
	callgroup=2
	callerid="user3" <2003>
--->musiconhold=Support ;set both values just to be sure
--->musicclass=Support  ;set both values just to be sure
music.conf 
;
; Music on hold class definitions
;
[classes]
default => quietmp3:/var/lib/asterisk/mohmp3
Sales => quietmp3:/var/lib/asterisk/mohmp3/Sales
Support => quietmp3:/var/lib/asterisk/mohmp3/Support
;loud => mp3:/var/lib/asterisk/mohmp3
;random => quietmp3:/var/lib/asterisk/mohmp3,-z
I see mpg123 qued up the music 
Problem if I make place a call on hold from any of the extensions, the
music is always set as the default disregarding the values set under
each extension.
I have verified that all three classes are working by modifying the 
[general]
.
.
musicclass=Sales
and also to 
[general]
.
.
musicclass=Support
Every time I place a call on hold the person on the other end ALWAYS
hears the music defined under the [general] setting.
Any advices as to what I may be doing wrong would be much appreciated.
~ron
    
    
More information about the asterisk-users
mailing list