BackGround

Synopsis Play a sound file while awaiting extension

Description Background(filename1[&filename2…][|options[|langoverride][|context]])

This application will play the given list of files while waiting for an extension to be dialed by the calling channel. To continue waiting for digits after this application has finished playing files, the WaitExten application should be used. The 'langoverride' option explicity specifies which language to attempt to use for the requested sound files. If a 'context' is specified, this is the dialplan context that this application will use when exiting to a dialed extension. If one of the requested sound files does not exist, call processing will be terminated.

Background() inside a macro If you use Background() inside a macro, the context utilized for the extension is the one where the macro is called, not the context in which the macro is running macro-xxxxx . So if you want to use background with an extension inside your macro, you can use the context parameter, and make it match the one of the macro you are in. Tested successfully on Asterisk 1.4.17.

Options

  • s - causes the playback of the message to be skipped if the channel is not in the 'up' state (i.e. it hasn't been answered yet.) If this happens, the application will return immediately.
  • n - don't answer the channel before playing the files
  • m - only break if a digit hit matches a one digit extension in the destination context

Returns See http://bugs.digium.com/view.php?id=7835 for details of a crude patch to implement the return of ${BACKGROUNDSTATUS} («FAILED» or «SUCCESS» in the same way Playback() does).

Wait for DTMF Input If you want Asterisk to just wait for input without playing a sound file, see the WaitExten application.

Example

;Sample 'main menu' context with submenu
exten => s,1,Answer
exten => s,2,Background(thanks) ; "Thanks for calling. Press 1 for sales, 2 for support, ..."
exten => 1,1,Goto(submenu,s,1)
exten => 2,1,Hangup 

commands

  • asterisk/cmd/background.txt
  • Последние изменения: 2014/04/22