NethVoice CTI is a web application allows the user to have a web phone to manage calls, modify the phonebook, handle the queues of a switchboard, use the chat between connected users and much more.
To better understand the needs of the different types of user who use NethVoice CTI, this file on Figma identifies 4 Personas.
- components - contains the reusable components
- The components are divided in subdirectories by macrosection, for example:
- history
- layout
- login
- operators
- phonebook
- common
- settings
- The components are divided in subdirectories by macrosection, for example:
- config - contains the configuration files for the app
- Build and project configuration are in the root directory of the project
- lib - contains functions that can be extracted from components
- The files are divided by context, for example:
- login.ts
- notification.ts
- operators.ts
- phonebook.ts
- websocket.ts
- util.ts
- The files are divided by context, for example:
- pages - contains all the pages of the application
- There is a file for every app route, check the Next.js routing docs for more info
- models - contains the models used by rematch
- Check the rematch models docs for more info
- public - contains the static files
- services - contains the requests to the server's APIs
- store - contains the stores for rematch
- Check the rematch store docs for more info
- styles - contains the styling files
- theme - contains classes used by the common components
The project is initialized using Next.js with Typescript and uses Tailwind CSS for the design.
- rematch & react-redux - for the management of the shared state between components
- axios - for the http requests
- janus-gateway - for comunication with the WebRTC server
- socket.io - for web socket connections
Requirements
- Node.js 12.22.0 or later
Install dependencies
npm install
Run locally in development mode:
npm run dev
Build locally:
npm run build
Start locally:
npm start
Other command could be available in package.json scripts.
To ensure a good development experince the following extensions are recommended for vscode:
The project can be locally built through containers.
Requirements
Clone this repository
git clone https://github.com/nethesis/nethvoice-cti.git
cd nethvoice-cti
Create the container image:
Requires
- Access to github.com/nethesis/nethesis-icons
- A valid token with repo permission of your GitHub account
podman build --env ICONS_TOKEN=<YOUR_VALID_GH_TOKEN> -t ghcr.io/nethesis/nethvoice-cti .
It returns the image_id.
Note: the image is automatically built on GitHub actions on each push.
The project can be deployed through containers.
It is possible to specify some variables through environment:
PRODUCT_NAME (default: "NethVoice CTI")
COMPANY_NAME (default: "Nethesis")
COMPANY_SUBNAME (default: "CTI")
COMPANY_URL (default: "https://www.nethesis.it/")
LOGIN_PEOPLE (rebranding of the login people image: it can be shown or hidden based on the value (show or hide string value))
NAVBAR_LOGO_URL (rebranding of navbar logo: specify a URL to a SVG image)
NAVBAR_LOGO__DARK_URL (rebranding of navbar logo: specify a URL to a SVG image)
LOGIN_LOGO_URL (rebranding of login logo: specify a URL to a SVG image)
LOGIN_LOGO_DARK_URL (rebranding of login logo in dark mode: specify a URL to a SVG image)
FAVICON_URL (used for rebranding: specify a URL to an ICO image)
LOGIN_BACKGROUND_URL (used for rebranding: specify a URL to a SVG image)
API_ENDPOINT (default: host + port + path)
API_SCHEME (default: current protocol ["http://"|"https://"])
WS_ENDPOINT (default: wss://host + port + path + "/ws")
SIP_HOST (default: "127.0.0.1")
SIP_PORT (default: "5060")
To change the logos and background of application you have to set these enviroment variables (reference of variables type above):
- LOGIN_PEOPLE
- NAVBAR_LOGO_URL
- NAVBAR_LOGO__DARK_URL
- LOGIN_LOGO_URL
- LOGIN_LOGO_DARK_URL
- FAVICON_URL
- LOGIN_BACKGROUND_URL
Run the container specifying an API endpoint :
podman run --rm --name nethvoice-cti --env='API_ENDPOINT=nethvoice.nethesis.it' -p 3000:3000/tcp ghcr.io/nethesis/nethvoice-cti:latest
Run the container with custom logos and background :
podman run --tz='Europe/Rome' --rm --name nethvoice-cti \
--env='API_ENDPOINT=cti.nethesis.it' \
--env='API_SCHEME=https://' \
--env='LOGIN_PEOPLE=hide' \
--env="TIMEZONE=Europe/Rome" \
--env="HOST=127.0.0.1" \
--env='LOGIN_BACKGROUND_URL=https://upload.wikimedia.org/wikipedia/commons/6/6b/Bitmap_VS_SVG.svg' \
--env='FAVICON_URL=https://www.favicon.cc/logo3d/85805.png' \
--env='NAVBAR_LOGO_URL=https://upload.wikimedia.org/wikipedia/commons/8/80/Atom_editor_logo.svg' \
--env='NAVBAR_LOGO_DARK_URL=https://upload.wikimedia.org/wikipedia/commons/8/80/Atom_editor_logo.svg' \
--env='LOGIN_LOGO_URL=https://upload.wikimedia.org/wikipedia/commons/4/4f/SVG_Logo.svg' \
--env='LOGIN_LOGO_DARK_URL=https://upload.wikimedia.org/wikipedia/commons/4/4f/SVG_Logo.svg' \
-p 3000:3000 ghcr.io/nethesis/nethvoice-cti:latest
If port 3000 is already in use, replace it with a free one.
The project will be available on localhost:3000
CTI color palette is defined in tailwind.config.js
and consists of five shades of a primary color (currently green). These five shades are named:
primary
primaryLighter
primaryLight
primaryDark
primaryDarker
Most of UI components are derived from Tailwind UI. Tailwind code needs to be adapted to use CTI color palette and to support dark mode, so:
- every Tailwind class that is color related (e.g.
bg-sky-100
,text-indigo-600
) needs to be changed in order to use CTI color palette - for every Tailwind class that is color related, a
dark:
class must be added to specify the color used in dark mode
See next paragraphs for details.
Tailwind CSS represents color shades with numbers from 50 (lightest) to 900 (darkest). Here are some examples to adapt color related classes included in Tailwind components for CTI color palette:
bg-sky-600
becomesbg-primary
bg-sky-700
becomesbg-primaryDark
text-sky-900
becomestext-primaryDarker
border-sky-100
becomesborder-primaryLighter
ring-sky-500
becomesring-primaryLight
- Never use
white
andblack
colors in dark mode. Usegray-100
(very light gray) andgray-900
(very dark gray) instead - The sum of color shades in light and dark mode should be about 900 (e.g. 100+800, 300+600, 400+500). In dark mode light colors become dark, and dark colors become light
- Sometimes, little manual adjustments are needed (e.g. to make an icon more legible in dark mode)
- Some examples:
bg-white
: add classdark:bg-gray-900
(don't useblack
)bg-gray-100
: add classdark:bg-gray-800
bg-gray-400
: add classdark:bg-gray-500
text-gray-600
: add classdark:text-gray-300
text-gray-900
: add classdark:text-gray-100
(don't usewhite
)bg-primary
: add classdark:bg-primary
(primary color is unchanged in dark mode)ring-primaryLight
: add classdark:ring-primaryDark
text-primaryDarker
: add classdark:text-primaryLighter
More examples are included in this PR