mirror of
https://github.com/baresip/baresip
synced 2026-08-07 00:26:06 -04:00
## Summary This PR adds a call-level callback for incoming SIP INFO requests. The new callback allows applications embedding baresip to inspect and handle incoming SIP INFO messages directly from the call layer. The callback exposes: - the related `struct call` - the SIP INFO `Content-Type` - the raw body payload - the body length - the original `struct sip_msg` - custom SIP headers through the original SIP message reference ## Changes Added a new SIP INFO handler type: ```C typedef bool (call_sip_info_h)(struct call *call, const char *content_type, const uint8_t *body, size_t body_len, const struct sip_msg *msg, void *arg); ``` Added a public registration API: ```C void call_set_sip_info_handler(call_sip_info_h *handler, void *arg); ``` Added internal SIP INFO event emission: ```c call_emit_sip_info(call, msg); ``` Added a new internal helper: ```c static void call_emit_sip_info(struct call *call, const struct sip_msg *msg); ``` The helper extracts the SIP INFO `Content-Type`, including optional content-type parameters, maps the SIP message body from the SIP message buffer, and invokes the registered application handler. The callback return value is propagated as `app_handled`, allowing the call code to know whether the SIP INFO request was handled by the application layer. ## Motivation Some applications use SIP INFO for custom in-call signaling, not only for standard DTMF-related use cases. For example, applications may need to receive custom commands, metadata, or vendor-specific headers carried inside SIP INFO requests. Before this change, there was no clean call-level API for applications or SDK wrappers to receive incoming SIP INFO messages while preserving access to the raw body and original SIP headers. |
||
|---|---|---|
| .. | ||
| baresip.h | ||