Playing a Background file with a variable as the name


We have an app where the callers will record their names and this is to be read out to other members.
I am trying to get Background to play the file, if its set as a varible then it will not play.
So can Playback or Background read a file that is defined by a varible for example “Background(${file})” ?

any Ideas ?

yes, we use that exact feature for our ‘caller announce’ macros.

exten => s,1,Playback(sayyourname)
exten => s,2,SetVar(CALLER_NAME=/tmp/${CALLERIDNUM}-${EPOCH})
exten => s,3,Record(${CALLER_NAME}.gsm|2|4)
exten => s,4,Dial(${ARG1}|${ARG3}|rtM(announce^${CALLER_NAME}))
exten => s,5,Voicemail(u${ARG2})
exten => s,6,Hangup
exten => s,105,Goto(5)
exten => h,1,System(/bin/rm -f ${ARG1}.gsm)

exten => s,1,Background(callfrom)
exten => s,2,Background(${ARG1})
exten => s,3,Read(ACCEPT|call-accept|1)
exten => s,4,Gotoif($[${ACCEPT} = 1] ?50) ;connect
exten => s,5,Gotoif($[${ACCEPT} = 2] ?30) ;reject to vm
exten => s,6,Gotoif($[${ACCEPT} = 3] ?30:30) ;any thing else vm
exten => s,30,SetVar(MACRO_RESULT=CONTINUE)
exten => s,31,Goto(50)
exten => s,50,System(/bin/rm -f ${ARG1}.gsm)
exten => h,1,System(/bin/rm -f ${ARG1}.gsm)[/code]

we’re setting the $CALLER_NAME var to the callerID with a timestamp, then recording the caller saying their name to that variable. we pass that to the announce macro, and Background it.

hopefully this makes sense, let me know if it doesn’t.


Ok, After more digging and a dial plan of almost all variables being Noop’d I have solved it.

The app in question is app_conference and is using a script to announce new callers and leaving callers.

The original script and dialplan just beeps. and doesnt let the first caller wait on Muzak as per meetme.

Ours does announce and wait on muzak

The problem was that by the time the script calls the part to announce the call almost all info as to the original call is lost, but obviously (when brain in gear) the ${channel} varible still had the correct info so using that its now working telling members the new member has joined and what member number they are. :smile: