Asterisk - The Open Source Telephony Project GIT-master-f36a736
func_uuid.c
Go to the documentation of this file.
1/*
2* Asterisk -- An open source telephony toolkit.
3 *
4 * Copyright (C) 2024, Maksim Nesterov
5 *
6 * See http://www.asterisk.org for more information about
7 * the Asterisk project. Please do not directly contact
8 * any of the maintainers of this project for assistance;
9 * the project provides a web site, mailing lists and IRC
10 * channels for your use.
11 *
12 * This program is free software, distributed under the terms of
13 * the GNU General Public License Version 2. See the LICENSE file
14 * at the top of the source tree.
15 */
16
17/*! \file
18 *
19 * \brief UUID dialplan function
20 *
21 * \author Maksim Nesterov <braamsdev@gmail.com>
22 *
23 * \ingroup functions
24 */
25
26/*** MODULEINFO
27 <support_level>extended</support_level>
28 ***/
29
30#include "asterisk.h"
31
32#include "asterisk/module.h"
33#include "asterisk/pbx.h"
34#include "asterisk/uuid.h"
35
36/*** DOCUMENTATION
37 <function name="UUID" language="en_US">
38 <synopsis>
39 Generates an UUID.
40 </synopsis>
41 <syntax>
42 </syntax>
43 <description>
44 <para>Returns a version 4 (random) Universally Unique Identifier (UUID) as a string.</para>
45 <example title="Generate an UUID">
46 same => n,Set(uuid=${UUID()})
47 </example>
48 </description>
49 </function>
50 ***/
51
52static int uuid(struct ast_channel *chan, const char *cmd, char *data,
53 char *buf, size_t len)
54{
56 return 0;
57}
58
60 .name = "UUID",
61 .read = uuid,
62 .read_max = AST_UUID_STR_LEN,
63};
64
65static int unload_module(void)
66{
68}
69
70static int load_module(void)
71{
73}
74
76 "UUID generation dialplan function");
Asterisk main include file. File version handling, generic pbx functions.
char buf[BUFSIZE]
Definition: eagi_proxy.c:66
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
static int uuid(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
Definition: func_uuid.c:52
AST_MODULE_INFO_STANDARD_EXTENDED(ASTERISK_GPL_KEY, "UUID generation dialplan function")
static int load_module(void)
Definition: func_uuid.c:70
static int unload_module(void)
Definition: func_uuid.c:65
static struct ast_custom_function uuid_function
Definition: func_uuid.c:59
Asterisk module definitions.
#define ASTERISK_GPL_KEY
The text the key() function should return.
Definition: module.h:46
Core PBX routines and definitions.
#define ast_custom_function_register(acf)
Register a custom function.
Definition: pbx.h:1558
int ast_custom_function_unregister(struct ast_custom_function *acf)
Unregister a custom function.
Main Channel structure associated with a channel.
Data structure associated with a custom dialplan function.
Definition: pbx.h:118
const char * name
Definition: pbx.h:119
Universally unique identifier support.
#define AST_UUID_STR_LEN
Definition: uuid.h:27
char * ast_uuid_generate_str(char *buf, size_t size)
Generate a UUID string.
Definition: uuid.c:141