ASTERISK CEL 1.8


yum install unixODBC unixODBC-devel libtool-ltdl libtool-ltdl-devel

make menuselect -> CEL -> cel_odbc

make && make install && make config

service asterisk restart

ecentrix*CLI> module show like odbc
Module Description Use Count
res_odbc.so ODBC resource 0
res_config_odbc.so Realtime ODBC configuration 0
cdr_odbc.so ODBC CDR Backend 0
cdr_adaptive_odbc.so Adaptive ODBC CDR backend 0
func_odbc.so ODBC lookups 0
cel_odbc.so ODBC CEL backend 0
6 modules loaded

Create database “asteriskcdrdb”

CREATE TABLE IF NOT EXISTS `cel` (
  `id` int(11) NOT NULL auto_increment,
  `eventtype` varchar(30) NOT NULL,
  `eventtime` datetime NOT NULL,
  `cid_name` varchar(80) NOT NULL,
  `cid_num` varchar(80) NOT NULL,
  `cid_ani` varchar(80) NOT NULL,
  `cid_rdnis` varchar(80) NOT NULL,
  `cid_dnid` varchar(80) NOT NULL,
  `exten` varchar(80) NOT NULL,
  `context` varchar(80) NOT NULL,
  `channame` varchar(80) NOT NULL,
  `src` varchar(80) NOT NULL,
  `dst` varchar(80) NOT NULL,
  `channel` varchar(80) NOT NULL,
  `dstchannel` varchar(80) NOT NULL,
  `appname` varchar(80) NOT NULL,
  `appdata` varchar(80) NOT NULL,
  `amaflags` int(11) NOT NULL,
  `accountcode` varchar(20) NOT NULL,
  `uniqueid` varchar(32) NOT NULL,
  `linkedid` varchar(32) NOT NULL,
  `peer` varchar(80) NOT NULL,
  `userdeftype` varchar(255) NOT NULL,
  `eventextra` varchar(255) NOT NULL,
  `userfield` varchar(255) NOT NULL,
  PRIMARY KEY  (`id`),
  KEY `uniqueid_index` (`uniqueid`),
  KEY `linkedid_index` (`linkedid`)
);

vim /etc/odbc.ini

[mysql-odbc]
Description = ODBC to Mysql
Driver = MySQL
Database = asteriskcdrdb
Server = 127.0.0.1
UserName = userdb
Password = passdb
Socket = /var/lib/mysql/mysql.sock
option = 3

vim /etc/odbcinst.ini

[MySQL]
Description = ODBC for MySQL
Driver64 = /usr/lib64/libmyodbc5.so #--> 64 bit os
Setup64 = /usr/lib64/libodbcmyS.so # ---> 64 bit os
FileUsage = 1


[root@ecentrix asterisk-1.8.26.1]# cat /etc/asterisk/cel.conf | egrep 'enable|apps|events' 
enable=yes
apps=all
events=ALL
dateformat = %d-%m-%Y %T



[root@ecentrix asterisk-1.8.26.1]# cat /etc/asterisk/res_odbc.conf | egrep 'enabled|dsn|username|password|pooling|limit|pre-connect'
enabled => yes
dsn => mysql-odbc
username => dbuser
password => dbpass
pre-connect => yes
limit => 1
enabled => no


[root@ecentrix asterisk-1.8.26.1]# cat  /etc/asterisk/cel_odbc.conf
[cel]
connection=asterisk
table=cel
username=dbuser
password=dbpass
loguniqueid=yes

ecentrix*CLI> cel show status
CEL Logging: Enabled
CEL Tracking Event: ALL
CEL Tracking Event: CHAN_START
CEL Tracking Event: CHAN_END
CEL Tracking Event: HANGUP
CEL Tracking Event: ANSWER
CEL Tracking Event: APP_START
CEL Tracking Event: APP_END
CEL Tracking Event: BRIDGE_START
CEL Tracking Event: BRIDGE_END
CEL Tracking Event: CONF_START
CEL Tracking Event: CONF_END
CEL Tracking Event: PARK_START
CEL Tracking Event: PARK_END
CEL Tracking Event: BLINDTRANSFER
CEL Tracking Event: ATTENDEDTRANSFER
CEL Tracking Event: TRANSFER
CEL Tracking Event: HOOKFLASH
CEL Tracking Event: 3WAY_START
CEL Tracking Event: 3WAY_END
CEL Tracking Event: CONF_ENTER
CEL Tracking Event: CONF_EXIT
CEL Tracking Event: USER_DEFINED
CEL Tracking Event: LINKEDID_END
CEL Tracking Event: BRIDGE_UPDATE
CEL Tracking Event: PICKUP
CEL Tracking Event: FORWARD
CEL Tracking Application: all
CEL Event Subscriber: ODBC CEL backend
CEL Event Subscriber: CEL Custom CSV Logging
ecentrix*CLI> odbc show

ODBC DSN Settings
-----------------

 Name: asterisk
 DSN: mysql-odbc
 Last connection attempt: 1970-01-01 07:00:00
 Pooled: No
 Connected: Yes

[root@ecentrix asterisk-1.8.26.1]# odbcinst -s -q
[mysql-odbc]


[root@ecentrix asterisk-1.8.26.1]# odbcinst -j
unixODBC 2.2.14
DRIVERS............: /etc/odbcinst.ini
SYSTEM DATA SOURCES: /etc/odbc.ini
FILE DATA SOURCES..: /etc/ODBCDataSources
USER DATA SOURCES..: /root/.odbc.ini
SQLULEN Size.......: 8
SQLLEN Size........: 8
SQLSETPOSIROW Size.: 8

mysql> select * from cel;
+----+--------------+---------------------+----------+---------+---------+-----------+----------+-------+------------------+-------------------+-----+-----+---------+------------+---------+---------+----------+-------------+--------------+--------------+------+-------------+------------+-----------+
| id | eventtype | eventtime | cid_name | cid_num | cid_ani | cid_rdnis | cid_dnid | exten | context | channame | src | dst | channel | dstchannel | appname | appdata | amaflags | accountcode | uniqueid | linkedid | peer | userdeftype | eventextra | userfield |
+----+--------------+---------------------+----------+---------+---------+-----------+----------+-------+------------------+-------------------+-----+-----+---------+------------+---------+---------+----------+-------------+--------------+--------------+------+-------------+------------+-----------+
| 1 | CHAN_START | 2014-10-21 04:22:48 | 4001 | 4001 | | | | 3000 | from-agents | SIP/4001-00000000 | | | | | | | 3 | | 1413840168.0 | 1413840168.0 | | | | |
| 2 | ANSWER | 2014-10-21 04:22:48 | 4001 | 4001 | 4001 | | 3000 | 3000 | ecentrix-inbound | SIP/4001-00000000 | | | | | Answer | | 3 | | 1413840168.0 | 1413840168.0 | | | | |
| 3 | HANGUP | 2014-10-21 04:22:48 | 4001 | 4001 | 4001 | | 3000 | 3000 | ecentrix-inbound | SIP/4001-00000000 | | | | | | | 3 | | 1413840168.0 | 1413840168.0 | | | | |
| 4 | CHAN_END | 2014-10-21 04:22:48 | 4001 | 4001 | 4001 | | 3000 | 3000 | ecentrix-inbound | SIP/4001-00000000 | | | | | | | 3 | | 1413840168.0 | 1413840168.0 | | | | |
| 5 | LINKEDID_END | 2014-10-21 04:22:48 | 4001 | 4001 | 4001 | | 3000 | 3000 | ecentrix-inbound | SIP/4001-00000000 | | | | | | | 3 | | 1413840168.0 | 1413840168.0 | | | | |
+----+--------------+---------------------+----------+---------+---------+-----------+----------+-------+------------------+-------------------+-----+-----+---------+------------+---------+---------+----------+-------------+--------------+--------------+------+-------------+------------+-----------+
5 rows in set (0.00 sec)




Protected: FREESWITCH AND BILLING


This content is password protected. To view it please enter your password below:

agispeedy (The Agispeedy is an AGI Application Server implemention in asterisk and written by Pure PHP)


agispeedy

Donwload “agispeedy.jpg” rename to agispeedy.tar.gz then extract:)

/etc/init.d/agispeedy start

extensions.conf

[from-agents]

exten => 8888,1,Set(VAR_INPUT=1000)
exten => 8888,n,AGI(agi://127.0.0.1/demo,digits=12)
exten => 8888,n,Hangup()

[root@server66 ~]# php /agispeedy/bin/agispeedy.php –verbose

 

agi_demo.php

answer();
$agi->verbose(print_r($agi->param));

_number($agi,$agi->param);
_get_var($agi);
_input_digit($agi);

$agi->hangup();
return(true);
}

function _number($agi,$prm){
$agi->say_number($agi->param['digits'], $escape_digits=”);
}

function _get_var($agi){
$_gv=$agi->get_variable(‘VAR_INPUT’,$getvalue=TRUE);
$agi->verbose(“get_variable = “. $_gv);

}

function _input_digit($agi){
$_input=$agi->get_data(‘vm-tocancel’,$timeout=-1,$max_digits=2);
$agi->verbose(“_input_digit = “. $_input['result']);

}
?>

 

agispeedy

PHP AGI FREEPBX/TRIBOX/ELASTIX


/var/lib/asterisk/agi-bin/PHP

-rwxr-xr-x 1 asterisk asterisk   233 Oct  6 12:19 moses.php

drwxr-xr-x 4 asterisk asterisk  4096 Oct  6 12:22 phpagi –> folder phpagi

[root@localhost asterisk]# vim extensions_additional.conf
[ext-test]
include => ext-test-custom

exten => 7777,1,Answer(1)
exten => 7777,n,AGI(/var/lib/asterisk/agi-bin/PHP/moses.php)

moses.php

#!/usr/bin/php -q
<?php
error_reporting(E_ALL ^ (E_NOTICE | E_WARNING));

set_time_limit(0);
ob_implicit_flush(false);
require(‘phpagi/phpagi.php’);

$agi = new AGI();
$agi->stream_file(“voucher_does_not_exist”);
$agi->hangup();
?>

ASERISK EXTENSION_STATE


[from-agents]

exten => 4003,hint,SIP/${EXTEN}
exten => 4002,hint,SIP/${EXTEN}
exten => 4001,hint,SIP/${EXTEN}
exten => _4X.,1,Set(EXT_STATE=${EXTENSION_STATE(${EXTEN}@from-agents)})

exten => _4X.,n,ExecIf($[ "${EXT_STATE}" == "NOT_INUSE" ]?Set(IN_USED=READY))

exten => _4X.,n,ExecIf($[ "${EXT_STATE}" == "INUSE" | "${EXT_STATE}" == "RINGING" | "${EXT_STATE}" == "INUSE&RINGING" | "${EXT_STATE}" == "BUSY" ]?Set(IN_USED=BUSY))

exten => _4X.,n,ExecIf($[ "${EXT_STATE}" == "UNAVAILABLE" | "${EXT_STATE}" == "UNKNOWN" ]?Set(IN_USED=UNAVAILABLE))
exten => _4X.,n,Noop(EXTENSION_STATUS=${IN_USED})

exten => _4X.,n(ok),Dial(SIP/${EXTEN},30,A(/var/lib/asterisk/sounds/vm-tmpexists)) –> play sound ketika di answer

exten => _4X.,n,Hangup()

perlbrew / PERL STANALONE


[root@ipbx ecentrix]# chmod +x /home/ecentrix
[root@ipbx ecentrix]# su – ecentrix
[ecentrix@ipbx ~]$  curl -L http://install.perlbrew.pl | bash
% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
Dload  Upload   Total   Spent    Left  Speed
107  1074  107  1074    0     0    419      0  0:00:02  0:00:02 –:–:–  4837

## Download the latest perlbrew

## Installing perlbrew
perlbrew is installed: ~/perl5/perlbrew/bin/perlbrew

perlbrew root (~/perl5/perlbrew) is initialized.

Append the following piece of code to the end of your ~/.bash_profile and start a
new shell, perlbrew should be up and fully functional from there:

source ~/perl5/perlbrew/etc/bashrc

Simply run `perlbrew` for usage details.

Happy brewing!

## Installing patchperl

## Done.

[ecentrix@ipbx ~]$ echo “source ~/perl5/perlbrew/etc/bashrc” >> ~/.bashrc

[ecentrix@ipbx ~]$ source ~/.bashrc

[ecentrix@ipbx ~]$ perlbrew available
perl-5.21.2
perl-5.20.0
perl-5.18.2
perl-5.16.3
perl-5.14.4
perl-5.12.5
perl-5.10.1
perl-5.8.9
perl-5.6.2
perl5.005_04
perl5.004_05
perl5.003_07

[ecentrix@ipbx ~]$ perlbrew install-multiple perl-5.21.2 –both thread -Doptimize=’-O3′ –append=’-O3′
perlbrew install-multiple perl-5.18.2 –both thread -Doptimize=’-O3′ –append=’-O3′
perlbrew install-multiple perl-5.20.0 –both thread -Doptimize=’-O3′ –append=’-O3′

[ecentrix@ipbx ~]$ perlbrew list

[ecentrix@vcentos bin]$ perlbrew install-cpanm

/home/ecentrix/perl5/perlbrew/bin/cpanm already exists, are you sure to override ? [y/N] [N] y

cpanm is installed to

/home/ecentrix/perl5/perlbrew/bin/cpanm

cpanm –interactive -v Log::Dispatch::FileRotate
cpanm –interactive -v DBI
cpanm –interactive -v Data::UUID
cpanm –interactive -v Time::HiRes
cpanm –interactive -v threads
cpanm –interactive -v threads::shared
cpanm –interactive -v Device::Gsm::Sms
cpanm –interactive -v Device::Modem
cpanm –interactive -v UUID::Generator::PurePerl
cpanm –interactive -v Log::Log4perl
cpanm –interactive -v Device::Gsm::Pdu
cpanm –interactive -v Time::HiRes
cpanm –interactive -v threads::shared
cpanm –interactive -v feature
cpanm –interactive -v IO::Socket::INET
cpanm –interactive -v Log::Dispatch::FileRotate
cpanm –interactive -v DBD::mysql
cpanm –interactive -v Pod::Perldoc::ToMan
cpanm –interactive -v Device::SerialPort
cpanm –interactive -v File::Basename
cpanm –interactive -v UUID::Generator::PurePerl

OR

/home/ecentrix/perl5/perlbrew/perls/perl-5.21.2-thread-multi-O3/bin/perl -MCPAN -e ‘fforce install Log::Dispatch::FileRotate’

Thanks
Moses

IMPORT CSV TO MYSQL (LOAD INTO FILE)


mysql -umyuser -pmypass -Bs -e “LOAD DATA INFILE ‘/home/cdr/cdr01/cdr-2014-07.csv’ INTO TABLE asterisk_cdr.cdr FIELDS TERMINATED BY ‘,’ ENCLOSED BY ‘\”‘ LINES TERMINATED BY ‘\n'”

shisdew

Listens until think alike

moses.spaceku@yahoo.com / voip ipbx

Hosted PBX, IP-PBX SOHO/ CALL CENTER, VOICE GATEWAY, VOICE CARD, COST EFECTIVE SOLUTIONS (LCR), GSM/CDMA GATEWAY

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: