Asterisk - The Open Source Telephony Project GIT-master-f36a736
|
CallerID (and other GR30) management and generation Includes code and algorithms from the Zapata library. More...
#include "asterisk/format.h"
Go to the source code of this file.
Typedefs | |
typedef struct callerid_state | CIDSTATE |
Functions | |
int | ast_callerid_callwaiting_full_generate (unsigned char *buf, const char *name, const char *number, const char *ddn, int redirecting, int pres, int qualifier, struct ast_format *codec) |
Generate Caller-ID spill but in a format suitable for Call Waiting(tm)'s Caller*ID(tm) More... | |
int | ast_callerid_callwaiting_full_tz_generate (unsigned char *buf, const char *name, const char *number, const char *ddn, int redirecting, int pres, int qualifier, struct ast_format *codec, const char *tz) |
Generate Caller-ID spill but in a format suitable for Call Waiting(tm)'s Caller*ID(tm) More... | |
int | ast_callerid_callwaiting_generate (unsigned char *buf, const char *name, const char *number, struct ast_format *codec) |
Generate Caller-ID spill but in a format suitable for Call Waiting(tm)'s Caller*ID(tm) More... | |
int | ast_callerid_full_generate (unsigned char *buf, const char *name, const char *number, const char *ddn, int redirecting, int pres, int qualifier, int format, struct ast_format *codec) |
Generate Caller-ID spill from the "callerid" field of asterisk (in e-mail address like format) More... | |
int | ast_callerid_full_tz_generate (unsigned char *buf, const char *name, const char *number, const char *ddn, int redirecting, int pres, int qualifier, int format, struct ast_format *codec, const char *tz) |
Generate Caller-ID spill from the "callerid" field of asterisk (in e-mail address like format) More... | |
int | ast_callerid_generate (unsigned char *buf, const char *name, const char *number, struct ast_format *codec) |
Generate Caller-ID spill from the "callerid" field of asterisk (in e-mail address like format) More... | |
char * | ast_callerid_merge (char *buf, int bufsiz, const char *name, const char *num, const char *unknown) |
int | ast_callerid_parse (char *instr, char **name, char **location) |
Destructively parse inbuf into name and location (or number) More... | |
int | ast_callerid_split (const char *src, char *name, int namelen, char *num, int numlen) |
int | ast_callerid_vmwi_generate (unsigned char *buf, int active, int type, struct ast_format *codec, const char *name, const char *number, int flags) |
Generate message waiting indicator. More... | |
const char * | ast_connected_line_source_describe (int data) |
Convert connected line update source value to explanatory string. More... | |
const char * | ast_connected_line_source_name (int data) |
Convert connected line update source value to text code. More... | |
int | ast_connected_line_source_parse (const char *data) |
Convert connected line update source text code to value (used in config file parsing) More... | |
const char * | ast_describe_caller_presentation (int data) |
Convert caller ID pres value to explanatory string. More... | |
int | ast_gen_cas (unsigned char *outbuf, int sas, int len, struct ast_format *codec) |
Generate a CAS (CPE Alert Signal) tone for 'n' samples. More... | |
int | ast_is_shrinkable_phonenumber (const char *exten) |
Check if a string consists only of digits and + # ( ) - . (meaning it can be cleaned with ast_shrink_phone_number) More... | |
int | ast_isphonenumber (const char *n) |
Check if a string consists only of digits and + #. More... | |
const char * | ast_named_caller_presentation (int data) |
Convert caller ID pres value to text code. More... | |
int | ast_parse_caller_presentation (const char *data) |
Convert caller ID text code to value (used in config file parsing) More... | |
const char * | ast_party_name_charset_describe (int data) |
Convert ast_party_name.char_set value to explanatory string. More... | |
int | ast_party_name_charset_parse (const char *data) |
Convert ast_party_name.char_set text code to value (used in config file parsing) More... | |
const char * | ast_party_name_charset_str (int data) |
Convert ast_party_name.char_set value to text code. More... | |
const char * | ast_redirecting_reason_describe (int data) |
Convert redirecting reason value to explanatory string. More... | |
const char * | ast_redirecting_reason_name (const struct ast_party_redirecting_reason *data) |
Convert redirecting reason value to text code. More... | |
int | ast_redirecting_reason_parse (const char *data) |
Convert redirecting reason text code to value (used in config file parsing) More... | |
void | ast_shrink_phone_number (char *n) |
Shrink a phone number in place to just digits (more accurately it just removes ()'s, .'s, and -'s... More... | |
int | callerid_feed (struct callerid_state *cid, unsigned char *ubuf, int samples, struct ast_format *codec) |
Read samples into the state machine. More... | |
int | callerid_feed_jp (struct callerid_state *cid, unsigned char *ubuf, int samples, struct ast_format *codec) |
Read samples into the state machine. More... | |
void | callerid_free (struct callerid_state *cid) |
This function frees callerid_state cid. More... | |
int | callerid_full_generate (unsigned char *buf, const char *number, const char *name, const char *ddn, int redirecting, int flags, int format, int callwaiting, struct ast_format *codec) |
Generates a CallerID FSK stream in ulaw format suitable for transmission. More... | |
int | callerid_full_tz_generate (unsigned char *buf, const char *number, const char *name, const char *ddn, int redirecting, int flags, int format, int callwaiting, struct ast_format *codec, const char *tz) |
Generates a CallerID FSK stream in ulaw format suitable for transmission. More... | |
int | callerid_generate (unsigned char *buf, const char *number, const char *name, int flags, int callwaiting, struct ast_format *codec) |
Generates a CallerID FSK stream in ulaw format suitable for transmission. More... | |
void | callerid_get (struct callerid_state *cid, char **number, char **name, int *flags) |
Extract info out of callerID state machine. Flags are listed above. More... | |
void | callerid_get_dtmf (char *cidstring, char *number, int *flags) |
Get and parse DTMF-based callerid. More... | |
void | callerid_get_with_redirecting (struct callerid_state *cid, char **name, char **number, int *flags, int *redirecting) |
Extract info out of callerID state machine. Flags are listed above. More... | |
static float | callerid_getcarrier (float *cr, float *ci, int bit) |
void | callerid_init (void) |
CallerID Initialization. More... | |
struct callerid_state * | callerid_new (int cid_signalling) |
Create a callerID state machine. More... | |
Variables | |
float | cid_di [4] |
float | cid_dr [4] |
float | clidsb |
CallerID (and other GR30) management and generation Includes code and algorithms from the Zapata library.
Definition in file callerid.h.
#define AST_LIN2X | ( | a | ) | ((ast_format_cmp(codec, ast_format_alaw) == AST_FORMAT_CMP_EQUAL) ? (AST_LIN2A(a)) : (AST_LIN2MU(a))) |
Definition at line 85 of file callerid.h.
#define AST_PRES_ALLOWED 0x00 |
Definition at line 432 of file callerid.h.
#define AST_PRES_ALLOWED_NETWORK_NUMBER (AST_PRES_ALLOWED | AST_PRES_NETWORK_NUMBER) |
Definition at line 446 of file callerid.h.
#define AST_PRES_ALLOWED_USER_NUMBER_FAILED_SCREEN (AST_PRES_ALLOWED | AST_PRES_USER_NUMBER_FAILED_SCREEN) |
Definition at line 443 of file callerid.h.
#define AST_PRES_ALLOWED_USER_NUMBER_NOT_SCREENED (AST_PRES_ALLOWED | AST_PRES_USER_NUMBER_UNSCREENED) |
Definition at line 437 of file callerid.h.
#define AST_PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN (AST_PRES_ALLOWED | AST_PRES_USER_NUMBER_PASSED_SCREEN) |
Definition at line 440 of file callerid.h.
#define AST_PRES_NETWORK_NUMBER 0x03 |
Definition at line 429 of file callerid.h.
#define AST_PRES_NUMBER_NOT_AVAILABLE (AST_PRES_UNAVAILABLE | AST_PRES_NETWORK_NUMBER) |
Definition at line 461 of file callerid.h.
#define AST_PRES_NUMBER_TYPE 0x03 |
Definition at line 425 of file callerid.h.
#define AST_PRES_PROHIB_NETWORK_NUMBER (AST_PRES_RESTRICTED | AST_PRES_NETWORK_NUMBER) |
Definition at line 458 of file callerid.h.
#define AST_PRES_PROHIB_USER_NUMBER_FAILED_SCREEN (AST_PRES_RESTRICTED | AST_PRES_USER_NUMBER_FAILED_SCREEN) |
Definition at line 455 of file callerid.h.
#define AST_PRES_PROHIB_USER_NUMBER_NOT_SCREENED (AST_PRES_RESTRICTED | AST_PRES_USER_NUMBER_UNSCREENED) |
Definition at line 449 of file callerid.h.
#define AST_PRES_PROHIB_USER_NUMBER_PASSED_SCREEN (AST_PRES_RESTRICTED | AST_PRES_USER_NUMBER_PASSED_SCREEN) |
Definition at line 452 of file callerid.h.
#define AST_PRES_RESERVED 0x60 |
Definition at line 435 of file callerid.h.
#define AST_PRES_RESTRICTED 0x20 |
Definition at line 433 of file callerid.h.
#define AST_PRES_RESTRICTION 0x60 |
Definition at line 431 of file callerid.h.
#define AST_PRES_UNAVAILABLE 0x40 |
Definition at line 434 of file callerid.h.
#define AST_PRES_USER_NUMBER_FAILED_SCREEN 0x02 |
Definition at line 428 of file callerid.h.
#define AST_PRES_USER_NUMBER_PASSED_SCREEN 0x01 |
Definition at line 427 of file callerid.h.
#define AST_PRES_USER_NUMBER_UNSCREENED 0x00 |
Definition at line 426 of file callerid.h.
#define AST_XLAW | ( | a | ) | ((ast_format_cmp(codec, ast_format_alaw) == AST_FORMAT_CMP_EQUAL) ? (AST_ALAW(a)) : (AST_MULAW(a))) |
Definition at line 86 of file callerid.h.
#define CID_MSGWAITING (1 << 4) |
Definition at line 56 of file callerid.h.
#define CID_MWI_TYPE_MDMF 0x01 |
MWI MDMF format – generate only MWI field
Definition at line 81 of file callerid.h.
#define CID_MWI_TYPE_MDMF_FULL 0x02 |
MWI MDMF format – generate name, callerid, date and MWI fields
Definition at line 83 of file callerid.h.
#define CID_MWI_TYPE_SDMF 0x00 |
MWI SDMF format
Definition at line 79 of file callerid.h.
#define CID_NOMSGWAITING (1 << 5) |
Definition at line 57 of file callerid.h.
#define CID_PRIVATE_NAME (1 << 0) |
Definition at line 52 of file callerid.h.
#define CID_PRIVATE_NUMBER (1 << 1) |
Definition at line 53 of file callerid.h.
#define CID_QUALIFIER (1 << 6) |
Definition at line 58 of file callerid.h.
#define CID_SIG_BELL 1 |
Definition at line 60 of file callerid.h.
#define CID_SIG_DTMF 3 |
Definition at line 62 of file callerid.h.
#define CID_SIG_SMDI 5 |
Definition at line 64 of file callerid.h.
#define CID_SIG_V23 2 |
Definition at line 61 of file callerid.h.
#define CID_SIG_V23_JP 4 |
Definition at line 63 of file callerid.h.
#define CID_START_DTMF_NOALERT 4 |
Definition at line 69 of file callerid.h.
#define CID_START_POLARITY 2 |
Definition at line 67 of file callerid.h.
#define CID_START_POLARITY_IN 3 |
Definition at line 68 of file callerid.h.
#define CID_START_RING 1 |
Definition at line 66 of file callerid.h.
#define CID_TYPE_MDMF 0x01 |
MDMF - name, number, etc.
Definition at line 75 of file callerid.h.
#define CID_TYPE_SDMF 0x00 |
SDMF - number only
Definition at line 73 of file callerid.h.
#define CID_UNKNOWN_NAME (1 << 2) |
Definition at line 54 of file callerid.h.
#define CID_UNKNOWN_NUMBER (1 << 3) |
Definition at line 55 of file callerid.h.
#define MAX_CALLERID_SIZE 32000 |
Definition at line 50 of file callerid.h.
#define PUT_AUDIO_SAMPLE | ( | y | ) |
Definition at line 391 of file callerid.h.
#define PUT_BYTE | ( | a | ) |
Definition at line 386 of file callerid.h.
#define PUT_CLID | ( | byte | ) |
Definition at line 412 of file callerid.h.
#define PUT_CLID_BAUD | ( | bit | ) |
Definition at line 403 of file callerid.h.
#define PUT_CLID_MARKMS |
Definition at line 397 of file callerid.h.
typedef struct callerid_state CIDSTATE |
Definition at line 90 of file callerid.h.
Connected line update source code.
Definition at line 550 of file callerid.h.
redirecting reason codes.
This list attempts to encompass redirecting reasons as defined by several channel technologies.
Definition at line 498 of file callerid.h.
int ast_callerid_callwaiting_full_generate | ( | unsigned char * | buf, |
const char * | name, | ||
const char * | number, | ||
const char * | ddn, | ||
int | redirecting, | ||
int | pres, | ||
int | qualifier, | ||
struct ast_format * | codec | ||
) |
Generate Caller-ID spill but in a format suitable for Call Waiting(tm)'s Caller*ID(tm)
Definition at line 1253 of file callerid.c.
References __ast_callerid_generate(), buf, CID_TYPE_MDMF, name, and NULL.
Referenced by my_send_callerid().
int ast_callerid_callwaiting_full_tz_generate | ( | unsigned char * | buf, |
const char * | name, | ||
const char * | number, | ||
const char * | ddn, | ||
int | redirecting, | ||
int | pres, | ||
int | qualifier, | ||
struct ast_format * | codec, | ||
const char * | tz | ||
) |
Generate Caller-ID spill but in a format suitable for Call Waiting(tm)'s Caller*ID(tm)
tz | TZ-format time zone for date/time (NULL for system default) |
Definition at line 1266 of file callerid.c.
References __ast_callerid_generate(), buf, CID_TYPE_MDMF, name, and tz.
int ast_callerid_callwaiting_generate | ( | unsigned char * | buf, |
const char * | name, | ||
const char * | number, | ||
struct ast_format * | codec | ||
) |
Generate Caller-ID spill but in a format suitable for Call Waiting(tm)'s Caller*ID(tm)
Definition at line 1242 of file callerid.c.
References __ast_callerid_generate(), buf, CID_TYPE_MDMF, name, and NULL.
Referenced by send_cwcidspill().
int ast_callerid_full_generate | ( | unsigned char * | buf, |
const char * | name, | ||
const char * | number, | ||
const char * | ddn, | ||
int | redirecting, | ||
int | pres, | ||
int | qualifier, | ||
int | format, | ||
struct ast_format * | codec | ||
) |
Generate Caller-ID spill from the "callerid" field of asterisk (in e-mail address like format)
buf | buffer for output samples. See callerid_generate() for details regarding buffer. |
name | Caller-ID Name |
number | Caller-ID Number |
ddn | Dialable Directory Number (or NULL) |
redirecting | Redirecting Reason (-1 if N/A) |
pres | Presentation (0 for default) |
qualifier | Call Qualifier (0 for no, 1 for yes) |
format | Message Format |
codec | Asterisk codec (either AST_FORMAT_ALAW or AST_FORMAT_ULAW) |
Like ast_callerid_generate but with additional parameters.
Definition at line 1247 of file callerid.c.
References __ast_callerid_generate(), buf, name, and NULL.
Referenced by my_send_callerid().
int ast_callerid_full_tz_generate | ( | unsigned char * | buf, |
const char * | name, | ||
const char * | number, | ||
const char * | ddn, | ||
int | redirecting, | ||
int | pres, | ||
int | qualifier, | ||
int | format, | ||
struct ast_format * | codec, | ||
const char * | tz | ||
) |
Generate Caller-ID spill from the "callerid" field of asterisk (in e-mail address like format)
buf | buffer for output samples. See callerid_generate() for details regarding buffer. |
name | Caller-ID Name |
number | Caller-ID Number |
ddn | Dialable Directory Number (or NULL) |
redirecting | Redirecting Reason (-1 if N/A) |
pres | Presentation (0 for default) |
qualifier | Call Qualifier (0 for no, 1 for yes) |
format | Message Format |
codec | Asterisk codec (either AST_FORMAT_ALAW or AST_FORMAT_ULAW) |
tz | TZ-format time zone name to use for date/time (NULL for system default) |
Like ast_callerid_generate but with additional parameters.
Definition at line 1260 of file callerid.c.
References __ast_callerid_generate(), buf, name, and tz.
int ast_callerid_generate | ( | unsigned char * | buf, |
const char * | name, | ||
const char * | number, | ||
struct ast_format * | codec | ||
) |
Generate Caller-ID spill from the "callerid" field of asterisk (in e-mail address like format)
buf | buffer for output samples. See callerid_generate() for details regarding buffer. |
name | Caller-ID Name |
number | Caller-ID Number |
codec | Asterisk codec (either AST_FORMAT_ALAW or AST_FORMAT_ULAW) |
Acts like callerid_generate except uses an asterisk format callerid string.
Definition at line 1237 of file callerid.c.
References __ast_callerid_generate(), buf, CID_TYPE_MDMF, name, and NULL.
char * ast_callerid_merge | ( | char * | buf, |
int | bufsiz, | ||
const char * | name, | ||
const char * | num, | ||
const char * | unknown | ||
) |
Definition at line 1273 of file callerid.c.
References ast_copy_string(), ast_escape_quoted(), buf, name, and unknown.
Referenced by caller_id_to_str(), cdr_object_create_public_records(), cdr_object_format_property(), cli_show_channel(), cli_show_subscriptions_detail(), handle_cli_iax2_show_peer(), launch_monitor_thread(), leave_voicemail(), prep_email_sub_vars(), and sip_subscription_to_ami().
int ast_callerid_parse | ( | char * | instr, |
char ** | name, | ||
char ** | location | ||
) |
Destructively parse inbuf into name and location (or number)
Parses callerid stream from inbuf and changes into useable form, outputted in name and location.
instr | buffer of callerid stream (in audio form) to be parsed. Warning, data in buffer is changed. |
name | address of a pointer-to-char for the name value of the stream. |
location | address of a pointer-to-char for the phone number value of the stream. |
0 | on success |
-1 | on failure |
Definition at line 1162 of file callerid.c.
References ast_copy_string(), ast_isphonenumber(), ast_shrink_phone_number(), ast_strip(), ast_strip_quoted(), ast_unescape_quoted(), name, NULL, and tmp().
Referenced by action_originate(), adsi_message(), advanced_options(), ari_channels_handle_originate_with_id(), ast_callerid_split(), ast_privacy_check(), ast_privacy_set(), AST_TEST_DEFINE(), dial_exec_full(), handle_setcallerid(), play_message_callerid(), and unistim_new().
int ast_callerid_split | ( | const char * | src, |
char * | name, | ||
int | namelen, | ||
char * | num, | ||
int | numlen | ||
) |
Definition at line 1292 of file callerid.c.
References ast_callerid_parse(), ast_copy_string(), ast_shrink_phone_number(), ast_strdupa, buf, name, NULL, and tmp().
Referenced by build_peer(), build_user(), caller_id_handler(), callerid_read(), disa_exec(), msg_create_from_file(), parse_line(), party_id_write(), prep_email_sub_vars(), process_dahdi(), and store_callerid().
int ast_callerid_vmwi_generate | ( | unsigned char * | buf, |
int | active, | ||
int | type, | ||
struct ast_format * | codec, | ||
const char * | name, | ||
const char * | number, | ||
int | flags | ||
) |
Generate message waiting indicator.
buf | |
active | The message indicator state – either 0 no messages in mailbox or 1 messages in mailbox |
type | Format of message (any of CID_MWI_TYPE_*) |
codec | |
name | |
number | |
flags |
Definition at line 952 of file callerid.c.
References callerid_genmsg(), CID_MWI_TYPE_MDMF, CID_MWI_TYPE_MDMF_FULL, CID_TYPE_MDMF, len(), name, NULL, PUT_BYTE, PUT_CLID, PUT_CLID_MARKMS, and type.
Referenced by mwi_send_init().
const char * ast_connected_line_source_describe | ( | int | data | ) |
Convert connected line update source value to explanatory string.
data | AST_CONNECTED_LINE_UPDATE_SOURCE from callerid.h |
Definition at line 1492 of file callerid.c.
References ARRAY_LEN, connected_line_source_types, ast_value_translation::description, and value.
const char * ast_connected_line_source_name | ( | int | data | ) |
Convert connected line update source value to text code.
data | AST_CONNECTED_LINE_UPDATE_SOURCE from callerid.h |
Definition at line 1505 of file callerid.c.
References ARRAY_LEN, connected_line_source_types, ast_value_translation::name, and value.
Referenced by connectedline_read().
int ast_connected_line_source_parse | ( | const char * | data | ) |
Convert connected line update source text code to value (used in config file parsing)
data | text string from config file |
AST_CONNECTED_LINE_UPDATE_SOURCE | from callerid.h |
-1 | if not in table |
Definition at line 1479 of file callerid.c.
References ARRAY_LEN, connected_line_source_types, name, and ast_value_translation::value.
Referenced by connectedline_write().
const char * ast_describe_caller_presentation | ( | int | data | ) |
Convert caller ID pres value to explanatory string.
data | AST_PRES_ value from callerid.h |
Definition at line 1364 of file callerid.c.
References ARRAY_LEN, ast_value_translation::description, pres_types, and value.
Referenced by ast_json_party_id(), channel_callerid(), channel_new_callerid(), json_party_name(), and json_party_number().
int ast_gen_cas | ( | unsigned char * | outbuf, |
int | sas, | ||
int | len, | ||
struct ast_format * | codec | ||
) |
Generate a CAS (CPE Alert Signal) tone for 'n' samples.
outbuf | Allocated buffer for data. Must be at least 2400 bytes unless no SAS is desired |
sas | Non-zero if CAS should be preceeded by SAS |
len | How many samples to generate. |
codec | Which codec (AST_FORMAT_ALAW or AST_FORMAT_ULAW) |
-1 | on error (if len is less than 2400) |
0 | on success |
Definition at line 271 of file callerid.c.
References casdi1, casdi2, casdr1, casdr2, gen_tone(), gen_tones(), len(), callerid_state::pos, sasdi, and sasdr.
Referenced by __adsi_transmit_messages(), dahdi_callwait(), and my_callwait().
int ast_is_shrinkable_phonenumber | ( | const char * | exten | ) |
Check if a string consists only of digits and + # ( ) - . (meaning it can be cleaned with ast_shrink_phone_number)
exten | The extension (or URI) to be checked. |
1 | if exten is valid AST shrinkable phone number |
0 | if not |
Definition at line 1157 of file callerid.c.
References ast_is_valid_string().
Referenced by ari_channels_handle_originate_with_id().
int ast_isphonenumber | ( | const char * | n | ) |
Check if a string consists only of digits and + #.
n | number to be checked. |
0 | if n is a number |
1 | if not |
Definition at line 1152 of file callerid.c.
References ast_is_valid_string().
Referenced by ast_callerid_parse(), and hfp_parse_clip().
const char * ast_named_caller_presentation | ( | int | data | ) |
Convert caller ID pres value to text code.
data | AST_PRES_ value from callerid.h |
Definition at line 1382 of file callerid.c.
References ARRAY_LEN, ast_value_translation::name, pres_types, and value.
Referenced by __ast_callerid_generate(), caller_id_privacy_to_str(), party_id_read(), party_name_read(), party_number_read(), and redirecting_read().
int ast_parse_caller_presentation | ( | const char * | data | ) |
Convert caller ID text code to value (used in config file parsing)
data | text string from config file |
value | AST_PRES_ from callerid.h |
-1 | if not in table |
Definition at line 1343 of file callerid.c.
References ARRAY_LEN, name, pres_types, and ast_value_translation::value.
Referenced by caller_id_privacy_handler(), dial_exec_full(), party_id_write(), party_name_write(), party_number_write(), and redirecting_write().
const char * ast_party_name_charset_describe | ( | int | data | ) |
Convert ast_party_name.char_set value to explanatory string.
data | AST_PARTY_CHAR_SET from channel.h |
Definition at line 1547 of file callerid.c.
References ARRAY_LEN, ast_value_translation::description, party_name_charset_tbl, and value.
Referenced by json_party_name().
int ast_party_name_charset_parse | ( | const char * | data | ) |
Convert ast_party_name.char_set text code to value (used in config file parsing)
data | text string from config file |
AST_PARTY_CHAR_SET | from channel.h |
-1 | if not in table |
Definition at line 1534 of file callerid.c.
References ARRAY_LEN, name, party_name_charset_tbl, and ast_value_translation::value.
Referenced by party_name_write().
const char * ast_party_name_charset_str | ( | int | data | ) |
Convert ast_party_name.char_set value to text code.
data | AST_PARTY_CHAR_SET from channel.h |
Definition at line 1560 of file callerid.c.
References ARRAY_LEN, ast_value_translation::name, party_name_charset_tbl, and value.
Referenced by party_name_read().
const char * ast_redirecting_reason_describe | ( | int | data | ) |
Convert redirecting reason value to explanatory string.
data | Q931_REDIRECTING_REASON from callerid.h |
Definition at line 1436 of file callerid.c.
References ARRAY_LEN, ast_value_translation::description, redirecting_reason_types, and value.
Referenced by __ast_callerid_generate().
const char * ast_redirecting_reason_name | ( | const struct ast_party_redirecting_reason * | data | ) |
Convert redirecting reason value to text code.
data | ast_party_redirecting_reason structure from channel.h |
Definition at line 1449 of file callerid.c.
References ARRAY_LEN, ast_strlen_zero(), ast_party_redirecting_reason::code, ast_value_translation::name, redirecting_reason_types, ast_party_redirecting_reason::str, and value.
Referenced by my_get_callerid(), and redirecting_read().
int ast_redirecting_reason_parse | ( | const char * | data | ) |
Convert redirecting reason text code to value (used in config file parsing)
data | text string from config file |
Q931_REDIRECTING_REASON | from callerid.h |
-1 | if not in table |
Definition at line 1423 of file callerid.c.
References ARRAY_LEN, name, redirecting_reason_types, and ast_value_translation::value.
Referenced by redirecting_write(), and set_redirecting_reason().
void ast_shrink_phone_number | ( | char * | n | ) |
Shrink a phone number in place to just digits (more accurately it just removes ()'s, .'s, and -'s...
n | The number to be stripped/shrunk |
Shrink a phone number in place to just digits (more accurately it just removes ()'s, .'s, and -'s...
Remove '(', ' ', ')', non-trailing '.', and '-' not in square brackets. Basically, remove anything that could be invalid in a pattern.
Definition at line 1101 of file callerid.c.
Referenced by __analog_ss_thread(), action_originate(), analog_ss_thread(), ari_channels_handle_originate_with_id(), ast_callerid_parse(), ast_callerid_split(), ast_privacy_check(), ast_privacy_set(), check_access(), handle_setcallerid(), pbx_load_config(), setup_privacy_args(), and write_metadata().
int callerid_feed | ( | struct callerid_state * | cid, |
unsigned char * | ubuf, | ||
int | samples, | ||
struct ast_format * | codec | ||
) |
Read samples into the state machine.
cid | Which state machine to act upon |
ubuf | containing your samples |
samples | number of samples contained within the buffer. |
codec | which codec (AST_FORMAT_ALAW or AST_FORMAT_ULAW) |
Send received audio to the Caller*ID demodulator.
-1 | on error |
0 | for "needs more samples" |
1 | if the CallerID spill reception is complete. |
Definition at line 570 of file callerid.c.
References ast_alloca, ast_copy_string(), ast_debug, ast_log, AST_REDIRECTING_REASON_CALL_FWD_DTE, AST_REDIRECTING_REASON_DEFLECTION, AST_REDIRECTING_REASON_NO_ANSWER, AST_REDIRECTING_REASON_UNCONDITIONAL, AST_REDIRECTING_REASON_USER_BUSY, ast_strlen_zero(), AST_XLAW, b, buf, CID_MSGWAITING, CID_NOMSGWAITING, CID_PRIVATE_NAME, CID_PRIVATE_NUMBER, CID_QUALIFIER, CID_UNKNOWN_NAME, CID_UNKNOWN_NUMBER, callerid_state::cksum, callerid_state::flags, fsk_serial(), callerid_state::fskd, len(), callerid_state::len, LOG_ERROR, LOG_NOTICE, LOG_WARNING, mdmf_param_name(), callerid_state::name, callerid_state::number, callerid_state::oldlen, callerid_state::oldstuff, callerid_state::pos, callerid_state::rawdata, callerid_state::redirecting, callerid_state::sawflag, and callerid_state::type.
Referenced by analog_ss_thread(), mwi_thread(), and my_get_callerid().
int callerid_feed_jp | ( | struct callerid_state * | cid, |
unsigned char * | ubuf, | ||
int | samples, | ||
struct ast_format * | codec | ||
) |
Read samples into the state machine.
cid | Which state machine to act upon |
ubuf | containing your samples |
samples | number of samples contained within the buffer. |
codec | which codec (AST_FORMAT_ALAW or AST_FORMAT_ULAW) |
Send received audio to the Caller*ID demodulator (for japanese style lines).
-1 | on error |
0 | for "needs more samples" |
1 | if the CallerID spill reception is complete. |
Definition at line 316 of file callerid.c.
References ast_alloca, ast_copy_string(), ast_debug, ast_log, AST_XLAW, b, buf, calc_crc(), CID_UNKNOWN_NUMBER, callerid_state::crc, DEBUG_ATLEAST, callerid_state::flags, fsk_serial(), callerid_state::fskd, len(), callerid_state::len, LOG_ERROR, LOG_NOTICE, LOG_WARNING, callerid_state::name, callerid_state::number, callerid_state::oldlen, callerid_state::oldstuff, callerid_state::pos, callerid_state::rawdata, callerid_state::sawflag, and callerid_state::skipflag.
Referenced by analog_ss_thread(), and my_get_callerid().
void callerid_free | ( | struct callerid_state * | cid | ) |
This function frees callerid_state cid.
cid | This is the callerid_state state machine to free |
Definition at line 833 of file callerid.c.
References ast_free.
Referenced by analog_ss_thread(), mwi_thread(), and my_stop_cid_detect().
int callerid_full_generate | ( | unsigned char * | buf, |
const char * | number, | ||
const char * | name, | ||
const char * | ddn, | ||
int | redirecting, | ||
int | flags, | ||
int | format, | ||
int | callwaiting, | ||
struct ast_format * | codec | ||
) |
Generates a CallerID FSK stream in ulaw format suitable for transmission.
buf | Buffer to use. If "buf" is supplied, it will use that buffer instead of allocating its own. "buf" must be at least 32000 bytes in size of you want to be sure you don't have an overrun. |
number | Use NULL for no number or "P" for "private" |
name | name to be used |
ddn | Dialable Directory Number (or NULL) |
redirecting | Redirecting reason |
flags | passed flags |
format | Message format |
callwaiting | callwaiting flag |
codec | – either AST_FORMAT_ULAW or AST_FORMAT_ALAW |
This function creates a stream of callerid (a callerid spill) data in ulaw format.
Definition at line 1044 of file callerid.c.
References buf, callerid_full_tz_generate(), name, and NULL.
Referenced by callerid_generate().
int callerid_full_tz_generate | ( | unsigned char * | buf, |
const char * | number, | ||
const char * | name, | ||
const char * | ddn, | ||
int | redirecting, | ||
int | flags, | ||
int | format, | ||
int | callwaiting, | ||
struct ast_format * | codec, | ||
const char * | tz | ||
) |
Generates a CallerID FSK stream in ulaw format suitable for transmission.
buf | Buffer to use. If "buf" is supplied, it will use that buffer instead of allocating its own. "buf" must be at least 32000 bytes in size of you want to be sure you don't have an overrun. |
number | Use NULL for no number or "P" for "private" |
name | name to be used |
ddn | Dialable Directory Number (or NULL) |
redirecting | Redirecting reason |
flags | passed flags |
format | Message format |
callwaiting | callwaiting flag |
codec | – either AST_FORMAT_ULAW or AST_FORMAT_ALAW |
tz | TZ-format time zone to use for date/time (NULL for system default) |
This function creates a stream of callerid (a callerid spill) data in ulaw format.
Definition at line 1051 of file callerid.c.
References callerid_genmsg(), len(), name, PUT_BYTE, PUT_CLID, PUT_CLID_MARKMS, and tz.
Referenced by __ast_callerid_generate(), and callerid_full_generate().
int callerid_generate | ( | unsigned char * | buf, |
const char * | number, | ||
const char * | name, | ||
int | flags, | ||
int | callwaiting, | ||
struct ast_format * | codec | ||
) |
Generates a CallerID FSK stream in ulaw format suitable for transmission.
buf | Buffer to use. If "buf" is supplied, it will use that buffer instead of allocating its own. "buf" must be at least 32000 bytes in size of you want to be sure you don't have an overrun. |
number | Use NULL for no number or "P" for "private" |
name | name to be used |
flags | passed flags |
callwaiting | callwaiting flag |
codec | – either AST_FORMAT_ULAW or AST_FORMAT_ALAW |
This function creates a stream of callerid (a callerid spill) data in ulaw format.
Definition at line 1039 of file callerid.c.
References buf, callerid_full_generate(), CID_TYPE_MDMF, name, and NULL.
void callerid_get | ( | struct callerid_state * | cid, |
char ** | number, | ||
char ** | name, | ||
int * | flags | ||
) |
Extract info out of callerID state machine. Flags are listed above.
cid | Callerid state machine to act upon |
number | Pass the address of a pointer-to-char (will contain the phone number) |
name | Pass the address of a pointer-to-char (will contain the name) |
flags | Pass the address of an int variable (will contain the various callerid flags - presentation flags and call qualifier) |
This function extracts a callerid string out of a callerid_state state machine. If no number is found, *number will be set to NULL. Likewise for the name. Flags can contain any of the following: CID_PRIVATE_NAME, CID_PRIVATE_NUMBER, CID_UNKNOWN_NAME, CID_UNKNOWN_NUMBER, CID_MSGWAITING, CID_NOMSGWAITING, CID_QUALIFIER
Definition at line 205 of file callerid.c.
References callerid_get_with_redirecting(), callerid_state::flags, name, and callerid_state::redirecting.
Referenced by analog_ss_thread(), and mwi_thread().
void callerid_get_dtmf | ( | char * | cidstring, |
char * | number, | ||
int * | flags | ||
) |
Get and parse DTMF-based callerid.
cidstring | The actual transmitted string. |
number | The cid number is returned here. |
flags | The cid flags are returned here. |
Definition at line 211 of file callerid.c.
References ast_debug, ast_log, CID_PRIVATE_NUMBER, CID_UNKNOWN_NUMBER, callerid_state::flags, and LOG_WARNING.
Referenced by __analog_ss_thread(), and analog_ss_thread().
void callerid_get_with_redirecting | ( | struct callerid_state * | cid, |
char ** | name, | ||
char ** | number, | ||
int * | flags, | ||
int * | redirecting | ||
) |
Extract info out of callerID state machine. Flags are listed above.
cid | Callerid state machine to act upon | |
[out] | number | Pass the address of a pointer-to-char (will contain the phone number) |
[out] | name | Pass the address of a pointer-to-char (will contain the name) |
[out] | flags | Pass the address of an int variable (will contain the various callerid flags) |
[out] | redirecting | Pass the address of an int variable (will contain the redirecting reason, if received - presentation flags and call qualifier) |
This function extracts a callerid string out of a callerid_state state machine. If no number is found, *number will be set to NULL. Likewise for the name. Flags can contain any of the following: CID_PRIVATE_NAME, CID_PRIVATE_NUMBER, CID_UNKNOWN_NAME, CID_UNKNOWN_NUMBER, CID_MSGWAITING, CID_NOMSGWAITING, CID_QUALIFIER
Definition at line 189 of file callerid.c.
References CID_PRIVATE_NAME, CID_PRIVATE_NUMBER, CID_UNKNOWN_NAME, CID_UNKNOWN_NUMBER, callerid_state::flags, callerid_state::name, name, NULL, callerid_state::number, and callerid_state::redirecting.
Referenced by callerid_get(), and my_get_callerid().
|
inlinestatic |
Definition at line 372 of file callerid.h.
void callerid_init | ( | void | ) |
CallerID Initialization.
CallerID Initialization.
Definition at line 116 of file callerid.c.
References CALLERID_MARK, CALLERID_SPACE, CAS_FREQ1, CAS_FREQ2, casdi1, casdi2, casdr1, casdr2, cid_di, cid_dr, cos, M_PI, SAS_FREQ, sasdi, and sasdr.
Referenced by asterisk_daemon().
struct callerid_state * callerid_new | ( | int | cid_signalling | ) |
Create a callerID state machine.
cid_signalling | Type of signalling in use |
This function returns a malloc'd instance of the callerid_state data structure.
Definition at line 130 of file callerid.c.
References ast_calloc, fsk_data::bw, CID_UNKNOWN_NAME, CID_UNKNOWN_NUMBER, fsk_data::f_mark_idx, fsk_data::f_space_idx, callerid_state::flags, callerid_state::fskd, fskmodem_init(), fsk_data::icont, fsk_data::instop, fsk_data::ispb, fsk_data::nbit, fsk_data::nstop, fsk_data::pllids, fsk_data::pllispb, fsk_data::pllispb2, and fsk_data::spb.
Referenced by analog_ss_thread(), mwi_thread(), and my_start_cid_detect().
|
extern |
Definition at line 65 of file callerid.c.
Referenced by callerid_getcarrier(), and callerid_init().
|
extern |
Definition at line 65 of file callerid.c.
Referenced by callerid_getcarrier(), and callerid_init().
|
extern |
Definition at line 66 of file callerid.c.