From 6dca261bddd2d6e233814b8537896b0f7853246f Mon Sep 17 00:00:00 2001 From: Max Grobecker Date: Sun, 21 Sep 2025 15:34:56 +0200 Subject: [PATCH] res_pjsip_geolocation: Add support for Geolocation loc-src parameter This adds support for the Geolocation 'loc-src' parameter to res_pjsip_geolocation. The already existing config option 'location_source` in res_geolocation is documented to add a 'loc-src' parameter containing a user-defined FQDN to the 'Geolocation:' header, but that option had no effect as it was not implemented by res_pjsip_geolocation. If the `location_source` configuration option is not set or invalid, that parameter will not be added (this is already checked by res_geolocation). This commits adds already documented functionality. --- res/res_pjsip_geolocation.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/res/res_pjsip_geolocation.c b/res/res_pjsip_geolocation.c index 422c56d5f9..0053943dcb 100644 --- a/res/res_pjsip_geolocation.c +++ b/res/res_pjsip_geolocation.c @@ -602,10 +602,13 @@ static void handle_outgoing_request(struct ast_sip_session *session, struct pjsi uri = ast_strdupa(ast_str_buffer(buf)); ast_str_reset(buf); ast_str_set(&buf, 0, "<%s>", uri); + if (!ast_strlen_zero(final_eprofile->location_source)) { + ast_str_append(&buf, 0, ";loc-src=%s", final_eprofile->location_source); + } uri = ast_strdupa(ast_str_buffer(buf)); - ast_trace(4, "%s: Using URI '%s'\n", session_name, uri); + /* It's almost impossible for add header to fail but you never know */ geoloc_hdr = ast_sip_add_header2(tdata, "Geolocation", uri); if (geoloc_hdr == NULL) {