56 #define POLARITY_IDLE 0
57 #define POLARITY_REV 1
58 #define MIN_MS_SINCE_FLASH ( (2000) )
94 const char const *
name;
104 #define ISTRUNK(p) ((p->sig == ANALOG_SIG_FXSLS) || (p->sig == ANALOG_SIG_FXSKS) || \
105 (p->sig == ANALOG_SIG_FXSGS))
112 if (!strcasecmp(
sigtypes[i].name, name)) {
125 if (sigtype ==
sigtypes[i].sigtype) {
138 if (!strcasecmp(
cidtypes[i].name, name)) {
151 if (cid_type ==
cidtypes[i].cid_type) {
218 if (!strcasecmp(value,
"ring")) {
220 }
else if (!strcasecmp(value,
"polarity")) {
222 }
else if (!strcasecmp(value,
"polarity_in")) {
224 }
else if (!strcasecmp(value,
"dtmf")) {
239 return "Polarity_In";
252 res =
"ANALOG_EVENT_ONHOOK";
255 res =
"ANALOG_EVENT_RINGOFFHOOK";
258 res =
"ANALOG_EVENT_WINKFLASH";
261 res =
"ANALOG_EVENT_ALARM";
264 res =
"ANALOG_EVENT_NOALARM";
267 res =
"ANALOG_EVENT_DIALCOMPLETE";
270 res =
"ANALOG_EVENT_HOOKCOMPLETE";
273 res =
"ANALOG_EVENT_PULSE_START";
276 res =
"ANALOG_EVENT_POLARITY";
279 res =
"ANALOG_EVENT_RINGBEGIN";
282 res =
"ANALOG_EVENT_EC_DISABLED";
285 res =
"ANALOG_EVENT_RINGERON";
288 res =
"ANALOG_EVENT_RINGEROFF";
291 res =
"ANALOG_EVENT_REMOVED";
294 res =
"ANALOG_EVENT_NEONMWI_ACTIVE";
297 res =
"ANALOG_EVENT_NEONMWI_INACTIVE";
299 #ifdef HAVE_DAHDI_ECHOCANCEL_FAX_MODE
301 res =
"ANALOG_EVENT_TX_CED_DETECTED";
304 res =
"ANALOG_EVENT_RX_CED_DETECTED";
307 res =
"ANALOG_EVENT_EC_NLP_DISABLED";
310 res =
"ANALOG_EVENT_EC_NLP_ENABLED";
314 res =
"ANALOG_EVENT_PULSEDIGIT";
317 res =
"ANALOG_EVENT_DTMFDOWN";
320 res =
"ANALOG_EVENT_DTMFUP";
323 res =
"UNKNOWN/OTHER";
335 ast_debug(1,
"Swapping %u and %u\n", a, b);
375 ast_debug(1,
"Sending callerid. CID_NAME: '%s' CID_NUM: '%s'\n",
389 #define analog_get_index(ast, p, nullok) _analog_get_index(ast, p, nullok, __PRETTY_FUNCTION__, __LINE__)
403 "Unable to get index for '%s' on channel %d (%s(), line %lu)\n",
430 p->
owner = new_owner;
719 bridge_3way, &owner_3way->
connected, !inthreeway)) {
721 bridge_3way->
name, owner_real->
name);
724 }
else if (bridge_real) {
738 !inthreeway, bridge_real, &owner_real->
connected, 0)) {
740 bridge_real->
name, owner_3way->
name);
744 ast_debug(1,
"Neither %s nor %s are in a bridge, nothing to transfer\n",
745 owner_real->
name, owner_3way->
name);
762 for (x = 0; x < 3; x++) {
775 ast_debug(1,
"Updated conferencing on %d, with %d conference users\n", p->
channel, needconf);
788 *callwait = (p->
owner != NULL);
827 #ifdef DAHDI_CHECK_HOOKSTATE
834 }
else if (offhook) {
1005 int res, idx, mysig;
1009 ast_debug(1,
"CALLING CID_NAME: %s CID_NUM:: %s\n",
1038 if (p->
owner == ast) {
1046 c = strchr(dest,
'/');
1050 if (c && (strlen(c) < p->
stripmsd)) {
1057 ast_debug(1,
"FXO: setup deferred dialstring: %s\n", c);
1136 ast_debug(1,
"Ignore possible polarity reversal on line seizure\n");
1155 c = strchr(dest,
'/');
1167 if (
errno != EINPROGRESS) {
1195 const char *cic =
"", *ozz =
"";
1209 ast_log(
LOG_WARNING,
"Unable to dial channel of type feature group D MF tandem access without CIC or OZZ set\n");
1248 int saveerr =
errno;
1297 ast_debug(1,
"Hangup: channel: %d index = %d, normal = %d, callwait = %d, thirdcall = %d\n",
1307 ast_debug(1,
"Normal call hung up with both three way call and a call waiting call in place?\n");
1310 ast_debug(1,
"We were flipped over to the callwait, moving back and unowning.\n");
1317 ast_debug(1,
"We were in the threeway and have a callwait still. Ditching the threeway.\n");
1323 ast_debug(1,
"Call was complete, setting owner to former third call\n");
1328 ast_debug(1,
"Call was incomplete, setting owner to NULL\n");
1359 ast_debug(1,
"Call was complete, setting owner to former third call\n");
1364 ast_debug(1,
"Call was incomplete, setting owner to NULL\n");
1490 int oldstate = ast->
_state;
1532 ast_debug(1,
"Finally swapping real and threeway\n");
1593 ast_debug(1,
"%s DTMF digit: 0x%02X '%c' on %s\n",
1610 *dest = &p->
subs[idx].
f;
1614 ast_debug(1,
"Got some DTMF, but it's for the CAS\n");
1625 *dest = &p->
subs[idx].
f;
1645 if (strchr(term, c)) {
1710 #define ANALOG_NEED_MFDETECT(p) (((p)->sig == ANALOG_SIG_FEATDMF) || ((p)->sig == ANALOG_SIG_FEATDMF_TA) || ((p)->sig == ANALOG_SIG_E911) || ((p)->sig == ANALOG_SIG_FGC_CAMA) || ((p)->sig == ANALOG_SIG_FGC_CAMAMF) || ((p)->sig == ANALOG_SIG_FEATB))
1714 int extlen = strlen(exten);
1720 if (extlen < strlen(pickup_ext) && !strncmp(pickup_ext, exten, extlen)) {
1724 if (exten[0] ==
'*' && extlen < 3) {
1772 ast_log(
LOG_WARNING,
"Channel became a zombie before simple switch could be started (%s)\n", chan->
name);
1777 ast_verb(3,
"Starting simple switch on '%s'\n", chan->
name);
1814 memset(dtmfbuf, 0,
sizeof(dtmfbuf));
1859 && (strlen(dtmfbuf) != 14)) {
1908 dtmfbuf[
len] =
'\0';
1917 ast_debug(1,
"waitfordigit returned < 0...\n");
1921 dtmfbuf[len++] = res;
1922 dtmfbuf[
len] =
'\0';
1934 }
else if (res < 0) {
1935 ast_debug(1,
"Got hung up before digits finished\n");
1950 if ((res > 0) && (strlen(anibuf) > 2)) {
1951 if (anibuf[strlen(anibuf) - 1] ==
'#') {
1952 anibuf[strlen(anibuf) - 1] = 0;
1965 if (exten[0] ==
'*') {
1970 s1 =
strsep(&stringp,
"*");
1971 s2 =
strsep(&stringp,
"*");
1987 if (exten[0] ==
'*') {
1992 s1 =
strsep(&stringp,
"#");
1993 s2 =
strsep(&stringp,
"#");
2011 if (exten[0] ==
'*') {
2016 s1 =
strsep(&stringp,
"#");
2017 s2 =
strsep(&stringp,
"#");
2018 if (s2 && (*(s2 + 1) ==
'0')) {
2033 if (exten[0] ==
'*') {
2038 s1 =
strsep(&stringp,
"#");
2071 ast_verb(3,
"Unknown extension '%s' in context '%s' requested\n", exten, chan->
context);
2108 ast_debug(1,
"waitfordigit returned < 0...\n");
2113 ast_debug(1,
"waitfordigit returned '%c' (%d), timeout = %d\n", res, res, timeout);
2135 memset(exten, 0,
sizeof(exten));
2168 }
else if (res == 0) {
2169 ast_debug(1,
"not enough digits (and no ambiguous match)...\n");
2174 }
else if (p->
callwaiting && !strcmp(exten,
"*70")) {
2175 ast_verb(3,
"Disabling call waiting on %s\n", chan->
name);
2184 memset(exten, 0,
sizeof(exten));
2203 ast_debug(1,
"No call pickup possible...\n");
2215 }
else if (!p->
hidecallerid && !strcmp(exten,
"*67")) {
2216 ast_verb(3,
"Disabling Caller*ID on %s\n", chan->
name);
2229 memset(exten, 0,
sizeof(exten));
2231 }
else if (p->
callreturn && !strcmp(exten,
"*69")) {
2240 }
else if (!strcmp(exten,
"*78")) {
2245 memset(exten, 0,
sizeof(exten));
2247 }
else if (!strcmp(exten,
"*79")) {
2252 memset(exten, 0,
sizeof(exten));
2257 memset(exten, 0,
sizeof(exten));
2260 ast_verb(3,
"Cancelling call forwarding on channel %d\n", p->
channel);
2264 memset(exten, 0,
sizeof(exten));
2281 memset(exten, 0,
sizeof(exten));
2295 memset(exten, 0,
sizeof(exten));
2297 }
else if (!strcmp(exten,
"*0")) {
2304 if (pbridge &&
ISTRUNK(pbridge)) {
2310 "Unable to flash-hook bridged trunk from channel %s: %s\n",
2334 ast_debug(1,
"Can't match %s from '%s' in context %s\n", exten,
2354 if (smdi_msg != NULL) {
2357 if (smdi_msg->
type ==
'B')
2359 else if (smdi_msg->
type ==
'N')
2386 ast_debug(1,
"Receiving DTMF cid on channel %s\n", chan->
name);
2410 "Exiting simple switch\n");
2437 ast_debug(1,
"CID got string '%s'\n", dtmfbuf);
2439 ast_debug(1,
"CID is '%s', flags %d\n", dtmfcid, flags);
2449 int timeout = 10000;
2459 struct timeval off_start;
2505 "Exiting simple switch\n");
2532 "state, but I have nothing to do. "
2533 "Terminating simple switch, should be "
2534 "restarted by the actual ring.\n",
2540 int timeout = 10000;
2544 int receivedRingT = 0;
2557 if (res == 1 || res == 2) {
2561 ast_debug(1,
"Hanging up due to polarity reversal on channel %d while detecting callerid\n", p->
channel);
2570 curRingData[receivedRingT] = p->
ringt;
2682 p->
subs[idx].
f.
src =
"dahdi_handle_event";
2684 f = &p->
subs[idx].
f;
2692 ast_debug(1,
"Detected %sdigit '%c'\n", (res & ANALOG_EVENT_PULSEDIGIT) ?
"pulse ":
"", res & 0xff);
2701 ast_debug(1,
"DTMF Down '%c'\n", res & 0xff);
2712 ast_verb(3,
"Channel %d echo canceler disabled due to CED detection\n", p->
channel);
2715 #ifdef HAVE_DAHDI_ECHOCANCEL_FAX_MODE
2717 ast_verb(3,
"Channel %d detected a CED tone towards the network.\n", p->
channel);
2720 ast_verb(3,
"Channel %d detected a CED tone from the network.\n", p->
channel);
2723 ast_verb(3,
"Channel %d echo canceler disabled its NLP.\n", p->
channel);
2726 ast_verb(3,
"Channel %d echo canceler enabled its NLP.\n", p->
channel);
2746 int dial_err =
errno;
2766 ast_debug(1,
"Done dialing, but waiting for progress detection before doing more...\n");
2821 ast_verb(3,
"Channel %d still has (callwait) call, ringing phone\n", p->
channel);
2833 unsigned int mssinceflash;
2842 if (p->
owner != ast) {
2850 ast_debug(1,
"Last flash was %u ms ago\n", mssinceflash);
2854 ast_debug(1,
"Looks like a bounced flash, hanging up both calls on %d\n", p->
channel);
2936 int saveerr =
errno;
2942 return &p->
subs[idx].
f;
2988 return &p->
subs[idx].
f;
2995 return &p->
subs[idx].
f;
3107 "Channel: %d\r\n", p->
channel);
3119 ast_debug(1,
"Winkflash, index: %u, normal: %d, callwait: %d, thirdcall: %d\n",
3197 ast_debug(1,
"Flash when call not up or ringing\n");
3218 "Cannot allocate new call structure on channel %d\n",
3277 ast_debug(1,
"Got flash with three way call up, dropping last call on %d\n", p->
channel);
3295 ast_verb(3,
"Building conference call with %s and %s\n",
3355 ast_log(
LOG_WARNING,
"Received unexpected wink on channel of type ANALOG_SIG_FEATDMF_TA\n");
3422 ast_debug(1,
"Got hook complete in MF FGD, waiting for wink now on channel %d\n",p->
channel);
3452 ast_debug(1,
"Ignore Answer on polarity switch, channel %d\n", p->
channel);
3463 ast_debug(1,
"Ignore Hangup on polarity switch, channel %d\n", p->
channel);
3486 ast_debug(1,
"Polarity switch detected but NOT answering (too close to OffHook event) on channel %d, state %u\n", p->
channel, ast->
_state);
3493 ast_debug(1,
"Polarity switch detected but NOT hanging up (too close to Answer event) on channel %d, state %u\n", p->
channel, ast->
_state);
3499 ast_debug(1,
"Polarity switch detected (too close to previous event) on channel %d, state %u\n", p->
channel, ast->
_state);
3507 ast_debug(1,
"Polarity Reversal event occured - DEBUG 2: channel %d, state %u, pol= %d, aonp= %d, honp= %d, pdelay= %d, tv= %" PRIi64
"\n", p->
channel, ast->
_state, p->
polarity, p->
answeronpolarityswitch, p->
hanguponpolarityswitch, p->
polarityonanswerdelay,
ast_tvdiff_ms(
ast_tvnow(), p->
polaritydelaytv) );
3510 ast_debug(1,
"Dunno what to do with event %d on channel %d\n", res, p->
channel);
3512 return &p->
subs[idx].
f;
3535 p->
subs[idx].
f.
src =
"dahdi_exception";
3549 ast_debug(1,
"Restoring owner of channel %d on event %d\n", p->
channel, res);
3612 f = &p->
subs[idx].
f;
3617 if (ast != p->
owner) {
3619 f = &p->
subs[idx].
f;
3643 ast_debug(1,
"channel (%d) - signaling (%d) - event (%s)\n",
3660 if (res && (
errno == EBUSY)) {
3690 ast_log(
LOG_WARNING,
"Unable to play dialtone on channel %d, do you have defaultzone and loadzone defined?\n", i->
channel);
3755 "Channel: %d\r\n", i->
channel);
3823 ast_verb(2,
"Starting post polarity "
3824 "CID detection on channel %d\n",
3838 "polarity reversal on non-FXO (ANALOG_SIG_FXS) "
3839 "interface %d\n", i->
channel);
3849 ast_verb(2,
"Starting DTMF CID detection on channel %d\n",
3863 "dtmfcid generation event on non-FXO (ANALOG_SIG_FXS) "
3864 "interface %d\n", i->
channel);
3894 p->
sig = signallingtype;
3942 if (new_pvt->
owner == oldchan) {
3945 for (x = 0; x < 3; x++) {
3946 if (new_pvt->
subs[x].
owner == oldchan) {
3963 ast_verb(3,
"%s DND on channel %d\n",
3964 flag ?
"Enabled" :
"Disabled",
3967 "Channel: DAHDI/%d\r\n"
3969 flag ?
"enabled" :
"disabled");
static int analog_send_callerid(struct analog_pvt *p, int cwcid, struct ast_party_caller *caller)
#define ANALOG_SMDI_MD_WAIT_TIMEOUT
int ast_safe_sleep(struct ast_channel *chan, int ms)
Wait for a specified amount of time, looking for hangups.
static int analog_handles_digit(struct ast_frame *f)
union ast_frame_subclass subclass
int ast_hangup(struct ast_channel *chan)
Hang up a channel.
char cid_name[AST_MAX_EXTENSION]
#define analog_get_index(ast, p, nullok)
void ast_set_callerid(struct ast_channel *chan, const char *cid_num, const char *cid_name, const char *cid_ani)
Set caller ID number, name and ANI and generate AMI event.
unsigned int threewaycalling
#define ast_channel_lock(chan)
int ast_matchmore_extension(struct ast_channel *c, const char *context, const char *exten, int priority, const char *callerid)
Looks to see if adding anything to this extension might match something. (exists ^ canmatch) ...
unsigned int use_callerid
static char exten[AST_MAX_EXTENSION]
Main Channel structure associated with a channel.
int(*const conf_add)(void *pvt, enum analog_sub sub)
struct ast_smdi_interface * smdi_iface
The SMDI interface to get SMDI messages from.
char * str
Subscriber phone number (Malloced)
static int analog_unalloc_sub(struct analog_pvt *p, enum analog_sub x)
struct ast_party_connected_line connected
Channel Connected Line ID information.
char fwd_st[SMDI_MAX_STATION_NUM_LEN+1]
int ast_streamfile(struct ast_channel *c, const char *filename, const char *preflang)
Streams a file.
static int _analog_get_index(struct ast_channel *ast, struct analog_pvt *p, int nullok, const char *fname, unsigned long line)
Asterisk main include file. File version handling, generic pbx functions.
void(*const answer_polarityswitch)(void *pvt)
Switch FXS line polarity, based on answeronpolarityswitch=yes.
int ast_queue_control(struct ast_channel *chan, enum ast_control_frame_type control)
Queue a control frame with payload.
struct ast_party_caller caller
struct ast_frame ast_null_frame
struct ast_party_caller caller
Channel Caller ID information.
char * strsep(char **str, const char *delims)
struct timeval polaritydelaytv
static int analog_check_for_conference(struct analog_pvt *p)
CallerID (and other GR30) management and generation Includes code and algorithms from the Zapata libr...
void * analog_handle_init_event(struct analog_pvt *i, int event)
#define ast_pthread_create_detached(a, b, c, d)
static int analog_stop_cid_detect(struct analog_pvt *p)
struct ast_party_id id
Connected party ID.
void(*const set_callwaiting)(void *pvt, int callwaiting_enable)
static struct ast_frame * __analog_handle_event(struct analog_pvt *p, struct ast_channel *ast)
static int analog_off_hook(struct analog_pvt *p)
struct ast_party_name name
Subscriber name.
static int analog_start(struct analog_pvt *p)
int analog_hangup(struct analog_pvt *p, struct ast_channel *ast)
static int analog_set_linear_mode(struct analog_pvt *p, enum analog_sub sub, int linear_mode)
char mohsuggest[MAX_MUSICCLASS]
char context[AST_MAX_CONTEXT]
static int analog_firstdigittimeout
#define ast_set_flag(p, flag)
static int analog_play_tone(struct analog_pvt *p, enum analog_sub sub, enum analog_tone tone)
char calling_st[SMDI_MAX_STATION_NUM_LEN+1]
void(*const deadlock_avoidance_private)(void *pvt)
int ast_cel_report_event(struct ast_channel *chan, enum ast_cel_event_type event_type, const char *userdefevname, const char *extra, struct ast_channel *peer2)
Report a channel event.
static void analog_lock_sub_owner(struct analog_pvt *pvt, enum analog_sub sub_idx)
static int analog_train_echocanceller(struct analog_pvt *p)
char callwait_name[AST_MAX_EXTENSION]
int(*const off_hook)(void *pvt)
Set channel off hook.
struct analog_pvt * analog_new(enum analog_sigtype signallingtype, struct analog_callback *c, void *private_data)
void(*const swap_subs)(void *pvt, enum analog_sub a, struct ast_channel *new_a_owner, enum analog_sub b, struct ast_channel *new_b_owner)
struct ast_channel * owner
static int analog_get_callerid(struct analog_pvt *p, char *name, char *number, enum analog_event *ev, size_t timeout)
static int analog_get_event(struct analog_pvt *p)
int(*const dial_digits)(void *pvt, enum analog_sub sub, struct analog_dialoperation *dop)
struct ast_frame * ast_read(struct ast_channel *chan)
Reads a frame.
int ast_say_digit_str(struct ast_channel *chan, const char *num, const char *ints, const char *lang)
says digits of a string
static int analog_handle_notify_message(struct ast_channel *chan, struct analog_pvt *p, int cid_flags, int neon_mwievent)
void(*const set_new_owner)(void *pvt, struct ast_channel *new_owner)
static int analog_start_cid_detect(struct analog_pvt *p, int cid_signalling)
void(*const cancel_cidspill)(void *pvt)
int ast_ignore_pattern(const char *context, const char *pattern)
Checks to see if a number should be ignored.
static void analog_start_polarityswitch(struct analog_pvt *p)
void analog_handle_dtmf(struct analog_pvt *p, struct ast_channel *ast, enum analog_sub idx, struct ast_frame **dest)
const char * analog_cidstart_to_str(enum analog_cid_start cid_start)
char * str
Subscriber name (Malloced)
int(*const conf_del)(void *pvt, enum analog_sub sub)
struct ast_channel * ss_astchan
struct timeval ast_tvnow(void)
Returns current timeval. Meant to replace calls to gettimeofday().
unsigned int transfertobusy
#define AST_OPTION_TONE_VERIFY
static void analog_all_subchannels_hungup(struct analog_pvt *p)
int(*const start)(void *pvt)
int64_t ast_tvdiff_ms(struct timeval end, struct timeval start)
Computes the difference (in milliseconds) between two struct timeval instances.
Generic File Format Support. Should be included by clients of the file handling routines. File service providers should instead include mod_format.h.
int ast_queue_cc_frame(struct ast_channel *chan, const char *const monitor_type, const char *const dialstring, enum ast_cc_service_type service, void *private_data)
Queue an AST_CONTROL_CC frame.
int ast_pickup_call(struct ast_channel *chan)
Pickup a call.
void(*const set_cadence)(void *pvt, int *cidrings, struct ast_channel *chan)
int(*const is_dialing)(void *pvt, enum analog_sub sub)
unsigned int hidecallerid
const ast_string_field linkedid
int ast_channel_setoption(struct ast_channel *channel, int option, void *data, int datalen, int block)
Sets an option on a channel.
int(*const confmute)(void *pvt, int mute)
static char cid_num[AST_MAX_EXTENSION]
static void analog_set_outgoing(struct analog_pvt *p, int is_outgoing)
int polarityonanswerdelay
int analog_fixup(struct ast_channel *oldchan, struct ast_channel *newchan, void *newp)
static void analog_hangup_polarityswitch(struct analog_pvt *p)
#define ast_verb(level,...)
struct ast_smdi_md_message * ast_smdi_md_message_wait(struct ast_smdi_interface *iface, int timeout)
Get the next SMDI message from the queue.
static int analog_wink(struct analog_pvt *p, enum analog_sub index)
int(*const distinctive_ring)(struct ast_channel *chan, void *pvt, int idx, int *ringdata)
void(*const unlock_private)(void *pvt)
int ast_canmatch_extension(struct ast_channel *c, const char *context, const char *exten, int priority, const char *callerid)
Looks for a valid matching extension.
const char * pbx_builtin_getvar_helper(struct ast_channel *chan, const char *name)
Return a pointer to the value of the corresponding channel variable.
struct ast_cc_config_params * ast_channel_get_cc_config_params(struct ast_channel *chan)
Get the CCSS parameters from a channel.
unsigned int use_smdi
TRUE if SMDI (Simplified Message Desk Interface) is enabled.
int(*const get_sub_fd)(void *pvt, enum analog_sub sub)
static int analog_get_sub_fd(struct analog_pvt *p, enum analog_sub sub)
static const char * analog_get_orig_dialstring(struct analog_pvt *p)
int ast_queue_hangup_with_cause(struct ast_channel *chan, int cause)
Queue a hangup frame with hangupcause set.
unsigned int cancallforward
static void analog_set_waitingfordt(struct analog_pvt *p, struct ast_channel *ast)
int(*const on_hook)(void *pvt)
Set channel on hook.
void(*const set_pulsedial)(void *pvt, int flag)
enum ast_cc_monitor_policies ast_get_cc_monitor_policy(struct ast_cc_config_params *config)
Get the cc_monitor_policy.
struct ast_channel * owner
int(*const wink)(void *pvt, enum analog_sub sub)
int(*const check_for_conference)(void *pvt)
void(*const increase_ss_count)(void)
int(*const have_progressdetect)(void *pvt)
struct ast_channel *(*const new_ast_channel)(void *pvt, int state, int startpbx, enum analog_sub sub, const struct ast_channel *requestor)
struct ast_party_id id
Caller party ID.
int(*const allocate_sub)(void *pvt, enum analog_sub sub)
enum analog_sigtype sigtype
static void analog_unlock_private(struct analog_pvt *p)
#define EVENT_FLAG_SYSTEM
#define ast_debug(level,...)
Log a DEBUG message.
void(*const set_polarity)(void *pvt, int value)
Set FXS line polarity to 0=IDLE NZ=REVERSED.
static int analog_alloc_sub(struct analog_pvt *p, enum analog_sub x)
struct ast_party_id ani
Automatic Number Identification (ANI)
static void * __analog_ss_thread(void *data)
static int analog_dial_digits(struct analog_pvt *p, enum analog_sub sub, struct analog_dialoperation *dop)
void ast_set_hangupsource(struct ast_channel *chan, const char *source, int force)
Set the source of the hangup in this channel and it's bridge.
static char pickup_ext[AST_MAX_EXTENSION]
static void analog_swap_subs(struct analog_pvt *p, enum analog_sub a, enum analog_sub b)
static force_inline int attribute_pure ast_strlen_zero(const char *s)
int(*const set_echocanceller)(void *pvt, int enable)
int(*const send_callerid)(void *pvt, int cwcid, struct ast_party_caller *caller)
void(*const set_inthreeway)(void *pvt, enum analog_sub sub, int inthreeway)
#define AST_MAX_EXTENSION
void(*const set_needringing)(void *pvt, int value)
void ast_smdi_md_message_destroy(struct ast_smdi_md_message *msg)
ast_smdi_md_message destructor.
void ast_party_number_init(struct ast_party_number *init)
Initialize the given number structure.
Caller Party information.
static int analog_matchdigittimeout
#define S_COR(a, b, c)
returns the equivalent of logic or for strings, with an additional boolean check: second one if not e...
int ast_softhangup(struct ast_channel *chan, int reason)
Softly hangup up a channel.
static void analog_answer_polarityswitch(struct analog_pvt *p)
static char analog_defaultcic[64]
static int analog_distinctive_ring(struct ast_channel *chan, struct analog_pvt *p, int idx, int *ringdata)
int(*const play_tone)(void *pvt, enum analog_sub sub, enum analog_tone tone)
int(*const complete_conference_update)(void *pvt, int needconf)
int analog_available(struct analog_pvt *p)
char callwait_num[AST_MAX_EXTENSION]
#define AST_CAUSE_NO_ANSWER
int(*const train_echocanceller)(void *pvt)
static int analog_stop_callwait(struct analog_pvt *p)
static struct ast_channel * analog_new_ast_channel(struct analog_pvt *p, int state, int startpbx, enum analog_sub sub, const struct ast_channel *requestor)
struct ast_frame * analog_exception(struct analog_pvt *p, struct ast_channel *ast)
int ast_exists_extension(struct ast_channel *c, const char *context, const char *exten, int priority, const char *callerid)
Determine whether an extension exists.
An SMDI message desk message.
void(*const lock_private)(void *pvt)
Core PBX routines and definitions.
int analog_call(struct analog_pvt *p, struct ast_channel *ast, char *rdest, int timeout)
void ast_party_number_free(struct ast_party_number *doomed)
Destroy the party number contents.
int(*const set_linear_mode)(void *pvt, enum analog_sub sub, int linear_mode)
const char * analog_sigtype_to_str(enum analog_sigtype sigtype)
#define AST_CC_GENERIC_MONITOR_TYPE
#define ASTOBJ_UNREF(object, destructor)
Decrement the reference count on an object.
char cid_num[AST_MAX_EXTENSION]
char lastcid_name[AST_MAX_EXTENSION]
static void analog_set_inthreeway(struct analog_pvt *p, enum analog_sub sub, int inthreeway)
The AMI - Asterisk Manager Interface - is a TCP protocol created to manage Asterisk with third-party ...
static int analog_on_hook(struct analog_pvt *p)
#define ast_strdupa(s)
duplicate a string in memory from the stack
struct analog_dialoperation dop
int analog_ss_thread_start(struct analog_pvt *p, struct ast_channel *chan)
void(*const all_subchannels_hungup)(void *pvt)
enum analog_cid_start cid_start
int ast_channel_transfer_masquerade(struct ast_channel *target_chan, const struct ast_party_connected_line *target_id, int target_held, struct ast_channel *transferee_chan, const struct ast_party_connected_line *transferee_id, int transferee_held)
Setup a masquerade to transfer a call.
static char * analog_event2str(enum analog_event event)
int(*const start_cid_detect)(void *pvt, int cid_signalling)
void(*const hangup_polarityswitch)(void *pvt)
Switch FXS line polarity, based on answeronpolarityswitch and hanguponpolarityswitch.
int analog_config_complete(struct analog_pvt *p)
enum analog_sigtype analog_str_to_sigtype(const char *name)
static char analog_defaultozz[64]
int(*const stop_cid_detect)(void *pvt)
static int analog_dsp_reset_and_flush_digits(struct analog_pvt *p)
int ast_remaining_ms(struct timeval start, int max_ms)
Calculate remaining milliseconds given a starting timestamp and upper bound.
static int analog_callwait(struct analog_pvt *p)
static int analog_attempt_transfer(struct analog_pvt *p, int inthreeway)
int analog_answer(struct analog_pvt *p, struct ast_channel *ast)
const ast_string_field call_forward
void ast_party_name_init(struct ast_party_name *init)
Initialize the given name structure.
void *(*const get_sigpvt_bridged_channel)(struct ast_channel *chan)
static struct @119 cidtypes[]
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
int ani2
Automatic Number Identification 2 (Info Digits)
enum ast_channel_state _state
struct ast_channel * ast_bridged_channel(struct ast_channel *chan)
Find bridged channel.
void analog_free(struct analog_pvt *p)
static int analog_decrease_ss_count(struct analog_pvt *p)
int(*const has_voicemail)(void *pvt)
const ast_string_field name
void analog_delete(struct analog_pvt *doomed)
Delete the analog private structure.
void ast_party_name_free(struct ast_party_name *doomed)
Destroy the party name contents.
void ast_log(int level, const char *file, int line, const char *function, const char *fmt,...)
Used for sending a log message This is the standard logger function. Probably the only way you will i...
int(*const check_confirmanswer)(void *pvt)
void(*const get_and_handle_alarms)(void *pvt)
static void analog_cb_handle_dtmf(struct analog_pvt *p, struct ast_channel *ast, enum analog_sub analog_index, struct ast_frame **dest)
int(*const ring)(void *pvt)
static int analog_canmatch_featurecode(const char *exten)
int ast_softhangup_nolock(struct ast_channel *chan, int reason)
Softly hangup up a channel (no channel lock)
static int analog_check_confirmanswer(struct analog_pvt *p)
#define ast_channel_unlock(chan)
void(*const set_ringtimeout)(void *pvt, int ringt)
int(*const stop_callwait)(void *pvt)
int(*const check_waitingfordt)(void *pvt)
int(*const is_off_hook)(void *pvt)
enum analog_cid_start analog_str_to_cidstart(const char *value)
unsigned int dahditrcallerid
static void analog_set_cadence(struct analog_pvt *p, struct ast_channel *chan)
int(*const unallocate_sub)(void *pvt, enum analog_sub sub)
static int analog_is_off_hook(struct analog_pvt *p)
int msgstate
-1 = unknown, 0 = no messages, 1 = new messages available
static void analog_set_confirmanswer(struct analog_pvt *p, int flag)
unsigned int permhidecallerid
void(*const set_waitingfordt)(void *pvt, struct ast_channel *ast)
static void analog_set_callwaiting(struct analog_pvt *p, int callwaiting_enable)
int(*const get_callerid)(void *pvt, char *name, char *num, enum analog_event *ev, size_t timeout)
static int analog_gendigittimeout
static int analog_has_voicemail(struct analog_pvt *p)
void(*const handle_notify_message)(struct ast_channel *chan, void *pvt, int cid_flags, int neon_mwievent)
static void analog_set_pulsedial(struct analog_pvt *p, int flag)
#define ast_clear_flag(p, flag)
static char cid_name[AST_MAX_EXTENSION]
void(*const decrease_ss_count)(void)
static int analog_confmute(struct analog_pvt *p, int mute)
unsigned int analog_str_to_cidtype(const char *name)
int pbx_builtin_setvar_helper(struct ast_channel *chan, const char *name, const char *value)
Add a variable to the channel variable stack, removing the most recently set value for the same name...
int(*const flash)(void *pvt)
static int analog_wait_event(struct analog_pvt *p)
static int analog_check_waitingfordt(struct analog_pvt *p)
static void * analog_get_bridged_channel(struct analog_pvt *p, struct ast_channel *chan)
void(*const set_confirmanswer)(void *pvt, int flag)
#define ANALOG_NEED_MFDETECT(p)
int ast_waitfordigit(struct ast_channel *c, int ms)
Waits for a digit.
void callerid_free(struct callerid_state *cid)
This function frees callerid_state cid.
static void analog_set_needringing(struct analog_pvt *p, int value)
char call_forward[AST_MAX_EXTENSION]
static void analog_lock_private(struct analog_pvt *p)
int ast_waitfor(struct ast_channel *chan, int ms)
Wait for input on a channel.
static int analog_increase_ss_count(struct analog_pvt *p)
static int analog_set_echocanceller(struct analog_pvt *p, int enable)
int(*const callwait)(void *pvt)
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
#define S_OR(a, b)
returns the equivalent of logic or for strings: first one if not empty, otherwise second one...
unsigned int callwaitingcallerid
struct timeval ast_tv(ast_time_t sec, ast_suseconds_t usec)
Returns a timeval from sec, usec.
static int analog_is_dialing(struct analog_pvt *p, enum analog_sub index)
int(*const dsp_set_digitmode)(void *pvt, enum analog_dsp_digitmode mode)
int ast_waitstream(struct ast_channel *c, const char *breakon)
Waits for a stream to stop or digit to be pressed.
char lastcid_num[AST_MAX_EXTENSION]
int(*const wait_event)(void *pvt)
struct analog_callback * calls
int ast_setstate(struct ast_channel *chan, enum ast_channel_state)
Change the state of a channel.
static int analog_my_getsigstr(struct ast_channel *chan, char *str, const char *term, int ms)
int ast_queue_control_data(struct ast_channel *chan, enum ast_control_frame_type control, const void *data, size_t datalen)
Queue a control frame with payload.
Interface header for analog signaling module.
void(*const handle_dtmf)(void *pvt, struct ast_channel *ast, enum analog_sub analog_index, struct ast_frame **dest)
enum ast_pbx_result ast_pbx_run(struct ast_channel *c)
Execute the PBX in the current thread.
static int analog_have_progressdetect(struct analog_pvt *p)
#define MIN_MS_SINCE_FLASH
static void analog_set_new_owner(struct analog_pvt *p, struct ast_channel *new_owner)
Data structure associated with a single frame of data.
Internal Asterisk hangup causes.
enum analog_sigtype outsigmod
const char *(*const get_orig_dialstring)(void *pvt)
int ast_masq_park_call_exten(struct ast_channel *park_me, struct ast_channel *parker, const char *park_exten, const char *park_context, int timeout, int *extout)
Park a call via a masqueraded channel.
void(*const set_dialing)(void *pvt, int is_dialing)
Options provided by main asterisk program.
static void analog_cancel_cidspill(struct analog_pvt *p)
unsigned int callwaitcas
TRUE if Call Waiting (CW) CPE Alert Signal (CAS) is being sent.
int ast_db_put(const char *family, const char *key, const char *value)
Store value addressed by family/key.
int ast_parking_ext_valid(const char *exten_str, struct ast_channel *chan, const char *context)
Determine if parking extension exists in a given context.
enum ast_frame_type frametype
static int analog_update_conf(struct analog_pvt *p)
int(*const get_event)(void *pvt)
#define ast_channel_trylock(chan)
const char * analog_cidtype_to_str(unsigned int cid_type)
unsigned char valid
TRUE if the name information is valid/present.
Call Parking and Pickup API Includes code and algorithms from the Zapata library. ...
struct analog_subchannel subs[3]
void callerid_get_dtmf(char *cidstring, char *number, int *flags)
Get and parse DTMF-based callerid.
static void analog_get_and_handle_alarms(struct analog_pvt *p)
unsigned int hanguponpolarityswitch
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...
static int analog_flash(struct analog_pvt *p)
Say numbers and dates (maybe words one day too)
static void analog_set_ringtimeout(struct analog_pvt *p, int ringt)
#define manager_event(category, event, contents,...)
External routines may send asterisk manager events this way.
int(*const dsp_reset_and_flush_digits)(void *pvt)
static void analog_set_dialing(struct analog_pvt *p, int is_dialing)
static int analog_dsp_set_digitmode(struct analog_pvt *p, enum analog_dsp_digitmode mode)
void(*const start_polarityswitch)(void *pvt)
Reset FXS line polarity to IDLE, based on answeronpolarityswitch and hanguponpolarityswitch.
union ast_frame::@172 data
Persistant data storage (akin to *doze registry)
unsigned char valid
TRUE if the number information is valid/present.
int analog_dnd(struct analog_pvt *p, int flag)
void(*const set_outgoing)(void *pvt, int is_outgoing)
static void analog_set_alarm(struct analog_pvt *p, int in_alarm)
struct ast_channel * analog_request(struct analog_pvt *p, int *callwait, const struct ast_channel *requestor)
static int analog_ring(struct analog_pvt *p)
unsigned int permcallwaiting
const ast_string_field language
char exten[AST_MAX_EXTENSION]
const char * ast_pickup_ext(void)
Determine system call pickup extension.
unsigned int answeronpolarityswitch
void(*const set_alarm)(void *pvt, int in_alarm)
static struct @118 sigtypes[]
#define ast_string_field_set(x, field, data)
Set a field to a simple string value.
struct ast_party_number number
Subscriber phone number.