DIGIT MANIPULATION WELLGATE FXS


digit_manipulation_wellgate01 digit_manipulation_wellgate02

RSYSLOG WELLGATE CDR


#$ModLoad imuxsock # provides support for local system logging (e.g. via logger command)
#$ModLoad imklog # provides kernel logging support (previously done by rklogd)
#$ModLoad immark # provides –MARK– message capability

# Provides UDP syslog reception
$ModLoad imudp
$UDPServerRun 514

# Provides TCP syslog reception
$ModLoad imtcp
$InputTCPServerRun 514
#### GLOBAL DIRECTIVES ####

# Use default timestamp format
$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat

EXAMPLE CDR

Nov 13 11:38:44 2014-11-13 12: 39:13 CDR OUT Src :8023 Dst :922222081287264002 CallID 80be4168-cd0010ac-17bc-45026-7f-29658e35-7f START:2014/11/13 12:38:50 ANSWER:2014/11/13 12:39:03 END:2014/11/13 12:39:13 DURATION:023 BillSec:010 DISPOSITION:FINISHED

cdr_wellgate

:fromhost-ip,startswith,”172.16.0.205″ /var/log/remote.log

EVENT ASTERISK MANAGER


npm install asterisk-manager

/home/node_modules/asterisk-manager/lib/test.js

test.js

var ami = new require(‘asterisk-manager’)(‘5038′,’192.168.0.105′,’username’,’password’, true);

// Listen for any/all AMI events.
ami.on(‘managerevent’, function(evt) {
console.log(‘EVENT ::’, evt);

});

// Listen for specific AMI events. A list of event names can be found at
// https://wiki.asterisk.org/wiki/display/AST/Asterisk+11+AMI+Events
ami.on(‘hangup’, function(evt) {
console.log(‘HANGUP ::’, evt);
});
ami.on(‘confbridgejoin’, function(evt) {
console.log(‘CONFBRIDGEJOIN ::’, evt);
});

ami.on(‘close’, function(e) {
console.log(‘CLOSE ::’, e);
});
ami.on(‘disconnect’, function(e) {
console.log(‘DISCONNECT ::’, e);
});
ami.on(‘connect’, function(e) {
console.log(‘CONNECT ::’, e);
});

ami.action({
‘action':’originate’,
‘channel':’SIP/4001′,
‘context':’default’,
‘exten':1234,
‘priority':1,
‘variables':{
‘name1′:’value1′,
‘name2′:’value2′
}
}, function(err, res) {});

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();
?>

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: