The following info was taken from this location:

http://www.voip-info.org/tiki-index.php?page=NVBackgroundDetect

Sample Usage (extensions.conf) 
[context-incoming] 
; Answer and do some detection work 
exten => s,1,Answer 
exten => s,2,NVBackgroundDetect(welcome) 
exten => s,3,Hangup 
 
; If user presses "1", dial main line 
exten => 1,1,Dial(SIP/5500) 
exten => 1,2,Hangup 
 
; If this is a fax, dial fax line 
exten => fax,1,Dial(SIP/5501) 
exten => fax,2,Hangup 
 
; If user is talking, send him to Debra 
exten => talk,1,Dial(SIP/5502) 
exten => talk,2,Hangup 
