45 #ifndef _ASTERISK_CALLERID_H 46 #define _ASTERISK_CALLERID_H 50 #define MAX_CALLERID_SIZE 32000 52 #define CID_PRIVATE_NAME (1 << 0) 53 #define CID_PRIVATE_NUMBER (1 << 1) 54 #define CID_UNKNOWN_NAME (1 << 2) 55 #define CID_UNKNOWN_NUMBER (1 << 3) 56 #define CID_MSGWAITING (1 << 4) 57 #define CID_NOMSGWAITING (1 << 5) 59 #define CID_SIG_BELL 1 61 #define CID_SIG_DTMF 3 62 #define CID_SIG_V23_JP 4 63 #define CID_SIG_SMDI 5 65 #define CID_START_RING 1 66 #define CID_START_POLARITY 2 67 #define CID_START_POLARITY_IN 3 68 #define CID_START_DTMF_NOALERT 4 72 #define CID_MWI_TYPE_SDMF 0x00 74 #define CID_MWI_TYPE_MDMF 0x01 76 #define CID_MWI_TYPE_MDMF_FULL 0x02 78 #define AST_LIN2X(a) ((ast_format_cmp(codec, ast_format_alaw) == AST_FORMAT_CMP_EQUAL) ? (AST_LIN2A(a)) : (AST_LIN2MU(a))) 79 #define AST_XLAW(a) ((ast_format_cmp(codec, ast_format_alaw) == AST_FORMAT_CMP_EQUAL) ? (AST_ALAW(a)) : (AST_MULAW(a))) 269 *ci = *cr * cid_di[bit] + *ci *
cid_dr[bit];
272 t = 2.0 - (*cr * *cr + *ci * *ci);
278 #define PUT_BYTE(a) do { \ 283 #define PUT_AUDIO_SAMPLE(y) do { \ 284 int __sample_idx = (short)(rint(8192.0 * (y))); \ 285 *(buf++) = AST_LIN2X(__sample_idx); \ 289 #define PUT_CLID_MARKMS do { \ 291 for (__clid_x=0;__clid_x<8;__clid_x++) \ 292 PUT_AUDIO_SAMPLE(callerid_getcarrier(&cr, &ci, 1)); \ 295 #define PUT_CLID_BAUD(bit) do { \ 296 while(scont < clidsb) { \ 297 PUT_AUDIO_SAMPLE(callerid_getcarrier(&cr, &ci, bit)); \ 304 #define PUT_CLID(byte) do { \ 306 unsigned char b = (byte); \ 308 for (z=0;z<8;z++) { \ 309 PUT_CLID_BAUD(b & 1); \ 317 #define AST_PRES_NUMBER_TYPE 0x03 318 #define AST_PRES_USER_NUMBER_UNSCREENED 0x00 319 #define AST_PRES_USER_NUMBER_PASSED_SCREEN 0x01 320 #define AST_PRES_USER_NUMBER_FAILED_SCREEN 0x02 321 #define AST_PRES_NETWORK_NUMBER 0x03 323 #define AST_PRES_RESTRICTION 0x60 324 #define AST_PRES_ALLOWED 0x00 325 #define AST_PRES_RESTRICTED 0x20 326 #define AST_PRES_UNAVAILABLE 0x40 327 #define AST_PRES_RESERVED 0x60 329 #define AST_PRES_ALLOWED_USER_NUMBER_NOT_SCREENED \ 330 (AST_PRES_ALLOWED | AST_PRES_USER_NUMBER_UNSCREENED) 332 #define AST_PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN \ 333 (AST_PRES_ALLOWED | AST_PRES_USER_NUMBER_PASSED_SCREEN) 335 #define AST_PRES_ALLOWED_USER_NUMBER_FAILED_SCREEN \ 336 (AST_PRES_ALLOWED | AST_PRES_USER_NUMBER_FAILED_SCREEN) 338 #define AST_PRES_ALLOWED_NETWORK_NUMBER \ 339 (AST_PRES_ALLOWED | AST_PRES_NETWORK_NUMBER) 341 #define AST_PRES_PROHIB_USER_NUMBER_NOT_SCREENED \ 342 (AST_PRES_RESTRICTED | AST_PRES_USER_NUMBER_UNSCREENED) 344 #define AST_PRES_PROHIB_USER_NUMBER_PASSED_SCREEN \ 345 (AST_PRES_RESTRICTED | AST_PRES_USER_NUMBER_PASSED_SCREEN) 347 #define AST_PRES_PROHIB_USER_NUMBER_FAILED_SCREEN \ 348 (AST_PRES_RESTRICTED | AST_PRES_USER_NUMBER_FAILED_SCREEN) 350 #define AST_PRES_PROHIB_NETWORK_NUMBER \ 351 (AST_PRES_RESTRICTED | AST_PRES_NETWORK_NUMBER) 353 #define AST_PRES_NUMBER_NOT_AVAILABLE \ 354 (AST_PRES_UNAVAILABLE | AST_PRES_NETWORK_NUMBER)
AST_CONNECTED_LINE_UPDATE_SOURCE
Connected line update source code.
static char exten[AST_MAX_EXTENSION]
const char * ast_named_caller_presentation(int data)
Convert caller ID pres value to text code.
int ast_connected_line_source_parse(const char *data)
Convert connected line update source text code to value (used in config file parsing) ...
int ast_callerid_split(const char *src, char *name, int namelen, char *num, int numlen)
const char * ast_describe_caller_presentation(int data)
Convert caller ID pres value to explanatory string.
const char * ast_connected_line_source_name(int data)
Convert connected line update source value to text code.
int ast_redirecting_reason_parse(const char *data)
Convert redirecting reason text code to value (used in config file parsing)
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) ...
const char * ast_redirecting_reason_name(const struct ast_party_redirecting_reason *data)
Convert redirecting reason value to text code.
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_...
void callerid_get(struct callerid_state *cid, char **number, char **name, int *flags)
Extract info out of callerID state machine. Flags are listed above.
int callerid_feed_jp(struct callerid_state *cid, unsigned char *ubuf, int samples, struct ast_format *codec)
Read samples into the state machine.
char * ast_callerid_merge(char *buf, int bufsiz, const char *name, const char *num, const char *unknown)
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.
void callerid_init(void)
CallerID Initialization.
int ast_party_name_charset_parse(const char *data)
Convert ast_party_name.char_set text code to value (used in config file parsing)
AST_REDIRECTING_REASON
redirecting reason codes.
int ast_parse_caller_presentation(const char *data)
Convert caller ID text code to value (used in config file parsing)
Redirecting reason information.
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
const char * ast_redirecting_reason_describe(int data)
Convert redirecting reason value to explanatory string.
static float callerid_getcarrier(float *cr, float *ci, int bit)
static struct ast_codec unknown
int ast_isphonenumber(const char *n)
Check if a string consists only of digits and + #.
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) ...
const char * ast_party_name_charset_str(int data)
Convert ast_party_name.char_set value to text code.
void callerid_free(struct callerid_state *cid)
This function frees callerid_state cid.
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.
const char * ast_connected_line_source_describe(int data)
Convert connected line update source value to explanatory string.
void callerid_get_dtmf(char *cidstring, char *number, int *flags)
Get and parse DTMF-based callerid.
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...
struct callerid_state * callerid_new(int cid_signalling)
Create a callerID state machine.
const char * ast_party_name_charset_describe(int data)
Convert ast_party_name.char_set value to explanatory string.
int callerid_feed(struct callerid_state *cid, unsigned char *ubuf, int samples, struct ast_format *codec)
Read samples into the state machine.
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.
int ast_callerid_parse(char *instr, char **name, char **location)
Destructively parse inbuf into name and location (or number)