I was looking for a way to play background music to a telephone. My use was for a nurse to set a telephone in a exam room to play music until the doctor was ready to see the patient. I found this is another forum (#$%$box) and thought maybe someone would find a use for it...
How it works:
The system sets each real caller who joins a meeting as a "MARKED" user, but does not set the music 'call' as marked. This way, when the last user leaves a meeting, it will disconnect the music automatically. This differences is achieved by using a variable in the .call file.
Installation:
Open the /etc/asterisk/extensions_custom.conf file
Past the code below between the ======= symbols
Save the code.
Open FreePBX
Create a ringgroup (i used number 600, whatever number you use, match it to the variable in the dialplan
SetVar(meetroom=600)
In the 'extension list' in the ringgroup put in any invalid extension number
Point the ring group to a custom failover destination
custom-meetme-music,s,1
Create a Queue. I used 5000 in my example, you can use any number you want, just match it to the variable in the dialplan
SetVar(meetmemusicnumber=5000)
Leave the queue defaults. This will allow a system to queue a call forever. For this code, it will just play music forever.
Save your changes, click the "RELOAD" button on the screen and call your ring group number and test.
=======
[custom-meetme-music]
exten => s,1,NoOp(&& MeetMe with Music Dial Plan &&)
exten => s,n,SetVar(meetroom=600)
;set this to be the same number you dial to get to the meeting room.
;this code used a ring group "600" to execute this code
exten => s,n,SetVar(meetmemusicnumber=5000)
;the queue number you assign to play music
exten => s,n,MeetMeCount(${meetroom}|count)
exten => s,n,Gotoif,$[${meetmemusic} = 1]?joinmusic
exten => s,n,Gotoif,$[${count} > 0]?joincaller
exten => s,n,NoOp(&& Creating .call file to bridge music &&)
exten => s,n,system(echo "Channel: Local/${meetmemusicnumber}@from-internal/n" >> /etc/asterisk/${meetmemusicnumber}.call)
exten => s,n,system(echo "MaxRetries: 1" >> /etc/asterisk/${meetmemusicnumber}.call)
exten => s,n,system(echo "WaitTime:5" >> /etc/asterisk/${meetmemusicnumber}.call)
exten => s,n,system(echo "Context: from-internal" >> /etc/asterisk/${meetmemusicnumber}.call)
exten => s,n,system(echo "Extension: ${meetroom}" >> /etc/asterisk/${meetmemusicnumber}.call)
exten => s,n,system(echo "Priority: 1" >> /etc/asterisk/${meetmemusicnumber}.call)
exten => s,n,system(echo "SetVar: meetmemusic=1" >> /etc/asterisk/${meetmemusicnumber}.call)
exten => s,n,system(chown asterisk:asterisk ${meetmemusicnumber}.call)
exten => s,n,Wait(1)
exten => s,n,system(mv /etc/asterisk/${meetmemusicnumber}.call /var/spool/asterisk/outgoing)
exten => s,n,Goto(joincaller)
exten => s,n(joinmusic),SetVar(meetmemusic=0)
exten => s,n,NoOp(&& STARTING THE MUSIC &&)
exten => s,n,MeetMe(${meetroom}|dsx))
exten => s,n(joincaller),MeetMe(${meetroom}|Adsx)
=======================
It is working great and the customer likes the feature... I couldn't find another way to setup background music to a telephone. If there is an easier way please let me know.
Richie
How it works:
The system sets each real caller who joins a meeting as a "MARKED" user, but does not set the music 'call' as marked. This way, when the last user leaves a meeting, it will disconnect the music automatically. This differences is achieved by using a variable in the .call file.
Installation:
Open the /etc/asterisk/extensions_custom.conf file
Past the code below between the ======= symbols
Save the code.
Open FreePBX
Create a ringgroup (i used number 600, whatever number you use, match it to the variable in the dialplan
SetVar(meetroom=600)
In the 'extension list' in the ringgroup put in any invalid extension number
Point the ring group to a custom failover destination
custom-meetme-music,s,1
Create a Queue. I used 5000 in my example, you can use any number you want, just match it to the variable in the dialplan
SetVar(meetmemusicnumber=5000)
Leave the queue defaults. This will allow a system to queue a call forever. For this code, it will just play music forever.
Save your changes, click the "RELOAD" button on the screen and call your ring group number and test.
=======
[custom-meetme-music]
exten => s,1,NoOp(&& MeetMe with Music Dial Plan &&)
exten => s,n,SetVar(meetroom=600)
;set this to be the same number you dial to get to the meeting room.
;this code used a ring group "600" to execute this code
exten => s,n,SetVar(meetmemusicnumber=5000)
;the queue number you assign to play music
exten => s,n,MeetMeCount(${meetroom}|count)
exten => s,n,Gotoif,$[${meetmemusic} = 1]?joinmusic
exten => s,n,Gotoif,$[${count} > 0]?joincaller
exten => s,n,NoOp(&& Creating .call file to bridge music &&)
exten => s,n,system(echo "Channel: Local/${meetmemusicnumber}@from-internal/n" >> /etc/asterisk/${meetmemusicnumber}.call)
exten => s,n,system(echo "MaxRetries: 1" >> /etc/asterisk/${meetmemusicnumber}.call)
exten => s,n,system(echo "WaitTime:5" >> /etc/asterisk/${meetmemusicnumber}.call)
exten => s,n,system(echo "Context: from-internal" >> /etc/asterisk/${meetmemusicnumber}.call)
exten => s,n,system(echo "Extension: ${meetroom}" >> /etc/asterisk/${meetmemusicnumber}.call)
exten => s,n,system(echo "Priority: 1" >> /etc/asterisk/${meetmemusicnumber}.call)
exten => s,n,system(echo "SetVar: meetmemusic=1" >> /etc/asterisk/${meetmemusicnumber}.call)
exten => s,n,system(chown asterisk:asterisk ${meetmemusicnumber}.call)
exten => s,n,Wait(1)
exten => s,n,system(mv /etc/asterisk/${meetmemusicnumber}.call /var/spool/asterisk/outgoing)
exten => s,n,Goto(joincaller)
exten => s,n(joinmusic),SetVar(meetmemusic=0)
exten => s,n,NoOp(&& STARTING THE MUSIC &&)
exten => s,n,MeetMe(${meetroom}|dsx))
exten => s,n(joincaller),MeetMe(${meetroom}|Adsx)
=======================
It is working great and the customer likes the feature... I couldn't find another way to setup background music to a telephone. If there is an easier way please let me know.
Richie