Asterisk - The Open Source Telephony Project GIT-master-f36a736
|
CallerID Generation support. More...
#include "asterisk.h"
#include <time.h>
#include <math.h>
#include <ctype.h>
#include "asterisk/ulaw.h"
#include "asterisk/alaw.h"
#include "asterisk/frame.h"
#include "asterisk/channel.h"
#include "asterisk/callerid.h"
#include "asterisk/fskmodem.h"
#include "asterisk/utils.h"
#include "asterisk/format_cache.h"
Go to the source code of this file.
Data Structures | |
struct | ast_value_translation |
struct | callerid_state |
Macros | |
#define | AST_CALLERID_UNKNOWN "<unknown>" |
#define | CALLERID_MARK 1200.0 |
#define | CALLERID_SPACE 2200.0 |
#define | CAS_FREQ1 2130.0 |
#define | CAS_FREQ2 2750.0 |
#define | SAS_FREQ 440.0 |
Functions | |
static int | __ast_callerid_generate (unsigned char *buf, const char *name, const char *number, const char *ddn, int redirecting, int pres, int qualifier, int format, int callwaiting, struct ast_format *codec, const char *tz) |
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 *input_str, char **name, char **location) |
Destructively parse inbuf into name and location (or number) More... | |
int | ast_callerid_split (const char *buf, 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 sendsas, 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... | |
static int | ast_is_valid_string (const char *exten, const char *valid) |
Checks if phone number consists of valid characters. 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) |
Clean up phone string. More... | |
static unsigned short | calc_crc (unsigned short crc, unsigned char data) |
int | callerid_feed (struct callerid_state *cid, unsigned char *ubuf, int len, struct ast_format *codec) |
Read samples into the state machine. More... | |
int | callerid_feed_jp (struct callerid_state *cid, unsigned char *ubuf, int len, 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... | |
static int | callerid_genmsg (char *msg, int size, const char *number, const char *name, int flags, int format, const char *ddn, int redirecting, const char *tz) |
void | callerid_get (struct callerid_state *cid, char **name, char **number, 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... | |
void | callerid_init (void) |
Initialize stuff for inverse FFT. More... | |
struct callerid_state * | callerid_new (int cid_signalling) |
Create a callerID state machine. More... | |
static void | gen_tone (unsigned char *buf, int len, struct ast_format *codec, float ddr1, float ddi1, float *cr1, float *ci1) |
static void | gen_tones (unsigned char *buf, int len, struct ast_format *codec, float ddr1, float ddi1, float ddr2, float ddi2, float *cr1, float *ci1, float *cr2, float *ci2) |
static const char * | mdmf_param_name (int param) |
Variables | |
float | casdi1 |
float | casdi2 |
float | casdr1 |
float | casdr2 |
float | cid_di [4] |
float | cid_dr [4] |
float | clidsb = 8000.0 / 1200.0 |
static const struct ast_value_translation | connected_line_source_types [] |
Translation table for connected line update source settings. More... | |
static const struct ast_value_translation | party_name_charset_tbl [] |
Translation table for ast_party_name char-set settings. More... | |
static const struct ast_value_translation | pres_types [] |
Translation table for Caller ID Presentation settings. More... | |
static const struct ast_value_translation | redirecting_reason_types [] |
Translation table for redirecting reason settings. More... | |
float | sasdi |
float | sasdr |
CallerID Generation support.
Definition in file callerid.c.
#define AST_CALLERID_UNKNOWN "<unknown>" |
Definition at line 76 of file callerid.c.
#define CALLERID_MARK 1200.0 |
1200 hz for "1"
Definition at line 71 of file callerid.c.
#define CALLERID_SPACE 2200.0 |
2200 hz for "0"
Definition at line 70 of file callerid.c.
#define CAS_FREQ1 2130.0 |
Definition at line 73 of file callerid.c.
#define CAS_FREQ2 2750.0 |
Definition at line 74 of file callerid.c.
#define SAS_FREQ 440.0 |
Definition at line 72 of file callerid.c.
|
static |
Definition at line 1208 of file callerid.c.
References ast_debug, ast_named_caller_presentation(), AST_PRES_RESTRICTED, AST_PRES_UNAVAILABLE, ast_redirecting_reason_describe(), ast_strlen_zero(), buf, callerid_full_tz_generate(), CID_PRIVATE_NAME, CID_PRIVATE_NUMBER, CID_QUALIFIER, CID_TYPE_MDMF, CID_UNKNOWN_NAME, CID_UNKNOWN_NUMBER, name, NULL, and tz.
Referenced by ast_callerid_callwaiting_full_generate(), ast_callerid_callwaiting_full_tz_generate(), ast_callerid_callwaiting_generate(), ast_callerid_full_generate(), ast_callerid_full_tz_generate(), and ast_callerid_generate().
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 * | buf, |
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().
|
static |
Checks if phone number consists of valid characters.
exten | String that needs to be checked |
valid | Valid characters in string |
1 | if valid string |
0 | if string contains invalid characters |
Definition at line 1140 of file callerid.c.
References ast_strlen_zero().
Referenced by ast_is_shrinkable_phonenumber(), and ast_isphonenumber().
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 | ) |
Clean up phone string.
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().
|
static |
Definition at line 293 of file callerid.c.
References callerid_state::crc, and org.
Referenced by callerid_feed_jp().
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.
|
static |
Definition at line 838 of file callerid.c.
References ast_localtime(), 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_tvnow(), CID_PRIVATE_NAME, CID_PRIVATE_NUMBER, CID_QUALIFIER, CID_TYPE_SDMF, CID_UNKNOWN_NAME, CID_UNKNOWN_NUMBER, name, ast_tm::tm_hour, ast_tm::tm_mday, ast_tm::tm_min, ast_tm::tm_mon, and tz.
Referenced by ast_callerid_vmwi_generate(), and callerid_full_tz_generate().
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().
void callerid_init | ( | void | ) |
Initialize stuff for inverse FFT.
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().
|
inlinestatic |
Definition at line 100 of file callerid.c.
References AST_LIN2X, buf, and len().
Referenced by ast_gen_cas().
|
inlinestatic |
Definition at line 78 of file callerid.c.
References AST_LIN2X, buf, and len().
Referenced by ast_gen_cas().
|
static |
Definition at line 554 of file callerid.c.
Referenced by callerid_feed().
float casdi1 |
Definition at line 68 of file callerid.c.
Referenced by ast_gen_cas(), and callerid_init().
float casdi2 |
Definition at line 68 of file callerid.c.
Referenced by ast_gen_cas(), and callerid_init().
float casdr1 |
Definition at line 68 of file callerid.c.
Referenced by ast_gen_cas(), and callerid_init().
float casdr2 |
Definition at line 68 of file callerid.c.
Referenced by ast_gen_cas(), and callerid_init().
float cid_di[4] |
Definition at line 65 of file callerid.c.
Referenced by callerid_getcarrier(), and callerid_init().
float cid_dr[4] |
Definition at line 65 of file callerid.c.
Referenced by callerid_getcarrier(), and callerid_init().
float clidsb = 8000.0 / 1200.0 |
Definition at line 66 of file callerid.c.
|
static |
Translation table for connected line update source settings.
Definition at line 1468 of file callerid.c.
Referenced by ast_connected_line_source_describe(), ast_connected_line_source_name(), and ast_connected_line_source_parse().
|
static |
Translation table for ast_party_name char-set settings.
Definition at line 1519 of file callerid.c.
Referenced by ast_party_name_charset_describe(), ast_party_name_charset_parse(), and ast_party_name_charset_str().
|
static |
Translation table for Caller ID Presentation settings.
Definition at line 1318 of file callerid.c.
Referenced by ast_describe_caller_presentation(), ast_named_caller_presentation(), and ast_parse_caller_presentation().
|
static |
Translation table for redirecting reason settings.
Definition at line 1396 of file callerid.c.
Referenced by ast_redirecting_reason_describe(), ast_redirecting_reason_name(), and ast_redirecting_reason_parse().
float sasdi |
Definition at line 67 of file callerid.c.
Referenced by ast_gen_cas(), and callerid_init().
float sasdr |
Definition at line 67 of file callerid.c.
Referenced by ast_gen_cas(), and callerid_init().