35 #include "asterisk/module.h"
384 }
else if (argc == 1 && !strcasecmp(
"valid", argv[0])) {
385 snprintf(buf, len,
"%d", name->
valid);
386 }
else if (argc == 1 && !strcasecmp(
"charset", argv[0])) {
388 }
else if (argc == 1 && !strncasecmp(
"pres", argv[0], 4)) {
423 }
else if (argc == 1 && !strcasecmp(
"valid", argv[0])) {
424 snprintf(buf, len,
"%d", number->
valid);
425 }
else if (argc == 1 && !strcasecmp(
"plan", argv[0])) {
426 snprintf(buf, len,
"%d", number->
plan);
427 }
else if (argc == 1 && !strncasecmp(
"pres", argv[0], 4)) {
459 if (subaddress->
str) {
462 }
else if (argc == 1 && !strcasecmp(
"valid", argv[0])) {
463 snprintf(buf, len,
"%d", subaddress->
valid);
464 }
else if (argc == 1 && !strcasecmp(
"type", argv[0])) {
465 snprintf(buf, len,
"%d", subaddress->
type);
466 }
else if (argc == 1 && !strcasecmp(
"odd", argv[0])) {
500 if (argc == 1 && !strcasecmp(
"all", argv[0])) {
501 snprintf(buf, len,
"\"%s\" <%s>",
504 }
else if (!strcasecmp(
"name", argv[0])) {
506 }
else if (!strncasecmp(
"num", argv[0], 3)) {
509 }
else if (!strncasecmp(
"subaddr", argv[0], 7)) {
512 }
else if (argc == 1 && !strcasecmp(
"tag", argv[0])) {
516 }
else if (argc == 1 && !strcasecmp(
"ton", argv[0])) {
519 }
else if (argc == 1 && !strncasecmp(
"pres", argv[0], 4)) {
559 }
else if (argc == 1 && !strcasecmp(
"valid", argv[0])) {
560 name->
valid = atoi(value) ? 1 : 0;
561 }
else if (argc == 1 && !strcasecmp(
"charset", argv[0])) {
567 if ((
'0' <= val[0]) && (val[0] <=
'9')) {
568 char_set = atoi(val);
575 "Unknown name char-set '%s', value unchanged\n", val);
580 }
else if (argc == 1 && !strncasecmp(
"pres", argv[0], 4)) {
587 if ((
'0' <= val[0]) && (val[0] <=
'9')) {
595 "Unknown name presentation '%s', value unchanged\n", val);
633 }
else if (argc == 1 && !strcasecmp(
"valid", argv[0])) {
634 number->
valid = atoi(value) ? 1 : 0;
635 }
else if (argc == 1 && !strcasecmp(
"plan", argv[0])) {
639 if ((
'0' <= val[0]) && (val[0] <=
'9')) {
640 number->
plan = atoi(val);
643 "Unknown type-of-number/numbering-plan '%s', value unchanged\n", val);
646 }
else if (argc == 1 && !strncasecmp(
"pres", argv[0], 4)) {
653 if ((
'0' <= val[0]) && (val[0] <=
'9')) {
661 "Unknown number presentation '%s', value unchanged\n", val);
697 }
else if (argc == 1 && !strcasecmp(
"valid", argv[0])) {
698 subaddress->
valid = atoi(value) ? 1 : 0;
699 }
else if (argc == 1 && !strcasecmp(
"type", argv[0])) {
700 subaddress->
type = atoi(value) ? 2 : 0;
701 }
else if (argc == 1 && !strcasecmp(
"odd", argv[0])) {
736 if (argc == 1 && !strcasecmp(
"all", argv[0])) {
746 id->number.valid = 1;
751 }
else if (!strcasecmp(
"name", argv[0])) {
753 }
else if (!strncasecmp(
"num", argv[0], 3)) {
756 }
else if (!strncasecmp(
"subaddr", argv[0], 7)) {
759 }
else if (argc == 1 && !strcasecmp(
"tag", argv[0])) {
762 }
else if (argc == 1 && !strcasecmp(
"ton", argv[0])) {
766 }
else if (argc == 1 && !strncasecmp(
"pres", argv[0], 4)) {
776 if ((
'0' <= val[0]) && (val[0] <=
'9')) {
784 "Unknown combined presentation '%s', value unchanged\n", val);
787 id->name.presentation = pres;
788 id->number.presentation = pres;
820 if (!callerpres_deprecate_notify) {
821 callerpres_deprecate_notify = 1;
823 " Use CALLERID(name-pres) or CALLERID(num-pres) instead.\n");
851 if (!callerpres_deprecate_notify) {
852 callerpres_deprecate_notify = 1;
854 " Use CALLERID(name-pres) or CALLERID(num-pres) instead.\n");
859 ast_log(
LOG_WARNING,
"'%s' is not a valid presentation (see 'show function CALLERPRES')\n", value);
899 if (
args.argc == 0) {
910 if (
args.argc == 2) {
916 if (member.
argc == 1 && !strcasecmp(
"all", member.
argv[0])) {
917 snprintf(buf, len,
"\"%s\" <%s>", name, num);
918 }
else if (member.
argc == 1 && !strcasecmp(
"name", member.
argv[0])) {
920 }
else if (member.
argc == 1 && !strncasecmp(
"num", member.
argv[0], 3)) {
929 if (member.
argc == 1 && !strcasecmp(
"rdnis", member.
argv[0])) {
934 }
else if (!strcasecmp(
"dnid", member.
argv[0])) {
935 if (member.
argc == 1) {
938 member.
argv[1] =
"num";
940 if (!strncasecmp(
"num", member.
argv[1], 3)) {
945 if (member.
argc == 2) {
950 }
else if (member.
argc == 3 && !strcasecmp(
"plan", member.
argv[2])) {
956 }
else if (!strncasecmp(
"subaddr", member.
argv[1], 7)) {
974 }
else if (member.
argc == 1 && !strcasecmp(
"ani2", member.
argv[0])) {
976 }
else if (!strcasecmp(
"ani", member.
argv[0])) {
977 if (member.
argc == 1) {
980 member.
argv[1] =
"num";
1032 if (!value || !chan) {
1038 if (args.
argc == 0) {
1052 if (member.
argc == 1 && !strcasecmp(
"rdnis", member.
argv[0])) {
1059 }
else if (!strcasecmp(
"dnid", member.
argv[0])) {
1061 if (member.
argc == 1) {
1064 member.
argv[1] =
"num";
1066 if (!strncasecmp(
"num", member.
argv[1], 3)) {
1071 if (member.
argc == 2) {
1079 }
else if (member.
argc == 3 && !strcasecmp(
"plan", member.
argv[2])) {
1084 if ((
'0' <= val[0]) && (val[0] <=
'9')) {
1091 "Unknown type-of-number/numbering-plan '%s', value unchanged\n", val);
1096 }
else if (!strncasecmp(
"subaddr", member.
argv[1], 7)) {
1102 member.
argv + 2, value);
1120 }
else if (member.
argc == 1 && !strcasecmp(
"ani2", member.
argv[0])) {
1124 if ((
'0' <= val[0]) && (val[0] <=
'9')) {
1132 }
else if (!strcasecmp(
"ani", member.
argv[0])) {
1134 if (member.
argc == 1) {
1137 member.
argv[1] =
"num";
1212 if (member.
argc == 1 && !strcasecmp(
"source", member.
argv[0])) {
1255 if (!value || !chan) {
1261 if (args.
argc == 0) {
1290 if (member.
argc == 1 && !strcasecmp(
"source", member.
argv[0])) {
1296 if ((
'0' <= val[0]) && (val[0] <=
'9')) {
1303 ast_log(
LOG_ERROR,
"Unknown connectedline source '%s', value unchanged\n", val);
1305 connected.
source = source;
1306 set_it(chan, &connected, NULL);
1312 set_it(chan, &connected, NULL);
1361 if (!strcasecmp(
"from", member.
argv[0])) {
1372 }
else if (!strcasecmp(
"to", member.
argv[0])) {
1383 }
else if (member.
argc == 1 && !strncasecmp(
"pres", member.
argv[0], 4)) {
1391 }
else if (member.
argc == 1 && !strcasecmp(
"reason", member.
argv[0])) {
1393 }
else if (member.
argc == 1 && !strcasecmp(
"count", member.
argv[0])) {
1428 if (!value || !chan) {
1434 if (args.
argc == 0) {
1463 if (!strcasecmp(
"from", member.
argv[0])) {
1468 set_it(chan, &redirecting, NULL);
1477 }
else if (!strcasecmp(
"to", member.
argv[0])) {
1481 set_it(chan, &redirecting, NULL);
1490 }
else if (member.
argc == 1 && !strncasecmp(
"pres", member.
argv[0], 4)) {
1496 if ((
'0' <= val[0]) && (val[0] <=
'9')) {
1504 "Unknown redirecting combined presentation '%s', value unchanged\n", val);
1510 set_it(chan, &redirecting, NULL);
1512 }
else if (member.
argc == 1 && !strcasecmp(
"reason", member.
argv[0])) {
1518 if ((
'0' <= val[0]) && (val[0] <=
'9')) {
1525 ast_log(
LOG_ERROR,
"Unknown redirecting reason '%s', value unchanged\n", val);
1527 redirecting.
reason = reason;
1528 set_it(chan, &redirecting, NULL);
1530 }
else if (member.
argc == 1 && !strcasecmp(
"count", member.
argv[0])) {
1534 if ((
'0' <= val[0]) && (val[0] <=
'9')) {
1535 redirecting.
count = atoi(val);
1536 set_it(chan, &redirecting, NULL);
1538 ast_log(
LOG_ERROR,
"Unknown redirecting count '%s', value unchanged\n", val);
1555 .
name =
"CALLERPRES",
1562 .
name =
"CONNECTEDLINE",
1568 .
name =
"REDIRECTING",
static enum ID_FIELD_STATUS party_subaddress_write(struct ast_party_subaddress *subaddress, int argc, char *argv[], const char *value)
Information needed to identify an endpoint in a call.
int presentation
Q.931 encoded presentation-indicator encoded field.
#define ast_channel_lock(chan)
static int unload_module(void)
Main Channel structure associated with a channel.
#define AST_DEFINE_APP_ARGS_TYPE(type, arglist)
Define a structure type to hold an application's arguments.
static struct ast_app_option connectedline_opts[128]
int plan
Q.931 Type-Of-Number and Numbering-Plan encoded fields.
char * str
Subscriber phone number (Malloced)
const char * ast_named_caller_presentation(int data)
Convert caller ID pres value to text code.
#define AST_MODULE_INFO_STANDARD(keystr, desc)
struct ast_party_connected_line connected
Channel Connected Line ID information.
Asterisk main include file. File version handling, generic pbx functions.
#define AST_APP_OPTIONS(holder, options...)
Declares an array of options for an application.
char * str
Subscriber phone number (Malloced)
void ast_channel_set_caller_event(struct ast_channel *chan, const struct ast_party_caller *caller, const struct ast_set_party_caller *update)
Set the caller id information in the Asterisk channel and generate an AMI event if the caller id name...
int ast_connected_line_source_parse(const char *data)
Convert connected line update source text code to value (used in config file parsing) ...
struct ast_party_caller caller
Channel Caller ID information.
int ast_callerid_split(const char *src, char *name, int namelen, char *num, int numlen)
int presentation
Q.931 presentation-indicator and screening-indicator encoded fields.
CallerID (and other GR30) management and generation Includes code and algorithms from the Zapata libr...
struct ast_party_id id
Connected party ID.
static struct ast_custom_function redirecting_function
void ast_party_connected_line_set_init(struct ast_party_connected_line *init, const struct ast_party_connected_line *guide)
Initialize the given connected line structure using the given guide for a set update operation...
#define ast_test_flag(p, flag)
static void update(int code_size, int y, int wi, int fi, int dq, int sr, int dqsez, struct g726_state *state_ptr)
struct ast_party_name name
Subscriber name.
struct ast_party_id from
Who is redirecting the call (Sent to the party the call is redirected toward)
const char * ast_connected_line_source_name(int data)
Convert connected line update source value to text code.
void ast_channel_update_redirecting(struct ast_channel *chan, const struct ast_party_redirecting *redirecting, const struct ast_set_party_redirecting *update)
Indicate that the redirecting id has changed.
static enum ID_FIELD_STATUS party_name_write(struct ast_party_name *name, int argc, char *argv[], const char *value)
static int connectedline_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
int ast_party_id_presentation(const struct ast_party_id *id)
Determine the overall presentation value for the given party.
void ast_channel_update_connected_line(struct ast_channel *chan, const struct ast_party_connected_line *connected, const struct ast_set_party_connected_line *update)
Indicate that the connected line information has changed.
void ast_party_caller_set(struct ast_party_caller *dest, const struct ast_party_caller *src, const struct ast_set_party_caller *update)
Set the caller information based on another caller source.
int ast_app_parse_options(const struct ast_app_option *options, struct ast_flags *flags, char **args, char *optstr)
Parses a string containing application options and sets flags/arguments.
int ast_redirecting_reason_parse(const char *data)
Convert redirecting reason text code to value (used in config file parsing)
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application's arguments.
struct ast_party_redirecting redirecting
Redirecting/Diversion information.
int char_set
Character set the name is using.
char * str
Subscriber name (Malloced)
void ast_party_caller_free(struct ast_party_caller *doomed)
Destroy the caller party contents.
unsigned char valid
TRUE if the subaddress information is valid/present.
static int callerpres_deprecate_notify
void ast_party_connected_line_free(struct ast_party_connected_line *doomed)
Destroy the connected line information contents.
static int callerid_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
char * str
Malloced subaddress string.
static struct ast_custom_function callerid_function
static enum ID_FIELD_STATUS party_number_write(struct ast_party_number *number, int argc, char *argv[], const char *value)
static enum ID_FIELD_STATUS party_number_read(char *buf, size_t len, int argc, char *argv[], const struct ast_party_number *number)
unsigned char odd_even_indicator
TRUE if odd number of address signals.
const char * ast_redirecting_reason_name(int data)
Convert redirecting reason value to text code.
static const char *const subnames[]
int ast_custom_function_unregister(struct ast_custom_function *acf)
Unregister a custom function.
void ast_party_dialed_set(struct ast_party_dialed *dest, const struct ast_party_dialed *src)
Set the dialed information based on another dialed source.
static int connectedline_write(struct ast_channel *chan, const char *cmd, char *data, const char *value)
struct ast_party_id id
Caller party ID.
int ast_cdr_setcid(struct ast_cdr *cdr, struct ast_channel *chan)
Initialize based on a channel.
static int callerid_write(struct ast_channel *chan, const char *cmd, char *data, const char *value)
static struct ast_custom_function callerpres_function
static enum ID_FIELD_STATUS party_name_read(char *buf, size_t len, int argc, char *argv[], const struct ast_party_name *name)
struct ast_party_id ani
Automatic Number Identification (ANI)
General Asterisk PBX channel definitions.
static enum ID_FIELD_STATUS party_subaddress_read(char *buf, size_t len, int argc, char *argv[], const struct ast_party_subaddress *subaddress)
struct ast_party_dialed::@155 number
Dialed/Called number.
Data structure associated with a custom dialplan function.
Caller Party information.
#define S_COR(a, b, c)
returns the equivalent of logic or for strings, with an additional boolean check: second one if not e...
int ast_party_name_charset_parse(const char *data)
Convert ast_party_name.char_set text code to value (used in config file parsing)
void ast_channel_set_redirecting(struct ast_channel *chan, const struct ast_party_redirecting *redirecting, const struct ast_set_party_redirecting *update)
Set the redirecting id information in the Asterisk channel.
Core PBX routines and definitions.
int ast_parse_caller_presentation(const char *data)
Convert caller ID text code to value (used in config file parsing)
static enum ID_FIELD_STATUS party_id_read(char *buf, size_t len, int argc, char *argv[], const struct ast_party_id *id)
static struct ast_app_option redirecting_opts[128]
struct ast_party_dialed dialed
Dialed/Called information.
#define ast_strdupa(s)
duplicate a string in memory from the stack
struct ast_party_subaddress subaddress
Subscriber subaddress.
Dialed/Called Party information.
void ast_party_caller_set_init(struct ast_party_caller *init, const struct ast_party_caller *guide)
Initialize the given caller structure using the given guide for a set update operation.
int plan
Q.931 Type-Of-Number and Numbering-Plan encoded fields.
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
int ani2
Automatic Number Identification 2 (Info Digits)
Connected Line/Party information.
char * ast_skip_blanks(const char *str)
Gets a pointer to the first non-whitespace character in a string.
void ast_log(int level, const char *file, int line, const char *function, const char *fmt,...)
Used for sending a log message This is the standard logger function. Probably the only way you will i...
Redirecting Line information. RDNIS (Redirecting Directory Number Information Service) Where a call d...
char * ast_trim_blanks(char *str)
Trims trailing whitespace characters from a string.
static int redirecting_write(struct ast_channel *chan, const char *cmd, char *data, const char *value)
#define ast_channel_unlock(chan)
static int redirecting_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
int source
Information about the source of an update.
struct ast_party_subaddress subaddress
Dialed/Called subaddress.
Structure used to handle boolean flags.
static int callerpres_write(struct ast_channel *chan, const char *cmd, char *data, const char *value)
Indicate what information in ast_party_connected_line should be set.
const char * ast_party_name_charset_str(int data)
Convert ast_party_name.char_set value to text code.
char * tag
User-set "tag".
int type
Q.931 subaddress type.
void ast_party_redirecting_free(struct ast_party_redirecting *doomed)
Destroy the redirecting information contents.
Indicate what information in ast_party_redirecting should be set.
int count
Number of times the call was redirected.
struct ast_party_id to
Call is redirecting to a new party (Sent to the caller)
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
static enum ID_FIELD_STATUS party_id_write(struct ast_party_id *id, int argc, char *argv[], const char *value)
Information needed to specify a number in a call.
Application convenience functions, designed to give consistent look and feel to Asterisk apps...
void ast_party_redirecting_set_init(struct ast_party_redirecting *init, const struct ast_party_redirecting *guide)
Initialize the given redirecting id structure using the given guide for a set update operation...
void ast_party_dialed_free(struct ast_party_dialed *doomed)
Destroy the dialed party contents.
#define AST_APP_ARG(name)
Define an application argument.
unsigned char valid
TRUE if the name information is valid/present.
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the 'standard' argument separation process for an application.
Information needed to specify a subaddress in a call.
#define AST_NONSTANDARD_APP_ARGS(args, parse, sep)
Performs the 'nonstandard' argument separation process for an application.
int reason
enum AST_REDIRECTING_REASON value for redirection
#define ASTERISK_GPL_KEY
The text the key() function should return.
Information needed to specify a name in a call.
unsigned char valid
TRUE if the number information is valid/present.
static int callerpres_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
#define ast_custom_function_register(acf)
Register a custom function.
void ast_channel_set_connected_line(struct ast_channel *chan, const struct ast_party_connected_line *connected, const struct ast_set_party_connected_line *update)
Set the connected line information in the Asterisk channel.
#define ASTERISK_FILE_VERSION(file, version)
Register/unregister a source code file with the core.
#define AST_APP_OPTION(option, flagno)
Declares an application option that does not accept an argument.
void ast_party_dialed_set_init(struct ast_party_dialed *init, const struct ast_party_dialed *guide)
Initialize the given dialed structure using the given guide for a set update operation.
static int load_module(void)
static struct ast_custom_function connectedline_function
struct ast_party_number number
Subscriber phone number.