curl -X POST 'https://api.twilio.com/2010-04-01/Accounts/AC4cd51364f73a254df228050e9788f90c1a/Messages.json' \
> --data-urlencode 'To=18097143489' \
> --data-urlencode 'From=+18779990230' \
> --data-urlencode 'Body=Just testing curl' \
> -u AC4cd51364f73a254df228050e9788f90c:c63c01506d9dd94b788a170b3208f11f
{"sid": "SM41aabac2c3934a5fbcf7446626d4dcf5", "date_created": "Wed, 16 Nov 2016 07:55:22 +0000", "date_updated": "Wed, 16 Nov 2016 07:55:22 +0000", "date_sent": null, "account_sid": "AC4cd51364f73a254df228050e9788f90c", "to": "+18097143489", "from": "+18779990230", "messaging_service_sid": null, "body": "Just testing curl", "status": "queued", "num_segments": "1", "num_media": "0", "direction": "outbound-api", "api_version": "2010-04-01", "price": null, "price_unit": "USD", "error_code": null, "error_message": null, "uri": "/2010-04-01/Accounts/AC4cd51364f73a254df228050e9788f90c/Messages/SM41aabac2c3934a5fbcf7446626d4dcf5.json", "subresource_uris": {"media": "/2010-04-01/Accounts/AC4cd51364f73a254df228050e9788f90c/Messages/SM41aabac2c3934a5fbcf7446626d4dcf5/Media.json"}}
https://www.twilio.com/console/dev-tools/api-explorer/sms/sms-mms-create
Soporte & Consultoria
Soporte Remoto y Consultoria skype : ambiorixg12.
Nota no se brinda ningun tipo de consulta o soporte fuera del blog de forma gratuita
martes, 15 de noviembre de 2016
getting twilio message properties
<?php
// Get the PHP helper library from twilio.com/docs/php/install
require_once './twilio-php-master/Twilio/autoload.php'; // Loads the library
use Twilio\Rest\Client;
// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "AC4cd51364f734dtt4df228050e9788f90c";
$token = "c63c01506d9dd94b5sww788a170b3208f11f";
$client = new Client($sid, $token);
// Loop over the list of smss and echo a property for each one
foreach ($client->messages->read() as $sms) {
echo $sms->to." ".$sms->status." ".$sms->sid."\n";
$sms = $client
->messages($sms->sid)
->fetch();
echo $sms->body."\n";
}
?>
php list-all.php
+18097143489 delivered SM1281e9eee50644038d2d2e4969b931a8
Testing mms
+18097143489 delivered MM4fe9abd1cee742fda7657db7e434764b
Testing mms
http://m.twil.io/dShvo7J
+18097143489 delivered MMa323f084842142afad38a6b85949f10a
Testing mms
http://m.twil.io/3JuxmXv
+14012196176 delivered SMd2f5c77178ae46a1be9e0eabb1305860
We Love Twilo
+18097143489 delivered SM77720d7889ae442b94a3b697b576417f
I love twilio!
+18097143489 delivered SM1c8aa8d76d2d4c648003bf8a367100a0
I
+18097143489 delivered SM90e23c23c0424a00abca30473876cf80
Hey testing Twilio sms service!
+18097143489 delivered SMbbc077ff378f49ad8eed166237d28eeb
Hey Jenny! Good luck on the bar exam!
// Get the PHP helper library from twilio.com/docs/php/install
require_once './twilio-php-master/Twilio/autoload.php'; // Loads the library
use Twilio\Rest\Client;
// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "AC4cd51364f734dtt4df228050e9788f90c";
$token = "c63c01506d9dd94b5sww788a170b3208f11f";
$client = new Client($sid, $token);
// Loop over the list of smss and echo a property for each one
foreach ($client->messages->read() as $sms) {
echo $sms->to." ".$sms->status." ".$sms->sid."\n";
$sms = $client
->messages($sms->sid)
->fetch();
echo $sms->body."\n";
}
?>
php list-all.php
+18097143489 delivered SM1281e9eee50644038d2d2e4969b931a8
Testing mms
+18097143489 delivered MM4fe9abd1cee742fda7657db7e434764b
Testing mms
http://m.twil.io/dShvo7J
+18097143489 delivered MMa323f084842142afad38a6b85949f10a
Testing mms
http://m.twil.io/3JuxmXv
+14012196176 delivered SMd2f5c77178ae46a1be9e0eabb1305860
We Love Twilo
+18097143489 delivered SM77720d7889ae442b94a3b697b576417f
I love twilio!
+18097143489 delivered SM1c8aa8d76d2d4c648003bf8a367100a0
I
+18097143489 delivered SM90e23c23c0424a00abca30473876cf80
Hey testing Twilio sms service!
+18097143489 delivered SMbbc077ff378f49ad8eed166237d28eeb
Hey Jenny! Good luck on the bar exam!
domingo, 13 de noviembre de 2016
Twilio sms
<?php
// Require the bundled autoload file - the path may need to change
// based on where you downloaded and unzipped the SDK
require __DIR__ . '/twilio-php-master/Twilio/autoload.php';
// Use the REST API Client to make requests to the Twilio REST API
use Twilio\Rest\Client;
// Your Account SID and Auth Token from twilio.com/console
$sid = 'AC4cd51364f73aw154df228050ex2933';
$token = 'c63c01506d9ddxw4b788a17ssxd11f';
$client = new Client($sid, $token);
// Use the client to do fun stuff like send text messages!
$client->messages->create(
// the number you'd like to send the message to
"+$argv[1]",
array(
// A Twilio phone number you purchased at twilio.com/console
"from" => "+14017953076 ",
// the body of the text message you'd like to send
'body' => "$argv[2]"
)
);
//https://www.twilio.com/docs/libraries/php
?>
1) wget https://github.com/twilio/twilio-php/archive/master.zip
https://www.twilio.com/docs/api/rest/sending-messages
// Require the bundled autoload file - the path may need to change
// based on where you downloaded and unzipped the SDK
require __DIR__ . '/twilio-php-master/Twilio/autoload.php';
// Use the REST API Client to make requests to the Twilio REST API
use Twilio\Rest\Client;
// Your Account SID and Auth Token from twilio.com/console
$sid = 'AC4cd51364f73aw154df228050ex2933';
$token = 'c63c01506d9ddxw4b788a17ssxd11f';
$client = new Client($sid, $token);
// Use the client to do fun stuff like send text messages!
$client->messages->create(
// the number you'd like to send the message to
"+$argv[1]",
array(
// A Twilio phone number you purchased at twilio.com/console
"from" => "+14017953076 ",
// the body of the text message you'd like to send
'body' => "$argv[2]"
)
);
//https://www.twilio.com/docs/libraries/php
?>
1) wget https://github.com/twilio/twilio-php/archive/master.zip
2)unzip mas*
3)cat ./twilio-php-master/Twilio/autoload.php
php sms.php 18097143423 'I love twilio!'
https://www.twilio.com/docs/libraries/php
https://www.twilio.com/docs/quickstart/php/sms/sending-via-rest#sending-mms-via-rest
https://support.twilio.com/hc/en-us/articles/223181808-Restricted-SMS-message-types-using-Twilio
https://support.twilio.com/hc/en-us/articles/223133967-Changing-the-sender-ID-for-sending-SMS-messages
https://support.twilio.com/hc/en-us/articles/223181348-Getting-started-with-Alphanumeric-Sender-ID
https://www.twilio.com/docs/api/twiml/sms/your_response
https://www.twilio.com/docs/api/rest/sms
https://www.twilio.com/docs/libraries/php
https://www.twilio.com/docs/quickstart/php/sms/sending-via-rest#sending-mms-via-rest
https://support.twilio.com/hc/en-us/articles/223181808-Restricted-SMS-message-types-using-Twilio
https://support.twilio.com/hc/en-us/articles/223133967-Changing-the-sender-ID-for-sending-SMS-messages
https://support.twilio.com/hc/en-us/articles/223181348-Getting-started-with-Alphanumeric-Sender-ID
https://www.twilio.com/docs/api/twiml/sms/your_response
https://www.twilio.com/docs/api/rest/sms
https://www.twilio.com/docs/api/rest/sending-messages
jueves, 10 de noviembre de 2016
IP monitor
#!/usr/bin/php -q
<?php
$sip_peers=shell_exec("/usr/sbin/asterisk -x \" sip show peers\" | awk '{print $2}' | grep -v Unspecified | grep -v sip | grep -v Host");
$ip=explode("\n",$sip_peers);
foreach($ip as $key=>$value){
$url=file_get_contents("http://ipinfo.io/$value");
$url=json_decode($url, true);
$whitelist=array("71.41.210.190","66.241.99.90","64.2.142.187","104.238.138.237","127.0.0.1");
/* if($url['country']!="US"); use this if statement if want to filter by IP*/
if(!in_array($url['ip'],$whitelist)) {
if(!isset($url['ip'])) {
echo " too many request sent";
exit();
}
echo $url['country']." RED ALERT UNKNOWN IP ". $url['ip']."\n";
$body="Unauthorized peer with the IP ". $url['ip'];
$headers = 'From: Asterisk Dominicana <ambiorixg12@asterisk-dominicana.com>' . "\r\n";
$headers .= 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
mail("ambiorixg12@gmail.com"," Asterisk Alert",$body,$headers);
$remoteip=$url['ip'];
system("/sbin/iptables -A INPUT -s $remoteip -j DROP");
continue;
}
echo $url['ip']." ".$url['country']."\n";
}
crontab -e
*/5 * * * * /usr/bin/php /root/ip_monitor.php >> /root/ip-results.txt 2>> /root/ip-errror.txt
<?php
$sip_peers=shell_exec("/usr/sbin/asterisk -x \" sip show peers\" | awk '{print $2}' | grep -v Unspecified | grep -v sip | grep -v Host");
$ip=explode("\n",$sip_peers);
foreach($ip as $key=>$value){
$url=file_get_contents("http://ipinfo.io/$value");
$url=json_decode($url, true);
$whitelist=array("71.41.210.190","66.241.99.90","64.2.142.187","104.238.138.237","127.0.0.1");
/* if($url['country']!="US"); use this if statement if want to filter by IP*/
if(!in_array($url['ip'],$whitelist)) {
if(!isset($url['ip'])) {
echo " too many request sent";
exit();
}
echo $url['country']." RED ALERT UNKNOWN IP ". $url['ip']."\n";
$body="Unauthorized peer with the IP ". $url['ip'];
$headers = 'From: Asterisk Dominicana <ambiorixg12@asterisk-dominicana.com>' . "\r\n";
$headers .= 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
mail("ambiorixg12@gmail.com"," Asterisk Alert",$body,$headers);
$remoteip=$url['ip'];
system("/sbin/iptables -A INPUT -s $remoteip -j DROP");
continue;
}
echo $url['ip']." ".$url['country']."\n";
}
crontab -e
*/5 * * * * /usr/bin/php /root/ip_monitor.php >> /root/ip-results.txt 2>> /root/ip-errror.txt
domingo, 6 de noviembre de 2016
Local channel and hold
[myucstom]
exten=>_x.,1,Set(__outnum=${SHELL(php /var/www/file.php)})
same => n,GotoIf($[${outnum}!=FALSE]?OK)
same=>n,Playback(im-sorry)
same=>n,hangup()
same=>n(OK),Set(__caller=${CHANNEL})
same=>n,Set(__caller_two=${EXTEN})
same=>n,Set(__callercid=${CALLERID(num)})
same=>n,Dial(Local/s@moh&Local/s@response)
same=>n,Playback(/var/www/travel/sounds/goodbye)
[moh]
exten=>s,1,Noop(///${caller}///)
same=>n,Answer()
same=n,Playback(/var/www/travel/sounds/welcome)
same=>n,MusicOnHold(default)
same=>n,Hangup()
[response]
exten=>s,1,Noop(///${caller}***${outnum}***)
same=>n,System(/usr/sbin/asterisk -x "channel originate Local/${callercid}@cid extension ${caller}@hello")
[cid]
exten=>_x.,1,Set(CALLERID(num)=${EXTEN})
same=>n,Set(__outnum=${SHELL(php /var/www/file.php)})
same=>n,Dial(SIP/601)
;same=>n,Dial(SIP/0011101306932454266@sbc.voxbeam.com)
[hello]
exten=>_.,1,Answer()
same=>n,Noop(*** ${EXTEN} ***${outnum}** )
same=>n(message),playback(/var/www/travel/sounds/messagetopo)
same=>n,MixMonitor(/var/www/travel/${EXTEN}.wav)
same=>n,Bridge(${EXTEN})
same=>n,Playback(/var/www/travel/sounds/goodbye)
El cliente se queda en espera escuchando musica, luego el agente escucha el mensaje de la llamada del cliente y luego se unen en unica llamada
exten=>_x.,1,Set(__outnum=${SHELL(php /var/www/file.php)})
same => n,GotoIf($[${outnum}!=FALSE]?OK)
same=>n,Playback(im-sorry)
same=>n,hangup()
same=>n(OK),Set(__caller=${CHANNEL})
same=>n,Set(__caller_two=${EXTEN})
same=>n,Set(__callercid=${CALLERID(num)})
same=>n,Dial(Local/s@moh&Local/s@response)
same=>n,Playback(/var/www/travel/sounds/goodbye)
[moh]
exten=>s,1,Noop(///${caller}///)
same=>n,Answer()
same=n,Playback(/var/www/travel/sounds/welcome)
same=>n,MusicOnHold(default)
same=>n,Hangup()
[response]
exten=>s,1,Noop(///${caller}***${outnum}***)
same=>n,System(/usr/sbin/asterisk -x "channel originate Local/${callercid}@cid extension ${caller}@hello")
[cid]
exten=>_x.,1,Set(CALLERID(num)=${EXTEN})
same=>n,Set(__outnum=${SHELL(php /var/www/file.php)})
same=>n,Dial(SIP/601)
;same=>n,Dial(SIP/0011101306932454266@sbc.voxbeam.com)
[hello]
exten=>_.,1,Answer()
same=>n,Noop(*** ${EXTEN} ***${outnum}** )
same=>n(message),playback(/var/www/travel/sounds/messagetopo)
same=>n,MixMonitor(/var/www/travel/${EXTEN}.wav)
same=>n,Bridge(${EXTEN})
same=>n,Playback(/var/www/travel/sounds/goodbye)
El cliente se queda en espera escuchando musica, luego el agente escucha el mensaje de la llamada del cliente y luego se unen en unica llamada
jueves, 27 de octubre de 2016
custom parking lot
- exten=>_2XXX,1,Answer()same=>n,Set(PARKINGEXTEN=${
EXTEN:2}) same=>n,park()same=>n,Set(CALLERID(name)=Failed Parking Lot) same=>n,Noop( checking var ${BLINDTRANSFER:0:7})same=>n,Set(ALERTINFOA=\;info=Ring2) same=>n,SipAddHeader(${ALERTINFOA})) same=>n,Dial(${BLINDTRANSFER:0:7}) 
IF you blind transfer to the specific parking lot it will park the customer on that specific lot, if lot is busy, it will call the extension who transferred the call
Note this will park spaces parkpos => 701-720 , using the default Parking Lot created on res_parking.conf, if you want use spefic slot you will need create you parking lot on res_parking.conf and then include the contextt
miércoles, 19 de octubre de 2016
Autoanswer and Server side auto answer.
Zoiper 3 Biz supports both Autoanswer and Server side auto answer.
Autoanswer is a BIZ feature, It is not available for the free version of Zoiper.Enabling Auto answer in Zoiper 3:
Open the Settings menu and select Automation

A new window will open. Configure it by your own preference.
Suscribirse a:
Entradas (Atom)