The caller hears a recording. After it finishes, they press 1 and the call goes to the director. A second recording lets them press 1 while it is still playing. There is no agent. Your server does not hard-code the extension. It reads the director from your own database.
1. Records in DotSIP
- Under SIP accounts, keep the trunk that receives the call. If it has no inbound route, the call uses route-tools.
- Under Routes, edit route-tools. Scheme http or https, URL http://127.0.0.1:9099/route if the server runs on the same machine. Timeout 5000. Save.
- Under SIP phones, create user 200, display name Director, a password, and enabled. Register the director’s phone to DotSIP with that user.
- Put welcome.wav and welcome-barge.wav in data/media. Mono PCM16, 8000, 16000, or 24000 Hz. Not MP3.
2. Your database
This file is yours. It is not data/dotsip.sqlite.
CREATE TABLE menu (
digit TEXT PRIMARY KEY,
phone TEXT NOT NULL,
media TEXT NOT NULL,
barge_in INTEGER NOT NULL
);
INSERT INTO menu(digit, phone, media, barge_in) VALUES
('after', '200', 'welcome.wav', 0),
('during', '200', 'welcome-barge.wav', 1);
The samples below create this table on first start. Change the row when the director’s extension changes. Restarting DotSIP is not required for that.
3. What DotSIP posts
{
"format": "dotsip.route",
"format_version": 1,
"direction": "inbound",
"call_id": "c-7f3a",
"sip_account": { "id": "trunk", "name": "trunk" },
"sip_phone": null,
"dialed": "101",
"route": "route-tools",
"caller": { "number": "+421901234567", "name": null, "rights": null, "groups": [] }
}
Your server answers HTTP 200 with the plan. barge_in false waits until the WAV ends. barge_in true stops the WAV when a key is pressed. The phone in the plan is the phone column, which must match the SIP phone user 200.
4. The server
One process, three languages. It reads menu and returns the plan. Query ?barge=1 to use the during-playback row. The route URL in DotSIP is then http://127.0.0.1:9099/route?barge=1.
PHP is php -S 127.0.0.1:9099 server.php. Python is Flask on the same port. Node.js 22 or newer has node:sqlite. Call the trunk, hear the file, press 1. Extension 200 must ring. If the file is skipped, the WAV is missing or not mono PCM16.