NVLineDetect

Answer Detection, Dialtone Detection, and Dead Channel Detection for ZAP and IAX, SIP, others

Including busy detect, congestion detection, and ring detection. Search the web for the code.

Synopsis

Detects answer/dead/other signals on ZAP and other channels

Description

NVLineDetect([waitdur[|options[|deaddur[|sildur[|mindur[|maxdur]]]]]])

This application listens for certain tones (on ZAP and most channel types) for max waitdur seconds of time. In particular, it detects presence of conditions: ANSWER, PICKUP, RING, BUSY, CONGESTION, DIALTONE, and DEAD. The respective extension name (in lowercase letters) will be called (i.e. 'answer', 'pickup', etc.). In addition, the variable TONE_DETECTED is set. If all undetected, control will continue at the next priority.

Parameters

waitdur: Maximum number of seconds to wait (default=30)
options:
'n': Attempt on-hook if unanswered (default=no)
'd': Ignore answer detection of ring+talk (default=no)
'a': Ignore pickup detection of ring+sil (default=no)
'b': Ignore busy detection (default=no)
'c': Ignore congestion detection (default=no)
'r': Return after ring/ringing detection (default=no)
'd': Return after dialtone detection (default=no)
's': Ignore dead channel detection (default=no)
deaddur: How many ms of no activity to wait for dead (default=30)
sildur: Silence ms after min/maxdur before answer/pickup (default=1000)
mindur: Minimum non-silence talk ms needed (default=100)
maxdur: Maximum non-silence talk ms allowed (default=0/forever)

Return codes

Returns -1 on hangup, and 0 on successful completion with no exit conditions.

Notes

This code is NOT included with Asterisk at this point, however it is free. To get it, search the web.

This code works best on ZAP channel or channels using ULAW/ALAW, however it will work with other codecs.

Requirements

  • Asterisk development or stable

Sample Usage (extensions.conf)

[context-incoming]
; Answer and do some detection work
exten => s,1,Answer
exten => s,2,NVLineDetect
exten => s,3,Hangup

; The channel is dead
exten => dead,1,Hangup

; Play welcome, send to primary
exten => answer,1,NVBackgroundDetect(welcome)
exten => answer,2,Dial(SIP/5500)
exten => answer,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

Installation

Easiest way to get up and running:

(1) Drop the code in your /usr/src/asterisk/apps directory

(2) Edit the Makefile in the apps directory. Add the following line:
APPS+=app_nv_linedetect.so

(3) Go to /usr/src/asterisk and run "make", then run "make install"

(4) Start or restart Asterisk

(5) Type "show application nvlinedetect" from the CLI and you should see it

NOTE: Dialtone detection requires additional changes. This will be posted shortly.


Future Improvements

None at this time.

Compatability

The copy I obtained included instructions to replace the existing dsp.c dsp.h and frame.h files with the ones supplied. This causes asterisk 1.2.9 errors when compiling.
Why isn't a patch supplied when existing files need to be modified?
Copying a modified version of source code from an older version of asterisk into a current version could introduce a number of bugs.

See also

Answer Detection, Dialtone Detection, and Dead Channel Detection for ZAP and IAX, SIP, others

Including busy detect, congestion detection, and ring detection. Search the web for the code.

Synopsis

Detects answer/dead/other signals on ZAP and other channels

Description

NVLineDetect([waitdur[|options[|deaddur[|sildur[|mindur[|maxdur]]]]]])

This application listens for certain tones (on ZAP and most channel types) for max waitdur seconds of time. In particular, it detects presence of conditions: ANSWER, PICKUP, RING, BUSY, CONGESTION, DIALTONE, and DEAD. The respective extension name (in lowercase letters) will be called (i.e. 'answer', 'pickup', etc.). In addition, the variable TONE_DETECTED is set. If all undetected, control will continue at the next priority.

Parameters

waitdur: Maximum number of seconds to wait (default=30)
options:
'n': Attempt on-hook if unanswered (default=no)
'd': Ignore answer detection of ring+talk (default=no)
'a': Ignore pickup detection of ring+sil (default=no)
'b': Ignore busy detection (default=no)
'c': Ignore congestion detection (default=no)
'r': Return after ring/ringing detection (default=no)
'd': Return after dialtone detection (default=no)
's': Ignore dead channel detection (default=no)
deaddur: How many ms of no activity to wait for dead (default=30)
sildur: Silence ms after min/maxdur before answer/pickup (default=1000)
mindur: Minimum non-silence talk ms needed (default=100)
maxdur: Maximum non-silence talk ms allowed (default=0/forever)

Return codes

Returns -1 on hangup, and 0 on successful completion with no exit conditions.

Notes

This code is NOT included with Asterisk at this point, however it is free. To get it, search the web.

This code works best on ZAP channel or channels using ULAW/ALAW, however it will work with other codecs.

Requirements

  • Asterisk development or stable

Sample Usage (extensions.conf)

[context-incoming]
; Answer and do some detection work
exten => s,1,Answer
exten => s,2,NVLineDetect
exten => s,3,Hangup

; The channel is dead
exten => dead,1,Hangup

; Play welcome, send to primary
exten => answer,1,NVBackgroundDetect(welcome)
exten => answer,2,Dial(SIP/5500)
exten => answer,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

Installation

Easiest way to get up and running:

(1) Drop the code in your /usr/src/asterisk/apps directory

(2) Edit the Makefile in the apps directory. Add the following line:
APPS+=app_nv_linedetect.so

(3) Go to /usr/src/asterisk and run "make", then run "make install"

(4) Start or restart Asterisk

(5) Type "show application nvlinedetect" from the CLI and you should see it

NOTE: Dialtone detection requires additional changes. This will be posted shortly.


Future Improvements

None at this time.

Compatability

The copy I obtained included instructions to replace the existing dsp.c dsp.h and frame.h files with the ones supplied. This causes asterisk 1.2.9 errors when compiling.
Why isn't a patch supplied when existing files need to be modified?
Copying a modified version of source code from an older version of asterisk into a current version could introduce a number of bugs.

See also

Created by: justin_newman, Last modification: Wed 13 of Jun, 2012 (05:05 UTC) by admin
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+