#include <time.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <math.h>
#include <asterisk/ulaw.h>
#include <asterisk/alaw.h>
#include <asterisk/frame.h>
#include <asterisk/callerid.h>
#include <asterisk/logger.h>
#include <asterisk/fskmodem.h>
#include <asterisk/utils.h>
Include dependency graph for callerid.c:
Go to the source code of this file.
Data Structures | |
struct | callerid_state |
Defines | |
#define | CALLERID_SPACE 2200.0 /* 2200 hz for "0" */ |
#define | CALLERID_MARK 1200.0 /* 1200 hz for "1" */ |
#define | SAS_FREQ 440.0 |
#define | CAS_FREQ1 2130.0 |
#define | CAS_FREQ2 2750.0 |
Functions | |
void | callerid_init (void) |
CallerID Initialization. | |
callerid_state * | callerid_new (void) |
Create a callerID state machine. | |
void | callerid_get (struct callerid_state *cid, char **name, char **number, int *flags) |
Extract info out of callerID state machine. Flags are listed above. | |
int | ast_gen_cas (unsigned char *outbuf, int sendsas, int len, int codec) |
Generate a CAS (CPE Alert Signal) tone for 'n' samples. | |
int | callerid_feed (struct callerid_state *cid, unsigned char *ubuf, int len, int codec) |
Read samples into the state machine. | |
void | callerid_free (struct callerid_state *cid) |
Free a callerID state. | |
int | vmwi_generate (unsigned char *buf, int active, int mdmf, int codec) |
Generate message waiting indicator. | |
int | callerid_generate (unsigned char *buf, char *number, char *name, int flags, int callwaiting, int codec) |
Generates a CallerID FSK stream in ulaw format suitable for transmission. | |
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... | |
int | ast_isphonenumber (char *n) |
Check if a string consists only of digits. Returns non-zero if so. | |
int | ast_callerid_parse (char *instr, char **name, char **location) |
Destructively parse inbuf into name and location (or number). | |
int | ast_callerid_generate (unsigned char *buf, char *callerid, int codec) |
Generate Caller-ID spill from the "callerid" field of asterisk (in e-mail address like format). | |
int | ast_callerid_callwaiting_generate (unsigned char *buf, char *callerid, int codec) |
Generate Caller-ID spill from the "callerid" field of asterisk (in e-mail address like format) but in a format suitable for Call Waiting(tm)'s Caller*ID(tm). | |
Variables | |
float | cid_dr [4] |
float | cid_di [4] |
float | clidsb = 8000.0 / 1200.0 |
float | sasdr |
float | sasdi |
float | casdr1 |
float | casdi1 |
float | casdr2 |
float | casdi2 |
|
Definition at line 53 of file callerid.c. Referenced by callerid_init(). |
|
Definition at line 52 of file callerid.c. Referenced by callerid_init(). |
|
Definition at line 55 of file callerid.c. Referenced by callerid_init(). |
|
Definition at line 56 of file callerid.c. Referenced by callerid_init(). |
|
Definition at line 54 of file callerid.c. Referenced by callerid_init(). |
|
Generate Caller-ID spill from the "callerid" field of asterisk (in e-mail address like format) but in a format suitable for Call Waiting(tm)'s Caller*ID(tm). See ast_callerid_generate for other details Definition at line 591 of file callerid.c.
|
|
Generate Caller-ID spill from the "callerid" field of asterisk (in e-mail address like format).
Definition at line 586 of file callerid.c.
|
|
Destructively parse inbuf into name and location (or number).
Definition at line 520 of file callerid.c. References ast_isphonenumber(), and ast_shrink_phone_number(). Referenced by ast_cdr_init(), ast_cdr_setcid(), ast_cdr_update(), ast_privacy_check(), and ast_privacy_set().
|
|
Generate a CAS (CPE Alert Signal) tone for 'n' samples.
Definition at line 150 of file callerid.c. References casdi1, casdi2, casdr1, casdr2, sasdi, and sasdr.
|
|
Check if a string consists only of digits. Returns non-zero if so.
Definition at line 509 of file callerid.c. Referenced by ast_callerid_parse().
|
|
Shrink a phone number in place to just digits (more accurately it just removes ()'s, .'s, and -'s...
Definition at line 500 of file callerid.c. Referenced by ast_callerid_parse(), ast_cdr_init(), ast_cdr_setcid(), ast_cdr_update(), ast_privacy_check(), and ast_privacy_set().
|
|
Read samples into the state machine.
Definition at line 171 of file callerid.c. References ast_log(), AST_XLAW, CID_PRIVATE_NAME, CID_PRIVATE_NUMBER, CID_UNKNOWN_NAME, CID_UNKNOWN_NUMBER, callerid_state::cksum, callerid_state::flags, free, fsk_serie(), callerid_state::fskd, callerid_state::len, LOG_ERROR, LOG_NOTICE, LOG_WARNING, malloc, callerid_state::name, callerid_state::number, callerid_state::oldlen, callerid_state::oldstuff, callerid_state::pos, callerid_state::rawdata, callerid_state::sawflag, and callerid_state::type.
|
|
Free a callerID state.
Definition at line 322 of file callerid.c. References free.
|
|
Generates a CallerID FSK stream in ulaw format suitable for transmission.
Definition at line 458 of file callerid.c. References PUT_BYTE, PUT_CLID, and PUT_CLID_MARKMS.
|
|
Extract info out of callerID state machine. Flags are listed above.
Returns nothing. Definition at line 137 of file callerid.c. References CID_PRIVATE_NUMBER, CID_UNKNOWN_NAME, CID_UNKNOWN_NUMBER, callerid_state::flags, callerid_state::name, and callerid_state::number.
|
|
CallerID Initialization. Initializes the callerid system. Mostly stuff for inverse FFT Definition at line 95 of file callerid.c. References CALLERID_MARK, CALLERID_SPACE, CAS_FREQ1, CAS_FREQ2, casdi1, casdi2, casdr1, casdr2, cid_di, cid_dr, SAS_FREQ, sasdi, and sasdr. Referenced by main().
|
|
Create a callerID state machine. This function returns a malloc'd instance of the callerid_state data structure. Returns a pointer to a malloc'd callerid_state structure, or NULL on error. Definition at line 110 of file callerid.c. References ast_log(), CID_UNKNOWN_NAME, CID_UNKNOWN_NUMBER, LOG_WARNING, and malloc.
|
|
Generate message waiting indicator.
Definition at line 396 of file callerid.c. References PUT_BYTE, PUT_CLID, and PUT_CLID_MARKMS.
|
|
Definition at line 50 of file callerid.c. Referenced by ast_gen_cas(), and callerid_init(). |
|
Definition at line 50 of file callerid.c. Referenced by ast_gen_cas(), and callerid_init(). |
|
Definition at line 50 of file callerid.c. Referenced by ast_gen_cas(), and callerid_init(). |
|
Definition at line 50 of file callerid.c. Referenced by ast_gen_cas(), and callerid_init(). |
|
Definition at line 47 of file callerid.c. Referenced by callerid_init(). |
|
Definition at line 47 of file callerid.c. Referenced by callerid_init(). |
|
Definition at line 48 of file callerid.c. |
|
Definition at line 49 of file callerid.c. Referenced by ast_gen_cas(), and callerid_init(). |
|
Definition at line 49 of file callerid.c. Referenced by ast_gen_cas(), and callerid_init(). |