Asterisk Code Bits

Asterisk Code Bits

 
Configure inbound call duration
https://community.freepbx.org/t/how-to-limit-call-duration/22284

In /etc/asterisk/extensions_custom.conf:
[from-pstn-limited] exten => _.,1,noop(Limiting maximum call duration)
exten => _.,n,Set(TIMEOUT(absolute)=3600)
exten => _.,n,Goto(from-pstn,${EXTEN},1)

 
Set context in trunk peer details with 
context=from-pstn-limited

GotoIF  – comparison between two variables TEST and TEST2

n,Set(TEST=101)

n,Set(TEST2=102)

n,GotoIf($[${TEST} = ${TEST2}]?10:20)
exten => 1,10,NoOp(&&&& match

exten => 1,11,Hangup()
exten => 1,20,NoOp(&&&&&&& mismatch)

exten => 1,21,HanguP()

 
COUNTER
exten => s,n,Set(Attempts=1)
exten => s,n,Set(Attempts=${MATH(${Attempts}+1,i)})
exten => s,n,ExecIf($[“${Attempts}”=”4”]?HANGUP())
 
exten => s,n,Playback(if-this-is-correct-press)
exten => s,n,SayDigits(1)
exten => s,n,Read(digi,,1)
exten => s,n,ExecIf($[“${digi}”=”1”]?goto(writevalue))
 
exten => s,n(writevalue),NoOp(Caller pressed 1)

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.