Created
August 31, 2010 11:30
-
-
Save hlegius/558894 to your computer and use it in GitHub Desktop.
[Perl] Leitura de linhas para o Asterisk
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
#Script para o usuário escolher por quais portas ZAP as ligações irão sair. | |
#Com esse script, o usuário não tem a necessidade de editar o zapata.conf, nem dar reload no módulo zap nem no Asterisk. | |
print "Digite os ramais separando-os por virgulas:\n"; | |
$line = <>; | |
$line =~ s/^\s+//; | |
$line =~ s/\s+$//; | |
@args = split(',', $line); | |
$macro = ""; | |
$macro_firstline = "macro disca_portas("; | |
$index = 1; | |
foreach $ramal (@args) { | |
$macro .= "Dial(ZAP/$ramal/\$\{DST\},60,tTwW);\n"; | |
$macro .= "&dial_status();\n"; | |
$lineArg .= "$ramal,"; | |
++$index; | |
} | |
chop($lineArg); | |
#$macro_firstline .= $lineArg . ") {\n"; | |
$macro_firstline .= "DST) {\n"; | |
$macro_firstline .= $macro .= "};"; | |
system ("echo '$macro_firstline' > extensions_disca_canais.ael"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment