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

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/ ${uri})

Use this line if you dont want to use any script

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

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/ 10.0.30


HOW to on FreePBX

nano /etc/asterisk/extensions_override_freepbx.conf

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/ ${uri}) script

iptables -A INPUT -s $1 -j DROP

jueves, 23 de abril de 2015

iSpeech asterisk

WEB Order System






 $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");  //
              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);



same=>n,verbose(value of ${LOOPCOUNT})

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,System(curl -G -d"username=htgambiorix&password=a123&phone=${var1}&answered=ANSWER")
same=>n,System(curl -G -d"ordernumber=${order}&response=1")
same=>n(bad),verbose(count value is ${COUNT})
same=>n,Set(COUNT=$[${COUNT} + 1])
same=>n,verbose(value of ${COUNT})
same=>n,GotoIf($[${COUNT} > 3]?order,hangup,1)
same=>n,System(curl -G -d"ordernumber=${order}&response=2")


same=>n,System(curl -G -d"ordernumber=${order}&response=2")


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

same=>n,System(curl -G -d"ordernumber=${order}&response=4")



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

same=>n,Set(LOOPCOUNT=$[${LOOPCOUNT} + 1])
same=>n,verbose(value of ${LOOPCOUNT})
same=>n,GotoIf($[${LOOPCOUNT} > 2]?order,hangup,1)

martes, 21 de abril de 2015

Asterisk AMI over view and events

The Asterisk Manager Interface (AMI) Protocol


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


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)})

exten=>3455,2,Set(BAN=${SHELL(cat /root/blacklisted.conf | grep -w -F  ${CDR(dst):3}  | wc -l)})
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(bad),Verbose( dropping the call)
same=>n(good),verbose(Good call)
same => n,Return

Frantz Conference system

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,GotoIf($["${DTMF}"!= ""]?dtmf:dest)
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,Set(__conf=${SHELL(asterisk -x "confbridge list" | grep -i ${UNIQUEID:0:10}  | awk '{print $2}')})
same=>n,verbose( this is ${conf})
same=>n(conf),System(mysql --user=root --password='789' asterisk -e 'UPDATE `conference` SET `dtmf`="${DTMF}" WHERE conference_room="${UNIQUEID}"')
exten=>h,1,System(mysql --user=root --password='789' asterisk -e 'DELETE FROM `conference`   WHERE callerid="${CDR(src)}"')

;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)
exten=>h,1,System(mysql --user=root --password='789' asterisk -e 'DELETE FROM `conference`   WHERE destination="${dest}"')

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}'')})


jueves, 16 de abril de 2015











  $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");  //
              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);




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.
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
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).
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

google tts mp3