Asterisk - The Open Source Telephony Project GIT-master-a358458
callerid.h
Go to the documentation of this file.
1/*
2 * Asterisk -- An open source telephony toolkit.
3 *
4 * Copyright (C) 1999 - 2005, Digium, Inc.
5 *
6 * Mark Spencer <markster@digium.com>
7 *
8 * See http://www.asterisk.org for more information about
9 * the Asterisk project. Please do not directly contact
10 * any of the maintainers of this project for assistance;
11 * the project provides a web site, mailing lists and IRC
12 * channels for your use.
13 *
14 * This program is free software, distributed under the terms of
15 * the GNU General Public License Version 2. See the LICENSE file
16 * at the top of the source tree.
17 */
18
19/*! \file
20 * \brief CallerID (and other GR30) management and generation
21 * Includes code and algorithms from the Zapata library.
22 *
23 * \ref CID
24 *
25 */
26
27/*!
28 * \page CID Caller ID names and numbers
29 *
30 * Caller ID names are currently 8 bit characters, propably
31 * ISO8859-1, depending on what your channel drivers handle.
32 *
33 * IAX2 and SIP caller ID names are UTF8
34 * On ISDN Caller ID names are 7 bit, Almost ASCII
35 * (See http://www.zytrax.com/tech/ia5.html )
36 *
37 * \note Asterisk does not currently support SIP utf8 caller ID names or caller ID's.
38 *
39 * \par See also
40 * \arg \ref callerid.c
41 * \arg \ref callerid.h
42 * \arg \ref Def_CallerPres
43 */
44
45#ifndef _ASTERISK_CALLERID_H
46#define _ASTERISK_CALLERID_H
47
48#include "asterisk/format.h"
49
50#define MAX_CALLERID_SIZE 32000
51
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)
59
60#define CID_SIG_BELL 1
61#define CID_SIG_V23 2
62#define CID_SIG_DTMF 3
63#define CID_SIG_V23_JP 4
64#define CID_SIG_SMDI 5
65
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
70
71/* Caller ID message formats */
72/*! SDMF - number only */
73#define CID_TYPE_SDMF 0x00
74/*! MDMF - name, number, etc. */
75#define CID_TYPE_MDMF 0x01
76
77/* defines dealing with message waiting indication generation */
78/*! MWI SDMF format */
79#define CID_MWI_TYPE_SDMF 0x00
80/*! MWI MDMF format -- generate only MWI field */
81#define CID_MWI_TYPE_MDMF 0x01
82/*! MWI MDMF format -- generate name, callerid, date and MWI fields */
83#define CID_MWI_TYPE_MDMF_FULL 0x02
84
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)))
87
88
89struct callerid_state;
90typedef struct callerid_state CIDSTATE;
91
92/*! \brief CallerID Initialization
93 * \par
94 * Initializes the callerid system. Mostly stuff for inverse FFT
95 */
96void callerid_init(void);
97
98/*! \brief Generates a CallerID FSK stream in ulaw format suitable for transmission.
99 * \param buf Buffer to use. If "buf" is supplied, it will use that buffer instead of allocating its own.
100 * "buf" must be at least 32000 bytes in size of you want to be sure you don't have an overrun.
101 * \param number Use NULL for no number or "P" for "private"
102 * \param name name to be used
103 * \param flags passed flags
104 * \param callwaiting callwaiting flag
105 * \param codec -- either AST_FORMAT_ULAW or AST_FORMAT_ALAW
106 * \details
107 * This function creates a stream of callerid (a callerid spill) data in ulaw format.
108 * \return It returns the size
109 * (in bytes) of the data (if it returns a size of 0, there is probably an error)
110 */
111int callerid_generate(unsigned char *buf, const char *number, const char *name, int flags, int callwaiting, struct ast_format *codec);
112
113/*! \brief Generates a CallerID FSK stream in ulaw format suitable for transmission.
114 * \param buf Buffer to use. If "buf" is supplied, it will use that buffer instead of allocating its own.
115 * "buf" must be at least 32000 bytes in size of you want to be sure you don't have an overrun.
116 * \param number Use NULL for no number or "P" for "private"
117 * \param name name to be used
118 * \param ddn Dialable Directory Number (or NULL)
119 * \param redirecting Redirecting reason
120 * \param flags passed flags
121 * \param format Message format
122 * \param callwaiting callwaiting flag
123 * \param codec -- either AST_FORMAT_ULAW or AST_FORMAT_ALAW
124 * \details
125 * This function creates a stream of callerid (a callerid spill) data in ulaw format.
126 * \return It returns the size
127 * (in bytes) of the data (if it returns a size of 0, there is probably an error)
128 */
129int callerid_full_generate(unsigned char *buf, const char *number, const char *name, const char *ddn, int redirecting,
130 int flags, int format, int callwaiting, struct ast_format *codec);
131
132/*! \brief Generates a CallerID FSK stream in ulaw format suitable for transmission.
133 * \param buf Buffer to use. If "buf" is supplied, it will use that buffer instead of allocating its own.
134 * "buf" must be at least 32000 bytes in size of you want to be sure you don't have an overrun.
135 * \param number Use NULL for no number or "P" for "private"
136 * \param name name to be used
137 * \param ddn Dialable Directory Number (or NULL)
138 * \param redirecting Redirecting reason
139 * \param flags passed flags
140 * \param format Message format
141 * \param callwaiting callwaiting flag
142 * \param codec -- either AST_FORMAT_ULAW or AST_FORMAT_ALAW
143 * \param tz TZ-format time zone to use for date/time (NULL for system default)
144 * \details
145 * This function creates a stream of callerid (a callerid spill) data in ulaw format.
146 * \return It returns the size
147 * (in bytes) of the data (if it returns a size of 0, there is probably an error)
148 */
149int callerid_full_tz_generate(unsigned char *buf, const char *number, const char *name, const char *ddn, int redirecting,
150 int flags, int format, int callwaiting, struct ast_format *codec, const char *tz);
151
152/*! \brief Create a callerID state machine
153 * \param cid_signalling Type of signalling in use
154 *
155 * \details
156 * This function returns a malloc'd instance of the callerid_state data structure.
157 * \return Returns a pointer to a malloc'd callerid_state structure, or NULL on error.
158 */
159struct callerid_state *callerid_new(int cid_signalling);
160
161/*! \brief Read samples into the state machine.
162 * \param cid Which state machine to act upon
163 * \param ubuf containing your samples
164 * \param samples number of samples contained within the buffer.
165 * \param codec which codec (AST_FORMAT_ALAW or AST_FORMAT_ULAW)
166 *
167 * \details
168 * Send received audio to the Caller*ID demodulator.
169 * \retval -1 on error
170 * \retval 0 for "needs more samples"
171 * \retval 1 if the CallerID spill reception is complete.
172 */
173int callerid_feed(struct callerid_state *cid, unsigned char *ubuf, int samples, struct ast_format *codec);
174
175/*! \brief Read samples into the state machine.
176 * \param cid Which state machine to act upon
177 * \param ubuf containing your samples
178 * \param samples number of samples contained within the buffer.
179 * \param codec which codec (AST_FORMAT_ALAW or AST_FORMAT_ULAW)
180 *
181 * \details
182 * Send received audio to the Caller*ID demodulator (for japanese style lines).
183 * \retval -1 on error
184 * \retval 0 for "needs more samples"
185 * \retval 1 if the CallerID spill reception is complete.
186 */
187int callerid_feed_jp(struct callerid_state *cid, unsigned char *ubuf, int samples, struct ast_format *codec);
188
189/*! \brief Extract info out of callerID state machine. Flags are listed above
190 * \param cid Callerid state machine to act upon
191 * \param number Pass the address of a pointer-to-char (will contain the phone number)
192 * \param name Pass the address of a pointer-to-char (will contain the name)
193 * \param flags Pass the address of an int variable(will contain the various callerid flags)
194 *
195 * \details
196 * This function extracts a callerid string out of a callerid_state state machine.
197 * If no number is found, *number will be set to NULL. Likewise for the name.
198 * Flags can contain any of the following:
199 */
200void callerid_get(struct callerid_state *cid, char **number, char **name, int *flags);
201
202/*!
203 * \brief Get and parse DTMF-based callerid
204 * \param cidstring The actual transmitted string.
205 * \param number The cid number is returned here.
206 * \param flags The cid flags are returned here.
207 */
208void callerid_get_dtmf(char *cidstring, char *number, int *flags);
209
210/*! \brief This function frees callerid_state cid.
211 * \param cid This is the callerid_state state machine to free
212 */
213void callerid_free(struct callerid_state *cid);
214
215/*! \brief Generate Caller-ID spill from the "callerid" field of asterisk (in e-mail address like format)
216 * \param buf buffer for output samples. See callerid_generate() for details regarding buffer.
217 * \param name Caller-ID Name
218 * \param number Caller-ID Number
219 * \param codec Asterisk codec (either AST_FORMAT_ALAW or AST_FORMAT_ULAW)
220 *
221 * \details
222 * Acts like callerid_generate except uses an asterisk format callerid string.
223 */
224int ast_callerid_generate(unsigned char *buf, const char *name, const char *number, struct ast_format *codec);
225
226/*! \brief Generate Caller-ID spill from the "callerid" field of asterisk (in e-mail address like format)
227 * \param buf buffer for output samples. See callerid_generate() for details regarding buffer.
228 * \param name Caller-ID Name
229 * \param number Caller-ID Number
230 * \param ddn Dialable Directory Number (or NULL)
231 * \param redirecting Redirecting Reason (-1 if N/A)
232 * \param pres Presentation (0 for default)
233 * \param qualifier Call Qualifier (0 for no, 1 for yes)
234 * \param format Message Format
235 * \param codec Asterisk codec (either AST_FORMAT_ALAW or AST_FORMAT_ULAW)
236 *
237 * \details
238 * Like ast_callerid_generate but with additional parameters.
239 */
240int ast_callerid_full_generate(unsigned char *buf, const char *name, const char *number,
241 const char *ddn, int redirecting, int pres, int qualifier, int format, struct ast_format *codec);
242
243/*! \brief Generate Caller-ID spill from the "callerid" field of asterisk (in e-mail address like format)
244 * \param buf buffer for output samples. See callerid_generate() for details regarding buffer.
245 * \param name Caller-ID Name
246 * \param number Caller-ID Number
247 * \param ddn Dialable Directory Number (or NULL)
248 * \param redirecting Redirecting Reason (-1 if N/A)
249 * \param pres Presentation (0 for default)
250 * \param qualifier Call Qualifier (0 for no, 1 for yes)
251 * \param format Message Format
252 * \param codec Asterisk codec (either AST_FORMAT_ALAW or AST_FORMAT_ULAW)
253 * \param tz TZ-format time zone name to use for date/time (NULL for system default)
254 *
255 * \details
256 * Like ast_callerid_generate but with additional parameters.
257 */
258int ast_callerid_full_tz_generate(unsigned char *buf, const char *name, const char *number,
259 const char *ddn, int redirecting, int pres, int qualifier, int format, struct ast_format *codec, const char *tz);
260
261/*!
262 * \brief Generate message waiting indicator
263 * \param buf
264 * \param active The message indicator state
265 * -- either 0 no messages in mailbox or 1 messages in mailbox
266 * \param type Format of message (any of CID_MWI_TYPE_*)
267 * \param codec
268 * \param name
269 * \param number
270 * \param flags
271 * \see callerid_generate() for more info as it uses the same encoding
272 * \version 1.6.1 changed mdmf parameter to type, added name, number and flags for caller id message generation
273 */
274int ast_callerid_vmwi_generate(unsigned char *buf, int active, int type, struct ast_format *codec, const char *name,
275 const char *number, int flags);
276
277/*! \brief Generate Caller-ID spill but in a format suitable for Call Waiting(tm)'s Caller*ID(tm)
278 * \see ast_callerid_generate() for other details
279 */
280int ast_callerid_callwaiting_generate(unsigned char *buf, const char *name, const char *number, struct ast_format *codec);
281
282/*! \brief Generate Caller-ID spill but in a format suitable for Call Waiting(tm)'s Caller*ID(tm)
283 * \see ast_callerid_generate() for other details
284 */
285int ast_callerid_callwaiting_full_generate(unsigned char *buf, const char *name, const char *number,
286 const char *ddn, int redirecting, int pres, int qualifier, struct ast_format *codec);
287
288/*! \brief Generate Caller-ID spill but in a format suitable for Call Waiting(tm)'s Caller*ID(tm)
289 * \param tz TZ-format time zone for date/time (NULL for system default)
290 * \see ast_callerid_generate() for other details
291 */
292int ast_callerid_callwaiting_full_tz_generate(unsigned char *buf, const char *name, const char *number,
293 const char *ddn, int redirecting, int pres, int qualifier, struct ast_format *codec, const char *tz);
294
295/*! \brief Destructively parse inbuf into name and location (or number)
296 * \details
297 * Parses callerid stream from inbuf and changes into useable form, outputted in name and location.
298 * \param instr buffer of callerid stream (in audio form) to be parsed. Warning, data in buffer is changed.
299 * \param name address of a pointer-to-char for the name value of the stream.
300 * \param location address of a pointer-to-char for the phone number value of the stream.
301 * \note XXX 'name' is not parsed consistently e.g. we have
302 * input location name
303 * " foo bar " <123> 123 ' foo bar ' (with spaces around)
304 * " foo bar " NULL 'foo bar' (without spaces around)
305 * The parsing of leading and trailing space/quotes should be more consistent.
306 * \retval 0 on success
307 * \retval -1 on failure
308 */
309int ast_callerid_parse(char *instr, char **name, char **location);
310
311/*!
312 * \brief Generate a CAS (CPE Alert Signal) tone for 'n' samples
313 * \param outbuf Allocated buffer for data. Must be at least 2400 bytes unless no SAS is desired
314 * \param sas Non-zero if CAS should be preceeded by SAS
315 * \param len How many samples to generate.
316 * \param codec Which codec (AST_FORMAT_ALAW or AST_FORMAT_ULAW)
317 * \retval -1 on error (if len is less than 2400)
318 * \retval 0 on success
319 */
320int ast_gen_cas(unsigned char *outbuf, int sas, int len, struct ast_format *codec);
321
322/*!
323 * \brief Shrink a phone number in place to just digits (more accurately it just removes ()'s, .'s, and -'s...
324 * \param n The number to be stripped/shrunk
325 */
326void ast_shrink_phone_number(char *n);
327
328/*!
329 * \brief Check if a string consists only of digits and + \#
330 * \param n number to be checked.
331 * \retval 0 if \p n is a number
332 * \retval 1 if not
333 */
334int ast_isphonenumber(const char *n);
335
336/*!
337 * \brief Check if a string consists only of digits and + \# ( ) - .
338 * (meaning it can be cleaned with ast_shrink_phone_number)
339 * \param exten The extension (or URI) to be checked.
340 * \retval 1 if \p exten is valid AST shrinkable phone number
341 * \retval 0 if not
342 */
343int ast_is_shrinkable_phonenumber(const char *exten);
344
345int ast_callerid_split(const char *src, char *name, int namelen, char *num, int numlen);
346
347char *ast_callerid_merge(char *buf, int bufsiz, const char *name, const char *num, const char *unknown);
348
349/*
350 * Caller*ID and other GR-30 compatible generation
351 * routines (used by ADSI for example)
352 */
353
354extern float cid_dr[4];
355extern float cid_di[4];
356extern float clidsb;
357
358static inline float callerid_getcarrier(float *cr, float *ci, int bit)
359{
360 /* Move along. There's nothing to see here... */
361 float t;
362 t = *cr * cid_dr[bit] - *ci * cid_di[bit];
363 *ci = *cr * cid_di[bit] + *ci * cid_dr[bit];
364 *cr = t;
365
366 t = 2.0 - (*cr * *cr + *ci * *ci);
367 *cr *= t;
368 *ci *= t;
369 return *cr;
370}
371
372#define PUT_BYTE(a) do { \
373 *(buf++) = (a); \
374 bytes++; \
375} while(0)
376
377#define PUT_AUDIO_SAMPLE(y) do { \
378 int __sample_idx = (short)(rint(8192.0 * (y))); \
379 *(buf++) = AST_LIN2X(__sample_idx); \
380 bytes++; \
381} while(0)
382
383#define PUT_CLID_MARKMS do { \
384 int __clid_x; \
385 for (__clid_x=0;__clid_x<8;__clid_x++) \
386 PUT_AUDIO_SAMPLE(callerid_getcarrier(&cr, &ci, 1)); \
387} while(0)
388
389#define PUT_CLID_BAUD(bit) do { \
390 while(scont < clidsb) { \
391 PUT_AUDIO_SAMPLE(callerid_getcarrier(&cr, &ci, bit)); \
392 scont += 1.0; \
393 } \
394 scont -= clidsb; \
395} while(0)
396
397
398#define PUT_CLID(byte) do { \
399 int z; \
400 unsigned char b = (byte); \
401 PUT_CLID_BAUD(0); /* Start bit */ \
402 for (z=0;z<8;z++) { \
403 PUT_CLID_BAUD(b & 1); \
404 b >>= 1; \
405 } \
406 PUT_CLID_BAUD(1); /* Stop bit */ \
407} while(0)
408
409/* Various defines and bits for handling PRI- and SS7-type restriction */
410
411#define AST_PRES_NUMBER_TYPE 0x03
412#define AST_PRES_USER_NUMBER_UNSCREENED 0x00
413#define AST_PRES_USER_NUMBER_PASSED_SCREEN 0x01
414#define AST_PRES_USER_NUMBER_FAILED_SCREEN 0x02
415#define AST_PRES_NETWORK_NUMBER 0x03
416
417#define AST_PRES_RESTRICTION 0x60
418#define AST_PRES_ALLOWED 0x00
419#define AST_PRES_RESTRICTED 0x20
420#define AST_PRES_UNAVAILABLE 0x40
421#define AST_PRES_RESERVED 0x60
422
423#define AST_PRES_ALLOWED_USER_NUMBER_NOT_SCREENED \
424 (AST_PRES_ALLOWED | AST_PRES_USER_NUMBER_UNSCREENED)
425
426#define AST_PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN \
427 (AST_PRES_ALLOWED | AST_PRES_USER_NUMBER_PASSED_SCREEN)
428
429#define AST_PRES_ALLOWED_USER_NUMBER_FAILED_SCREEN \
430 (AST_PRES_ALLOWED | AST_PRES_USER_NUMBER_FAILED_SCREEN)
431
432#define AST_PRES_ALLOWED_NETWORK_NUMBER \
433 (AST_PRES_ALLOWED | AST_PRES_NETWORK_NUMBER)
434
435#define AST_PRES_PROHIB_USER_NUMBER_NOT_SCREENED \
436 (AST_PRES_RESTRICTED | AST_PRES_USER_NUMBER_UNSCREENED)
437
438#define AST_PRES_PROHIB_USER_NUMBER_PASSED_SCREEN \
439 (AST_PRES_RESTRICTED | AST_PRES_USER_NUMBER_PASSED_SCREEN)
440
441#define AST_PRES_PROHIB_USER_NUMBER_FAILED_SCREEN \
442 (AST_PRES_RESTRICTED | AST_PRES_USER_NUMBER_FAILED_SCREEN)
443
444#define AST_PRES_PROHIB_NETWORK_NUMBER \
445 (AST_PRES_RESTRICTED | AST_PRES_NETWORK_NUMBER)
446
447#define AST_PRES_NUMBER_NOT_AVAILABLE \
448 (AST_PRES_UNAVAILABLE | AST_PRES_NETWORK_NUMBER)
449
450int ast_parse_caller_presentation(const char *data);
451const char *ast_describe_caller_presentation(int data);
452const char *ast_named_caller_presentation(int data);
453
454/*!
455 * \page Def_CallerPres Caller ID Presentation
456 *
457 * Caller ID presentation values are used to set properties to a
458 * caller ID in PSTN networks, and as RPID value in SIP transactions.
459 *
460 * The following values are available to use:
461 * \arg \b Defined value, text string in config file, explanation
462 *
463 * \arg \b AST_PRES_ALLOWED_USER_NUMBER_NOT_SCREENED, "allowed_not_screened", Presentation Allowed, Not Screened,
464 * \arg \b AST_PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN, "allowed_passed_screen", Presentation Allowed, Passed Screen,
465 * \arg \b AST_PRES_ALLOWED_USER_NUMBER_FAILED_SCREEN, "allowed_failed_screen", Presentation Allowed, Failed Screen,
466 * \arg \b AST_PRES_ALLOWED_NETWORK_NUMBER, "allowed", Presentation Allowed, Network Number,
467 * \arg \b AST_PRES_PROHIB_USER_NUMBER_NOT_SCREENED, "prohib_not_screened", Presentation Prohibited, Not Screened,
468 * \arg \b AST_PRES_PROHIB_USER_NUMBER_PASSED_SCREEN, "prohib_passed_screen", Presentation Prohibited, Passed Screen,
469 * \arg \b AST_PRES_PROHIB_USER_NUMBER_FAILED_SCREEN, "prohib_failed_screen", Presentation Prohibited, Failed Screen,
470 * \arg \b AST_PRES_PROHIB_NETWORK_NUMBER, "prohib", Presentation Prohibited, Network Number,
471 *
472 * \par References
473 * \arg \ref callerid.h Definitions
474 * \arg \ref callerid.c Functions
475 * \arg \ref CID Caller ID names and numbers
476 */
477
478/*!
479 * \brief redirecting reason codes.
480 *
481 * This list attempts to encompass redirecting reasons
482 * as defined by several channel technologies.
483 */
496 AST_REDIRECTING_REASON_CALL_FWD_DTE, /* This is something defined in Q.931, and no I don't know what it means */
498};
499
500/*!
501 * \since 1.8
502 * \brief Convert redirecting reason text code to value (used in config file parsing)
503 *
504 * \param data text string from config file
505 *
506 * \retval Q931_REDIRECTING_REASON from callerid.h
507 * \retval -1 if not in table
508 */
509int ast_redirecting_reason_parse(const char *data);
510
511/*!
512 * \since 1.8
513 * \brief Convert redirecting reason value to explanatory string
514 *
515 * \param data Q931_REDIRECTING_REASON from callerid.h
516 *
517 * \return string for human presentation
518 */
519const char *ast_redirecting_reason_describe(int data);
520
522
523/*!
524 * \since 1.8
525 * \brief Convert redirecting reason value to text code
526 *
527 * \param data ast_party_redirecting_reason structure from channel.h
528 *
529 * \return string for config file
530 */
531const char *ast_redirecting_reason_name(const struct ast_party_redirecting_reason *data);
532
533/*!
534 * \brief Connected line update source code
535 */
537 /*! Update for unknown reason (May be interpreted to mean from answer) */
539 /*! Update from normal call answering */
541 /*! Update from call diversion (Deprecated, use REDIRECTING updates instead.) */
543 /*! Update from call transfer(active) (Party has already answered) */
545 /*! Update from call transfer(alerting) (Party has not answered yet) */
548
549/*!
550 * \since 1.8
551 * \brief Convert connected line update source text code to value (used in config file parsing)
552 *
553 * \param data text string from config file
554 *
555 * \retval AST_CONNECTED_LINE_UPDATE_SOURCE from callerid.h
556 * \retval -1 if not in table
557 */
558int ast_connected_line_source_parse(const char *data);
559
560/*!
561 * \since 1.8
562 * \brief Convert connected line update source value to explanatory string
563 *
564 * \param data AST_CONNECTED_LINE_UPDATE_SOURCE from callerid.h
565 *
566 * \return string for human presentation
567 */
568const char *ast_connected_line_source_describe(int data);
569
570/*!
571 * \since 1.8
572 * \brief Convert connected line update source value to text code
573 *
574 * \param data AST_CONNECTED_LINE_UPDATE_SOURCE from callerid.h
575 *
576 * \return string for config file
577 */
578const char *ast_connected_line_source_name(int data);
579
580/*!
581 * \since 1.8
582 * \brief Convert ast_party_name.char_set text code to value (used in config file parsing)
583 *
584 * \param data text string from config file
585 *
586 * \retval AST_PARTY_CHAR_SET from channel.h
587 * \retval -1 if not in table
588 */
589int ast_party_name_charset_parse(const char *data);
590
591/*!
592 * \since 1.8
593 * \brief Convert ast_party_name.char_set value to explanatory string
594 *
595 * \param data AST_PARTY_CHAR_SET from channel.h
596 *
597 * \return string for human presentation
598 */
599const char *ast_party_name_charset_describe(int data);
600
601/*!
602 * \since 1.8
603 * \brief Convert ast_party_name.char_set value to text code
604 *
605 * \param data AST_PARTY_CHAR_SET from channel.h
606 *
607 * \return string for config file
608 */
609const char *ast_party_name_charset_str(int data);
610
611
612#endif /* _ASTERISK_CALLERID_H */
char * ast_callerid_merge(char *buf, int bufsiz, const char *name, const char *num, const char *unknown)
Definition: callerid.c:1174
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: callerid.c:1154
int ast_parse_caller_presentation(const char *data)
Convert caller ID text code to value (used in config file parsing)
Definition: callerid.c:1244
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.
Definition: callerid.c:261
const char * ast_connected_line_source_describe(int data)
Convert connected line update source value to explanatory string.
Definition: callerid.c:1393
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)
Definition: callerid.c:1148
int callerid_feed_jp(struct callerid_state *cid, unsigned char *ubuf, int samples, struct ast_format *codec)
Read samples into the state machine.
Definition: callerid.c:306
float cid_dr[4]
Definition: callerid.c:64
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.
Definition: callerid.c:853
int ast_callerid_parse(char *instr, char **name, char **location)
Destructively parse inbuf into name and location (or number)
Definition: callerid.c:1063
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.
Definition: callerid.c:940
void callerid_free(struct callerid_state *cid)
This function frees callerid_state cid.
Definition: callerid.c:734
const char * ast_describe_caller_presentation(int data)
Convert caller ID pres value to explanatory string.
Definition: callerid.c:1265
const char * ast_party_name_charset_describe(int data)
Convert ast_party_name.char_set value to explanatory string.
Definition: callerid.c:1448
const char * ast_redirecting_reason_name(const struct ast_party_redirecting_reason *data)
Convert redirecting reason value to text code.
Definition: callerid.c:1350
AST_CONNECTED_LINE_UPDATE_SOURCE
Connected line update source code.
Definition: callerid.h:536
@ AST_CONNECTED_LINE_UPDATE_SOURCE_TRANSFER
Definition: callerid.h:544
@ AST_CONNECTED_LINE_UPDATE_SOURCE_UNKNOWN
Definition: callerid.h:538
@ AST_CONNECTED_LINE_UPDATE_SOURCE_DIVERSION
Definition: callerid.h:542
@ AST_CONNECTED_LINE_UPDATE_SOURCE_TRANSFER_ALERTING
Definition: callerid.h:546
@ AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER
Definition: callerid.h:540
void ast_shrink_phone_number(char *n)
Shrink a phone number in place to just digits (more accurately it just removes ()'s,...
Definition: callerid.c:1002
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: callerid.c:1143
const char * ast_party_name_charset_str(int data)
Convert ast_party_name.char_set value to text code.
Definition: callerid.c:1461
AST_REDIRECTING_REASON
redirecting reason codes.
Definition: callerid.h:484
@ AST_REDIRECTING_REASON_AWAY
Definition: callerid.h:495
@ AST_REDIRECTING_REASON_UNKNOWN
Definition: callerid.h:485
@ AST_REDIRECTING_REASON_SEND_TO_VM
Definition: callerid.h:497
@ AST_REDIRECTING_REASON_NO_ANSWER
Definition: callerid.h:487
@ AST_REDIRECTING_REASON_DO_NOT_DISTURB
Definition: callerid.h:491
@ AST_REDIRECTING_REASON_FOLLOW_ME
Definition: callerid.h:493
@ AST_REDIRECTING_REASON_DEFLECTION
Definition: callerid.h:492
@ AST_REDIRECTING_REASON_UNAVAILABLE
Definition: callerid.h:488
@ AST_REDIRECTING_REASON_UNCONDITIONAL
Definition: callerid.h:489
@ AST_REDIRECTING_REASON_CALL_FWD_DTE
Definition: callerid.h:496
@ AST_REDIRECTING_REASON_OUT_OF_ORDER
Definition: callerid.h:494
@ AST_REDIRECTING_REASON_TIME_OF_DAY
Definition: callerid.h:490
@ AST_REDIRECTING_REASON_USER_BUSY
Definition: callerid.h:486
static float callerid_getcarrier(float *cr, float *ci, int bit)
Definition: callerid.h:358
struct callerid_state * callerid_new(int cid_signalling)
Create a callerID state machine.
Definition: callerid.c:129
void callerid_init(void)
CallerID Initialization.
Definition: callerid.c:115
int callerid_feed(struct callerid_state *cid, unsigned char *ubuf, int samples, struct ast_format *codec)
Read samples into the state machine.
Definition: callerid.c:545
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.
Definition: callerid.c:945
int ast_party_name_charset_parse(const char *data)
Convert ast_party_name.char_set text code to value (used in config file parsing)
Definition: callerid.c:1435
void callerid_get_dtmf(char *cidstring, char *number, int *flags)
Get and parse DTMF-based callerid.
Definition: callerid.c:201
int ast_isphonenumber(const char *n)
Check if a string consists only of digits and + #.
Definition: callerid.c:1053
const char * ast_redirecting_reason_describe(int data)
Convert redirecting reason value to explanatory string.
Definition: callerid.c:1337
int ast_redirecting_reason_parse(const char *data)
Convert redirecting reason text code to value (used in config file parsing)
Definition: callerid.c:1324
const char * ast_connected_line_source_name(int data)
Convert connected line update source value to text code.
Definition: callerid.c:1406
const char * ast_named_caller_presentation(int data)
Convert caller ID pres value to text code.
Definition: callerid.c:1283
int ast_connected_line_source_parse(const char *data)
Convert connected line update source text code to value (used in config file parsing)
Definition: callerid.c:1380
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)
Definition: callerid.c:1161
void callerid_get(struct callerid_state *cid, char **number, char **name, int *flags)
Extract info out of callerID state machine. Flags are listed above.
Definition: callerid.c:188
float cid_di[4]
Definition: callerid.c:64
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.
Definition: callerid.c:952
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_...
Definition: callerid.c:1058
float clidsb
Definition: callerid.c:65
int ast_callerid_split(const char *src, char *name, int namelen, char *num, int numlen)
Definition: callerid.c:1193
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)
Definition: callerid.c:1138
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)
Definition: callerid.c:1167
static char * tz
Definition: cdr_pgsql.c:71
static const char type[]
Definition: chan_ooh323.c:109
char buf[BUFSIZE]
Definition: eagi_proxy.c:66
Media Format API.
static const char name[]
Definition: format_mp3.c:68
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
Definition of a media format.
Definition: format.c:43
Redirecting reason information.
Definition: channel.h:501
Number structure.
Definition: app_followme.c:154
static struct ast_codec unknown