Soporte & Consultoria
Soporte Remoto y Consultoria skype : ambiorixg12.
Nota no se brinda ningun tipo de consulta o soporte fuera del blog de forma gratuita
miércoles, 31 de diciembre de 2014
Llamar multiples numeros desde una base de dato
#!/bin/bash
mysql --silent -h localhost -u root -p198dd -D asterisk<<<'select dst from cdr where dst="100" limit 0,5' > tmp_results
while read dst
do
echo $dst
`asterisk -x "originate SIP/$dst extension 0@internal" `
done < tmp_results
root@asterisk-dominicana:~# ./db.sh
domingo, 28 de diciembre de 2014
Asterisk random caller id and rand function
Example1
exten => s,1,Set(junky=${RAND(1,8)});
- Sets junky to a random number between 1 and 8, inclusive.
Example2
if we had few caller ID number want to use it, try this:
[outbound]
exten => _886X.,1,Noop
same => n,Gosub(pickCallerIDnum,cell${RAND(1,5)},1)
same => n,Dial(SIP/${EXTEN}@gateway,32,gCX)
[pickCallerIDnum]
exten => cell1,1,Set(CALLERID(num)=09xxxxxxx1)
same => n,Return
exten => cell2,1,Set(CALLERID(num)=09xxxxxxx2)
same => n,Return
exten => cell3,1,Set(CALLERID(num)=09xxxxxxx3)
same => n,Return
exten => cell4,1,Set(CALLERID(num)=09xxxxxxx4)
same => n,Return
exten => cell5,1,Set(CALLERID(num)=09xxxxxxx5)
same => n,Return
Asterisk perment calling
#!/bin/bash
#$1=number of calls -1
#2 pause
#3 destination number
COUNTER=0
while [ $COUNTER -lt $1 ]; do
echo The counter is $COUNTER
sleep $2
asterisk -x "originate SIP/perment/9990000$3 extension 0@internal"
let COUNTER=COUNTER+1
done
root@asterisk-dominicana:~# ./while.sh 100 3 14795824808
dial plan
[internal]
exten=>0,1(music),Playback(/var/lib/asterisk/moh/macroform-cold_day)
same=>n,Goto(music)
--------------------------------------------------------------
Otras variantes mandandolo a un local channel para poder poner el caller ID
#!/bin/bash
#$1=number of calls -1
#2 pause
#3 destination number
COUNTER=0
while [ $COUNTER -lt $1 ]; do
echo The counter is $COUNTER
sleep $2
asterisk -x "originate Local/$3@perment extension 1701@radio"
let COUNTER=COUNTER+1
done
########################
EJEMPLO DEL ARHICOV calleridlist.conf del cual el script tomara los caller id
/root/calleridlist.conf
18007142585
18097142358
13052365874
################
DIAL PLAN
[perment]
;exten =>_x.,1,Gosub(pickCallerIDnum,cell${RAND(1,5)},1) ; ya no usare el gobsub para el caller id
exten=>_x.,1,Set(callid=${SHELL(shuf -n 1 /root/calleridlist.conf)}) ;tomar un caller id random de un archv
same=>n,Set(CALLERID(num)=${callid})
same=>n,Dial(SIP/99900${EXTEN}@perment,25)
same=>n,Hangup()
[pickCallerIDnum]
exten =>cell1,1,Set(CALLERID(num)=343444)
same => n,Return
exten => cell2,1,Set(CALLERID(num)=044552)
same => n,Return
exten => cell3,1,Set(CALLERID(num)=10573)
same => n,Return
exten => cell4,1,Set(CALLERID(num)=900094)
same => n,Return
exten => cell5,1,Set(CALLERID(num)=10995)
same => n,Return
[radio]
exten=>1701,1,Answer
same=>n,NoCDR()
same=>n,Set(CHANNEL(MUSICCLASS)=radio)
same=>n,MusicOnHold()
same=>n,Hangup
Luego corremos en consola
root@asterisk-dominicana:~# ./while.sh 5 5 18097143489
#$1=number of calls -1
#2 pause
#3 destination number
COUNTER=0
while [ $COUNTER -lt $1 ]; do
echo The counter is $COUNTER
sleep $2
asterisk -x "originate SIP/perment/9990000$3 extension 0@internal"
let COUNTER=COUNTER+1
done
root@asterisk-dominicana:~# ./while.sh 100 3 14795824808
dial plan
[internal]
exten=>0,1(music),Playback(/var/lib/asterisk/moh/macroform-cold_day)
same=>n,Goto(music)
--------------------------------------------------------------
Otras variantes mandandolo a un local channel para poder poner el caller ID
#!/bin/bash
#$1=number of calls -1
#2 pause
#3 destination number
COUNTER=0
while [ $COUNTER -lt $1 ]; do
echo The counter is $COUNTER
sleep $2
asterisk -x "originate Local/$3@perment extension 1701@radio"
let COUNTER=COUNTER+1
done
########################
EJEMPLO DEL ARHICOV calleridlist.conf del cual el script tomara los caller id
/root/calleridlist.conf
18007142585
18097142358
13052365874
################
DIAL PLAN
[perment]
;exten =>_x.,1,Gosub(pickCallerIDnum,cell${RAND(1,5)},1) ; ya no usare el gobsub para el caller id
exten=>_x.,1,Set(callid=${SHELL(shuf -n 1 /root/calleridlist.conf)}) ;tomar un caller id random de un archv
same=>n,Set(CALLERID(num)=${callid})
same=>n,Dial(SIP/99900${EXTEN}@perment,25)
same=>n,Hangup()
[pickCallerIDnum]
exten =>cell1,1,Set(CALLERID(num)=343444)
same => n,Return
exten => cell2,1,Set(CALLERID(num)=044552)
same => n,Return
exten => cell3,1,Set(CALLERID(num)=10573)
same => n,Return
exten => cell4,1,Set(CALLERID(num)=900094)
same => n,Return
exten => cell5,1,Set(CALLERID(num)=10995)
same => n,Return
[radio]
exten=>1701,1,Answer
same=>n,NoCDR()
same=>n,Set(CHANNEL(MUSICCLASS)=radio)
same=>n,MusicOnHold()
same=>n,Hangup
Luego corremos en consola
root@asterisk-dominicana:~# ./while.sh 5 5 18097143489
jueves, 25 de diciembre de 2014
Asterisk Backgroun Music a during a call
[internal]
exten=>0,1,Hangup()
exten=>0,2(music),Playback(/var/lib/asterisk/moh/macroform-cold_day)
same=>n,Goto(music)
[spy-exten]
exten =>_1923,1,Dial(Local/1924@spy-exten,30,G(internal^0^1))
exten=>_1924,1,ChanSpy(SIP/100,B)
exten=>0,1,Hangup()
exten=>0,2(music),Playback(/var/lib/asterisk/moh/macroform-cold_day)
same=>n,Goto(music)
[spy-exten]
exten =>_1923,1,Dial(Local/1924@spy-exten,30,G(internal^0^1))
exten=>_1924,1,ChanSpy(SIP/100,B)
Remote Party ID
Overview
In SIP, the Remote Party ID header field enables popular services as well as some regulatory and public safety requirements.
These services include the following:
• calling identity delivery
• calling identity delivery blocking
• tracing originator of call
jueves, 18 de diciembre de 2014
Sistema de Grabacion de mensaje y envio de mensaje por correo.
[recording]
exten=>s,1,Verbose(recording calls from the caller ${CALLERID(num)} )
same=>n,Set(FECHA=${STRFTIME(${EPOCH},,%Y-%m-%d_%H-%M-%S)}_${CALLERID(num)})
same=>n,Playback(beep)
same=>n,MixMonitor(/var/www/${FECHA}.wav)
same=>n,Set(TIMEOUT(absolute)=90)
same=>n,Wait(90)
exten=>h,1,System(/usr/bin/mpack -s "Asterisk Dominicana ${FECHA}" /var/www/${FECHA}.wav ambiorixg12@hotmail.com,ambiorixg12@gmail.com)
miércoles, 10 de diciembre de 2014
Restringir una extension a solo hacer llamadas internas en Elastix
Creamos un contexto personalizado en extension_custom.conf
[restringido]
include => ext-local
Luego agregamos la extension a dicho contexto y listo.
[restringido]
include => ext-local
Luego agregamos la extension a dicho contexto y listo.
sábado, 6 de diciembre de 2014
VoIP Codec: Payload size
Every encoded packet that is sent incurs fixed bandwidth overheads (due to IP and other headers added to the data in the network). Thus, larger payloads incur a proportionately smaller overhead, thus reducing the nominal bandwidth utilisation. However, by using larger payloads, more audio (ie., a longer period of time) is required to construct a single packet, which in turn increases the amount of time it takes for even the beginning of the packet to reach the other end and be decoded, thus increasing the lag in the conversation. This is a typical trade-off in VoIP.
Most codecs use payload sizes rage from 10 to 40 milliseconds per packet. Default payload and bandwidth consumption by different codecs:
http://www.voip-sip.org/voip-codec-payload-bandwidth-required/
jueves, 4 de diciembre de 2014
Sistema de IVR PHP & Asterisk
;IVR
[ivr]
exten=>s,1,Set(GLOBAL(LOOPCOUNT)=1)
same=>n,verbose(value of ${LOOPCOUNT})
;same=>n,verbose(value of ${LOOPCOUNT})
same=>n,Answer()
same=>n,Background(/var/lib/asterisk/sounds/custom/6)
same=>n,Waitexten(2)
exten =>i,1,Set(CALLERID(num)=${var1})
exten=>i,2,Dial(SIP/${advnumber}@comk,15)
same=>n,Hangup()
exten =>1,1,Set(CALLERID(num)=${var1})
exten=>1,2,Dial(SIP/${advnumber}@comk,15)
same>n,Hangup()
;exten=>h,1,System(/bin/echo "this is the ${advnumber} with the ${DIALSTATUS}">/home/postback.conf)
exten=>h,1,System(curl http://obamacare-guide.org/obm-api/obm-api.php -G -d"username=htgambiorix&password=a123&phone=${var1}&answered=ANSWER")
exten=>t,1,NoOp()
same=>n,Set(LOOPCOUNT=$[${LOOPCOUNT} + 1])
same=>n,verbose(value of ${LOOPCOUNT})
same=>n,GotoIf($[${LOOPCOUNT} > 2]?hangup,hang,1)
same=>n,Goto(ivr,s,1)
#################################################################
PHP
<?php
$pbx="localhost";
$pbx="localhost";
$trunk="comk";
$src=$_GET[phone];
$dest=$_GET[advnumber];
$extension=array($src); //numeros a llamar si vamos a usar extensions internas debemos remover la variable trunk en la linea Channel: SIP/$value@$trunk
foreach ($extension as $value){
$socket = fsockopen($pbx,"5038", $errno, $errstr, $timeout);
fputs($socket, "Action: Login\r\n");
fputs($socket, "UserName: admin\r\n"); //
fputs($socket, "Secret: am56\r\n\r\n"); //
//
$wrets=fgets($socket,128);
echo $wrets;
fputs($socket, "Action: Originate\r\n" );
fputs($socket, "Channel: SIP/$trunk/$value\r\n" );
#fputs($socket, "Channel: SIP/100\r\n" );
fputs($socket, "Exten: s\r\n" );
fputs($socket, "Context: ivr\r\n" );
fputs($socket, "Priority: 1\r\n" );
fputs($socket, "CallerID: $dest\r\n" );
fputs($socket, "Variable: __var1=$src\r\n" );
fputs($socket, "Variable: __advnumber=$dest\r\n" );
fputs($socket, "Async: yes\r\n\r\n" );
fputs($socket, "Action: Logoff\r\n\r\n");
sleep (1);
$wrets=fgets($socket,128);
}
?>
[ivr]
exten=>s,1,Set(GLOBAL(LOOPCOUNT)=1)
same=>n,verbose(value of ${LOOPCOUNT})
;same=>n,verbose(value of ${LOOPCOUNT})
same=>n,Answer()
same=>n,Background(/var/lib/asterisk/sounds/custom/6)
same=>n,Waitexten(2)
exten =>i,1,Set(CALLERID(num)=${var1})
exten=>i,2,Dial(SIP/${advnumber}@comk,15)
same=>n,Hangup()
exten =>1,1,Set(CALLERID(num)=${var1})
exten=>1,2,Dial(SIP/${advnumber}@comk,15)
same>n,Hangup()
;exten=>h,1,System(/bin/echo "this is the ${advnumber} with the ${DIALSTATUS}">/home/postback.conf)
exten=>h,1,System(curl http://obamacare-guide.org/obm-api/obm-api.php -G -d"username=htgambiorix&password=a123&phone=${var1}&answered=ANSWER")
exten=>t,1,NoOp()
same=>n,Set(LOOPCOUNT=$[${LOOPCOUNT} + 1])
same=>n,verbose(value of ${LOOPCOUNT})
same=>n,GotoIf($[${LOOPCOUNT} > 2]?hangup,hang,1)
same=>n,Goto(ivr,s,1)
#################################################################
PHP
<?php
$pbx="localhost";
$pbx="localhost";
$trunk="comk";
$src=$_GET[phone];
$dest=$_GET[advnumber];
$extension=array($src); //numeros a llamar si vamos a usar extensions internas debemos remover la variable trunk en la linea Channel: SIP/$value@$trunk
foreach ($extension as $value){
$socket = fsockopen($pbx,"5038", $errno, $errstr, $timeout);
fputs($socket, "Action: Login\r\n");
fputs($socket, "UserName: admin\r\n"); //
fputs($socket, "Secret: am56\r\n\r\n"); //
//
$wrets=fgets($socket,128);
echo $wrets;
fputs($socket, "Action: Originate\r\n" );
fputs($socket, "Channel: SIP/$trunk/$value\r\n" );
#fputs($socket, "Channel: SIP/100\r\n" );
fputs($socket, "Exten: s\r\n" );
fputs($socket, "Context: ivr\r\n" );
fputs($socket, "Priority: 1\r\n" );
fputs($socket, "CallerID: $dest\r\n" );
fputs($socket, "Variable: __var1=$src\r\n" );
fputs($socket, "Variable: __advnumber=$dest\r\n" );
fputs($socket, "Async: yes\r\n\r\n" );
fputs($socket, "Action: Logoff\r\n\r\n");
sleep (1);
$wrets=fgets($socket,128);
}
?>
Suscribirse a:
Entradas (Atom)