]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
ari: Provide the caller ID RDNIS for the channels
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>
Sat, 14 Oct 2023 07:48:10 +0000 (15:48 +0800)
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>
Tue, 7 Nov 2023 14:27:12 +0000 (14:27 +0000)
Provide the caller ID RDNIS when available. This will allow an
application to follow the redirect.

main/stasis_channels.c
res/ari/ari_model_validators.c
res/ari/ari_model_validators.h
rest-api/api-docs/channels.json

index 97024ea4df0489d7bba472c2b35f44f8e9ee8533..e37c5ca5c3275029bea17481e43ad9543c9572a9 100644 (file)
@@ -1323,6 +1323,10 @@ struct ast_json *ast_channel_snapshot_to_json(
                "creationtime", ast_json_timeval(snapshot->base->creationtime, NULL),
                "language", snapshot->base->language);
 
+       if (!ast_strlen_zero(snapshot->caller->rdnis)) {
+               ast_json_object_set(json_chan, "caller_rdnis", ast_json_string_create(snapshot->caller->rdnis));
+       }
+
        if (snapshot->ari_vars && !AST_LIST_EMPTY(snapshot->ari_vars)) {
                ast_json_object_set(json_chan, "channelvars", ast_json_channel_vars(snapshot->ari_vars));
        }
index fffb87a1624f047c3afe8c71414d44a0c04a73b4..a5ba5cc768d134555d223453bb10340ae582de6f 100644 (file)
@@ -1067,6 +1067,15 @@ int ast_ari_validate_channel(struct ast_json *json)
                                res = 0;
                        }
                } else
+               if (strcmp("caller_rdnis", ast_json_object_iter_key(iter)) == 0) {
+                       int prop_is_valid;
+                       prop_is_valid = ast_ari_validate_string(
+                               ast_json_object_iter_value(iter));
+                       if (!prop_is_valid) {
+                               ast_log(LOG_ERROR, "ARI Channel field caller_rdnis failed validation\n");
+                               res = 0;
+                       }
+               } else
                if (strcmp("channelvars", ast_json_object_iter_key(iter)) == 0) {
                        int prop_is_valid;
                        prop_is_valid = ast_ari_validate_object(
index 64f167c07cdc1dd20994636980ba16fd055c2a36..f350c8de33c8455c29c75e48244a28b6fee4ad53 100644 (file)
@@ -1346,6 +1346,7 @@ ari_validator ast_ari_validate_application_fn(void);
  * Channel
  * - accountcode: string (required)
  * - caller: CallerID (required)
+ * - caller_rdnis: string
  * - channelvars: object
  * - connected: CallerID (required)
  * - creationtime: Date (required)
index e3b4fcbbbadb2f4e303952183b9decc98a190b59..90658039685b456ba6c11dec5ebd1f8a85b05901 100644 (file)
                                        "required": false,
                                        "type": "object",
                                        "description": "Channel variables"
+                               },
+                               "caller_rdnis": {
+                                       "type": "string",
+                                       "description": "The Caller ID RDNIS"
                                }
                        }
                }