[asterisk-users] How to play audio file in background in dialplan?
Yaroslav Panych
panych.y at gmail.com
Fri Feb 3 16:47:03 CST 2012
I do not use any built-in MOH functionality. I don't need it.
In short my dialplan
same=>n,Answer()
same=>n,PlayBack(hello-identify-yourself)
; read 10 digits of user-id into variable
same=>n,Read(user_id,,10,,,30)
same=>n,PlayBack(please-provide-your-secret)
; read 10 digits of secret into variable
same=>n,Read(user_secret,,10,,,30)
; do external auth and profile load
same=>n,AGI(checkauth,${user_id},${user_secret}
; will set some dialplan variables
; one of them is ${PROFILE_WAITMUSIC} - path to user specific music
file to be played during long operations
; this file name and content is guaranteed to be changed after
musiconhold.conf file is written and Asterisk started.
; $PROFILE_SUCCESS contains auth results
same=>n,GoToIf($["${PROFILE_SUCCESS}"=="0"]?label_reject_user)
same=>n,PlayBack(welcome-please-eneter-task)
; read task code into variable
same=>n,Read(task,,2,,,30)
same=>n,PlayBack(processing-request)
same=>n,APP_TO_START_PLAY_IN_BACKGROUND(${PROFILE_MUSIC})
same=>n,AGI(taskproxy,${user_id},${task})
same=>n,DO-SOME-ACTION-BASED-ON-PREVIOUS-CALL-RETURN-CODE
same=>n,APP_TO_STOP_PLAY_IN_BACKGROUND()
etc
etc
etc
As Steve Edwards wrote, I cannot pack this dialplan into one big AGI
call, because if I will use STREAM FILE, I will be forced to violate
AGI protocol. That why I asking for Application which will not block
pbx context. StartMusicOnHold doesn't blocks, but it plays only
preconfigurated set of music's.
2012/2/4 Danny Nicholas <danny at debsinc.com>:
> How do you do MOH from your dial plan? I was under the impression that
> unless you specifically changed it, you would always have the "default"
> class.
More information about the asterisk-users
mailing list