asterisk/README.md

78 lines
2.9 KiB
Markdown
Raw Normal View History

2024-11-06 19:42:14 +00:00
# asterisk
2024-11-06 23:13:49 +00:00
## Installing Dependencies
Before installing Asterisk, you need to update your package lists and install the necessary dependencies. Open your terminal and execute the following commands:
`sudo apt update`
`sudo apt upgrade`
`sudo apt install -y wget build-essential subversion`
## Downloading and Installing Asterisk
With the dependencies in place, you can now download and compile Asterisk:
`cd /usr/src`
`sudo wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-18-current.tar.gz`
`sudo tar xvf asterisk-18-current.tar.gz`
Change into the extracted directory and install additional required packages:
`cd asterisk-18*`
`sudo contrib/scripts/install_prereq install`
Now, proceed to compile and install Asterisk:
`sudo ./configure`
`sudo make menuselect`
`sudo make`
`sudo make install`
`sudo make samples`
`sudo make config`
`sudo ldconfig`
With Asterisk installed, you can now set up its user and group permissions:
`sudo adduser --system --group --no-create-home asterisk`
`sudo chown -R asterisk:asterisk /etc/asterisk`
`sudo chown -R asterisk:asterisk /var/{lib,log,spool}/asterisk`
`sudo chown -R asterisk:asterisk /usr/lib/asterisk`
## Configuring Asterisk
Editing the main configuration file is the next step. Open it using your favorite text editor:
2024-11-06 23:17:46 +00:00
`sudo vim /etc/asterisk/asterisk.conf`
2024-11-06 23:13:49 +00:00
Make the necessary changes according to your setup, then start and enable Asterisk at boot:
`sudo systemctl start asterisk`
`sudo systemctl enable asterisk`
Ensure that Asterisk is running without issues:
`sudo asterisk -vvvr`
2024-11-06 23:17:46 +00:00
## Setting Up PJSIP Accounts
To handle VoIP calls, you need to set up PJSIP accounts. Edit the pjsip.conf and extensions.conf files:
2024-11-06 23:13:49 +00:00
2024-11-06 23:17:46 +00:00
`sudo vim /etc/asterisk/pjsip.conf`
`sudo vim /etc/asterisk/extensions.conf`
2024-11-06 23:13:49 +00:00
2024-11-06 23:17:46 +00:00
Add your SIP users in pjsip.conf and dial plan in extensions.conf.
## Google TTS script for Asterisk
You'll need to install the following dependencies:
`sudo apt install perl libwww-perl liblwp-protocol-https-perl sox mpg123`
Then download the script from the Google TTS repository and place it in the appropriate directory:
https://github.com/zaf/asterisk-googletts
2024-11-22 20:39:31 +00:00
## Voice-rt
Asterisk VoiceBot Realtime is a Node.js application that utilizes Asterisk for real-time audio transmission and processing. This application leverages Google Cloud Speech-to-Text, Google Cloud Text-to-Speech, and OpenAI for transcription, speech synthesis, and intelligent response generation.
Asterisk VoiceBot Realtime connects to a TCP server and handles audio data packets sent by Asterisk through the AudioSocket module. Upon receiving audio data, the application transcribes it using Google Cloud Speech-to-Text, sends the transcription to OpenAI for generating a response, and finally synthesizes the response into audio using Google Cloud Text-to-Speech. The generated audio is then sent back to the client through the socket.
https://hub.docker.com/r/gcareri/asterisk-voicebot-rt