[Home]

Summary:ASTERISK-01344: [patch] Improved Call Limit Control For Dial
Reporter:Anthony Minessale (anthm)Labels:
Date Opened:2004-04-05 13:16:12Date Closed:2004-09-25 02:49:36
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Applications/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) timerpatch.diff.txt
Description:This improves on the recent S(x) param added to app_dial

The patch adds the following:

'L(x[:y][:z])' -- Limit the call to 'x' ms warning when 'y' ms are left (repeated every 'z' ms)
-- Only 'x' is required, 'y' and 'z' are optional.
-- The following special variables are optional:
** LIMIT_PLAYAUDIO_CALLER (default yes) Play sounds to the caller.
** LIMIT_PLAYAUDIO_CALLEE Play sounds to the callee.
** LIMIT_TIMEOUT_FILE File to play when time is up.
** LIMIT_CONNECT_FILE File to play when call begins.
** LIMIT_WARNING_FILE File to play as warning if 'y' is defined.
-- 'timeleft' is a special sound macro to auto-say the time left and is the default.

* the special filename timeleft will auto generate
a message in the form of (you have x minutes y seconds)
providing minutes and seconds left are > 0
This requires the "minutes" and "seconds" gsm file
from the asterisk-sounds package.

SIDE EFFECTS:
Since each channel type has a form of native bridge
that kicks in if both ends of a call share a common channel It would be necessary to implement this feature
on each channel type seperatly.  Therefore to avoid this issue the feature will eliminate the potential for a native bridge if it is invoked even on like channels.

SAMPLE USAGE:
exten => 1,1,Dial(Zap/g3/14149361212|120|L(60000:30000:1:0:0:timeleft:vm-goodbye:timeleft);

* play sounds only to the caller
* play timeleft info at beginning of the call.
* allow call to last 60 sec and warn timeleft info at
 30 seconds

* hangup after 60 sec playing 'vm-goodbye'



****** ADDITIONAL INFORMATION ******

patch is attached
Comments:By: opsys (opsys) 2004-04-06 03:58:44

Works for me, However it should be in seconds as Absolute timeout is also in seconds. You could use decimal notation for finer time slots (ie 1.5 instead of 1500).

By: Anthony Minessale (anthm) 2004-04-06 10:53:28

I disagree, almost everything in asterisk is measured in ms and I prefer
to stay uniform with that.

By: dimi (dimi) 2004-04-06 11:10:55

Dear anthm
i have try this patch and i think is very usefull !! i hope in possible backport to Stable 1.0 after time to debug it.
I have found only minor problem in hangup TIME I create an exten like this:
exten => 2201,3,Dial(Zap/1|15|S(62)L(60000:30000:1:0:0:timeleft:vm-goodbye:timeleft))
i must Set the Timeout S(x) to few seconds more than  "x: ms till call ends" because i can hear the "goodbye" mex. I notice this issue (see log on botton) but i think is what you say as "SIDE EFFECTS" in i call exten from the same channel.
Thanks for you great work!!

------------------------
  -- Playing 'vm-goodbye' (language 'en')
Apr  6 16:44:20 WARNING[786451]: file.c:537 ast_readaudio_callback: Failed to write frame
   -- Playing 'vm-youhave' (language 'en')
Apr  6 16:44:20 WARNING[786451]: file.c:537 ast_readaudio_callback: Failed to write frame
   -- Playing 'digits/60' (language 'en')
Apr  6 16:44:20 WARNING[786451]: file.c:537 ast_readaudio_callback: Failed to write frame
   -- Playing 'seconds' (language 'en')
Apr  6 16:44:20 WARNING[786451]: res_parking.c:263 ast_bridge_call: Bridge failed on channels Zap/3-1 and Zap/1-1
   -- Hungup 'Zap/1-1'
   -- Executing Hangup("Zap/3-1", "") in new stack

By: Anthony Minessale (anthm) 2004-04-06 13:42:06

You do not need to use this feature and S(x) at the same time.

the 1st arg in the L() i.e. 60000 is the same effect as the S(60)
you are also not required to play the warning sounds at the beginning
and the end

Dial(Zap/1|15|L(60000:30000:1:0:0:timeleft)

will only play the 'timeleft' warning with 30 sec remaining and hangup the call after 60 sec

the s1 s2 and s3 correspond to warning,end,begining cos that is the order
of likelyhood you may want to use it.

By: dimi (dimi) 2004-04-06 19:57:58

Thanks for your example! I have try now with your example of Dial option but i have notice that the call is not dropped after 60s and seems go in loop and repeat the timeleft...
This problem is related to your "SIDE EFFECTS"?

My call from:
Sip Phone ---------> FXS/TDM400

Log from Asterisk CLI:
--------------------------------
-- Executing Dial("SIP/pippo-fa13", "Zap/32|15|L(60000:30000:1:0:0:timeleft)") in new stack
Apr  7 01:33:06 WARNING[376852]: app_dial.c:535 dial_exec: Limit Data: timelimit=60000, play_warning=30000, play_to_caller=1, play_to_callee=0, warning_freq=0, warning_sound=timeleft, end_sound=NULL, start_sound=NULL
   -- Called 32
   -- Zap/32-1 is ringing
   -- Zap/32-1 is ringing
   -- Zap/32-1 answered SIP/pippo-fa13
   -- Playing 'vm-youhave' (language 'en')
   -- Playing 'digits/20' (language 'en')
   -- Playing 'digits/9' (language 'en')
   -- Playing 'seconds' (language 'en')
Apr  7 01:34:31 NOTICE[131081]: chan_sip.c:4992 handle_response: Peer 'pippo' is now TOO LAGGED!
   -- Playing 'vm-youhave' (language 'en')
   -- Playing 'digits/30' (language 'en')
   -- Playing 'seconds' (language 'en')
Apr  7 01:34:41 NOTICE[131081]: chan_sip.c:4987 handle_response: Peer 'pippo' is now REACHABLE!
   -- Hungup 'Zap/32-1'
   -- Executing Hangup("SIP/pippo-fa13", "") in new stack
 == Spawn extension (local, h, 1) exited non-zero on 'SIP/pippo-fa13'
----------------------------

edited on: 04-06-04 18:53

By: Anthony Minessale (anthm) 2004-04-06 20:12:07

the only side effects I mentioned were that you cannont
use native bridge with this feature other than that, it should work

I did this test on mine and called local weather and it
warned me at 29 seconds left and then hungup on time.

exten => 1,1,Dial(Zap/g3/14149361212|15|L(60000:30000:1:0:0:timeleft))

It may be related to your setup or the type of call you are making I will have to test it some more tommorow

By: Anthony Minessale (anthm) 2004-04-10 12:42:10

OK I found a mistake in the app_dial it's now updated in the patch file

to fix it by hand locate this
ast_bridge_call(chan,peer,&config);

and change it to

res = ast_bridge_call(chan,peer,&config);

DOH!

By: Olle Johansson (oej) 2004-04-10 16:22:24

Any more test results from other users? Please add your comment here, good or bad!

By: Anthony Minessale (anthm) 2004-04-26 18:05:59

syntax has changed a bunch

     'L(x[:y][:z])' -- Limit the call to 'x' ms warning when 'y' ms are left (repeated every 'z' ms)
                    -- Only 'x' is required, 'y' and 'z' are optional.
                    -- The following special variables are optional:
                      ** LIMIT_PLAYAUDIO_CALLER    (default yes) Play sounds to the caller.
                      ** LIMIT_PLAYAUDIO_CALLEE    Play sounds to the callee.
                      ** LIMIT_TIMEOUT_FILE        File to play when time is up.
                      ** LIMIT_CONNECT_FILE        File to play when call begins.
                      ** LIMIT_WARNING_FILE        File to play as warning if 'y' is defined.
                    -- 'timeleft' is a special sound macro to auto-say the time left and is the default.

By: Anthony Minessale (anthm) 2004-04-26 19:17:32

Added to CVS 4/26/04

By: Brian West (bkw918) 2004-04-26 21:23:39

L(20000:10000:0:0:timeleft)

Does this only work on zap?  I'm doing sip to sip and all I get is "You have 9" every 10 seconds or so.

bkw

By: Brian West (bkw918) 2004-04-26 21:27:09

also need to track MOH and restart it if needed

By: Tony Mountifield (softins) 2004-04-27 10:49:41

I agree with opsys - it's rather redundant always putting three extra zeros at the end of each duration. Who is ever going to specify fractions of a second anyway?