]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
res_pjsip_geolocation: Add support for Geolocation loc-src parameter
authorMax Grobecker <m.grobecker@portunity.de>
Sun, 21 Sep 2025 13:34:56 +0000 (15:34 +0200)
committerMax Grobecker <m.grobecker@portunity.de>
Tue, 30 Sep 2025 13:53:36 +0000 (13:53 +0000)
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

index 422c56d5f9a9421cbf6a56f93fd24009027f7e4d..0053943dcbb2b77dd03085b8d58323c69ad19bd5 100644 (file)
@@ -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) {