]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
res_pjsip: Move tenantid to end of ast_sip_endpoint
authorGeorge Joseph <gjoseph@sangoma.com>
Wed, 6 Nov 2024 17:31:08 +0000 (10:31 -0700)
committerAsterisk Development Team <asteriskteam@digium.com>
Mon, 2 Jun 2025 13:37:24 +0000 (13:37 +0000)
The tenantid field was originally added to the ast_sip_endpoint
structure at the end of the AST_DECLARE_STRING_FIELDS block.  This
caused everything after it in the structure to move down in memory
and break ABI compatibility.  It's now at the end of the structure
as an AST_STRING_FIELD_EXTENDED.  Given the number of string fields
in the structure now, the initial string field allocation was
also increased from 64 to 128 bytes.

Resolves: #982
(cherry picked from commit 5a335b880d4ad321881294c7e9124166ca90adb9)

include/asterisk/res_pjsip.h
res/res_pjsip/pjsip_configuration.c

index a12ef3c3dd1883198989a8af5885470b694f4673..2ae806e0e355844b5af0ecae00a107f2e2793fd2 100644 (file)
@@ -911,8 +911,6 @@ struct ast_sip_endpoint {
                AST_STRING_FIELD(incoming_mwi_mailbox);
                /*! STIR/SHAKEN profile to use */
                AST_STRING_FIELD(stir_shaken_profile);
-               /*! Tenant ID for the endpoint */
-               AST_STRING_FIELD(tenantid);
        );
        /*! Configuration for extensions */
        struct ast_sip_endpoint_extensions extensions;
@@ -986,6 +984,8 @@ struct ast_sip_endpoint {
        AST_STRING_FIELD_EXTENDED(geoloc_incoming_call_profile);
        /*! The name of the geoloc profile to apply when Asterisk sends a call to this endpoint */
        AST_STRING_FIELD_EXTENDED(geoloc_outgoing_call_profile);
+       /*! Tenant ID for the endpoint */
+       AST_STRING_FIELD_EXTENDED(tenantid);
 };
 
 /*! URI parameter for symmetric transport */
index d895cd7104522b289fb9fcb183e6c575c32d3f57..93bf9898b7f0178c5bd1334af33853794ad6cf3f 100644 (file)
@@ -2383,7 +2383,7 @@ void *ast_sip_endpoint_alloc(const char *name)
        if (!endpoint) {
                return NULL;
        }
-       if (ast_string_field_init(endpoint, 64)) {
+       if (ast_string_field_init(endpoint, 128)) {
                ao2_cleanup(endpoint);
                return NULL;
        }
@@ -2393,6 +2393,10 @@ void *ast_sip_endpoint_alloc(const char *name)
                ao2_cleanup(endpoint);
                return NULL;
        }
+       if (ast_string_field_init_extended(endpoint, tenantid)) {
+               ao2_cleanup(endpoint);
+               return NULL;
+       }
 
        if (!(endpoint->media.codecs = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT))) {
                ao2_cleanup(endpoint);