452 enum ID_FIELD_STATUS {
468 enum CONNECTED_LINE_OPT_FLAGS {
469 CONNECTED_LINE_OPT_INHIBIT = (1 << 0),
482 enum REDIRECTING_OPT_FLAGS {
483 REDIRECTING_OPT_INHIBIT = (1 << 0),
510 static enum ID_FIELD_STATUS party_name_read(
char *buf,
size_t len,
int argc,
char *argv[],
const struct ast_party_name *
name)
512 enum ID_FIELD_STATUS status;
514 status = ID_FIELD_VALID;
521 }
else if (argc == 1 && !strcasecmp(
"valid", argv[0])) {
522 snprintf(buf, len,
"%d", name->
valid);
523 }
else if (argc == 1 && !strcasecmp(
"charset", argv[0])) {
525 }
else if (argc == 1 && !strncasecmp(
"pres", argv[0], 4)) {
529 status = ID_FIELD_UNKNOWN;
549 static enum ID_FIELD_STATUS party_number_read(
char *buf,
size_t len,
int argc,
char *argv[],
const struct ast_party_number *
number)
551 enum ID_FIELD_STATUS status;
553 status = ID_FIELD_VALID;
560 }
else if (argc == 1 && !strcasecmp(
"valid", argv[0])) {
561 snprintf(buf, len,
"%d", number->
valid);
562 }
else if (argc == 1 && !strcasecmp(
"plan", argv[0])) {
563 snprintf(buf, len,
"%d", number->
plan);
564 }
else if (argc == 1 && !strncasecmp(
"pres", argv[0], 4)) {
568 status = ID_FIELD_UNKNOWN;
588 static enum ID_FIELD_STATUS party_subaddress_read(
char *buf,
size_t len,
int argc,
char *argv[],
const struct ast_party_subaddress *subaddress)
590 enum ID_FIELD_STATUS status;
592 status = ID_FIELD_VALID;
596 if (subaddress->
str) {
599 }
else if (argc == 1 && !strcasecmp(
"valid", argv[0])) {
600 snprintf(buf, len,
"%d", subaddress->
valid);
601 }
else if (argc == 1 && !strcasecmp(
"type", argv[0])) {
602 snprintf(buf, len,
"%d", subaddress->
type);
603 }
else if (argc == 1 && !strcasecmp(
"odd", argv[0])) {
606 status = ID_FIELD_UNKNOWN;
626 static enum ID_FIELD_STATUS party_id_read(
char *buf,
size_t len,
int argc,
char *argv[],
const struct ast_party_id *
id)
628 enum ID_FIELD_STATUS status;
632 return ID_FIELD_UNKNOWN;
635 status = ID_FIELD_VALID;
637 if (argc == 1 && !strcasecmp(
"all", argv[0])) {
638 snprintf(buf, len,
"\"%s\" <%s>",
641 }
else if (!strcasecmp(
"name", argv[0])) {
642 status = party_name_read(buf, len, argc - 1, argv + 1, &id->
name);
643 }
else if (!strncasecmp(
"num", argv[0], 3)) {
645 status = party_number_read(buf, len, argc - 1, argv + 1, &id->
number);
646 }
else if (!strncasecmp(
"subaddr", argv[0], 7)) {
648 status = party_subaddress_read(buf, len, argc - 1, argv + 1, &id->
subaddress);
649 }
else if (argc == 1 && !strcasecmp(
"tag", argv[0])) {
653 }
else if (argc == 1 && !strcasecmp(
"ton", argv[0])) {
656 }
else if (argc == 1 && !strncasecmp(
"pres", argv[0], 4)) {
664 status = ID_FIELD_UNKNOWN;
684 static enum ID_FIELD_STATUS party_name_write(
struct ast_party_name *name,
int argc,
char *argv[],
const char *value)
687 enum ID_FIELD_STATUS status;
689 status = ID_FIELD_VALID;
696 }
else if (argc == 1 && !strcasecmp(
"valid", argv[0])) {
697 name->
valid = atoi(value) ? 1 : 0;
698 }
else if (argc == 1 && !strcasecmp(
"charset", argv[0])) {
704 if ((
'0' <= val[0]) && (val[0] <=
'9')) {
705 char_set = atoi(val);
712 "Unknown name char-set '%s', value unchanged\n", val);
713 status = ID_FIELD_INVALID;
717 }
else if (argc == 1 && !strncasecmp(
"pres", argv[0], 4)) {
724 if ((
'0' <= val[0]) && (val[0] <=
'9')) {
732 "Unknown name presentation '%s', value unchanged\n", val);
733 status = ID_FIELD_INVALID;
738 status = ID_FIELD_UNKNOWN;
758 static enum ID_FIELD_STATUS party_number_write(
struct ast_party_number *number,
int argc,
char *argv[],
const char *value)
761 enum ID_FIELD_STATUS status;
763 status = ID_FIELD_VALID;
770 }
else if (argc == 1 && !strcasecmp(
"valid", argv[0])) {
771 number->
valid = atoi(value) ? 1 : 0;
772 }
else if (argc == 1 && !strcasecmp(
"plan", argv[0])) {
776 if ((
'0' <= val[0]) && (val[0] <=
'9')) {
777 number->
plan = atoi(val);
780 "Unknown type-of-number/numbering-plan '%s', value unchanged\n", val);
781 status = ID_FIELD_INVALID;
783 }
else if (argc == 1 && !strncasecmp(
"pres", argv[0], 4)) {
790 if ((
'0' <= val[0]) && (val[0] <=
'9')) {
798 "Unknown number presentation '%s', value unchanged\n", val);
799 status = ID_FIELD_INVALID;
804 status = ID_FIELD_UNKNOWN;
824 static enum ID_FIELD_STATUS party_subaddress_write(
struct ast_party_subaddress *subaddress,
int argc,
char *argv[],
const char *value)
826 enum ID_FIELD_STATUS status;
828 status = ID_FIELD_VALID;
834 }
else if (argc == 1 && !strcasecmp(
"valid", argv[0])) {
835 subaddress->
valid = atoi(value) ? 1 : 0;
836 }
else if (argc == 1 && !strcasecmp(
"type", argv[0])) {
837 subaddress->
type = atoi(value) ? 2 : 0;
838 }
else if (argc == 1 && !strcasecmp(
"odd", argv[0])) {
841 status = ID_FIELD_UNKNOWN;
861 static enum ID_FIELD_STATUS party_id_write(
struct ast_party_id *
id,
int argc,
char *argv[],
const char *value)
864 enum ID_FIELD_STATUS status;
868 return ID_FIELD_UNKNOWN;
871 status = ID_FIELD_VALID;
873 if (argc == 1 && !strcasecmp(
"all", argv[0])) {
877 ast_callerid_split(value, name,
sizeof(name), num,
sizeof(num));
881 return ID_FIELD_INVALID;
883 id->number.valid = 1;
886 return ID_FIELD_INVALID;
888 }
else if (!strcasecmp(
"name", argv[0])) {
889 status = party_name_write(&id->
name, argc - 1, argv + 1, value);
890 }
else if (!strncasecmp(
"num", argv[0], 3)) {
892 status = party_number_write(&id->
number, argc - 1, argv + 1, value);
893 }
else if (!strncasecmp(
"subaddr", argv[0], 7)) {
895 status = party_subaddress_write(&id->
subaddress, argc - 1, argv + 1, value);
896 }
else if (argc == 1 && !strcasecmp(
"tag", argv[0])) {
899 }
else if (argc == 1 && !strcasecmp(
"ton", argv[0])) {
902 status = party_number_write(&id->
number, argc, argv, value);
903 }
else if (argc == 1 && !strncasecmp(
"pres", argv[0], 4)) {
913 if ((
'0' <= val[0]) && (val[0] <=
'9')) {
921 "Unknown combined presentation '%s', value unchanged\n", val);
922 status = ID_FIELD_INVALID;
924 id->name.presentation = pres;
925 id->number.presentation = pres;
928 status = ID_FIELD_UNKNOWN;
965 if (args.argc == 0) {
971 if (member.argc == 0 || ARRAY_LEN(member.
subnames) <= member.argc) {
976 if (args.argc == 2) {
980 ast_callerid_split(args.cid, name,
sizeof(name), num,
sizeof(num));
982 if (member.argc == 1 && !strcasecmp(
"all", member.
subnames[0])) {
983 snprintf(buf, len,
"\"%s\" <%s>", name, num);
984 }
else if (member.argc == 1 && !strcasecmp(
"name", member.
subnames[0])) {
986 }
else if (member.argc == 1 && !strncasecmp(
"num", member.
subnames[0], 3)) {
990 ast_log(LOG_ERROR,
"Unknown callerid data type '%s'.\n", data);
993 enum ID_FIELD_STATUS status;
994 ast_channel_lock(chan);
996 if (member.argc == 1 && !strcasecmp(
"rdnis", member.
subnames[0])) {
997 if (ast_channel_redirecting(chan)->from.number.valid
998 && ast_channel_redirecting(chan)->from.number.str) {
999 ast_copy_string(buf, ast_channel_redirecting(chan)->from.number.str, len);
1001 }
else if (!strcasecmp(
"dnid", member.
subnames[0])) {
1002 if (member.argc == 1) {
1007 if (!strncasecmp(
"num", member.
subnames[1], 3)) {
1012 if (member.argc == 2) {
1014 if (ast_channel_dialed(chan)->number.
str) {
1017 }
else if (member.argc == 3 && !strcasecmp(
"plan", member.
subnames[2])) {
1019 snprintf(buf, len,
"%d", ast_channel_dialed(chan)->number.
plan);
1021 ast_log(LOG_ERROR,
"Unknown callerid data type '%s'.\n", data);
1023 }
else if (!strncasecmp(
"subaddr", member.
subnames[1], 7)) {
1028 status = party_subaddress_read(buf, len, member.argc - 2, member.
subnames + 2,
1029 &ast_channel_dialed(chan)->subaddress);
1031 case ID_FIELD_VALID:
1032 case ID_FIELD_INVALID:
1035 ast_log(LOG_ERROR,
"Unknown callerid data type '%s'.\n", data);
1039 ast_log(LOG_ERROR,
"Unknown callerid data type '%s'.\n", data);
1041 }
else if (member.argc == 1 && !strcasecmp(
"ani2", member.
subnames[0])) {
1042 snprintf(buf, len,
"%d", ast_channel_caller(chan)->ani2);
1043 }
else if (!strcasecmp(
"ani", member.
subnames[0])) {
1044 if (member.argc == 1) {
1049 status = party_id_read(buf, len, member.argc - 1, member.
subnames + 1,
1050 &ast_channel_caller(chan)->ani);
1052 case ID_FIELD_VALID:
1053 case ID_FIELD_INVALID:
1056 ast_log(LOG_ERROR,
"Unknown callerid data type '%s'.\n", data);
1059 }
else if (!strcasecmp(
"priv", member.
subnames[0])) {
1060 status = party_id_read(buf, len, member.argc - 1, member.
subnames + 1,
1061 &ast_channel_caller(chan)->priv);
1063 case ID_FIELD_VALID:
1064 case ID_FIELD_INVALID:
1067 ast_log(LOG_ERROR,
"Unknown callerid data type '%s'.\n", data);
1071 status = party_id_read(buf, len, member.argc, member.
subnames, &ast_channel_caller(chan)->
id);
1073 case ID_FIELD_VALID:
1074 case ID_FIELD_INVALID:
1077 ast_log(LOG_ERROR,
"Unknown callerid data type '%s'.\n", data);
1082 ast_channel_unlock(chan);
1100 static int callerid_write(
struct ast_channel *chan,
const char *cmd,
char *data,
const char *value)
1104 enum ID_FIELD_STATUS status;
1110 if (!value || !chan) {
1116 if (args.argc == 0) {
1122 if (member.argc == 0 || ARRAY_LEN(member.
subnames) <= member.argc) {
1129 ast_channel_lock(chan);
1130 if (member.argc == 1 && !strcasecmp(
"rdnis", member.
subnames[0])) {
1132 ast_free(ast_channel_redirecting(chan)->from.number.str);
1134 }
else if (!strcasecmp(
"dnid", member.
subnames[0])) {
1136 if (member.argc == 1) {
1141 if (!strncasecmp(
"num", member.
subnames[1], 3)) {
1146 if (member.argc == 2) {
1151 }
else if (member.argc == 3 && !strcasecmp(
"plan", member.
subnames[2])) {
1156 if ((
'0' <= val[0]) && (val[0] <=
'9')) {
1157 ast_channel_dialed(chan)->
number.
plan = atoi(val);
1160 "Unknown type-of-number/numbering-plan '%s', value unchanged\n", val);
1163 ast_log(LOG_ERROR,
"Unknown callerid data type '%s'.\n", data);
1165 }
else if (!strncasecmp(
"subaddr", member.
subnames[1], 7)) {
1170 status = party_subaddress_write(&dialed.subaddress, member.argc - 2,
1173 case ID_FIELD_VALID:
1176 case ID_FIELD_INVALID:
1179 ast_log(LOG_ERROR,
"Unknown callerid data type '%s'.\n", data);
1183 ast_log(LOG_ERROR,
"Unknown callerid data type '%s'.\n", data);
1186 }
else if (member.argc == 1 && !strcasecmp(
"ani2", member.
subnames[0])) {
1190 if ((
'0' <= val[0]) && (val[0] <=
'9')) {
1191 ast_channel_caller(chan)->
ani2 = atoi(val);
1193 ast_log(LOG_ERROR,
"Unknown callerid ani2 '%s', value unchanged\n", val);
1195 }
else if (!strcasecmp(
"ani", member.
subnames[0])) {
1197 if (member.argc == 1) {
1202 status = party_id_write(&caller.ani, member.argc - 1, member.
subnames + 1, value);
1204 case ID_FIELD_VALID:
1207 case ID_FIELD_INVALID:
1210 ast_log(LOG_ERROR,
"Unknown callerid data type '%s'.\n", data);
1214 }
else if (!strcasecmp(
"priv", member.
subnames[0])) {
1216 status = party_id_write(&caller.priv, member.argc - 1, member.
subnames + 1, value);
1218 case ID_FIELD_VALID:
1221 case ID_FIELD_INVALID:
1224 ast_log(LOG_ERROR,
"Unknown callerid data type '%s'.\n", data);
1230 status = party_id_write(&caller.id, member.argc, member.
subnames, value);
1232 case ID_FIELD_VALID:
1235 case ID_FIELD_INVALID:
1238 ast_log(LOG_ERROR,
"Unknown callerid data type '%s'.\n", data);
1243 ast_channel_unlock(chan);
1261 static int connectedline_read(
struct ast_channel *chan,
const char *cmd,
char *data,
char *buf,
size_t len)
1265 enum ID_FIELD_STATUS status;
1276 if (member.argc == 0 || ARRAY_LEN(member.
subnames) <= member.argc) {
1281 ast_channel_lock(chan);
1283 if (member.argc == 1 && !strcasecmp(
"source", member.
subnames[0])) {
1285 }
else if (!strcasecmp(
"priv", member.
subnames[0])) {
1286 status = party_id_read(buf, len, member.argc - 1, member.
subnames + 1,
1287 &ast_channel_connected(chan)->priv);
1289 case ID_FIELD_VALID:
1290 case ID_FIELD_INVALID:
1293 ast_log(LOG_ERROR,
"Unknown connectedline data type '%s'.\n", data);
1297 status = party_id_read(buf, len, member.argc, member.
subnames, &ast_channel_connected(chan)->
id);
1299 case ID_FIELD_VALID:
1300 case ID_FIELD_INVALID:
1303 ast_log(LOG_ERROR,
"Unknown connectedline data type '%s'.\n", data);
1308 ast_channel_unlock(chan);
1325 static int connectedline_write(
struct ast_channel *chan,
const char *cmd,
char *data,
const char *value)
1335 enum ID_FIELD_STATUS status;
1337 if (!value || !chan) {
1343 if (args.argc == 0) {
1349 if (member.argc == 0 || ARRAY_LEN(member.
subnames) <= member.argc) {
1360 if (ast_test_flag(&opts, CONNECTED_LINE_OPT_INHIBIT)) {
1366 ast_channel_lock(chan);
1368 ast_channel_unlock(chan);
1372 if (member.argc == 1 && !strcasecmp(
"source", member.
subnames[0])) {
1378 if ((
'0' <= val[0]) && (val[0] <=
'9')) {
1385 ast_log(LOG_ERROR,
"Unknown connectedline source '%s', value unchanged\n", val);
1387 connected.
source = source;
1388 set_it(chan, &connected, NULL);
1390 }
else if (!strcasecmp(
"priv", member.
subnames[0])) {
1391 status = party_id_write(&connected.
priv, member.argc - 1, member.
subnames + 1, value);
1393 case ID_FIELD_VALID:
1394 set_it(chan, &connected, NULL);
1396 case ID_FIELD_INVALID:
1399 ast_log(LOG_ERROR,
"Unknown connectedline data type '%s'.\n", data);
1404 status = party_id_write(&connected.
id, member.argc, member.
subnames, value);
1406 case ID_FIELD_VALID:
1407 set_it(chan, &connected, NULL);
1409 case ID_FIELD_INVALID:
1412 ast_log(LOG_ERROR,
"Unknown connectedline data type '%s'.\n", data);
1434 static int redirecting_read(
struct ast_channel *chan,
const char *cmd,
char *data,
char *buf,
size_t len)
1439 enum ID_FIELD_STATUS status;
1450 if (member.argc == 0 || ARRAY_LEN(member.
subnames) <= member.argc) {
1455 ast_channel_lock(chan);
1457 ast_redirecting = ast_channel_redirecting(chan);
1458 if (!strcasecmp(
"orig", member.
subnames[0])) {
1459 if (member.argc == 2 && !strcasecmp(
"reason", member.
subnames[1])) {
1463 status = party_id_read(buf, len, member.argc - 1, member.
subnames + 1,
1464 &ast_redirecting->
orig);
1466 case ID_FIELD_VALID:
1467 case ID_FIELD_INVALID:
1470 ast_log(LOG_ERROR,
"Unknown redirecting data type '%s'.\n", data);
1474 }
else if (!strcasecmp(
"from", member.
subnames[0])) {
1475 status = party_id_read(buf, len, member.argc - 1, member.
subnames + 1,
1476 &ast_redirecting->
from);
1478 case ID_FIELD_VALID:
1479 case ID_FIELD_INVALID:
1482 ast_log(LOG_ERROR,
"Unknown redirecting data type '%s'.\n", data);
1485 }
else if (!strcasecmp(
"to", member.
subnames[0])) {
1486 status = party_id_read(buf, len, member.argc - 1, member.
subnames + 1,
1487 &ast_redirecting->
to);
1489 case ID_FIELD_VALID:
1490 case ID_FIELD_INVALID:
1493 ast_log(LOG_ERROR,
"Unknown redirecting data type '%s'.\n", data);
1496 }
else if (member.argc == 1 && !strncasecmp(
"pres", member.
subnames[0], 4)) {
1504 }
else if (member.argc == 1 && !strcasecmp(
"reason", member.
subnames[0])) {
1506 }
else if (member.argc == 1 && !strcasecmp(
"count", member.
subnames[0])) {
1507 snprintf(buf, len,
"%d", ast_redirecting->
count);
1508 }
else if (1 < member.argc && !strcasecmp(
"priv", member.
subnames[0])) {
1509 if (!strcasecmp(
"orig", member.
subnames[1])) {
1510 status = party_id_read(buf, len, member.argc - 2, member.
subnames + 2,
1513 case ID_FIELD_VALID:
1514 case ID_FIELD_INVALID:
1517 ast_log(LOG_ERROR,
"Unknown redirecting data type '%s'.\n", data);
1520 }
else if (!strcasecmp(
"from", member.
subnames[1])) {
1521 status = party_id_read(buf, len, member.argc - 2, member.
subnames + 2,
1524 case ID_FIELD_VALID:
1525 case ID_FIELD_INVALID:
1528 ast_log(LOG_ERROR,
"Unknown redirecting data type '%s'.\n", data);
1531 }
else if (!strcasecmp(
"to", member.
subnames[1])) {
1532 status = party_id_read(buf, len, member.argc - 2, member.
subnames + 2,
1535 case ID_FIELD_VALID:
1536 case ID_FIELD_INVALID:
1539 ast_log(LOG_ERROR,
"Unknown redirecting data type '%s'.\n", data);
1543 ast_log(LOG_ERROR,
"Unknown redirecting data type '%s'.\n", data);
1546 ast_log(LOG_ERROR,
"Unknown redirecting data type '%s'.\n", data);
1549 ast_channel_unlock(chan);
1566 static int redirecting_write(
struct ast_channel *chan,
const char *cmd,
char *data,
const char *value)
1569 enum ID_FIELD_STATUS status;
1578 if (!value || !chan) {
1584 if (args.argc == 0) {
1590 if (member.argc == 0 || ARRAY_LEN(member.
subnames) <= member.argc) {
1601 if (ast_test_flag(&opts, REDIRECTING_OPT_INHIBIT)) {
1607 ast_channel_lock(chan);
1609 ast_channel_unlock(chan);
1613 if (!strcasecmp(
"orig", member.
subnames[0])) {
1614 if (member.argc == 2 && !strcasecmp(
"reason", member.
subnames[1])) {
1620 if ((
'0' <= val[0]) && (val[0] <=
'9')) {
1631 ast_log(LOG_WARNING,
"Unknown redirecting reason '%s', defaulting to unknown\n", val);
1634 set_it(chan, &redirecting, NULL);
1638 set_it(chan, &redirecting, NULL);
1641 status = party_id_write(&redirecting.
orig, member.argc - 1, member.
subnames + 1,
1644 case ID_FIELD_VALID:
1645 set_it(chan, &redirecting, NULL);
1647 case ID_FIELD_INVALID:
1650 ast_log(LOG_ERROR,
"Unknown redirecting data type '%s'.\n", data);
1655 }
else if (!strcasecmp(
"from", member.
subnames[0])) {
1656 status = party_id_write(&redirecting.
from, member.argc - 1, member.
subnames + 1,
1659 case ID_FIELD_VALID:
1660 set_it(chan, &redirecting, NULL);
1662 case ID_FIELD_INVALID:
1665 ast_log(LOG_ERROR,
"Unknown redirecting data type '%s'.\n", data);
1669 }
else if (!strcasecmp(
"to", member.
subnames[0])) {
1670 status = party_id_write(&redirecting.
to, member.argc - 1, member.
subnames + 1, value);
1672 case ID_FIELD_VALID:
1673 set_it(chan, &redirecting, NULL);
1675 case ID_FIELD_INVALID:
1678 ast_log(LOG_ERROR,
"Unknown redirecting data type '%s'.\n", data);
1682 }
else if (member.argc == 1 && !strncasecmp(
"pres", member.
subnames[0], 4)) {
1688 if ((
'0' <= val[0]) && (val[0] <=
'9')) {
1696 "Unknown redirecting combined presentation '%s', value unchanged\n", val);
1702 set_it(chan, &redirecting, NULL);
1704 }
else if (member.argc == 1 && !strcasecmp(
"reason", member.
subnames[0])) {
1710 if ((
'0' <= val[0]) && (val[0] <=
'9')) {
1721 ast_log(LOG_WARNING,
"Unknown redirecting reason '%s', defaulting to unknown\n", val);
1722 redirecting.
reason.
code = AST_REDIRECTING_REASON_UNKNOWN;
1724 set_it(chan, &redirecting, NULL);
1728 set_it(chan, &redirecting, NULL);
1730 }
else if (member.argc == 1 && !strcasecmp(
"count", member.
subnames[0])) {
1734 if ((
'0' <= val[0]) && (val[0] <=
'9')) {
1735 redirecting.
count = atoi(val);
1736 set_it(chan, &redirecting, NULL);
1738 ast_log(LOG_ERROR,
"Unknown redirecting count '%s', value unchanged\n", val);
1740 }
else if (1 < member.argc && !strcasecmp(
"priv", member.
subnames[0])) {
1741 if (!strcasecmp(
"orig", member.
subnames[1])) {
1742 status = party_id_write(&redirecting.
priv_orig, member.argc - 2, member.
subnames + 2,
1745 case ID_FIELD_VALID:
1746 set_it(chan, &redirecting, NULL);
1748 case ID_FIELD_INVALID:
1751 ast_log(LOG_ERROR,
"Unknown redirecting data type '%s'.\n", data);
1755 }
else if (!strcasecmp(
"from", member.
subnames[1])) {
1756 status = party_id_write(&redirecting.
priv_from, member.argc - 2, member.
subnames + 2,
1759 case ID_FIELD_VALID:
1760 set_it(chan, &redirecting, NULL);
1762 case ID_FIELD_INVALID:
1765 ast_log(LOG_ERROR,
"Unknown redirecting data type '%s'.\n", data);
1769 }
else if (!strcasecmp(
"to", member.
subnames[1])) {
1770 status = party_id_write(&redirecting.
priv_to, member.argc - 2, member.
subnames + 2, value);
1772 case ID_FIELD_VALID:
1773 set_it(chan, &redirecting, NULL);
1775 case ID_FIELD_INVALID:
1778 ast_log(LOG_ERROR,
"Unknown redirecting data type '%s'.\n", data);
1783 ast_log(LOG_ERROR,
"Unknown redirecting data type '%s'.\n", data);
1786 ast_log(LOG_ERROR,
"Unknown redirecting data type '%s'.\n", data);
1796 .write = callerid_write,
1800 .
name =
"CONNECTEDLINE",
1801 .read = connectedline_read,
1802 .write = connectedline_write,
1806 .
name =
"REDIRECTING",
1807 .read = redirecting_read,
1808 .write = redirecting_write,
1818 static int unload_module(
void)
1833 static int load_module(
void)
1850 AST_MODULE_INFO_STANDARD(
ASTERISK_GPL_KEY,
"Party ID related dialplan functions (Caller-ID, Connected-line, Redirecting)");
Information needed to identify an endpoint in a call.
int presentation
Q.931 encoded presentation-indicator encoded field.
Main Channel structure associated with a channel.
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.
Asterisk main include file. File version handling, generic pbx functions.
struct ast_party_id priv_to
Call is redirecting to a new party (Sent to the caller) - private representation. ...
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) ...
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.
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...
struct ast_party_id priv_orig
Who originally redirected the call (Sent to the party the call is redirected toward) - private repres...
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.
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the 'standard' argument separation process for an application.
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_redirecting_reason_parse(const char *data)
Convert redirecting reason text code to value (used in config file parsing)
struct ast_party_id priv_from
Who is redirecting the call (Sent to the party the call is redirected toward) - private representatio...
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.
#define AST_DEFINE_APP_ARGS_TYPE(type, arglist)
Define a structure type to hold an application's arguments.
#define ast_strdup(str)
A wrapper for strdup()
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.
const char * ast_redirecting_reason_name(const struct ast_party_redirecting_reason *data)
Convert redirecting reason value to text code.
int code
enum AST_REDIRECTING_REASON value for redirection
unsigned char odd_even_indicator
TRUE if odd number of address signals.
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.
struct ast_party_id orig
Who originally redirected the call (Sent to the party the call is redirected toward) ...
#define AST_APP_OPTIONS(holder, options...)
Declares an array of options for an application.
General Asterisk PBX channel definitions.
struct ast_party_redirecting_reason orig_reason
Reason for the redirection by the original party.
#define ast_strdupa(s)
duplicate a string in memory from the stack
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.
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.
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)
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.
#define AST_NONSTANDARD_APP_ARGS(args, parse, sep)
Performs the 'nonstandard' argument separation process for an application.
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.
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.
char * str
a string value for the redirecting reason
int source
Information about the source of an update.
Module has failed to load, may be in an inconsistent state.
struct ast_party_redirecting_reason reason
Reason for the redirection.
Structure used to handle boolean flags.
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.
Information needed to specify a number in a call.
struct ast_party_dialed::@206 number
Dialed/Called number.
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.
unsigned char valid
TRUE if the name information is valid/present.
Information needed to specify a subaddress in a call.
#define AST_APP_OPTION(option, flagno)
Declares an application option that does not accept an argument.
#define ASTERISK_GPL_KEY
The text the key() function should return.
Asterisk module definitions.
Information needed to specify a name in a call.
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application's arguments.
Application convenience functions, designed to give consistent look and feel to Asterisk apps...
struct ast_party_id priv
Private connected party ID.
unsigned char valid
TRUE if the number information is valid/present.
#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.
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.
#define AST_APP_ARG(name)
Define an application argument.
struct ast_party_number number
Subscriber phone number.