mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Add playbook for osips+diam setup
- installs go - sets up cgrates - installs nightly version of opensips and modules - uses the prepaid opensips.cfg from tutorials by default - installs and sets up freediameter - installs pjsua and helper scripts
This commit is contained in:
committed by
Dan Christian Bogos
parent
fc0666d2ac
commit
ca0b9870b7
5
data/ansible/osips_diameter/hosts
Normal file
5
data/ansible/osips_diameter/hosts
Normal file
@@ -0,0 +1,5 @@
|
||||
# Ansible Inventory File
|
||||
|
||||
[all]
|
||||
example_host ansible_host=192.168.122.42 ansible_port=50026 ansible_user=example_user user=example_user
|
||||
|
||||
64
data/ansible/osips_diameter/main.yaml
Normal file
64
data/ansible/osips_diameter/main.yaml
Normal file
@@ -0,0 +1,64 @@
|
||||
---
|
||||
- hosts: all
|
||||
roles:
|
||||
- ../roles/go
|
||||
- role: ../roles/cgrates
|
||||
vars:
|
||||
cgrates_dbs:
|
||||
- mysql
|
||||
cgrates_dependencies:
|
||||
- git
|
||||
- redis-server
|
||||
- mariadb-server
|
||||
- xxd # needed for unix2ntp script (added here for convenience)
|
||||
|
||||
- role: ../roles/opensips
|
||||
vars:
|
||||
opensips_cfg_path: /usr/share/cgrates/tutorials/osips_diam/etc/opensips/opensips_ccr_prepaid.cfg
|
||||
opensips_dict_path: /usr/share/cgrates/tutorials/osips_diam/etc/opensips/dictionary.opensips
|
||||
opensips_version: '3.5'
|
||||
opensips_release_type: nightly
|
||||
opensips_modules:
|
||||
- opensips-auth-modules
|
||||
- opensips-diameter-module
|
||||
- opensips-json-module
|
||||
- opensips-mysql-module
|
||||
opensips_cfg_replacements:
|
||||
- before: '^socket=udp:enp0s3:5060.*$'
|
||||
after: 'socket=udp:{{ ansible_default_ipv4.interface }}:5060'
|
||||
|
||||
- role: ../roles/freediameter
|
||||
vars:
|
||||
fd_dns_entries:
|
||||
- ip: '{{ ansible_default_ipv4.address }}'
|
||||
hostname: '{{ fd_client_identity }}'
|
||||
- ip: '{{ ansible_default_ipv4.address }}'
|
||||
hostname: '{{ fd_server_identity }}'
|
||||
|
||||
- role: ../roles/pjsua
|
||||
vars:
|
||||
pjsua_helper_scripts: true
|
||||
|
||||
post_tasks:
|
||||
- name: Configure diameter listen address in CGRateS cfg
|
||||
become: true
|
||||
ansible.builtin.lineinfile:
|
||||
path: /usr/share/cgrates/tutorials/osips_diam/etc/cgrates/cgrates.json
|
||||
regexp: '^\s*"listen": "192\.168\.122\.42:3868",\s*$'
|
||||
line: '"listen": "{{ ansible_default_ipv4.address }}:3868",'
|
||||
|
||||
- name: Ensure opensips is allowed to access privkey.pem
|
||||
become: true
|
||||
ansible.builtin.file:
|
||||
path: /etc/freeDiameter/tls/privkey.pem
|
||||
mode: 0644
|
||||
|
||||
- name: Move unix2ntp script to /usr/local/bin
|
||||
become: true
|
||||
ansible.builtin.copy:
|
||||
src: /usr/share/cgrates/tutorials/osips_diam/etc/opensips/unix2ntp
|
||||
dest: /usr/local/bin
|
||||
owner: root
|
||||
group: root
|
||||
remote_src: yes
|
||||
mode: 0755
|
||||
@@ -58,7 +58,7 @@ loadmodule "sipmsgops.so"
|
||||
|
||||
#### FIFO Management Interface
|
||||
loadmodule "mi_fifo.so"
|
||||
modparam("mi_fifo", "fifo_name", "/run/opensips/opensips_fifo")
|
||||
modparam("mi_fifo", "fifo_name", "/tmp/opensips_fifo")
|
||||
modparam("mi_fifo", "fifo_mode", 0666)
|
||||
|
||||
#### USeR LOCation module
|
||||
|
||||
@@ -58,7 +58,7 @@ loadmodule "sipmsgops.so"
|
||||
|
||||
#### FIFO Management Interface
|
||||
loadmodule "mi_fifo.so"
|
||||
modparam("mi_fifo", "fifo_name", "/run/opensips/opensips_fifo")
|
||||
modparam("mi_fifo", "fifo_name", "/tmp/opensips_fifo")
|
||||
modparam("mi_fifo", "fifo_mode", 0666)
|
||||
|
||||
#### USeR LOCation module
|
||||
@@ -224,7 +224,7 @@ route[handle_answer] {
|
||||
|
||||
route[handle_hangup] {
|
||||
$var(duration) = $Ts - $dlg_val(answertime);
|
||||
exec("/usr/share/cgrates/tutorials/osips_diam/etc/opensips/unix2ntp", "$dlg_val(answertime)", $var(answertime32bit), , );
|
||||
exec("/usr/local/bin/unix2ntp", "$dlg_val(answertime)", $var(answertime32bit), , );
|
||||
$var(payload) = "[
|
||||
{ \"Session-Id\": \"" + $dlg_val(callid) + "\" },
|
||||
{ \"Origin-Host\": \"client.diameter.test\" },
|
||||
|
||||
@@ -58,7 +58,7 @@ loadmodule "sipmsgops.so"
|
||||
|
||||
#### FIFO Management Interface
|
||||
loadmodule "mi_fifo.so"
|
||||
modparam("mi_fifo", "fifo_name", "/run/opensips/opensips_fifo")
|
||||
modparam("mi_fifo", "fifo_name", "/tmp/opensips_fifo")
|
||||
modparam("mi_fifo", "fifo_mode", 0666)
|
||||
|
||||
#### USeR LOCation module
|
||||
@@ -177,7 +177,7 @@ route{
|
||||
# use the unix2ntp helper script to convert unix time to 32bit format
|
||||
# for the Event-Timestamp AVP
|
||||
# can this be done directly inside the cfg file?
|
||||
exec("/usr/share/cgrates/tutorials/osips_diam/etc/opensips/unix2ntp", "$dlg_val(setuptime)", $var(setuptime32bit), , );
|
||||
exec("/usr/local/bin/unix2ntp", "$dlg_val(setuptime)", $var(setuptime32bit), , );
|
||||
|
||||
# Send blocking CCR INITIAL_REQUEST and retrieve MaxUsage
|
||||
$var(payload) = "[
|
||||
@@ -272,7 +272,7 @@ route{
|
||||
|
||||
route[handle_answer] {
|
||||
$dlg_val(answertime) = $Ts;
|
||||
exec("/usr/share/cgrates/tutorials/osips_diam/etc/opensips/unix2ntp", "$dlg_val(answertime)", $dlg_val(answertime32bit), , );
|
||||
exec("/usr/local/bin/unix2ntp", "$dlg_val(answertime)", $dlg_val(answertime32bit), , );
|
||||
$var(payload) = "[
|
||||
{ \"Session-Id\": \"" + $dlg_val(callid) + "\" },
|
||||
{ \"Origin-Host\": \"client.diameter.test\" },
|
||||
|
||||
Reference in New Issue
Block a user