35
loading...
This website collects cookies to deliver better user experience
# Install PostgreSQL
sudo apt install postgresql postgresql-contrib
# start the postgres service
sudo service postgresql start
# Change to user postgres as it can perform all tasks on the database
sudo su postgres
# login to the DB
psql
# You should see something similar in your terminal
postgres=#
# Create database
# don't miss the colon
CREATE Database <your-database-name-here>;
# Create an account to manage the database
# don't miss the colon and the quotation marks
CREATE USER <your-username-here> WITH PASSWORD 'your-password-here' SUPERUSER;
# Leaving Database and postgres user
ctrl + d
ctrl + d
# Try login from the current user
psql -U <user_name> -W -h <hostname> <db_name>
extensions.conf
. In the following, I will show you how you could use it as a way to insert data into the PostgreSQL database. # add the agi module
load = res_agi.so
[transport-udp-nat]
type = transport
protocol = udp
bind = 0.0.0.0
[calling](!)
type=endpoint
context=interaction
allow = !all, ulaw, alaw
direct_media=no
trust_id_outbound=yes
rtp_symmetric=yes
force_rport=yes
rewrite_contact=yes
device_state_busy_at=1
dtmf_mode=rfc4733
[auth-userpass](!)
type = auth
auth_type = userpass
[aor-single-reg](!)
type = aor
max_contacts = 1
[7000](calling)
auth=7000
aors=7000
callerid = 7000 <7000>
[7000](auth-userpass)
password = 7000
username = 7000
[7000](aor-single-reg)
[7100](calling)
auth=7100
aors=7100
callerid = 7100 <7100>
[7100](auth-userpass)
password = 7100
username = 7100
[7100](aor-single-reg)
[interaction]
exten = _7X00,1,NoOp(${EXTEN})
; setting variables for data insertion
same = n,Set(_callInTime=${STRFTIME(,,%Y%b%d-%H%M%S)})
same = n,Set(_callerId=${CALLERID(num)})
same = n,Set(_extension=${EXTEN})
same = n,Set(_callDuration=${CDR(billsec)})
same = n,Answer
same = n,Dial(PJSIP/${EXTEN},30)
same = n,Goto(update_call_duration,s,1)
[update_call_duration]
; call_log is the agi file, the rest are the arguments
exten = s,1,agi(call_log,${callerId},${callInTime},${extension},${callDuration})
same = n,Hangup
extensions.conf
, we use the agi
dialplan application. Think of it as running a program like node abc.js
or python3 cde.py
. agi-bin
path to create the program. agi
program.