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, 29 de abril de 2015

Bloqueando direcion IP de llamadas no deseadas



[default]
exten => _X.,1,Noop(Dead calls rising)
exten => _X.,n,Set(uri=${CHANNEL(peerip)})
exten => _X.,n,Verbose(3,Unknown call from ${uri} to ${EXTEN})
exten => _X.,n,System(/root/block.sh ${uri})


Use this line if you dont want to use any script

same=>n,System(/sbin/iptables -A INPUT -s ${CHANNEL(peerip)} -j DROP)



#######block.sh script

#!/bin/bash
iptables -A INPUT -s $1 -j DROP
/etc/init.d/iptables-persistent save
/etc/init.d/iptables-persistent reload
#apt-get install iptables-persistent



#######
/root/block.sh 10.0.30




#######################

HOW to on FreePBX

nano /etc/asterisk/extensions_override_freepbx.conf


[from-sip-external]
exten => _X.,1,Noop(Dead calls rising)
exten => _X.,n,Set(uri=${CHANNEL(peerip)})
exten => _X.,n,Verbose(3,Unknown call from ${uri} to ${EXTEN})
exten => _X.,n,System(/var/log/asterisk/block.sh ${uri})



#######block.sh script

#!/bin/bash
iptables -A INPUT -s $1 -j DROP

jueves, 23 de abril de 2015

iSpeech asterisk

http://zaf.github.io/asterisk-ispeech/
https://github.com/zaf/asterisk-ispeech

WEB Order System

http://65.11.11.20/edc/webcall.php?dest=18097143489&cid=18007142020&code=4563&ordernumber=12345678

///////////

<?php



$pbx="localhost";

$trunk="cpeak";

$dest=$_GET[dest];
$cid=$_GET[cid];
$code=$_GET[code];
$order=$_GET[ordernumber];



 $socket = fsockopen($pbx,"5038", $errno, $errstr, $timeout);
 fputs($socket, "Action: Login\r\n");
 fputs($socket, "UserName: admin\r\n");     //
 fputs($socket, "Secret: passr456\r\n\r\n");  //
                                            //
              $wrets=fgets($socket,128);
              echo $wrets;
              fputs($socket, "Action: Originate\r\n" );
               fputs($socket, "Channel: SIP/$trunk/$dest\r\n" );
                #fputs($socket, "Channel: SIP/100\r\n" );
                fputs($socket, "Exten: s\r\n" );
               fputs($socket, "Context: order\r\n" );
               fputs($socket, "Priority: 1\r\n" );
               fputs($socket, "CallerID: $cid\r\n" );
                fputs($socket, "Variable: __code=$code\r\n" );
              fputs($socket, "Variable: __order=$order\r\n" );
              fputs($socket, "Async: yes\r\n\r\n" );
              fputs($socket, "Action: Logoff\r\n\r\n");
 sleep (1);
 $wrets=fgets($socket,128);


?>


/////////////



[order]
exten=>_x.,1,Goto(order,s,1)
exten=>s,1,Set(GLOBAL(LOOPCOUNT)=1)
same=>n,verbose(value of ${LOOPCOUNT})
same=>n,Answer()
same=>n,Playback(/var/lib/asterisk/sounds/edc/greeting)
same=>n,Saydigits(${order})
same=>n,Background(/var/lib/asterisk/sounds/edc/options)
same=>n,Waitexten(2)


;;;;1
exten =>1,1,Set(GLOBAL(COUNT)=1)
exten =>1,2(read),Read(confirm,/var/lib/asterisk/sounds/edc/code,4,,3,2)
same=>n,GotoIf($["${confirm}"!= "${code}"]?bad)
same=>n,Playback(/var/lib/asterisk/sounds/edc/confirmed)
;same=>n,System(curl http://obamacare-guide.org/obm-api/obm-api.php -G -d"username=htgambiorix&password=a123&phone=${var1}&answered=ANSWER")
same=>n,System(curl https://www.edcmeals.com/voip/confirmation.tpl -G -d"ordernumber=${order}&response=1")
same=>n,Hangup()
same=>n(bad),verbose(count value is ${COUNT})
same=>n,Playback(/var/lib/asterisk/sounds/edc/invalid)
same=>n,Set(COUNT=$[${COUNT} + 1])
same=>n,verbose(value of ${COUNT})
same=>n,GotoIf($[${COUNT} > 3]?order,hangup,1)
same=>n,Goto(read)
exten=>hangup,1,Playback(/var/lib/asterisk/sounds/edc/cb5)
same=>n,System(curl https://www.edcmeals.com/voip/confirmation.tpl -G -d"ordernumber=${order}&response=2")

same>n,Hangup()


;;;;2
exten=>2,1,Playback(/var/lib/asterisk/sounds/edc/tcb5)
same=>n,System(curl https://www.edcmeals.com/voip/confirmation.tpl -G -d"ordernumber=${order}&response=2")

same=>n,Hangup()


;;3
exten =>3,1,Goto(order,s,1)

;;4
exten=>4,1,Playback(/var/lib/asterisk/sounds/edc/tcb5)
same=>n,System(curl https://www.edcmeals.com/voip/confirmation.tpl -G -d"ordernumber=${order}&response=4")

same=>n,Hangup()


;;5
exten=>5,1,Dial(SIP/18097143489@cpeak)
same=>n,Hangup()


;;;invalid
exten =>i,1,Goto(order,s,1)


;;;;timeout
exten=>t,1,NoOp()
same=>n,Set(LOOPCOUNT=$[${LOOPCOUNT} + 1])
same=>n,verbose(value of ${LOOPCOUNT})
same=>n,GotoIf($[${LOOPCOUNT} > 2]?order,hangup,1)
same=>n,Goto(order,s,1)

martes, 21 de abril de 2015

Asterisk AMI over view and events

The Asterisk Manager Interface (AMI) Protocol

Introduction

The Asterisk Manager Interface (AMI) protocol is a very simple protocol that allows you to communicate and manage your asterisk server, almost completely. It has support to edit/create asterisk configuration files and also manage the calls, clients, agents, dialplan, etc.
You might also be interested in PAMI. An AMI client/framework that allows you to quickly develop ami clients in an oop/event-driven fashion.

Overview of the AMI Protocol

AMI is a plain text protocol, and it works by sending and receiving packets. Each packet consists in a series of text lines delimited by \r\n. And each packet is delimited by \r\n\r\n. AMI uses a tcp port configured in manager.conf. As soon as the connection is established, asterisk salutes you with something like:


viernes, 17 de abril de 2015

Marlon Filter System


[special]

exten => _444592.,1,Gosub(filter,3455,1)
exten => _444592.,2,Dial(IAX2/sb32/${EXTEN}@Guyana_IN)

exten => _175592.,1,Gosub(filter,3455,1)
exten => _175592.,2,Dial(IAX2/sb32/${EXTEN}@Guyana_IN)


exten => _732592.,1,Gosub(filter,3455,1)

exten => _732592.,2,Dial(IAX2/hp/${EXTEN}@Guyana_IN)


exten => _753592.,1,Gosub(filter,3455,1)
exten => _753592.,2,Dial(IAX2/raspberry-pi1/${EXTEN}@Guyana_IN)


exten => _764592.,1,Gosub(filter,3455,1)
exten => _764592.,2,Dial(IAX2/hp/${EXTEN}@Guyana_IN)


exten=>h,1,ExecIf($[${CDR(duration)}<20]?System(echo ${CDR(duration)}  ${CDR(dst):3}  ${CALLERID(num)} ${STRFTIME(${EPOCH},,%C%y%m%d%H%M%S)} >>/root/badcalls.conf))
exten=>h,2,ExecIf($[${CDR(duration)}>=30]?System(echo  ${CDR(dst):3}   >>/root/goodcalls.conf))
exten=>h,3,Verbose( call duration ${CDR(duration)})



[filter]
exten=>3455,1,Noop()
exten=>3455,2,Set(BAN=${SHELL(cat /root/blacklisted.conf | grep -w -F  ${CDR(dst):3}  | wc -l)})
same=>n,GotoIf($[${BAN}>0]?bad)
exten=>3455,3,Set(RESULT=${SHELL(cat /root/badcalls.conf | grep -w -F  ${CDR(dst):3}  | wc -l)})
same=>n,verbose( this is the  ${RESULT})
same=>n,GotoIf($[${RESULT}>2]?bad:good)
same=>n(bad),Verbose( dropping the call)
same=>n,Hangup()
same=>n(good),verbose(Good call)
same => n,Return

Frantz Conference system

[default]
exten=>_x.,1,Set(__dest=${CALLERID(num)})
exten=>_x.,2,Gosub(finder,s,1)
exten=>_x.,3(insert),System(mysql --user=root --password='789' asterisk -e 'INSERT INTO `conference`(`conference_id` , `callerid` , `destination` , `conference_room` ,`date`,`dtmf`)VALUES (NULL ,"${CALLE$
;same=>n,Set(${CALLERID(num)}=${CALLERID(num)})
same=>n,Answer()
same=>n,read(DTMF,/var/lib/asterisk/sounds/en/silence/2)
same=>n,GotoIf($["${DTMF}"!= ""]?dtmf:dest)
same=>n(dtmf),Dial(SIP/${DTMF}@208.78.160.195:7654,2)
same=>n,Wait(30)
same=>n,Set(__conf=${SHELL(asterisk -x "confbridge list" | grep -i  ${UNIQUEID:0:10} | awk '{print $2}')})
same=>n,verbose( this is ${conf})
same=>n,Dial(SIP/2225${DTMF}@208.78.160.48:5060,10)
same=>n,Goto(conf)
same=>n(dest),Dial(SIP/${CDR(dst)}@208.78.160.195:7654,2)
same=>n,Wait(30)
same=>n,Set(__conf=${SHELL(asterisk -x "confbridge list" | grep -i ${UNIQUEID:0:10}  | awk '{print $2}')})
same=>n,verbose( this is ${conf})
same=>n,Dial(SIP/2225${CDR(dst)}@208.78.160.48:5060,10)
same=>n(conf),System(mysql --user=root --password='789' asterisk -e 'UPDATE `conference` SET `dtmf`="${DTMF}" WHERE conference_room="${UNIQUEID}"')
same=>n,ConfBridge(${UNIQUEID:0:10})
exten=>h,1,System(mysql --user=root --password='789' asterisk -e 'DELETE FROM `conference`   WHERE callerid="${CDR(src)}"')


[finder]
;exten=>s,1,Set(__match=${SHELL(mysql --user=root --password='789' --skip-column-names  asterisk -e 'select conference_room  from conference where destination="${dest}"or dtmf="${dest}" limit 0,1 ')})
exten=>s,1,Set(__match=${SHELL(mysql --user=root --password='789' --skip-column-names  asterisk -e 'select conference_room  from conference where right(destination,5)="${dest:-5}"or right(dtmf,5)="${dest$
same=>n,verbose( this is ${match} ${dest})
same=>n,GotoIf($["${match}"= ""]?default,_x.,3)
same=>n(bridge),ConfBridge(${match:0:10})
same=>n,hangup()
exten=>h,1,System(mysql --user=root --password='789' asterisk -e 'DELETE FROM `conference`   WHERE destination="${dest}"')



[match]
exten=>099,1,Set(__match=${SHELL(mysql --user=root --password='789' --skip-column-names  asterisk -e 'select confence_room  from conference where destination='${CALLERID(num)}' or dmtf='${CALLERID(num)}'$
;same=>n,Set(message=${SHELL(mysql --user=root --password='789' --skip-column-names  asterisk -e 'select message  from dialer where telephone='${EXTEN}'')})
same=>n,Return()


[uri]
exten=>_33.,1,Dial(SIP/16465104856@208.78.160.195:7654,10)






jueves, 16 de abril de 2015

AMI ORIGINATE PHP

<?php

$pbx="localhost";

$pbx="localhost";

$trunk="cpeak";

$src=$_GET[src];

$dest=$_GET[dest];


$callerid=$_GET[cid];

$message=$_GET[code];





////////////////////////////////////////////////////

  $socket = fsockopen($pbx,"5038", $errno, $errstr, $timeout);
 fputs($socket, "Action: Login\r\n");
 fputs($socket, "UserName: admin\r\n");     //
 fputs($socket, "Secret: 1234\r\n\r\n");  //
                                            //
              $wrets=fgets($socket,128);
              echo $wrets;
              fputs($socket, "Action: Originate\r\n" );
               fputs($socket, "Channel: SIP/$trunk/$dest\r\n" );
                fputs($socket, "Application: Saydigits\r\n" );
               fputs($socket, "Data: $message\r\n" );
              fputs($socket, "CallerID: $callerid\r\n" );
                fputs($socket, "Variable: __var1=$src\r\n" );
              fputs($socket, "Variable: __var2=$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);


//////////////////////////////////////////////

?>


/

http://165.11.118.32/webcall.php?dest=01161285411381&cid=18007142020&code=4563









lunes, 6 de abril de 2015

Special Dialplan Extensions


Special Asterisk Dialplan Extensions

Here we'll list all of the special built-in dialplan extensions and their usage.
Icon
Other than special extensions, there is a special context "default" that is used when either a) an extension context is deleted while an extension is in use, or b) a specific starting extension handler has not been defined (unless overridden by the low level channel interface).

a: Assistant extension

This extension is similar to the o extension, only it gets triggered when the caller presses the asterisk (*) key while recording a voice mail message. This is typically used to reach an assistant.

e: Exception Catchall extension

This extension will substitute as a catchall for any of the 'i', 't', or 'T' extensions, if any of them do not exist and catching the error in a single routine is desired. The function EXCEPTION may be used to query the type of exception or the location where it occurred.

h: Hangup extension

When a call is hung up, Asterisk executes the h extension in the current context. This is typically used for some sort of clean-up after a call has been completed.

i: Invalid entry extension

If Asterisk can't find an extension in the current context that matches the digits dialed during the Background() or WaitExten() applications, it will send the call to the i extension. You can then handle the call however you see fit.

o: Operator extension

If a caller presses the zero key on their phone keypad while recording a voice mail message, and the o extension exists, the caller will be redirected to the o extension. This is typically used so that the caller can press zero to reach an operator.

s: Start extension

When an analog call comes into Asterisk, the call is sent to the s extension. The s extension is also used in macros.
Please note that the s extension is not a catch-all extension. It's simply the location that analog calls and macros begin. In our example above, it simply makes a convenient extension to use that can't be easily dialed from the Background() and WaitExten() applications.

t: Response timeout extension

When the caller waits too long before entering a response to the Background() or WaitExten() applications, and there are no more priorities in the current extension, the call is sent to the t extension.

T: Absolute timeout extension

Background and WaitExten Applications

The Background() application plays a sound prompt, but listens for DTMF input. Asterisk then tries to find an extension in the current dialplan context that matches the DTMF input. If it finds a matching extension, Asterisk will send the call to that extension.
The Background() application takes the name of the sound prompt as the first parameter just like the Playback() application, so remember not to include the file extension.
Multiple Prompts
Icon
If you have multiple prompts you'd like to play during the Background() application, simply concatenate them together with the ampersand (&) character, like this:
exten => 6123,1,Background(prompt1&prompt2&prompt3)
One problems you may encounter with the Background() application is that you may want Asterisk to wait a few more seconds after playing the sound prompt. In order to do this, you can call the WaitExten() application. You'll usually see the WaitExten() application called immediately after the Background() application. The first parameter to the WaitExten() application is the number of seconds to wait for the caller to enter an extension. If you don't supply the first parameter, Asterisk will use the built-in response timeout (which can be modified with the TIMEOUT() dialplan function).
[auto_attendant]
exten => start,1,Verbose(2,Incoming call from ${CALLERID(all)})
   same => n,Playback(silence/1)
   same => n,Background(prompt1&prompt2&prompt3)
   same => n,WaitExten(10)
   same => n,Goto(timeout-handler,1)
 
exten => timeout-handler,1)
   same => n,Dial(${GLOBAL(OPERATOR)},30)
   same => n,Voicemail(operator@default,${IF($[${DIALSTATUS} = BUSY]?b:u)})
   same => n,Hangup()


Background and WaitExten Applications

AGI Script on inbound call Vicidial

Yes you can set that up. Just change this:

exten => _X.,1,AGI(agi-DID_route.agi)


to this:

exten => _X.,1,AGI(agi-new.agi)
exten => _X.,n,AGI(agi-DID_route.agi)


in the [trunkinbound] context in extensions.conf, and have the DID route normally from there
http://www.vicidial.org/VICIDIALforum/viewtopic.php?f=4&t=34235

tts to mp3

https://ttsmp3.com/
https://www.texttospeechfree.com/
https://www.text2speech.org/
http://soundoftext.com/
http://ctrlq.org/listen/
http://www.texttomp3.online/

increase mp3  volume  https://www.mp3louder.com/