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, 7 de enero de 2015

Robot Call


#!/bin/bash

mysql --silent -h localhost  -u root -p1234 -D asterisk<<<'select telephone  from dialer  where status!="called" limit 0,5' > tmp_results

while read  telephone
do

 echo $telephone
`asterisk -x "originate Local/$telephone@robot extension $telephone@voice"` &



done < tmp_results
####################

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;



;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;robot calling system





;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;robot calling system


[robot]
exten=>_x.,1,Set(__callerid=${SHELL(mysql --user=root --password='1234' --skip-column-names  asterisk -e 'select callerid  from dialer where telephone='${EXTEN}' limit 0,1 ')})
same=>n,Set(CALLERID(num)=${callerid})
same=>n,Verbose( calling to number ${EXTEN})
same=>n,Set(__telephone=${EXTEN})
same=>n,System(mysql --user=root --password='1234' asterisk -e 'UPDATE `dialer` SET `status`="called" WHERE telephone="${EXTEN}"')
same=>n,Dial(SIP/${EXTEN}@rapidvox,18)
exten=>h,1,System(mysql --user=root --password='1234' asterisk -e 'UPDATE `dialer` SET `disposition`="${CDR(disposition)}" WHERE telephone="${telephone}"')
exten=>h,2,System(mysql --user=root --password='1234' asterisk -e 'UPDATE `dialer` SET `calldate`="${STRFTIME(${EPOCH},,%d%m%Y-%H:%M:%S)}" WHERE telephone="${telephone}"')



[voice]
exten=>_x.,1,verbose( telephone ${EXTEN})
same=>n,Set(__telephone=${EXTEN})
same=>n,Set(message=${SHELL(mysql --user=root --password='1234' --skip-column-names  asterisk -e 'select message  from dialer where telephone='${EXTEN}'')})
same=>n,Set(key=${SHELL(mysql --user=root --password='1234' --skip-column-names  asterisk -e 'select transf_key  from dialer where telephone='${EXTEN}'')})
same=>n,Set(transf_dest=${SHELL(mysql --user=root --password='1234' --skip-column-names  asterisk -e 'select transf_dest  from dialer where telephone='${EXTEN}'')})
same=>n,Read(CONFIRM,/var/lib/asterisk/sounds/broadcasting/${message:0:5},1)
same=> n,ExecIf($["${CONFIRM}"= "${key:0:1}"]?Dial(SIP/${transf_dest:0:11}@callcentric))
exten=>h,1,verbose( call duation is ${CDR(duration)} )
exten=>h,2,System(mysql --user=root --password='1234' asterisk -e 'UPDATE `dialer` SET `duration`="${CDR(duration)}" WHERE telephone="${telephone}"')
exten=>h,3,verbose( vars are ${CDR(duration)} ${telephone} ${message})









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

-- phpMyAdmin SQL Dump
-- version 4.0.10deb1
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Jan 07, 2015 at 01:36 PM
-- Server version: 5.5.40-0ubuntu0.14.04.1
-- PHP Version: 5.5.9-1ubuntu4.5

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;

--
-- Database: `asterisk`
--

-- --------------------------------------------------------

--
-- Table structure for table `dialer`
--

CREATE TABLE IF NOT EXISTS `dialer` (
  `id_call` int(10) NOT NULL AUTO_INCREMENT,
  `telephone` varchar(20) NOT NULL,
  `transf_key` char(1) NOT NULL,
`transf_dest` varchar(11) NOT NULL,
 `calldate` varchar(30) NOT NULL,
  `recorddate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `disposition` varchar(10) NOT NULL,
  `duration` varchar(10) NOT NULL,
  `message` varchar(5) NOT NULL,
  `message_description` varchar(100) NOT NULL,
  `status` varchar(10) NOT NULL,
  `callerid` varchar(15) NOT NULL,
  PRIMARY KEY (`id_call`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=19 ;

--
-- Dumping data for table `dialer`
--

INSERT INTO `dialer` (`id_call`, `telephone`, `calldate`, `recorddate`, `disposition`, `duration`, `message`, `message_description`, `status`, `reserved2`) VALUES
(2, '18097143489', '07012015-00:47:08', '2015-01-06 00:16:57', 'ANSWERED', '19', 'msg_1', 'mensaje 1', 'called', ''),
(3, '0115213311353451', '06012015-13:29:28', '2015-01-06 01:08:22', '', '', 'msg_3', 'ejemplo de numero que no existe', 'called', ''),
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;

No hay comentarios:

Publicar un comentario