How to limit each Call to 30 secs

Hi, New at this.

How can I limit each call to 30 seconds or less?

something like this.

exten => _X.,1,NoOp(Starting dial plan)
same => n,Set(CHANNEL(language)=en)
same => n,Read(userInput,${REC1},1,n,1,30)
same => n,Set(CDR(userfield)=${userInput})
same => n(hangup),Hangup()

Simple Call,

  • plays an audio file
  • reads user input
  • and saves the input

but the call should not exceed 30 seconds

My instinctive answer for anything the least bit complicated is “use a script”. Have it monitor call starts (via AMI or ARI); start a timer, then issue a Hangup on that channel after the desired interval.

1 Like

This command will match your need:
Set(TIMEOUT(absolute) = seconds)

1 Like

Set an absolute timeout on the channel using the TIMEOUT dialplan function[1]. Once reached the call will be hung up.

[1] TIMEOUT - Asterisk Documentation

1 Like

There is also an L option on Dial(). I think they use different starting points for the timing, and L assumes you are dialling a B leg.

Thanks that works for what I need

thanks for sharing the Doc, i works for my case