Skip to content

Instantly share code, notes, and snippets.

@ambiorixg12
Last active April 11, 2023 00:29
Show Gist options
  • Save ambiorixg12/b8ad38a33c6d71d87bf71764befc7549 to your computer and use it in GitHub Desktop.
Save ambiorixg12/b8ad38a33c6d71d87bf71764befc7549 to your computer and use it in GitHub Desktop.
playing an audio file after specif time
;;;custom notification;;;;
[playing-audio]
exten=>_x.,1,Noop( ----- Playing message on channel ${CHANNEL} -----------------)
same=>n,Set(__chan=${CHANNEL})
same=>n,Set(__inboundid=${EXTEN})
same=>n,Set(__time-play=20)
same=>n,Dial(Local/1923@spy-exten)
[bgmusic]
exten=>0,1,Hangup()
same=>n,Noop( ---------${inboundid}-------)
same=>n,Set(audiop=${SHELL(mysql -h localhost --user=root --password='Hfh@64G' --skip-column-names did_timeout -e "SELECT audio FROM notification_did WHERE did = '${inboundid}' limit 1")})
same=>n,Set(timep=${SHELL(mysql -h localhost --user=root --password='Hfh@64l7G' --skip-column-names did_timeout -e "SELECT timeout FROM notification_did WHERE did = '${inboundid}' limit 1")})
same=>n,wait(${timep:0:-1})
same=>n,Playback(/var/lib/asterisk/sounds/custom/${audiop:0:-1})
same=>n,hangup()
[spy-exten]
exten =>_1923,1,Dial(Local/1924@spy-exten,30,G(bgmusic^0^1))
same=>n,hangup()
exten=>_1924,1,Answer()
exten=>_1924,n,ChanSpy(${chan},EqB)
same=>n,Noop(--- ${chan}--)
same=>n,hangup()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment