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
Python library for the analysis of dynamic measurements

Python library for the analysis of dynamic measurements The goal of this library is to provide a starting point for users in metrology and related are

Physikalisch-Technische Bundesanstalt - Department 9.4 'Metrology for the digital Transformation' 18 Dec 21, 2022
Python tools for working with Orbit Ephemeris Messages (OEMs).

Python Orbit Ephemeris Message tools Python tools for working with Orbit Ephemeris Messages (OEMs). Development Status Installation The oem package is

Brad Sease 4 Apr 06, 2022
A demo of a data science project using Kedro

iris Overview This is your new Kedro project, which was generated using Kedro 0.17.4. Take a look at the Kedro documentation to get started. Rules and

Khuyen Tran 14 Oct 14, 2022
Alfred 4 Workflow to search through your maintained/watched/starred GitHub repositories.

Alfred 4 Workflow to search through your maintained/watched/starred GitHub repositories. Setup This workflow requires a number of Python modules. Thes

Bᴇʀɴᴅ Sᴄʜᴏʀɢᴇʀs 1 Oct 14, 2022
Data Applications Project

DBMS project- Hotel Franchise Data and application project By TEAM Kurukunda Bhargavi Pamulapati Pallavi Greeshma Amaraneni What is this project about

Greeshma 1 Nov 28, 2021
Bionic is Python Framework for crafting beautiful, fast user experiences for web and is free and open source.

Bionic is Python Framework for crafting beautiful, fast user experiences for web and is free and open source. Getting Started This is an example of ho

14 Apr 10, 2022
Secret santa is a fun and easy way to get together with your friends and/or family with a gift for them.

Vaccine Validator Tool to validate domestic New Zealand vaccine passes Create a new virtual environment: python3 -m venv ./venv Activate virtual envi

2 Dec 06, 2021
Python library for creating PEG parsers

PyParsing -- A Python Parsing Module Introduction The pyparsing module is an alternative approach to creating and executing simple grammars, vs. the t

Pyparsing 1.7k Jan 03, 2023
One destination for all the developer's learning resources.

DevResources One destination for all the developer's learning resources. Find all of your learning resources under one roof and add your own. Live ✨ Y

Gaurav Sharma 33 Oct 21, 2022
GCP Scripts and API Client Toolss

GCP Scripts and API Client Toolss Script Authentication The scripts and CLI assume GCP Application Default Credentials are set. Credentials can be set

3 Feb 21, 2022
Emulate and Dissect MSF and *other* attacks

Need help in analyzing Windows shellcode or attack coming from Metasploit Framework or Cobalt Strike (or may be also other malicious or obfuscated code)? Do you need to automate tasks with simple scr

123 Dec 16, 2022
En este repositorio realizaré la tarea del laberinto.

Laberinto Perfil de GitHub del autor de este proyecto: @jmedina28 En este repositorio queda resuelta la composición de un laberinto 5x5 con sus muros

Juan Medina 1 Dec 11, 2021
Digdata presented 'BrandX' as a clothing brand that wants to know the best places to set up a 'pop up' store.

Digdata presented 'BrandX' as a clothing brand that wants to know the best places to set up a 'pop up' store. I used the dataset given to write a program that ranks these places.

Mahmoud 1 Dec 11, 2021
An app about keyboards, originating from the design of u/Sonnenschirm

keebapp-backend An app about keyboards, originating from the design of u/Sonnenschirm Setup Firstly, ensure that the environment for python is install

8 Sep 04, 2022
Hoopoe - Get notified of important stuff, right away.

Hoopoe - Get notified of important stuff, right away. Report a Bug · Request a Feature . Ask a Question Table of Contents About Getting Started Prereq

Vahid Al 8 Nov 12, 2022
OTP-Bomber - An otp from MPL ID app, which can be spammed

OTP-Bomber An otp from MPL ID app, which can be spammed Note: Only available on

5 Oct 29, 2022
objectfactory is a python package to easily implement the factory design pattern for object creation, serialization, and polymorphism

py-object-factory objectfactory is a python package to easily implement the factory design pattern for object creation, serialization, and polymorphis

Devin A. Conley 6 Dec 14, 2022
Replite - An embeddable REPL powered by JupyterLite

replite An embeddable REPL, powered by JupyterLite. Usage To embed the code cons

Jeremy Tuloup 47 Nov 09, 2022
GMHI: Gut Microbiome Health Index

GMHI: Gut Microbiome Health Index Description Gut Microbiome Health Index (GMHI)

Daniel Chang 2 Jun 30, 2022
Repo Home WPDrawBot - (Repo, Home, WP) A powerful programmatic 2D drawing application for MacOS X which generates graphics from Python scripts. (graphics, dev, mac)

DrawBot DrawBot is a powerful, free application for macOS that invites you to write Python scripts to generate two-dimensional graphics. The built-in

Frederik Berlaen 342 Dec 27, 2022