]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
chan_dahdi: Fix Caller ID presentation for FXO ports.
authorNaveen Albert <asterisk@phreaknet.org>
Thu, 25 May 2023 23:49:35 +0000 (23:49 +0000)
committerAsterisk Development Team <asteriskteam@digium.com>
Mon, 10 Jul 2023 11:49:47 +0000 (11:49 +0000)
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.

Resolves: #120
ASTERISK-30333
ASTERISK-21741

(cherry picked from commit 86a11d5b19f8c52a8e57bc09792c0f8e664f555f)

channels/chan_dahdi.c

index 36d2c08110a9b02ca8e655c8681714338f33230c..db1bc6505bc86af5c312452568a06c2320a7b9bd 100644 (file)
@@ -1459,6 +1459,18 @@ static int my_get_callerid(void *pvt, char *namebuf, char *numbuf, enum analog_e
                        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;
                }