⚠️ Archived: This project is archived because I don't need it as a learning resource anymore, but a lot of parts are still good to reference, such as: Asterisk (setup, making video calls) and WebRTC (video chat app).
VoIP application ran using: Drash and Asterisk, to make and demonstrate voice calls using asterisk. Also acts as a training project for Drash, Sockets and Asterisk
I've decided to skip the IVR menu because I ddon't think we have a keypad for softphones int eh Telephone app? See here
- Drash - web server
- Wocket - web socket server
deno bundlle
- bundling client TS code- Asterisk
- Rhum - Testing framework
- Dawn - browser testing framework (not yet added)
- Dami - ami client
-
Docker environment is started
-
server
bundles client ts, and starts, handling any web requests -
Asterisk starts, listening for any call requests
-
ami
starts, listening on any requests to the socket -
Asterisks AMI is configured to run (see manager.conf), on port 5038. An AMI is a part of Asterisk, and we can connect to it using
telnet localhost 5038
to issue commands, then when connected, doAction: Login ^SHIFT ...
(ortelnet 0.0.0.0 5038
when inside the container)
- Register 2 phones, for demo-alice (pass = verysecretpassword as seen in sip.conf) and demo-bob (pass = anothersecretpassword). Domain is 0.0.0.0 (because docker). Username is also demo-alice (see sip.conf), or. it's thee extension eg 6001 or 6002
- Make a call! We can see the dialplans in extensions.conf (note the context for our 2 phones are from-internal), so make a call to 6001 (to alice) or 6002 (to bob)
-
.docker
- Holds docker-related files, such as dockerfiles, and asterisk configuration files -
.github
- Holds our workflows -
src/socket
- Our AMI socket server -
src/server
- Our drash application that acts as the server for this project, to serve a client on the webmiddleware
- Direcotry to hold our custom middleware to pipe into Drashpublic
- Our client assets.env
- Our env fileapp.ts
- Our entrypoint file to start the serverdenon.json
- Similar to PM2, we use denon to start and watch our server (app.ts
)deps.ts
- Holds our dependenciesresponse.ts
- A unique way to override the Drash response so we can customise how the server responds to a client (NOT IN USE)
- Packages
- For importing packages, a
deps.ts
file will hold all imports for the whole project, and all those will then be exported. Should a file require any package or module, they will use thedeps.ts
file to do so.
- For importing packages, a
- Use
mod.ts
to export your module - Use
app.ts
as your entry point file (eg web apps) - Use
deno fmt
See here
- Deno - Runtime environment
- Drash - HTTP Microframework
- Drash's Template Engine
- Asterisk - PBX System
- Denon - File watcher and server starter
- Paladin - Better secure our responses
- Docker
-
Resolving
.ts
extensions
Most of the steps were following using asterisks main documentation: https://wiki.asterisk.org/wiki/display/AST/Hello+World
-
Install asterisk
apt install asterisk
-
Setup the conf files and the step using the link above. It includes the sip/pjsip/extensions config files
-
Restart asterisk
asterisk -rx "core restart now"
-
Start asterisk
asterisk -cvvvvv
-
Connect using a softphone, where the domain is the IP of the server
-
Make a call to 100
- Docker compose file content:
asterisk:
container_name: asterisk_pbx
image: hibou/asterisk:14
ports:
- "5060:5060/udp"
- "5060:5060/tcp"
- "16384-16394:16384-16394/udp"
- "8088:8088"
- "8089:8089"
volumes:
- "./.docker/config/asterisk/sip.conf:/etc/asterisk/sip.conf"
- "./.docker/config/asterisk/extensions.conf:/etc/asterisk/extensions.conf"
- "./.docker/config/asterisk/pjsip.conf:/etc/asterisk/pjsip.conf"
- "./.docker/config/asterisk/rtp.conf:/etc/asterisk/rtp.conf"
labels:
- "traefik.enable=false"
- Dockerfile content:
FROM centos:6
# Set up EPEL
RUN curl -L http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm -o /tmp/epel-release-6-8.noarch.rpm && \
rpm -ivh /tmp/epel-release-6-8.noarch.rpm && \
rm -f /tmp/epel-release-6-8.noarch.rpm
# Update and install asterisk
RUN yum update -y && yum install -y asterisk
# Set config as a volume
VOLUME /etc/asterisk
# And when the container is started, run asterisk
ENTRYPOINT [ "/usr/sbin/asterisk", "-fcvvvv" ]
- Setup the config files: sip/pjsip/extnesions/rtp. Follow the link above on
the content needed, and for
rtp.conf
, use:
rtpstart=16384
rtpend=16394
4 Start docker
docker-compose up
- Connect using a softphone, where the domain is 0.0.0.0 for the container