[Asterisk-code-review] res pjsip: set callerid tag to empty string (asterisk[13])
George Joseph
asteriskteam at digium.com
Tue Oct 16 10:13:03 CDT 2018
George Joseph has submitted this change and it was merged. ( https://gerrit.asterisk.org/10476 )
Change subject: res_pjsip: set callerid_tag to empty string
......................................................................
res_pjsip: set callerid_tag to empty string
This patch sets the callerid_tag to empty string by default.
If the callerid_tag is set to NULL then the tag does not
become part of a connected line update.
For example:
Alice's tag is "Alice".
Bob's tag is empty.
Charlie's tag is "Charlie".
Alice calls Bob and then does attended transfer to Charlie.
When Alice hangs up the CONNECTEDLINE(tag) is "Alice"
on the interception routine on the Charlie's channel, but should be empty.
Ths patch also fix memory leaks if there are more then one options
"callerid", "callerid_tag", "voicemail_extension" and "contact_user"
in the pjsip.conf endpoint definition.
Change-Id: I86ba455c4677ca8d516d9a04ce7fb4d24dd576e4
---
M res/res_pjsip/pjsip_configuration.c
1 file changed, 15 insertions(+), 4 deletions(-)
Approvals:
Richard Mudgett: Looks good to me, but someone else must approve
Joshua Colp: Looks good to me, approved
George Joseph: Approved for Submit
diff --git a/res/res_pjsip/pjsip_configuration.c b/res/res_pjsip/pjsip_configuration.c
index b0eb2d4..477b317 100644
--- a/res/res_pjsip/pjsip_configuration.c
+++ b/res/res_pjsip/pjsip_configuration.c
@@ -590,6 +590,13 @@
char cid_name[80] = { '\0' };
char cid_num[80] = { '\0' };
+ ast_free(endpoint->id.self.name.str);
+ endpoint->id.self.name.str = NULL;
+ endpoint->id.self.name.valid = 0;
+ ast_free(endpoint->id.self.number.str);
+ endpoint->id.self.number.str = NULL;
+ endpoint->id.self.number.valid = 0;
+
ast_callerid_split(var->value, cid_name, sizeof(cid_name), cid_num, sizeof(cid_num));
if (!ast_strlen_zero(cid_name)) {
endpoint->id.self.name.str = ast_strdup(cid_name);
@@ -656,7 +663,10 @@
static int caller_id_tag_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
{
struct ast_sip_endpoint *endpoint = obj;
+
+ ast_free(endpoint->id.self.tag);
endpoint->id.self.tag = ast_strdup(var->value);
+
return endpoint->id.self.tag ? 0 : -1;
}
@@ -1059,6 +1069,7 @@
{
struct ast_sip_endpoint *endpoint = obj;
+ ast_free(endpoint->subscription.mwi.voicemail_extension);
endpoint->subscription.mwi.voicemail_extension = ast_strdup(var->value);
return endpoint->subscription.mwi.voicemail_extension ? 0 : -1;
@@ -1078,12 +1089,10 @@
{
struct ast_sip_endpoint *endpoint = obj;
+ ast_free(endpoint->contact_user);
endpoint->contact_user = ast_strdup(var->value);
- if (!endpoint->contact_user) {
- return -1;
- }
- return 0;
+ return endpoint->contact_user ? 0 : -1;
}
static int contact_user_to_str(const void *obj, const intptr_t *args, char **buf)
@@ -2028,7 +2037,9 @@
ao2_cleanup(endpoint);
return NULL;
}
+
ast_party_id_init(&endpoint->id.self);
+ endpoint->id.self.tag = ast_strdup("");
if (AST_VECTOR_INIT(&endpoint->ident_method_order, 1)) {
return NULL;
--
To view, visit https://gerrit.asterisk.org/10476
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-MessageType: merged
Gerrit-Change-Id: I86ba455c4677ca8d516d9a04ce7fb4d24dd576e4
Gerrit-Change-Number: 10476
Gerrit-PatchSet: 3
Gerrit-Owner: Alexei Gradinari <alex2grad at gmail.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Jenkins2 (1000185)
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20181016/1236c395/attachment-0001.html>
More information about the asterisk-code-review
mailing list