LIMIT CALL DURATION with RAND in Asterisk Dial Options


I’m trying to use :
Asterisk Dial Options

with RAND(x,y) function


limit inbound call duration randomly between 10 - 50 minutes.

So I will try this:

Now I have 2 questions:

  1. Will this work ? Did anyone try this?
  2. Can I disable the warning message?
  3. If I can use it then how deep can I nest other instructions? to achieve call disconnection to be always between 0-15s of the whole minute.
  4. Also if you have any other ways/suggestions please let me know.
  1. Why?
  2. What Warning?
  3. Try it out and let us know.

I would create the random number and load it into a variable then pass the variable to the dial command.

asterisk has within it’s math functions modulo (%) , there are 60 seconds in a minute :slight_smile:

(You explicitly set the warning with your second (y) argument, if you don’t want it leave it blank)

but why not just :-


And to be strictly within your spec. perhaps:-

L(${RAND(10,50)*60 + RAND(,15)})

which would account for positive offsets on the minute between 0 and 15 seconds, to include negative offsets just expand the expression, it’s not rocket science just high school math.