asteriskvoipringtone

Play MOH instead of ringtone in asterisk


I'm trying to play Music file ( MOH ) instead of ringing sound.

It's my extention_custom.conf

[from-internal]
exten = _X.,1,Verbose(call from: ${CALLERID(num)} to ${EXTEN})
same = n,Dial(Local/${CALLERID(num)}@somewhere,100,g|m(tt))

and i defined MOH class in the musiconhold_custom.conf:

[tt]
mode=files
directory=/var/lib/asterisk/moh/tt/
sort=alpha

sometimes it works and i can hear music instead of ringtone, but sometimes it's silent.

sip_custom.conf

[*****]
type=friend
secret=***
context=from-internal
username=****
host=***.***.***.***
allow=all
directmedia=yes
nat=yes

i don't know it's useful or not but when i checked the pCap files, everything in both situation were same, but when i could hear music, there is an additional line, it's :

SSRC changed from 0xC8F2189B/6305 to 0x1BEA4D36/8

Solution

  • Try changing directmedia to no. SSRC changing likely indicates that RTP media is being handed off from asterisk to the endpoint. If you disallow directmedia, then asterisk will stay in the middle (between the endpoints), and can always play moh.

    Keep in mind this may have topology implications for your network, but assuming your endpoints are all on the same LAN with asterisk, and your asterisk server can handle the RTP traffic, you won't see much change.