[Asterisk-code-review] chan_dahdi: Fix Caller ID presentation for FXO ports. (asterisk[master])

N A asteriskteam at digium.com
Fri Nov 25 19:22:09 CST 2022


N A has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/19603 )


Change subject: chan_dahdi: Fix Caller ID presentation for FXO ports.
......................................................................

chan_dahdi: Fix Caller ID presentation for FXO ports.

Currently, the presentation for incoming channels is
always available, because it is never actually set,
meaning the channel presentation can be nonsensical.
If the presentation from the incoming Caller ID spill
is private or unavailable, we now update the channel
presentation to reflect this.

ASTERISK-30333 #close

Change-Id: Ic16111998ae82eaf3068c1fe889c1ffdf81c9dde
---
M channels/chan_dahdi.c
1 file changed, 30 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/03/19603/1

diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c
index 5607eb0..f2b707f 100644
--- a/channels/chan_dahdi.c
+++ b/channels/chan_dahdi.c
@@ -1447,6 +1447,18 @@
 			if (num)
 				ast_copy_string(numbuf, num, ANALOG_MAX_CID);
 
+			if (flags & (CID_PRIVATE_NUMBER | CID_UNKNOWN_NUMBER)) {
+				/* If we got a presentation, we must set it on the channel */
+				struct ast_channel *chan = analog_p->ss_astchan;
+				struct ast_party_caller caller;
+
+				ast_party_caller_set_init(&caller, ast_channel_caller(chan));
+				caller.id.name.presentation = caller.id.number.presentation = (flags & CID_PRIVATE_NUMBER) ?
+					AST_PRES_RESTRICTED | AST_PRES_USER_NUMBER_UNSCREENED : AST_PRES_UNAVAILABLE | AST_PRES_USER_NUMBER_UNSCREENED;
+				ast_party_caller_set(ast_channel_caller(chan), &caller, NULL);
+				ast_party_caller_free(&caller);
+			}
+
 			ast_debug(1, "CallerID number: %s, name: %s, flags=%d\n", num, name, flags);
 			return 0;
 		}

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/19603
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: Ic16111998ae82eaf3068c1fe889c1ffdf81c9dde
Gerrit-Change-Number: 19603
Gerrit-PatchSet: 1
Gerrit-Owner: N A <asterisk at phreaknet.org>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20221126/02c4cffd/attachment-0001.html>


More information about the asterisk-code-review mailing list