CMS:Panel gen

panel_gen is software written by Sarah Autumn for the museum. It generates call traffic on the museum's switches to illustrate how they would have looked and sounded while in active service. It also functions as a load box for the machines, both for testing purposes, and for regularly exercising the mechanical apparatus.
Background
In 2017, Sarah visited the collection of Phil McCarter in Oregon. Among other things, Phil demonstrated call generation software written for him by fellow collector Shane Young. As Sarah walked through Phil's switchroom, she was inspired to create similar software for the Connections Museum.
Sarah began writing the code in Python with significant input from fellow volunteer æstrid Smith. Originally designed to be run as a console only application, it has evolved significantly over the years to be a full-featured application that is used regularly at the museum.
Design
panel_gen is normally run as a systemd
service, and consists of three main files:
- a core program in
panel_gen.py
- a REST API and browser-based web UI in
http_server.py
- a ncurses console app in
console.py

Although it is easily configured for different switching requirements, it is not designed to be portable beyond kercheep, due to the specialized requirements imposed on it by the hardware and software that it interacts with.
It is configured by modifying /etc/panel_gen.conf
, and then restarting the service. The configuration framework was specifically designed to allow the user to shape the call load for each switch based on the available equipment at the museum. Thus, the program should act safely, while still maintaining a reasonable load on the switches.
The software provides three human interfaces:
- an ncurses console app (
console.py
) which displays a realtime view of the program's status - a simple web UI which can be viewed as an "app" on smartphones. The UI presents "START" and "STOP" buttons for each switch, along with a large red "FORCE STOP" button which stops calls on all switches immediately.
- physical keys and lamps placed in the telephone switches themselves. The keys can be used to start or stop calls, and adjust the traffic level to low or high.
Implementation
The call simulator relies on Asterisk and DAHDI to provide the underlying framework for actually placing real telephone calls. The host computer, kercheep, is connected via several T1 spans to ADITs placed around the museum. When Asterisk is instructed by panel_gen
to place a call, it does so through DAHDI to the ADIT, and then out to a subscriber line on the switches themselves.
The call simulator program itself has two main objectives:
- to provide a user interface for humans
- to provide a set of switch objects and line objects that can be acted upon
When the program is run, several Switch
objects are created from information in the .conf file. Each Switch
object mirrors one of the physical switches at the museum. At the same time, several Line
objects are created and then those lines are made into members of each Switch
, again depending on the particulars defined in the .conf file. Each Line
is associated with a timer, which declares when the next action will be taken on that line. Actions include state changes such as go off-hook and dial, or hangup. The length of the timer for each line is determined by a user-defined bell curve, and is generated "randomly" within that curve each time the line's status changes.
Timers are decremented by one each second. When a timer reaches "0", the current state of the Line
is evaluated, and the line is put into the next logical state. This is done for each line on each switch, continuously.
# Sample code that illustrates what happens when a line timer == 0 if self.timer <= 0: if self.ast_status == "on_hook": if self.switch.is_dialing < self.switch.max_dialing: # Place a new call. self.call() else: # Back off until some calls complete. self.timer = random.gamma(4,4) elif self.ast_status == "Dialing" or self.ast_status == "Ringing": self.hangup()
The call()
function places a preformatted file in the /var/spool/asterisk/outgoing/
directory, which Asterisk monitors continuously. When Asterisk sees a valid call file, it uses the contents of that file to place a call to a destination on a channel. Meanwhile, panel_gen observes feedback from the Asterisk AMI of the call being placed, and starts a new timer which will hang up the call.
External Links
- panel_gen on github - The official repository for the software
- tinyrobot on github - the software for the microcontrollers that start and stop panel_gen