OpenSIPS Architecture Layers

Core Engine: The foundation that initializes the system (main.c), parses configuration files (cfg.y, cfg.lex), and executes routing scripts (route.c, action.c). The context.c framework provides extensible data attachment to transactions and dialogs.
Transaction State Layer (TM Module): Provides stateful SIP transaction handling via the tm module. Core files include t_lookup.c for transaction matching, t_reply.c for response handling, and t_fwd.c for request forwarding. This layer handles retransmissions, request forking, and maintains transaction state.
Call State Layer (Dialog Module): Sits above TM to track complete SIP dialogs (calls). The dialog module (dlg_hash.c, dlg_handlers.c) maintains dialog state throughout the entire call lifecycle, providing timeout management, dialog profiling, and keep-alive mechanisms.
Advanced Features: Modules like B2B (b2b_entities, b2b_logic), presence, routing (drouting), and media control (rtpengine) build on top of the dialog and transaction layers.