Summary:ASTERISK-19319: [patch] Triggers dialplan actions when specific CONTROL_FRAMES are detected on a channel.
Reporter:Marco Signorini (marcoloway)Labels:patch
Date Opened:2012-02-09 03:58:39.000-0600Date Closed:
Versions:10.1.1 13.18.4 Frequency of
Environment:Tested on CentOS 5Attachments:( 0) func_frame_trigger.c
Description:A filter can be applied to the trigger to limit frames sensibility.  This filter can either be a white or black list of control frame types.  When no filter type is present, white is used.  If no arguments are provided at all, all frames will trigger the specified gosub call.
If the specified gosub extension is not present on the dialplan, the function will gosub to the "s-XXXX" extension in the gosub context where XXXX is the type of the control frame.
It can be set only once on a given channel.

exten => 1,1,Set(FRAME_TRIGGER(white, CONTROL_HOLD)=ext,context); trigger gosub ext-CONTROL_HOLD@context only for HOLD type control frames
exten => 1,1,Set(FRAME_TRIGGER(black, CONTROL_HOLD)=ext,context); trigger gosub ext-CONROL_XXXX@context for all control type frames except for HOLD type control frames
exten => 1,1,Set(FRAME_TRIGGER(CONTROL_HOLD, CONROL_UNHOLD)=context) ; trigger gosub to s-CONTROL_HOLD@context and s-CONROL_UNHOLD context only for HOLD and UNHOLD type control frames

This feature was originally developed in order to track MOH events in a call center environment but has general interest.
Comments:By: Marco Signorini (marcoloway) 2012-02-09 04:00:08.925-0600

For version 10.1.1.
To be added to the "funcs" folder.

By: Marco Signorini (marcoloway) 2012-02-09 04:03:12.787-0600

Here is an example on how the function could be used to track MOH agent events on a queue:

exten => s,1,QueueLog(${ARG3},${ARG2},${ARG4},${ARG5},${ARG6}|${ARG7}|${ARG8})

exten => s-CONTROL_HOLD,n,Hangup
exten => s-CONTROL_UNHOLD,n,Hangup

exten => s,1,Set(FRAME_TRIGGER(CONTROL_HOLD,CONTROL_UNHOLD)=queue-hold-logger)
exten => s,n,Return

; ${ARG1} - QueueName
exten => s,1,Set(__INUNIQUEID=${UNIQUEID})
exten => s,n,Set(__INQUEUENAME=${ARG1})
exten => s,n,Queue(${INQUEUENAME},t,,,,,,queue-on-answer)
exten => s,n,Return

By: Matt Jordan (mjordan) 2012-02-16 16:21:40.684-0600

Would you care to put the proposed feature up on ReviewBoard?

By: Marco Signorini (marcoloway) 2012-02-21 05:12:54.280-0600

Hi Matt. Yes, sure. I tried to add it to the review board but I think my account is not enabled. I can't logon to the review board. Do I have to sign for a new account?

By: Marco Signorini (marcoloway) 2012-02-29 10:12:47.180-0600

Added to Review Board. Thanks!