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)
58#define CID_QUALIFIER (1 << 6)
63#define CID_SIG_V23_JP 4
66#define CID_START_RING 1
67#define CID_START_POLARITY 2
68#define CID_START_POLARITY_IN 3
69#define CID_START_DTMF_NOALERT 4
73#define CID_TYPE_SDMF 0x00
75#define CID_TYPE_MDMF 0x01
79#define CID_MWI_TYPE_SDMF 0x00
81#define CID_MWI_TYPE_MDMF 0x01
83#define CID_MWI_TYPE_MDMF_FULL 0x02
85#define AST_LIN2X(a) ((ast_format_cmp(codec, ast_format_alaw) == AST_FORMAT_CMP_EQUAL) ? (AST_LIN2A(a)) : (AST_LIN2MU(a)))
86#define AST_XLAW(a) ((ast_format_cmp(codec, ast_format_alaw) == AST_FORMAT_CMP_EQUAL) ? (AST_ALAW(a)) : (AST_MULAW(a)))
150 int flags,
int format,
int callwaiting,
struct ast_format *codec,
const char *
tz);
273 const char *ddn,
int redirecting,
int pres,
int qualifier,
int format,
struct ast_format *codec,
const char *
tz);
380 t = 2.0 - (*cr * *cr + *ci * *ci);
386#define PUT_BYTE(a) do { \
391#define PUT_AUDIO_SAMPLE(y) do { \
392 int __sample_idx = (short)(rint(8192.0 * (y))); \
393 *(buf++) = AST_LIN2X(__sample_idx); \
397#define PUT_CLID_MARKMS do { \
399 for (__clid_x=0;__clid_x<8;__clid_x++) \
400 PUT_AUDIO_SAMPLE(callerid_getcarrier(&cr, &ci, 1)); \
403#define PUT_CLID_BAUD(bit) do { \
404 while(scont < clidsb) { \
405 PUT_AUDIO_SAMPLE(callerid_getcarrier(&cr, &ci, bit)); \
412#define PUT_CLID(byte) do { \
414 unsigned char b = (byte); \
416 for (z=0;z<8;z++) { \
417 PUT_CLID_BAUD(b & 1); \
425#define AST_PRES_NUMBER_TYPE 0x03
426#define AST_PRES_USER_NUMBER_UNSCREENED 0x00
427#define AST_PRES_USER_NUMBER_PASSED_SCREEN 0x01
428#define AST_PRES_USER_NUMBER_FAILED_SCREEN 0x02
429#define AST_PRES_NETWORK_NUMBER 0x03
431#define AST_PRES_RESTRICTION 0x60
432#define AST_PRES_ALLOWED 0x00
433#define AST_PRES_RESTRICTED 0x20
434#define AST_PRES_UNAVAILABLE 0x40
435#define AST_PRES_RESERVED 0x60
437#define AST_PRES_ALLOWED_USER_NUMBER_NOT_SCREENED \
438 (AST_PRES_ALLOWED | AST_PRES_USER_NUMBER_UNSCREENED)
440#define AST_PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN \
441 (AST_PRES_ALLOWED | AST_PRES_USER_NUMBER_PASSED_SCREEN)
443#define AST_PRES_ALLOWED_USER_NUMBER_FAILED_SCREEN \
444 (AST_PRES_ALLOWED | AST_PRES_USER_NUMBER_FAILED_SCREEN)
446#define AST_PRES_ALLOWED_NETWORK_NUMBER \
447 (AST_PRES_ALLOWED | AST_PRES_NETWORK_NUMBER)
449#define AST_PRES_PROHIB_USER_NUMBER_NOT_SCREENED \
450 (AST_PRES_RESTRICTED | AST_PRES_USER_NUMBER_UNSCREENED)
452#define AST_PRES_PROHIB_USER_NUMBER_PASSED_SCREEN \
453 (AST_PRES_RESTRICTED | AST_PRES_USER_NUMBER_PASSED_SCREEN)
455#define AST_PRES_PROHIB_USER_NUMBER_FAILED_SCREEN \
456 (AST_PRES_RESTRICTED | AST_PRES_USER_NUMBER_FAILED_SCREEN)
458#define AST_PRES_PROHIB_NETWORK_NUMBER \
459 (AST_PRES_RESTRICTED | AST_PRES_NETWORK_NUMBER)
461#define AST_PRES_NUMBER_NOT_AVAILABLE \
462 (AST_PRES_UNAVAILABLE | AST_PRES_NETWORK_NUMBER)
char * ast_callerid_merge(char *buf, int bufsiz, const char *name, const char *num, const char *unknown)
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)
int ast_parse_caller_presentation(const char *data)
Convert caller ID text code to value (used in config file parsing)
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.
const char * ast_connected_line_source_describe(int data)
Convert connected line update source value to explanatory string.
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)
int callerid_feed_jp(struct callerid_state *cid, unsigned char *ubuf, int samples, struct ast_format *codec)
Read samples into the state machine.
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.
int ast_callerid_parse(char *instr, char **name, char **location)
Destructively parse inbuf into name and location (or number)
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_free(struct callerid_state *cid)
This function frees callerid_state cid.
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.
const char * ast_describe_caller_presentation(int data)
Convert caller ID pres value to explanatory string.
const char * ast_party_name_charset_describe(int data)
Convert ast_party_name.char_set value to explanatory string.
const char * ast_redirecting_reason_name(const struct ast_party_redirecting_reason *data)
Convert redirecting reason value to text code.
AST_CONNECTED_LINE_UPDATE_SOURCE
Connected line update source code.
@ AST_CONNECTED_LINE_UPDATE_SOURCE_TRANSFER
@ AST_CONNECTED_LINE_UPDATE_SOURCE_UNKNOWN
@ AST_CONNECTED_LINE_UPDATE_SOURCE_DIVERSION
@ AST_CONNECTED_LINE_UPDATE_SOURCE_TRANSFER_ALERTING
@ AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER
void ast_shrink_phone_number(char *n)
Shrink a phone number in place to just digits (more accurately it just removes ()'s,...
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_party_name_charset_str(int data)
Convert ast_party_name.char_set value to text code.
AST_REDIRECTING_REASON
redirecting reason codes.
@ AST_REDIRECTING_REASON_AWAY
@ AST_REDIRECTING_REASON_UNKNOWN
@ AST_REDIRECTING_REASON_SEND_TO_VM
@ AST_REDIRECTING_REASON_NO_ANSWER
@ AST_REDIRECTING_REASON_DO_NOT_DISTURB
@ AST_REDIRECTING_REASON_FOLLOW_ME
@ AST_REDIRECTING_REASON_DEFLECTION
@ AST_REDIRECTING_REASON_UNAVAILABLE
@ AST_REDIRECTING_REASON_UNCONDITIONAL
@ AST_REDIRECTING_REASON_CALL_FWD_DTE
@ AST_REDIRECTING_REASON_OUT_OF_ORDER
@ AST_REDIRECTING_REASON_TIME_OF_DAY
@ AST_REDIRECTING_REASON_USER_BUSY
static float callerid_getcarrier(float *cr, float *ci, int bit)
struct callerid_state * callerid_new(int cid_signalling)
Create a callerID state machine.
void callerid_init(void)
CallerID Initialization.
int callerid_feed(struct callerid_state *cid, unsigned char *ubuf, int samples, struct ast_format *codec)
Read samples into the state machine.
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.
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 callerid_get_dtmf(char *cidstring, char *number, int *flags)
Get and parse DTMF-based callerid.
int ast_isphonenumber(const char *n)
Check if a string consists only of digits and + #.
const char * ast_redirecting_reason_describe(int data)
Convert redirecting reason value to explanatory string.
int ast_redirecting_reason_parse(const char *data)
Convert redirecting reason text code to value (used in config file parsing)
const char * ast_connected_line_source_name(int data)
Convert connected line update source value to text code.
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_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)
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_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.
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_...
int ast_callerid_split(const char *src, char *name, int namelen, char *num, int numlen)
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)
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)
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
Redirecting reason information.
static struct ast_codec unknown