Skip to content

Instantly share code, notes, and snippets.

Rodrigo Lang rodrigolang

Block or report user

Report or block rodrigolang

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@rodrigolang
rodrigolang / vimrc
Created Jan 29, 2013
Configuração de "nice stuff's" para o vim.
View vimrc
" All system-wide defaults are set in $VIMRUNTIME/debian.vim (usually just
" /usr/share/vim/vimcurrent/debian.vim) and sourced by the call to :runtime
" you can find below. If you wish to change any of those settings, you should
" do it in this file (/etc/vim/vimrc), since debian.vim will be overwritten
" everytime an upgrade of the vim packages is performed. It is recommended to
" make changes after sourcing debian.vim since it alters the value of the
" 'compatible' option.
" This line should not be removed as it ensures that various options are
" properly set to work with the Vim-related packages available in Debian.
@rodrigolang
rodrigolang / realtime.sql
Last active Dec 11, 2015
Script SQL para criação de tabelas do ARA dynamic no Asterisk 11.
View realtime.sql
CREATE DATABASE asterisk;
\c asterisk
CREATE TABLE extensions (
id serial,
context character varying(20) default '' NOT NULL,
exten character varying(20) default '' NOT NULL,
priority smallint default 0 NOT NULL,
app character varying(20) default '' NOT NULL,
@rodrigolang
rodrigolang / extensions_loginagi.conf
Last active Dec 11, 2015
Contexto para ligações por login e senha utilizando AGI.
View extensions_loginagi.conf
[verifica-login]
exten => _X.,1,Answer()
exten => _X.,2,Wait(1)
exten => _X.,3,Playback(digite-login)
exten => _X.,4,Read(Login,,4,,,)
exten => _X.,5,Playback(digite-senha)
exten => _X.,6,Read(Senha,,4,,,)
exten => _X.,7,AGI(login.agi,${Login},${Senha})
exten => _X.,8,GotoIf( $[ "${MENSAGEM}" == "failure" ]?desliga:continua)
exten => _X.,9(desliga),Playback(senha-errada)
@rodrigolang
rodrigolang / call_login.sql
Last active Dec 11, 2015
Script para criação da tabela no banco de dados PostgreSQL para o AGI de ligações por login e senha.
View call_login.sql
CREATE TABLE login_ast (
login_id SERIAL,
nome varchar(30) NOT NULL,
login integer NOT NULL,
senha integer NOT NULL,
contexto varchar(30) NOT NULL,
CONSTRAINT login_ast_pk PRIMARY KEY (nome, login, senha, contexto),
CONSTRAINT login_ast_idx UNIQUE (login)
);
@rodrigolang
rodrigolang / call_login.php
Last active Dec 11, 2015
AGI em php que verifica login e senha para completar uma chamada. Para Asterisk versões 1.4, 1.6 e 1.8.
View call_login.php
#!/usr/bin/php5 -q
<?php
require_once('/var/lib/asterisk/agi-bin/phpagi/phpagi.php');
set_time_limit(10);
$agi = new AGI();
$login = $argv[1];
$senha = $argv[2];
@rodrigolang
rodrigolang / extensions_login.ael
Last active Dec 10, 2015
Exemplo de ligações por login e senha utilizando o AstDB do Asterisk escrita em AEL.
View extensions_login.ael
context verifica-login {
_X. => {
Answer();
Wait(1);
Playback(digite-login);
Read(login,,4,,,);
Set(pass=${DB(Senha/${login})});
Authenticate(${pass},d);
Set(CDR(userfield)=${login});
goto ${login},${EXTEN},1;
@rodrigolang
rodrigolang / extensions_login.conf
Last active Dec 10, 2015
Exemplo de ligações por login e senha utilizando o AstDB do Asterisk.
View extensions_login.conf
[verifica-login]
exten => _X.,1,Answer()
exten => _X.,2,Wait(1)
exten => _X.,3,Playback(digite-login)
exten => _X.,4,Read(login,,4,,,)
exten => _X.,5,Set(pass=${DB(Senha/${login})})
exten => _X.,6,Authenticate(${pass},d)
exten => _X.,7,Set(CDR(userfield)=${login})
exten => _X.,8,Goto(${login},${EXTEN},1)
exten => _X.,9,Hangup()
@rodrigolang
rodrigolang / extensions_password.ael
Created Jan 10, 2013
Saída de ligações com senha para Asterisk, escrita em AEL.
View extensions_password.ael
context saida-de-ligacoes {
_X. => {
Answer();
Wait(1);
Set(Pass=${DB(Senha/${CALLERID(num)})});
Authenticate(${Pass},d);
Set(CDR(userfield)=${Pass});
Dial(...);
Hangup();
}
@rodrigolang
rodrigolang / extensions_password.conf
Created Jan 10, 2013
Saída de ligações com senha para Asterisk.
View extensions_password.conf
[saida-de-ligacoes]
exten => _X.,1,Answer()
exten => _X.,2,Wait(1)
exten => _X.,3,Set(Pass=${DB(Senha/${CALLERID(num)})})
exten => _X.,4,Authenticate(${Pass},d)
exten => _X.,5,Set(CDR(userfield)=${Pass})
exten => _X.,6,Dial(...)
exten => _X.,7,Hangup()
@rodrigolang
rodrigolang / extensions_followme.ael
Last active Jul 1, 2016
Exemplo de um contexto para desvio no Asterisk 1.6. Possuir três tipos de desvio: imediato, caso ocupado e tempo expirado, escrito em AEL.
View extensions_followme.ael
context desvios {
includes {
desvio-imediato;
desvio-ocupado;
desvio-timeout;
}
}
context desvio-imediato {
*50 => {
You can’t perform that action at this time.