<blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;"><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;"><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;"><p style="white-space: pre-wrap; word-wrap: break-word;">May be better to set caller_id_tag to empty string only for<br>res_pjsip.<br>For example inside sip_endpoint_apply_handler() could be added<br>if (!endpoint->id.self.tag) {<br>endpoint->id.self.tag=ast_strdup("");<br>}<br>That makes a lot of sense.<br>ast_sip_endpoint_alloc() needs to set the tag to an empty<br>ast_strdup() string after calling ast_party_id_init().<br>caller_id_tag_handler() needs to free the previous tag or we leak<br>memory. (This would be true if there were more than one<br>callerid_tag in the pjsip.conf endpoint definition anyway.)</p></blockquote></blockquote><p style="white-space: pre-wrap; word-wrap: break-word;">What's the reason to assign empty value before config processing?<br>If the tag has value then will be ast_strdup()/ast_free()/ast_strdup().<br>If assign empty value after config processing at sip_endpoint_apply_handler()<br>then will be only one ast_strdup() in any cases.</p></blockquote><p style="white-space: pre-wrap; word-wrap: break-word;">It needs to be set in ast_sip_endpoint_alloc() to ensure that someone<br>calling ast_sorcery_alloc() will have an empty tag string set. ast_sorcery_alloc()<br>creates the specified sorcery object and applies the default values to it.<br>Defaults do not normally apply empty strings to objects (see aco_set_defaults())<br>so they would be a NULL pointer or whatever the object's alloc function<br>(ast_sip_endpoint_alloc()) set it to.</p><p><a href="https://gerrit.asterisk.org/10286">View Change</a></p><ul style="list-style: none; padding: 0;"></ul><p>To view, visit <a href="https://gerrit.asterisk.org/10286">change 10286</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/10286"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 13 </div>
<div style="display:none"> Gerrit-MessageType: comment </div>
<div style="display:none"> Gerrit-Change-Id: I6ce9e151a2220ce9e95aa66666933cfb9e2a4a01 </div>
<div style="display:none"> Gerrit-Change-Number: 10286 </div>
<div style="display:none"> Gerrit-PatchSet: 3 </div>
<div style="display:none"> Gerrit-Owner: Alexei Gradinari <alex2grad@gmail.com> </div>
<div style="display:none"> Gerrit-Reviewer: Alexei Gradinari <alex2grad@gmail.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins2 (1000185) </div>
<div style="display:none"> Gerrit-Reviewer: Richard Mudgett <rmudgett@digium.com> </div>
<div style="display:none"> Gerrit-Comment-Date: Thu, 11 Oct 2018 22:13:17 +0000 </div>
<div style="display:none"> Gerrit-HasComments: No </div>
<div style="display:none"> Gerrit-HasLabels: No </div>