Asterisk config features.conf Chinese

features.conf

Formerly known as parking.conf , renamed to features.conf as of July 17, 2004.

Configuration of Asterisk call parking

parkext => 700                         ; What ext. to dial to park
parkpos => 701-720                  ; What extensions to park calls on        
context  => parkedcalls              ; Which context parked calls are in, need to INCLUDE this in extensions.conf
parkingtime => 45                       ; Number of seconds a call can be parked for (default is 45 seconds)

; after park times out, call will ring back to the original extension

Note: You must restart * after making changes to features.conf, or reload res_features.so

Added to Asterisk with v1.2 release:

Allow to use something other than *8 to pickup a ringing line in your call group.
This feature can be used via the features.conf file in your asterisk directory:

pickupexten = *8 ; Configure the pickup extension. Default is *8

Some SIP phones and ATA's can interfere with service codes like *8 so you can change the pickupexten to some other value. For example, if your extensions are in the range of 201-299, you may want to pick 200.

;transferdigittimeout => 3      ; Number of seconds to wait between digits when transferring a call
                                ; (default is 3 seconds)
;xfersound = beep               ; to indicate an attended transfer is complete
;xferfailsound = beeperr        ; to indicate a failed transfer
;pickupexten = *8               ; 代接分機. (預設為 *8)
;pickupsound = beep             ; 代接成功時會嗶一聲(預設:無聲)
;pickupfailsound = beeperr      ; 代接失敗會嗶一聲(預設:無聲) (譯者註:與上面的差別大概就是叫聲不同吧)
;featuredigittimeout = 1000     ; 最大時間,單位為毫秒,等待數字輸入。
                                ; feature activation  (default is 1000 ms)
;atxfernoanswertimeout = 15     ; Timeout for answer on attended transfer default is 15 seconds.
;atxferdropcall = no            ; If someone does an attended transfer, then hangs up before the transferred
                                ; caller is connected, then by default, the system will try to call back the
                                ; person that did the transfer.  If this is set to "yes", the callback will
                                ; not be attempted and the transfer will just fail.
                                ; For atxferdropcall=no to work properly, you also need to
                                ; define ATXFER_NULL_TECH in main/features.c.  The reason the
                                ; code is not enabled by default is spelled out in the comment
                                ; block near the top of main/features.c describing ATXFER_NULL_TECH.
;atxferloopdelay = 10           ; Number of seconds to sleep between retries (if atxferdropcall = no)
;atxfercallbackretries = 2      ; Number of times to attempt to send the call back to the transferer.
                                ; By default, this is 2.

[featuremap]
;blindxfer => #1                ; Blind transfer  (default is #) -- Make sure to set the T and/or t option in the Dial() or Queue() app call!
;disconnect => *0               ; Disconnect  (default is *) -- Make sure to set the H and/or h option in the Dial() or Queue() app call!
;automon => *1                  ; 一鍵錄音,單聲道分成兩個檔案。請確認在Dial或Queue這個指令內,有啟用W或w才能錄音。x允許被叫使用 *1 錄音, W允許主叫使用*1
;atxfer => *2                   ; 參與轉接  -- Make sure to set the T and/or t option in the Dial() or Queue()  app call!
;parkcall => #72                ; Park call (one step parking)  -- Make sure to set the K and/or k option in the Dial() app call!
;automixmon => *3               ; 一鍵錄音,雙聲道錄成1個檔案。請確認在 Dial() 或 Queue() 這個指令內,有啟用X或x才能錄音。 x允許被叫使用 *3 錄音, X允許主叫使用*3


[applicationmap]
; don't use e.g #9 for applicationmap or featuremap unless you have changed 'blindxfer' from # to e.g. #1 !
testfeature => *9,callee,Playback,tt-monkeys   ;Play tt-monkes to callee if *9 was pressed - use 'callee' or 'caller'
testfeature3 => *9,self/caller,Monitor,wav|myoutfile|mb 
; note the use of the pipe char '|' here to separate arguments to monitor application

If you set the variable __TRANSFER_CONTEXT, then that context will be used (note the two leading underscores).
More on this: You need to set a TRANSFER_CONTEXT, either for the transferer or transferee channel. I dont know why, but res_features give priority to the transferee TRANSFER_CONTEXT, if not found, then use the transferrer TRANSFER_CONTEXT. That context is used to match the extension to dial. So you can set this var to any context you want.

New in 1.2.19 and 1.4.5: Finally the borders between attended and blind transfer begin to blur, making Asterisk behave much more like traditional PBX systems: An attended transfer no longer fails if the transferer hangs up before answer, therefore only the attended transfer method needs to be taught to the users. For Asterisk 1.6 this behaviour has been enhanced with a callback feature. See patches 8413 and 9338; this has also been discussed in this German forum.

Using the blindxfer in [featuremap] section you can redefine the transfer key. For example, if the blindxfer is set to "##", transfer only happens when you press the "#" key twice very quickly. This solves a problem using Asterisk phones to call IVR systems such as those used by banks and credit card companies - "Enter you account number followed by the # key".

blindxfer allows unattended or blind transfers. It works like this:

While on a conversation with another party, you dial the blindxfer sequence. Asterisk says "Transfer" then gives you a dial tone, while putting the other party on hold. You dial the transferee number and the caller is put through to that number immediately. Your line drops. The caller ID displayed to the person receiving the transferred call is exactly the same as the caller ID presented to you.

atxfer allows attended transfer or supervised transfer. It works like this:

While on conversation with another party, you dial the atxfer key sequence. Asterisk says "Transfer" then gives you a dial tone, while putting the other party on hold. You dial the transferee number and talk with the transferee to introduce the call, then you can hang up and the other party will be connected with the transferee. In case the transferee does not want to answer the call, he/she simply hangs up and you will be back to your original conversation. Press the disonnect key sequence, set to *0 by default, to return yourself to the original caller.
Note The caller ID presented to the person you are trying to transfer the call to is not what you would expect - Asterisk sets your caller ID to be the extension the call originally arrived at which may not be the same as the extension the call was answered at. There doesn't appear to be any way of getting the correct caller ID.

Note: You MUST use the T and/or t options in the command Dial() in order to allow the caller and/or callee to use any transfer feature



[applicationmap]
; Note that the DYNAMIC_FEATURES channel variable must be set to use the features
; defined here.  The value of DYNAMIC_FEATURES should be the names of the features
; to allow the channel to use separated by '#'.  For example:
;
;    Set(__DYNAMIC_FEATURES=myfeature1#myfeature2#myfeature3)
;
; (Note: The two leading underscores allow these feature settings to be set on
;  on the outbound channels, as well.  Otherwise, only the original channel
;  will have access to these features.)
;
; The syntax for declaring a dynamic feature is the following:
;
;<FeatureName> => <DTMF_sequence>,<ActivateOn>[/<ActivatedBy>],<Application>[,<AppArguments>[,MOH_Class]]
;
;  FeatureName   -> This is the name of the feature used in when setting the
;                   DYNAMIC_FEATURES variable to enable usage of this feature.
;  DTMF_sequence -> This is the key sequence used to activate this feature.
;  ActivateOn    -> This is the channel of the call that the application will be executed
;                   on. Valid values are "self" and "peer". "self" means run the
;                   application on the same channel that activated the feature. "peer"
;                   means run the application on the opposite channel from the one that
;                   has activated the feature.
;  ActivatedBy   -> This is which channel is allowed to activate this feature. Valid
;                   values are "caller", "callee", and "both". "both" is the default.
;                   The "caller" is the channel that executed the Dial application, while
;                   the "callee" is the channel called by the Dial application.
;  Application   -> This is the application to execute.
;  AppArguments  -> These are the arguments to be passed into the application.
;  MOH_Class     -> This is the music on hold class to play while the idle
;                   channel waits for the feature to complete. If left blank,
;                   no music will be played.
;
;
; IMPORTANT NOTE: The applicationmap is not intended to be used for all Asterisk
;   applications. When applications are used in extensions.conf, they are executed
;   by the PBX core. In this case, these applications are executed outside of the
;   PBX core, so it does *not* make sense to use any application which has any
;   concept of dialplan flow. Examples of this would be things like Macro, Goto,
;   Background, WaitExten, and many more.
;
; Enabling these features means that the PBX needs to stay in the media flow and
; media will not be re-directed if DTMF is sent in the media stream.
;
; Example Usage:
;
;testfeature => #9,peer,Playback,tt-monkeys  ;Allow both the caller and callee to play
;                                            ;tt-monkeys to the opposite channel
;
;pauseMonitor   => #1,self/callee,Pausemonitor     ;Allow the callee to pause monitoring
;                                                  ;on their channel
;unpauseMonitor => #3,self/callee,UnPauseMonitor   ;Allow the callee to unpause monitoring
;                                                  ;on their channel
;




Note that multiple application arguments need to be separated by | and not a comma!
Use the CLI command "show features" to verify the currently active application map.

Note: You can use the Goto() application to jump anywhere into the extensions conf, or Macro if you would like to be returned to the other party after macro execution, or use Transfer() for e.g. a pre-defined transfer target could be hard-coded into features.conf

See bug/patch 3764 for more details.

Usage cases

This feature aims especially the problem of a channel driver which has special options:
  • In case of zaptel it could be the echo cancel enabling and disabling.
  • In other channel drivers like mISDN we could enable/disable crypting, changing the volume, enable/disable echo-cancel and enable disable dtmf detection during a call.
  • A call center Agent could Change the field of the CDR depending on the call "value".

Details

You will need to use assign the channel variable DYNAMIC_FEATURES to permit the use of the applicationmap:

Set(DYNAMIC_FEATURES=hangup#play#testfeature)

Although this feature is a nice idea, there is one major problem - audio output is only sent to one party (the caller or callee). e.g. in the case of:

testfeature => #9,peer,Playback,tt-monkeys ;Allow both the caller and callee to play
; ;tt-monkeys to the opposite chann


Without the caller knowning when the monkeys have finished babbling, there's very little point to this feature.

By way of example, consider the case of a money lender who has to play compliance messages to the caller. If the compliance message is pre-recorded rather than read live from a script, then the company's liabilities are reduced. So, we would like to replace "tt-monkeys", above, with "compliancemessage". However, the caller doesn't know how long the message is (it could be changed at any time by the management), so how will they know that it has been/is being played?

Note on the media path: When Asterisk knows/assumes that if it is not in the media path, it also won't be able to receive DTMF frames that trigger the applicationmap feature. However, if you are using SIP INFO for DTMF signaling, then it should 'just work', since when Asterisk sees the appropriate DTMF frames it will cause the bridge to 'break' and bring the media path back.

Known bugs

  • Asterisk 1.2.9.1: Goto() and Gosub() appear to be broken in conjunction with applicationmap. Workaround: Use Dial() with a Local channel (and possibly "/n")

Open questions:

  • Does the application map that has been activated for a user cause or require Asterisk to stay in the media path?
  • What exactly does the "disconnect" feature do, and when would it make sense (useful example)?

Examples

One-touch recording

exten => 123,1,Set(DYNAMIC_FEATURES=automon) ; enable One-touch
exten => 123,2,Dial(SIP/phone100,,wW) ; wW allow one-touch recording

IN and OUT audio will be split into two files, and will be available on your asterisk server in the following directory:

/var/spool/asterisk/monitor


The two files can then be joined by using sox:
soxmix *in.wav *out.wav output.wav

If desired, the mixed-channel file can then be compressed into a low bitrate MP3 using lame:
lame --preset voice -v -B 64 -a output.wav output.mp3


Note: I don't know since when it was done but in 1.2 is for sure. If you have sox installed, the automon feature will mix both legs of a call at the end. By default, the recorded filename is auto-${EPOCH}-caller-calee. You can change the caller-callee part of it by setting TOUCH_MONITOR variable.

Actually, you don't have to do a Set to enable it, which would require it to be enabled before every single Dial statement.
Instead, to enable automon globally, you can in extensions.conf put:

[globals]
DYNAMIC_FEATURES=>automon

Which will enable it for any Dial() or Queue() call with the options w or W set.

By default, automon will use wav to record calls, but you can specify another format by setting TOUCH_MONITOR_FORMAT to the prefered one.

Note: The monitor runs on the "callee" channel, so channel variables which affect the end of the monitor process (such as MONITOR_EXEC, which controls how the in/out files are mixed) must be set on the "callee" channel using the M(macro) option of the Dial command.

Examples


One Touch Recording (applicationmap) with WAV to MP3 Conversion Macro.

extensions.conf :

[macro-apprecord]
exten => s,1,GotoIf($["${XAD}" = "0" | "${XAD}" = ""]?startrec:stoprec)
exten => s,n(startrec),Playback(startmonitor)
exten => s,n,Set(XAD=1)
exten => s,n,Set(FILENAME=${TIMESTAMP}-OUT${CALLERID(number)}-^-${UNIQUEID})
exten => s,n,Set(MONITOR_EXEC_ARGS=&& nice -n 19 /usr/local/bin/lame -b 96 -t -F -m m --bitwidth 16 --quiet "/var/spool/asterisk/monitor/${FILENAME}.wav" "/var/spool/asterisk/monitor/${FILENAME}.mp3" && rm -f "/var/spool/asterisk/monitor/${FILENAME}.wav")
exten => s,n,Monitor(wav,${FILENAME},m)
exten => s,n,MacroExit
exten => s,n(stoprec),StopMonitor
exten => s,n,Set(XAD=0)
exten => s,n,Playback(stopmonitor)
exten => s,n,MacroExit

features.conf :

apps => *9,caller,Macro,apprecord


To get call back from blind transfer

Based on a recipe left in comments area by Mr.Wanchat C. on Friday 28 of April, 2006 [05:14:16]

I simply use the ${BLINDTRANSFER} variable to callback when no one answer the transfered call.

exten => _XXX,1,NoOp(${UNIQUEID} - ${DATETIME} - ${CALLERID} => ${EXTEN}) ; Add some call tracing
exten => _XXX,2,Dial(SIP/${EXTEN},5,mTt)
exten => _XXX,3,~np~Gotoif($["x${BLINDTRANSFER}"="x"]?4:5)~/np~
exten => _XXX,4,Hangup
exten => _XXX,5,Set(tx=${BLINDTRANSFER:0:7})
exten => _XXX,6,Set(CALLERID(all)=RET_${EXTEN} <${CALLERID(num)}>)
exten => _XXX,7,Dial(${tx},,mTt)
exten => _XXX,8,Hangup
;
exten => _XXX,103,Set(tx=${BLINDTRANSFER:0:7})
exten => _XXX,104,Wait(5)
exten => _XXX,105,Set(CALLERID(all)=ERR_${EXTEN} <${CALLERID(num)}>)
exten => _XXX,106,Dial(${tx},,mTt)
exten => _XXX,107,Hangup

The recipe above is valid only for SIP channels. For IAX2 channels you will need to change the ${BLINDTRANSFER:0:7} line.
(this recipe is working on an Asterisk v. 1.2 - please double check for errors before going live)

UPDATE - To get call back from blind/atended transfer - asterisk 1.4.X

This method uses the CUT function instead of the subtring method, this way it Should work for any channel type, and any number of digits on the extensions (above was for 3 digit extens). Just tested on asterisk 1.4.26

exten => _XXXX,1,Dial(SIP/${EXTEN},20,tT)
exten => _XXXX,n,~np~GotoIf($[ "x${BLINDTRANSFER}" = "x" ]?noBT)~/np~
exten => _XXXX,n,Set(DIALRET=${CUT(BLINDTRANSFER,-,1)});
exten => _XXXX,n,Goto(dRet)
exten => _XXXX,n(noBT),~np~GotoIf($[ "x${TRANSFERERNAME}" = "x" ]?sai)~/np~
exten => _XXXX,n,Set(DIALRET=${CUT(TRANSFERERNAME,-,1)});
exten => _XXXX,n(dRet),Set(CALLERID(all)=RET_${EXTEN} <${CALLERID(num)}>)
exten => _XXXX,n,Dial(${DIALRET},,mTt)
exten => _XXXX,n(sai),Hangup()

See also


Go back to Asterisk

features.conf

Formerly known as parking.conf , renamed to features.conf as of July 17, 2004.

Configuration of Asterisk call parking

parkext => 700                         ; What ext. to dial to park
parkpos => 701-720                  ; What extensions to park calls on        
context  => parkedcalls              ; Which context parked calls are in, need to INCLUDE this in extensions.conf
parkingtime => 45                       ; Number of seconds a call can be parked for (default is 45 seconds)

; after park times out, call will ring back to the original extension

Note: You must restart * after making changes to features.conf, or reload res_features.so

Added to Asterisk with v1.2 release:

Allow to use something other than *8 to pickup a ringing line in your call group.
This feature can be used via the features.conf file in your asterisk directory:

pickupexten = *8 ; Configure the pickup extension. Default is *8

Some SIP phones and ATA's can interfere with service codes like *8 so you can change the pickupexten to some other value. For example, if your extensions are in the range of 201-299, you may want to pick 200.

;transferdigittimeout => 3      ; Number of seconds to wait between digits when transferring a call
                                ; (default is 3 seconds)
;xfersound = beep               ; to indicate an attended transfer is complete
;xferfailsound = beeperr        ; to indicate a failed transfer
;pickupexten = *8               ; 代接分機. (預設為 *8)
;pickupsound = beep             ; 代接成功時會嗶一聲(預設:無聲)
;pickupfailsound = beeperr      ; 代接失敗會嗶一聲(預設:無聲) (譯者註:與上面的差別大概就是叫聲不同吧)
;featuredigittimeout = 1000     ; 最大時間,單位為毫秒,等待數字輸入。
                                ; feature activation  (default is 1000 ms)
;atxfernoanswertimeout = 15     ; Timeout for answer on attended transfer default is 15 seconds.
;atxferdropcall = no            ; If someone does an attended transfer, then hangs up before the transferred
                                ; caller is connected, then by default, the system will try to call back the
                                ; person that did the transfer.  If this is set to "yes", the callback will
                                ; not be attempted and the transfer will just fail.
                                ; For atxferdropcall=no to work properly, you also need to
                                ; define ATXFER_NULL_TECH in main/features.c.  The reason the
                                ; code is not enabled by default is spelled out in the comment
                                ; block near the top of main/features.c describing ATXFER_NULL_TECH.
;atxferloopdelay = 10           ; Number of seconds to sleep between retries (if atxferdropcall = no)
;atxfercallbackretries = 2      ; Number of times to attempt to send the call back to the transferer.
                                ; By default, this is 2.

[featuremap]
;blindxfer => #1                ; Blind transfer  (default is #) -- Make sure to set the T and/or t option in the Dial() or Queue() app call!
;disconnect => *0               ; Disconnect  (default is *) -- Make sure to set the H and/or h option in the Dial() or Queue() app call!
;automon => *1                  ; 一鍵錄音,單聲道分成兩個檔案。請確認在Dial或Queue這個指令內,有啟用W或w才能錄音。x允許被叫使用 *1 錄音, W允許主叫使用*1
;atxfer => *2                   ; 參與轉接  -- Make sure to set the T and/or t option in the Dial() or Queue()  app call!
;parkcall => #72                ; Park call (one step parking)  -- Make sure to set the K and/or k option in the Dial() app call!
;automixmon => *3               ; 一鍵錄音,雙聲道錄成1個檔案。請確認在 Dial() 或 Queue() 這個指令內,有啟用X或x才能錄音。 x允許被叫使用 *3 錄音, X允許主叫使用*3


[applicationmap]
; don't use e.g #9 for applicationmap or featuremap unless you have changed 'blindxfer' from # to e.g. #1 !
testfeature => *9,callee,Playback,tt-monkeys   ;Play tt-monkes to callee if *9 was pressed - use 'callee' or 'caller'
testfeature3 => *9,self/caller,Monitor,wav|myoutfile|mb 
; note the use of the pipe char '|' here to separate arguments to monitor application

If you set the variable __TRANSFER_CONTEXT, then that context will be used (note the two leading underscores).
More on this: You need to set a TRANSFER_CONTEXT, either for the transferer or transferee channel. I dont know why, but res_features give priority to the transferee TRANSFER_CONTEXT, if not found, then use the transferrer TRANSFER_CONTEXT. That context is used to match the extension to dial. So you can set this var to any context you want.

New in 1.2.19 and 1.4.5: Finally the borders between attended and blind transfer begin to blur, making Asterisk behave much more like traditional PBX systems: An attended transfer no longer fails if the transferer hangs up before answer, therefore only the attended transfer method needs to be taught to the users. For Asterisk 1.6 this behaviour has been enhanced with a callback feature. See patches 8413 and 9338; this has also been discussed in this German forum.

Using the blindxfer in [featuremap] section you can redefine the transfer key. For example, if the blindxfer is set to "##", transfer only happens when you press the "#" key twice very quickly. This solves a problem using Asterisk phones to call IVR systems such as those used by banks and credit card companies - "Enter you account number followed by the # key".

blindxfer allows unattended or blind transfers. It works like this:

While on a conversation with another party, you dial the blindxfer sequence. Asterisk says "Transfer" then gives you a dial tone, while putting the other party on hold. You dial the transferee number and the caller is put through to that number immediately. Your line drops. The caller ID displayed to the person receiving the transferred call is exactly the same as the caller ID presented to you.

atxfer allows attended transfer or supervised transfer. It works like this:

While on conversation with another party, you dial the atxfer key sequence. Asterisk says "Transfer" then gives you a dial tone, while putting the other party on hold. You dial the transferee number and talk with the transferee to introduce the call, then you can hang up and the other party will be connected with the transferee. In case the transferee does not want to answer the call, he/she simply hangs up and you will be back to your original conversation. Press the disonnect key sequence, set to *0 by default, to return yourself to the original caller.
Note The caller ID presented to the person you are trying to transfer the call to is not what you would expect - Asterisk sets your caller ID to be the extension the call originally arrived at which may not be the same as the extension the call was answered at. There doesn't appear to be any way of getting the correct caller ID.

Note: You MUST use the T and/or t options in the command Dial() in order to allow the caller and/or callee to use any transfer feature



[applicationmap]
; Note that the DYNAMIC_FEATURES channel variable must be set to use the features
; defined here.  The value of DYNAMIC_FEATURES should be the names of the features
; to allow the channel to use separated by '#'.  For example:
;
;    Set(__DYNAMIC_FEATURES=myfeature1#myfeature2#myfeature3)
;
; (Note: The two leading underscores allow these feature settings to be set on
;  on the outbound channels, as well.  Otherwise, only the original channel
;  will have access to these features.)
;
; The syntax for declaring a dynamic feature is the following:
;
;<FeatureName> => <DTMF_sequence>,<ActivateOn>[/<ActivatedBy>],<Application>[,<AppArguments>[,MOH_Class]]
;
;  FeatureName   -> This is the name of the feature used in when setting the
;                   DYNAMIC_FEATURES variable to enable usage of this feature.
;  DTMF_sequence -> This is the key sequence used to activate this feature.
;  ActivateOn    -> This is the channel of the call that the application will be executed
;                   on. Valid values are "self" and "peer". "self" means run the
;                   application on the same channel that activated the feature. "peer"
;                   means run the application on the opposite channel from the one that
;                   has activated the feature.
;  ActivatedBy   -> This is which channel is allowed to activate this feature. Valid
;                   values are "caller", "callee", and "both". "both" is the default.
;                   The "caller" is the channel that executed the Dial application, while
;                   the "callee" is the channel called by the Dial application.
;  Application   -> This is the application to execute.
;  AppArguments  -> These are the arguments to be passed into the application.
;  MOH_Class     -> This is the music on hold class to play while the idle
;                   channel waits for the feature to complete. If left blank,
;                   no music will be played.
;
;
; IMPORTANT NOTE: The applicationmap is not intended to be used for all Asterisk
;   applications. When applications are used in extensions.conf, they are executed
;   by the PBX core. In this case, these applications are executed outside of the
;   PBX core, so it does *not* make sense to use any application which has any
;   concept of dialplan flow. Examples of this would be things like Macro, Goto,
;   Background, WaitExten, and many more.
;
; Enabling these features means that the PBX needs to stay in the media flow and
; media will not be re-directed if DTMF is sent in the media stream.
;
; Example Usage:
;
;testfeature => #9,peer,Playback,tt-monkeys  ;Allow both the caller and callee to play
;                                            ;tt-monkeys to the opposite channel
;
;pauseMonitor   => #1,self/callee,Pausemonitor     ;Allow the callee to pause monitoring
;                                                  ;on their channel
;unpauseMonitor => #3,self/callee,UnPauseMonitor   ;Allow the callee to unpause monitoring
;                                                  ;on their channel
;




Note that multiple application arguments need to be separated by | and not a comma!
Use the CLI command "show features" to verify the currently active application map.

Note: You can use the Goto() application to jump anywhere into the extensions conf, or Macro if you would like to be returned to the other party after macro execution, or use Transfer() for e.g. a pre-defined transfer target could be hard-coded into features.conf

See bug/patch 3764 for more details.

Usage cases

This feature aims especially the problem of a channel driver which has special options:
  • In case of zaptel it could be the echo cancel enabling and disabling.
  • In other channel drivers like mISDN we could enable/disable crypting, changing the volume, enable/disable echo-cancel and enable disable dtmf detection during a call.
  • A call center Agent could Change the field of the CDR depending on the call "value".

Details

You will need to use assign the channel variable DYNAMIC_FEATURES to permit the use of the applicationmap:

Set(DYNAMIC_FEATURES=hangup#play#testfeature)

Although this feature is a nice idea, there is one major problem - audio output is only sent to one party (the caller or callee). e.g. in the case of:

testfeature => #9,peer,Playback,tt-monkeys ;Allow both the caller and callee to play
; ;tt-monkeys to the opposite chann


Without the caller knowning when the monkeys have finished babbling, there's very little point to this feature.

By way of example, consider the case of a money lender who has to play compliance messages to the caller. If the compliance message is pre-recorded rather than read live from a script, then the company's liabilities are reduced. So, we would like to replace "tt-monkeys", above, with "compliancemessage". However, the caller doesn't know how long the message is (it could be changed at any time by the management), so how will they know that it has been/is being played?

Note on the media path: When Asterisk knows/assumes that if it is not in the media path, it also won't be able to receive DTMF frames that trigger the applicationmap feature. However, if you are using SIP INFO for DTMF signaling, then it should 'just work', since when Asterisk sees the appropriate DTMF frames it will cause the bridge to 'break' and bring the media path back.

Known bugs

  • Asterisk 1.2.9.1: Goto() and Gosub() appear to be broken in conjunction with applicationmap. Workaround: Use Dial() with a Local channel (and possibly "/n")

Open questions:

  • Does the application map that has been activated for a user cause or require Asterisk to stay in the media path?
  • What exactly does the "disconnect" feature do, and when would it make sense (useful example)?

Examples

One-touch recording

exten => 123,1,Set(DYNAMIC_FEATURES=automon) ; enable One-touch
exten => 123,2,Dial(SIP/phone100,,wW) ; wW allow one-touch recording

IN and OUT audio will be split into two files, and will be available on your asterisk server in the following directory:

/var/spool/asterisk/monitor


The two files can then be joined by using sox:
soxmix *in.wav *out.wav output.wav

If desired, the mixed-channel file can then be compressed into a low bitrate MP3 using lame:
lame --preset voice -v -B 64 -a output.wav output.mp3


Note: I don't know since when it was done but in 1.2 is for sure. If you have sox installed, the automon feature will mix both legs of a call at the end. By default, the recorded filename is auto-${EPOCH}-caller-calee. You can change the caller-callee part of it by setting TOUCH_MONITOR variable.

Actually, you don't have to do a Set to enable it, which would require it to be enabled before every single Dial statement.
Instead, to enable automon globally, you can in extensions.conf put:

[globals]
DYNAMIC_FEATURES=>automon

Which will enable it for any Dial() or Queue() call with the options w or W set.

By default, automon will use wav to record calls, but you can specify another format by setting TOUCH_MONITOR_FORMAT to the prefered one.

Note: The monitor runs on the "callee" channel, so channel variables which affect the end of the monitor process (such as MONITOR_EXEC, which controls how the in/out files are mixed) must be set on the "callee" channel using the M(macro) option of the Dial command.

Examples


One Touch Recording (applicationmap) with WAV to MP3 Conversion Macro.

extensions.conf :

[macro-apprecord]
exten => s,1,GotoIf($["${XAD}" = "0" | "${XAD}" = ""]?startrec:stoprec)
exten => s,n(startrec),Playback(startmonitor)
exten => s,n,Set(XAD=1)
exten => s,n,Set(FILENAME=${TIMESTAMP}-OUT${CALLERID(number)}-^-${UNIQUEID})
exten => s,n,Set(MONITOR_EXEC_ARGS=&& nice -n 19 /usr/local/bin/lame -b 96 -t -F -m m --bitwidth 16 --quiet "/var/spool/asterisk/monitor/${FILENAME}.wav" "/var/spool/asterisk/monitor/${FILENAME}.mp3" && rm -f "/var/spool/asterisk/monitor/${FILENAME}.wav")
exten => s,n,Monitor(wav,${FILENAME},m)
exten => s,n,MacroExit
exten => s,n(stoprec),StopMonitor
exten => s,n,Set(XAD=0)
exten => s,n,Playback(stopmonitor)
exten => s,n,MacroExit

features.conf :

apps => *9,caller,Macro,apprecord


To get call back from blind transfer

Based on a recipe left in comments area by Mr.Wanchat C. on Friday 28 of April, 2006 [05:14:16]

I simply use the ${BLINDTRANSFER} variable to callback when no one answer the transfered call.

exten => _XXX,1,NoOp(${UNIQUEID} - ${DATETIME} - ${CALLERID} => ${EXTEN}) ; Add some call tracing
exten => _XXX,2,Dial(SIP/${EXTEN},5,mTt)
exten => _XXX,3,~np~Gotoif($["x${BLINDTRANSFER}"="x"]?4:5)~/np~
exten => _XXX,4,Hangup
exten => _XXX,5,Set(tx=${BLINDTRANSFER:0:7})
exten => _XXX,6,Set(CALLERID(all)=RET_${EXTEN} <${CALLERID(num)}>)
exten => _XXX,7,Dial(${tx},,mTt)
exten => _XXX,8,Hangup
;
exten => _XXX,103,Set(tx=${BLINDTRANSFER:0:7})
exten => _XXX,104,Wait(5)
exten => _XXX,105,Set(CALLERID(all)=ERR_${EXTEN} <${CALLERID(num)}>)
exten => _XXX,106,Dial(${tx},,mTt)
exten => _XXX,107,Hangup

The recipe above is valid only for SIP channels. For IAX2 channels you will need to change the ${BLINDTRANSFER:0:7} line.
(this recipe is working on an Asterisk v. 1.2 - please double check for errors before going live)

UPDATE - To get call back from blind/atended transfer - asterisk 1.4.X

This method uses the CUT function instead of the subtring method, this way it Should work for any channel type, and any number of digits on the extensions (above was for 3 digit extens). Just tested on asterisk 1.4.26

exten => _XXXX,1,Dial(SIP/${EXTEN},20,tT)
exten => _XXXX,n,~np~GotoIf($[ "x${BLINDTRANSFER}" = "x" ]?noBT)~/np~
exten => _XXXX,n,Set(DIALRET=${CUT(BLINDTRANSFER,-,1)});
exten => _XXXX,n,Goto(dRet)
exten => _XXXX,n(noBT),~np~GotoIf($[ "x${TRANSFERERNAME}" = "x" ]?sai)~/np~
exten => _XXXX,n,Set(DIALRET=${CUT(TRANSFERERNAME,-,1)});
exten => _XXXX,n(dRet),Set(CALLERID(all)=RET_${EXTEN} <${CALLERID(num)}>)
exten => _XXXX,n,Dial(${DIALRET},,mTt)
exten => _XXXX,n(sai),Hangup()

See also


Go back to Asterisk

Created by: dominic16y, Last modification: Wed 26 of Sep, 2012 (09:16 UTC)
Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - Find us on Google+