STM32 SIP User Agent

This is a simple SIP/VoIP application running on STM32F429ZI nucleo board (Cortex-M4, 256 kB RAM). It is based on re/rem/baresip and other commercially-friendly (BSD/MIT licenses, e.g. FreeRTOS v10) components.

Bit of warning: SIP is memory intensive and actual memory usage is depending very much on traffic volume and required functionality. STM32 or similar microcontroller has a small fraction of resources available to Linux SBCs or PCs and would have problems handling multiple simultaneous SIP transactions/dialogs or high call rate. Heap can be depleted pretty quickly, heap fragmentation might also be a problem. Using a microcontroller in a large network with hard to predict traffic bursts might not be a good idea in general.

Compiling/programming/debugging

I've used EmBitz 1.11 for this project - a 50 MB installer contains everything that is needed to compile sources and debugging is also quite smooth. It looks like there is no official download source for this version at the moment, so just in case I've uploaded it as https://github.com/tomek-o/EmBitz-1.11.
One annoyance to be aware of is that if one of library projects (e.g. re/rem/baresip) changes then top-level project may not see this update automatically and might need forcing relinking by e.g. modifying any source file.
STM32 SIP EmBitz

Nucleo board has built-in ST-Link programmer/debugger supporting also virtual serial port used for logging. Opening serial terminal (115200 8N1) is highly recommended - logs include e.g. heap memory usage reports after each SIP call.
STM32F429 nucleo

I've used the same board previously for Scream receiver and RTP pager.

STM32 SIP serial output

This application has no user configuration at the moment (it can be configured only by changing source code and recompiling). Network can be configured to start with a DHCP client, if DHCP fails switching to static IP (192.168.10.11 with netmask 255.255.254.0 as set in main.h), although at the moment DHCP is not enabled (again: see main.h). Application resembles the functionality of a simple SIP audio gate: it answers any incoming call and plays received audio through STM32 built-in DAC. In the other direction only silence is transmitted ("nullaudio" audio source device is selected).

You can connect DAC outputs to some amplifier (I guess some resistor and DC-blocking capacitor in series would be recommended) or use DAC to directly drive headphones (in this case 1 kOhm resistor in series for each DAC output should be used).

I've slightly changed (halved) SIP timers (T1, T2, T4) from their default re values as default SIP timer values are rather long (500 ms T1) and shortening them helps reducing memory usage in some cases.

Included audio codecs:

Actual RAM usage: almost all of 192 kB "main" SRAM is allocated, starting with 112 kB FreeRTOS heap. 64 kB of CCM is not used at the moment.

Testing

Any SIP softphone or desk phone capable of direct IP/p2p calling should work. I might recommend using tSIP. For clean, not configured yet copy you would need to:

Github: https://github.com/tomek-o/STM32-SIP.

Releases: