Click2call for asterisk with python

Overview

Click2call para Asterisk com Python

Este projeto disponibiliza uma API construída em python contendo uma rota para Click2call e outra para listagem de ramais em tempo real. Ela pode ser integrada a qualquer servidor Asterisk.

Requisitos

  1. Criar um usuário no Maganer do seu Asterisk conforme abaixo (lembre-se de ajustar para o IP da sua rede):
[click2call]
secret=click2callsecret
deny=0.0.0.0/0.0.0.0
permit=127.0.0.1/255.255.255.255
permit=192.168.100.0/255.255.255.0
write=originate,system

Você poderá alterar o usuário e senha também.

  1. Recarregar o manager:
[[email protected]:/etc/asterisk]# rasterisk -x 'manager reload'

Deploy

  1. Definir as variáveis de ambiente:
[[email protected]:/]# cat .env
ASTERISK_IP=
ASTERISK_AMI_PORT=5038
ASTERISK_AMI_USER=
ASTERISK_AMI_PASSWORD=
ENVIRONMENT=dev
PORT=8000
HTTP_AUTH_USER=
HTTP_AUTH_PASSWORD=
Variável Valores
ASTERISK_IP IP do seu servidor Asterisk
ASTERISK_AMI_PORT Porta do manager do seu Asterisk
ASTERISK_AMI_USER Usuário criado no manager
ASTERISK_AMI_PASSWORD Senha do usuário criado no manager
ENVIRONMENT dev ou prod. Quando em dev qualquer alteração do código é recarregada imediatamente durante a execução do serviço
PORT Porta onde o serviço da API será executado
HTTP_AUTH_USER Usuário de acesso à api
HTTP_AUTH_PASSWORD Senha do usuário de acesso à api
  1. Fazer o build e a inicialização dos serviços:
docker-compose build
docker-compose up -d

Resquests

  • Click2call
curl --request POST \
  --url http://192.168.100.96:8000/click2call \
  --header 'Authorization: Basic c3VwZXJ1c2VyOnN1cGVyc2VjcmV0' \
  --header 'Content-Type: application/json' \
  --data '{
	"src":1000,
	"dst": 1001,
	"context":"from-internal"	
}'

Retorno:

{
	"status": "Success",
	"keys": {
		"ActionID": "1",
		"Message": "Originate successfully queued"
	},
	"follows": []
}
  • Listagem de ramais e seus status
curl --request GET \
  --url http://192.168.100.96:8000/get_extensions \
  --header 'Authorization: Basic c3VwZXJ1c2VyOnN1cGVyc2VjcmV0'

Retorno

[
	[
		{
			"Privilege": "System",
			"ChannelType": "SIP",
			"Peer": "SIP/1001",
			"PeerStatus": "Reachable",
			"Time": "9",
			"ActionID": "da32dd50-76ba-11ec-b872-0242ac150002"
		}
	],
	[
		{
			"Privilege": "System",
			"ChannelType": "SIP",
			"Peer": "SIP/1000",
			"PeerStatus": "Reachable",
			"Time": "1",
			"ActionID": "da32dd50-76ba-11ec-b872-0242ac150002"
		}
	]
]
Owner
Benedito Marques
Sysadmin em Fortics Tecnologia
Benedito Marques
A general purpose low level programming language written in Python.

A general purpose low level programming language written in Python. Basal is an easy mid level programming language compiling to C. It has an easy syntax, similar to Python, Rust etc.

Snm Logic 6 Mar 30, 2022
Collection of functions for working with interlaced content in VapourSynth.

vsfieldkit Collection of functions for working with interlaced content in VapourSynth. It does not have any hard dependencies outside of VapourSynth.

Justin Turner Arthur 11 May 27, 2022
A python package to adjust the bias of probabilistic forecasts/hindcasts using "Mean and Variance Adjustment" method.

Documentation A python package to adjust the bias of probabilistic forecasts/hindcasts using "Mean and Variance Adjustment" method. Read documentation

1 Feb 02, 2022
Tiny demo site for exploring SameSite=Lax

samesite-lax-demo Background on my blog: Exploring the SameSite cookie attribute for preventing CSRF This repo holds some tools for exploring the impl

Simon Willison 6 Nov 10, 2021
Py-Parser est un parser de code python en python encore en plien dévlopement.

PY - PARSER Py-Parser est un parser de code python en python encore en plien dévlopement. Une fois achevé, il servira a de nombreux projets comme glad

pf4 3 Feb 21, 2022
Ingestinator is my personal VFX pipeline tool for ingesting folders containing frame sequences that have been pulled and downloaded to a local folder

Ingestinator Ingestinator is my personal VFX pipeline tool for ingesting folders containing frame sequences that have been pulled and downloaded to a

Henry Wilkinson 2 Nov 18, 2022
IPO Checker for NEPSE

IPO Checker Checks more than one account for an IPO. Usage: ipo_checker.py [-h] --file FILE IPO Checker for a list. optional arguments: -h, --help

Sagar Tamang 4 Sep 20, 2022
Script to calculate the italian fiscal code of a person.

fiscal_code Hi! This is my first public repository, so please be kind if it is not well formatted or it contains errors. I started learning Python abo

FrancescoDiMuro 1 Nov 20, 2021
LinuxHelper - A collection of utilities for non-technical Linux users accessible via a GUI

Linux Helper A collection of utilities for non-technical Linux users accessible via a GUI This app is still in very early development, expect bugs and

Seth 7 Oct 03, 2022
《赛马娘》(ウマ娘: Pretty Derby)辅助 🐎🖥 基于 auto-derby 可视化操作/设置 启动器 一键包

ok-derby 《赛马娘》(ウマ娘: Pretty Derby)辅助 🐎 🖥 基于 auto-derby 可视化操作/设置 启动器 一键包 便捷,好用的 auto_derby 管理器! 功能 支持客户端 DMM (前台) 实验性 安卓 ADB 连接(后台)开发基于 1080x1920 分辨率

秋葉あんず 90 Jan 01, 2023
Python client library for the Databento API

Databento Python Library The Databento Python client library provides access to the Databento API for both live and historical data, from applications

Databento, Inc. 35 Dec 24, 2022
Trusted sessions for falcon using itsdangerous.

Falcon signed sessions This project allows you to easily add trusted cookies to falcon, it works by storing a signed cookie in the client's browser us

Ward 1 Feb 08, 2022
All you need to understand CRUD and MVP in DRF

Book-Store-API This an API which has been put in place just to make you order for books, upload books with price, image and all, pay and automtically

Oladipo Adesiyan 6 Jul 03, 2022
MoBioTools A simple yet versatile toolkit to automatically setup quantum mechanics/molecular mechanics

A simple yet versatile toolkit to setup quantum mechanical/molecular mechanical (QM/MM) calculations from molecular dynamics trajectories.

MoBioChem 17 Nov 27, 2022
Time python - Códigos para auxiliar e mostrar formas de como fazer um relógio e manipular o seu tempo

Time_python Códigos para auxiliar e mostrar formas de como fazer um relógio e manipular o seu tempo. Bibliotecas Nestes foram usadas bibliotecas nativ

Eduardo Henrique 1 Jan 03, 2022
ChainJacking is a tool to find which of your Go lang direct GitHub dependencies is susceptible to ChainJacking attack.

ChainJacking is a tool to find which of your Go lang direct GitHub dependencies is susceptible to ChainJacking attack.

Checkmarx 36 Nov 02, 2022
Rename and categorize your DMOJ solutions

DMOJ Downloader What is this for? DMOJ lets you download the code for all your solutions, however the files are just named as numbers

Evan Wild 1 Dec 04, 2022
An example project which contains the Unity components necessary to complete Navigation2's SLAM tutorial with a Turtlebot3, using a custom Unity environment in place of Gazebo.

Navigation 2 SLAM Example This example provides a Unity Project and a colcon workspace that, when used together, allows a user to substitute Unity as

Unity Technologies 183 Jan 04, 2023
This is a Docker-based pipeline for preparing sextractor-ready multiwavelength images

Pipeline for creating NB422-detected (ODI) catalog The repository contains a Docker-based pipeline for preprocessing observational data. The pipeline

1 Sep 01, 2022
An useful scripts for Misskey

misskey-scripts This place storing useful scripts which made by me. icon-repair Repair broken remote user's icon.

CyberRex 5 Sep 09, 2022