Skip to content

Instantly share code, notes, and snippets.

@rodrigolang
Last active August 8, 2022 17:20
Show Gist options
  • Save rodrigolang/4495156 to your computer and use it in GitHub Desktop.
Save rodrigolang/4495156 to your computer and use it in GitHub Desktop.
Facilidade de cadeado para Asterisk versões 1.4, 1.6 e 1.8.
[cadeado]
;;;Ativa cadeado
exten => _*55,1,Answer()
exten => _*55,2,Wait(1)
exten => _*55,3,Set(Pass=${DB(Senha/${CALLERID(num)})})
exten => _*55,4,Authenticate(${Pass},d)
exten => _*55,5,Set(DB(Cadeado/${CALLERID(num)})=1)
exten => _*55,6,Playback(cadeado-ativo)
;;;Desativa cadeado
exten => _*56,1,Answer()
exten => _*56,2,Wait(1)
exten => _*56,3,Set(Pass=${DB(Senha/${CALLERID(num)})})
exten => _*56,4,Authenticate(${Pass},d)
exten => _*56,5,Set(DB(Cadeado/${CALLERID(num)})=0)
exten => _*56,6,Playback(cadeado-desativo)
;;;Modifica a senha de cadeado
exten => _*57,1,Answer()
exten => _*57,2,Wait(1)
exten => _*57,3,Set(Pass=${DB(Senha/${CALLERID(num)})})
exten => _*57,4,Authenticate(${Pass},d)
exten => _*57,5,Playback(digite-nova-senha)
exten => _*57,6,Read(NovaSenha,,4,,,)
exten => _*57,7,Set(DB(Senha/${CALLERID(num)})=${NovaSenha})
exten => _*57,8,Playback(senha-modificada)
exten => h,1,Hangup()
[saida-de-ligacoes]
exten => _X.,1,Gotoif($[ "${DB(Cadeado/${CALLERID(num)})}" = "0" ]?continua:bloqueado)
exten => _X.,2(continua),Dial(........)
exten => _X.,3,Hangup()
exten => _X.,4(bloqueado),Playback(cadeado-ativo)
exten => h,1,Hangup()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment