62 #define POLARITY_IDLE 0 63 #define POLARITY_REV 1 64 #define MIN_MS_SINCE_FLASH ( (2000) ) 107 #define ISTRUNK(p) ((p->sig == ANALOG_SIG_FXSLS) || (p->sig == ANALOG_SIG_FXSKS) || \ 108 (p->sig == ANALOG_SIG_FXSGS)) 115 if (!strcasecmp(
sigtypes[i].name, name)) {
128 if (sigtype ==
sigtypes[i].sigtype) {
141 if (!strcasecmp(
cidtypes[i].name, name)) {
154 if (cid_type ==
cidtypes[i].cid_type) {
219 #define gen_analog_field_callback(type, callback_name, def_value) \ 220 static type analog_get_##callback_name(struct analog_pvt *p) \ 222 if (!analog_callbacks.get_##callback_name) { \ 225 return analog_callbacks.get_##callback_name(p->chan_pvt); \ 232 #undef gen_analog_field_callback 236 if (!strcasecmp(value,
"ring")) {
238 }
else if (!strcasecmp(value,
"polarity")) {
240 }
else if (!strcasecmp(value,
"polarity_in")) {
242 }
else if (!strcasecmp(value,
"dtmf")) {
257 return "Polarity_In";
270 res =
"ANALOG_EVENT_ONHOOK";
273 res =
"ANALOG_EVENT_RINGOFFHOOK";
276 res =
"ANALOG_EVENT_WINKFLASH";
279 res =
"ANALOG_EVENT_ALARM";
282 res =
"ANALOG_EVENT_NOALARM";
285 res =
"ANALOG_EVENT_DIALCOMPLETE";
288 res =
"ANALOG_EVENT_HOOKCOMPLETE";
291 res =
"ANALOG_EVENT_PULSE_START";
294 res =
"ANALOG_EVENT_POLARITY";
297 res =
"ANALOG_EVENT_RINGBEGIN";
300 res =
"ANALOG_EVENT_EC_DISABLED";
303 res =
"ANALOG_EVENT_RINGERON";
306 res =
"ANALOG_EVENT_RINGEROFF";
309 res =
"ANALOG_EVENT_REMOVED";
312 res =
"ANALOG_EVENT_NEONMWI_ACTIVE";
315 res =
"ANALOG_EVENT_NEONMWI_INACTIVE";
317 #ifdef HAVE_DAHDI_ECHOCANCEL_FAX_MODE 319 res =
"ANALOG_EVENT_TX_CED_DETECTED";
322 res =
"ANALOG_EVENT_RX_CED_DETECTED";
325 res =
"ANALOG_EVENT_EC_NLP_DISABLED";
328 res =
"ANALOG_EVENT_EC_NLP_ENABLED";
332 res =
"ANALOG_EVENT_PULSEDIGIT";
335 res =
"ANALOG_EVENT_DTMFDOWN";
338 res =
"ANALOG_EVENT_DTMFUP";
341 res =
"UNKNOWN/OTHER";
353 ast_debug(1,
"Swapping %u and %u\n", a, b);
393 ast_debug(1,
"Sending callerid. CID_NAME: '%s' CID_NUM: '%s'\n",
407 #define analog_get_index(ast, p, nullok) _analog_get_index(ast, p, nullok, __PRETTY_FUNCTION__, __LINE__) 421 "Unable to get index for '%s' on channel %d (%s(), line %lu)\n",
448 p->
owner = new_owner;
722 ast_verb(3,
"TRANSFERRING %s to %s\n",
751 for (x = 0; x < 3; x++) {
764 ast_debug(1,
"Updated conferencing on %d, with %d conference users\n", p->
channel, needconf);
816 #ifdef DAHDI_CHECK_HOOKSTATE 823 }
else if (offhook) {
993 ast_debug(1,
"CALLING CID_NAME: %s CID_NUM:: %s\n",
1022 if (p->
owner == ast) {
1030 c = strchr(dest,
'/');
1034 if (c && (strlen(c) < p->
stripmsd)) {
1041 ast_debug(1,
"FXO: setup deferred dialstring: %s\n", c);
1120 ast_debug(1,
"Ignore possible polarity reversal on line seizure\n");
1139 c = strchr(dest,
'/');
1151 if (
errno != EINPROGRESS) {
1179 const char *cic =
"", *ozz =
"";
1193 ast_log(
LOG_WARNING,
"Unable to dial channel of type feature group D MF tandem access without CIC or OZZ set\n");
1278 ast_debug(1,
"Hangup: channel: %d index = %d, normal = %d, callwait = %d, thirdcall = %d\n",
1288 ast_debug(1,
"Normal call hung up with both three way call and a call waiting call in place?\n");
1291 ast_debug(1,
"We were flipped over to the callwait, moving back and unowning.\n");
1298 ast_debug(1,
"We were in the threeway and have a callwait still. Ditching the threeway.\n");
1304 ast_debug(1,
"Call was complete, setting owner to former third call\n");
1309 ast_debug(1,
"Call was incomplete, setting owner to NULL\n");
1338 ast_debug(1,
"Call was complete, setting owner to former third call\n");
1343 ast_debug(1,
"Call was incomplete, setting owner to NULL\n");
1507 ast_debug(1,
"Finally swapping real and threeway\n");
1568 ast_debug(1,
"%s DTMF digit: 0x%02X '%c' on %s\n",
1585 *dest = &p->
subs[idx].
f;
1589 ast_debug(1,
"Got some DTMF, but it's for the CAS\n");
1600 *dest = &p->
subs[idx].
f;
1620 if (strchr(term, c)) {
1684 #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)) 1688 int extlen = strlen(exten);
1692 if (extlen < strlen(pickupexten) && !strncmp(pickupexten, exten, extlen)) {
1696 if (exten[0] ==
'*' && extlen < 3) {
1732 const char *pickupexten;
1766 ast_log(
LOG_ERROR,
"Unable to retrieve pickup configuration options. Unable to detect call pickup extension\n");
1769 pickupexten =
ast_strdupa(pickup_cfg->pickupexten);
1804 memset(dtmfbuf, 0,
sizeof(dtmfbuf));
1849 && (strlen(dtmfbuf) != 14)) {
1898 dtmfbuf[
len] =
'\0';
1901 timeout = analog_get_matchdigit_timeout(p);
1903 timeout = analog_get_interdigit_timeout(p);
1907 ast_debug(1,
"waitfordigit returned < 0...\n");
1911 dtmfbuf[len++] = res;
1912 dtmfbuf[
len] =
'\0';
1924 }
else if (res < 0) {
1925 ast_debug(1,
"Got hung up before digits finished\n");
1940 if ((res > 0) && (strlen(anibuf) > 2)) {
1941 if (anibuf[strlen(anibuf) - 1] ==
'#') {
1942 anibuf[strlen(anibuf) - 1] = 0;
1955 if (exten[0] ==
'*') {
1960 s1 =
strsep(&stringp,
"*");
1961 s2 =
strsep(&stringp,
"*");
1977 if (exten[0] ==
'*') {
1984 s1 =
strsep(&stringp,
"#");
1985 s2 =
strsep(&stringp,
"#");
2002 caller->
ani2 = atoi(s1);
2008 if (exten[0] ==
'*') {
2013 s1 =
strsep(&stringp,
"#");
2014 s2 =
strsep(&stringp,
"#");
2015 if (s2 && (*(s2 + 1) ==
'0')) {
2030 if (exten[0] ==
'*') {
2035 s1 =
strsep(&stringp,
"#");
2089 timeout = analog_get_firstdigit_timeout(p);
2096 int is_exten_parking = 0;
2107 ast_debug(1,
"waitfordigit returned < 0...\n");
2112 ast_debug(1,
"waitfordigit returned '%c' (%d), timeout = %d\n", res, res, timeout);
2137 memset(exten, 0,
sizeof(exten));
2170 timeout = analog_get_matchdigit_timeout(p);
2172 }
else if (res == 0) {
2173 ast_debug(1,
"not enough digits (and no ambiguous match)...\n");
2178 }
else if (p->
callwaiting && !strcmp(exten,
"*70")) {
2188 memset(exten, 0,
sizeof(exten));
2189 timeout = analog_get_firstdigit_timeout(p);
2191 }
else if (!strcmp(exten, pickupexten)) {
2207 ast_debug(1,
"No call pickup possible...\n");
2219 }
else if (!p->
hidecallerid && !strcmp(exten,
"*67")) {
2233 memset(exten, 0,
sizeof(exten));
2234 timeout = analog_get_firstdigit_timeout(p);
2235 }
else if (p->
callreturn && !strcmp(exten,
"*69")) {
2244 }
else if (!strcmp(exten,
"*78")) {
2249 memset(exten, 0,
sizeof(exten));
2251 }
else if (!strcmp(exten,
"*79")) {
2256 memset(exten, 0,
sizeof(exten));
2261 memset(exten, 0,
sizeof(exten));
2264 ast_verb(3,
"Cancelling call forwarding on channel %d\n", p->
channel);
2268 memset(exten, 0,
sizeof(exten));
2281 if (bridge_channel) {
2305 memset(exten, 0,
sizeof(exten));
2319 memset(exten, 0,
sizeof(exten));
2320 timeout = analog_get_firstdigit_timeout(p);
2321 }
else if (!strcmp(exten,
"*0")) {
2328 if (pbridge &&
ISTRUNK(pbridge)) {
2334 "Unable to flash-hook bridged trunk from channel %s: %s\n",
2356 ast_debug(1,
"Can't match %s from '%s' in context %s\n", exten,
2363 timeout = analog_get_interdigit_timeout(p);
2376 if (smdi_msg != NULL) {
2379 if (smdi_msg->
type ==
'B')
2381 else if (smdi_msg->
type ==
'N')
2433 "DTMFCID timed out waiting for ring. Exiting simple switch\n");
2462 ast_debug(1,
"CID got string '%s'\n", dtmfbuf);
2464 ast_debug(1,
"CID is '%s', flags %d\n", dtmfcid, flags);
2478 int timeout = 10000;
2483 struct timeval off_start;
2493 "CallerID returned with error on channel '%s'\n",
2533 "CID timed out waiting for ring. Exiting simple switch\n");
2560 "Channel %s in prering state, but I have nothing to do. Terminating simple switch, should be restarted by the actual ring.\n",
2570 int timeout = 10000;
2574 int ring_data_idx = 0;
2585 "CallerID returned with error on channel '%s'\n",
2601 "Hanging up due to polarity reversal on channel %d while detecting callerid\n",
2614 ring_data[ring_data_idx] = p->
ringt;
2695 int data_size =
sizeof(*cause_code);
2696 char *subclass =
NULL;
2719 p->
subs[idx].
f.
src =
"dahdi_handle_event";
2721 f = &p->
subs[idx].
f;
2729 ast_debug(1,
"Detected %sdigit '%c'\n", (res & ANALOG_EVENT_PULSEDIGIT) ?
"pulse ":
"", res & 0xff);
2738 ast_debug(1,
"DTMF Down '%c'\n", res & 0xff);
2754 data_size += strlen(subclass);
2756 memset(cause_code, 0, data_size);
2759 snprintf(cause_code->
code, data_size -
sizeof(*cause_code) + 1,
"ANALOG %s", subclass);
2767 ast_verb(3,
"Channel %d echo canceler disabled due to CED detection\n", p->
channel);
2770 #ifdef HAVE_DAHDI_ECHOCANCEL_FAX_MODE 2772 ast_verb(3,
"Channel %d detected a CED tone towards the network.\n", p->
channel);
2775 ast_verb(3,
"Channel %d detected a CED tone from the network.\n", p->
channel);
2778 ast_verb(3,
"Channel %d echo canceler disabled its NLP.\n", p->
channel);
2781 ast_verb(3,
"Channel %d echo canceler enabled its NLP.\n", p->
channel);
2818 ast_debug(1,
"Done dialing, but waiting for progress detection before doing more...\n");
2875 ast_verb(3,
"Channel %d still has (callwait) call, ringing phone\n", p->
channel);
2887 unsigned int mssinceflash;
2896 if (p->
owner != ast) {
2904 ast_debug(1,
"Last flash was %u ms ago\n", mssinceflash);
2908 ast_debug(1,
"Looks like a bounced flash, hanging up both calls on %d\n", p->
channel);
2995 return &p->
subs[idx].
f;
3040 return &p->
subs[idx].
f;
3047 return &p->
subs[idx].
f;
3167 ast_debug(1,
"Winkflash, index: %u, normal: %d, callwait: %d, thirdcall: %d\n",
3241 ast_debug(1,
"Flash when call not up or ringing\n");
3264 "Cannot allocate new call structure on channel %d\n",
3321 ast_debug(1,
"Got flash with three way call up, dropping last call on %d\n", p->
channel);
3339 ast_verb(3,
"Building conference call with %s and %s\n",
3395 ast_log(
LOG_WARNING,
"Received unexpected wink on channel of type ANALOG_SIG_FEATDMF_TA\n");
3460 ast_debug(1,
"Got hook complete in MF FGD, waiting for wink now on channel %d\n",p->
channel);
3490 ast_debug(1,
"Ignore Answer on polarity switch, channel %d\n", p->
channel);
3503 ast_debug(1,
"Ignore Hangup on polarity switch, channel %d\n", p->
channel);
3547 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_channel_state(ast), p->
polarity, p->
answeronpolarityswitch, p->
hanguponpolarityswitch, p->
polarityonanswerdelay,
ast_tvdiff_ms(
ast_tvnow(), p->
polaritydelaytv) );
3550 ast_debug(1,
"Dunno what to do with event %d on channel %d\n", res, p->
channel);
3552 return &p->
subs[idx].
f;
3575 p->
subs[idx].
f.
src =
"dahdi_exception";
3589 ast_debug(1,
"Restoring owner of channel %d on event %d\n", p->
channel, res);
3650 f = &p->
subs[idx].
f;
3655 if (ast != p->
owner) {
3657 f = &p->
subs[idx].
f;
3683 ast_debug(1,
"channel (%d) - signaling (%d) - event (%s)\n",
3700 if (res && (
errno == EBUSY)) {
3731 ast_log(
LOG_WARNING,
"Unable to play dialtone on channel %d, do you have defaultzone and loadzone defined?\n", i->
channel);
3866 ast_verb(2,
"Starting post polarity CID detection on channel %d\n",
3881 "handle_init_event detected polarity reversal on non-FXO (ANALOG_SIG_FXS) interface %d\n",
3893 ast_verb(2,
"Starting DTMF CID detection on channel %d\n",
3908 "handle_init_event detected dtmfcid generation event on non-FXO (ANALOG_SIG_FXS) interface %d\n",
3938 p->
sig = signallingtype;
3986 if (new_pvt->
owner == oldchan) {
3989 for (x = 0; x < 3; x++) {
3990 if (new_pvt->
subs[x].
owner == oldchan) {
4027 ast_verb(3,
"%s DND on channel %d\n",
4028 flag ?
"Enabled" :
"Disabled",
static int analog_send_callerid(struct analog_pvt *p, int cwcid, struct ast_party_caller *caller)
int(*const conf_add)(void *pvt, enum analog_sub sub)
struct ast_party_caller * ast_channel_caller(struct ast_channel *chan)
void(*const get_and_handle_alarms)(void *pvt)
#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)
int(*const on_hook)(void *pvt)
Set channel on hook.
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
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) ...
#define ast_channel_lock(chan)
unsigned int use_callerid
static char exten[AST_MAX_EXTENSION]
Main Channel structure associated with a channel.
struct ast_smdi_interface * smdi_iface
The SMDI interface to get SMDI messages from.
char * str
Subscriber phone number (Malloced)
int(*const wink)(void *pvt, enum analog_sub sub)
static int analog_unalloc_sub(struct analog_pvt *p, enum analog_sub x)
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)
void(*const answer_polarityswitch)(void *pvt)
Switch FXS line polarity, based on answeronpolarityswitch=yes.
void(*const start_polarityswitch)(void *pvt)
Reset FXS line polarity to IDLE, based on answeronpolarityswitch and hanguponpolarityswitch.
Asterisk main include file. File version handling, generic pbx functions.
enum ast_transfer_result ast_bridge_transfer_attended(struct ast_channel *to_transferee, struct ast_channel *to_transfer_target)
Attended transfer.
struct ast_features_pickup_config * ast_get_chan_features_pickup_config(struct ast_channel *chan)
Get the pickup configuration options for a channel.
char chan_name[AST_CHANNEL_NAME]
int ast_queue_control(struct ast_channel *chan, enum ast_control_frame_type control)
Queue a control frame without payload.
struct ast_party_caller caller
struct ast_party_caller caller
Channel Caller ID information.
struct ast_json * ast_json_pack(char const *format,...)
Helper for creating complex JSON values.
struct timeval polaritydelaytv
static int analog_check_for_conference(struct analog_pvt *p)
int(*const start_cid_detect)(void *pvt, int cid_signalling)
CallerID (and other GR30) management and generation Includes code and algorithms from the Zapata libr...
int(*const is_off_hook)(void *pvt)
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)
static const struct @163 cidtypes[]
struct ast_party_id id
Connected party ID.
void * ast_channel_tech_pvt(const struct ast_channel *chan)
#define ast_channel_unref(c)
Decrease channel reference count.
int(*const is_dialing)(void *pvt, enum analog_sub sub)
static struct ast_frame * __analog_handle_event(struct analog_pvt *p, struct ast_channel *ast)
static int analog_off_hook(struct analog_pvt *p)
void ast_json_unref(struct ast_json *value)
Decrease refcount on value. If refcount reaches zero, value is freed.
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)
void(*const handle_dtmf)(void *pvt, struct ast_channel *ast, enum analog_sub analog_index, struct ast_frame **dest)
int ast_queue_unhold(struct ast_channel *chan)
Queue an unhold frame.
char mohsuggest[MAX_MUSICCLASS]
#define AST_CAUSE_NETWORK_OUT_OF_ORDER
#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]
static void analog_lock_sub_owner(struct analog_pvt *pvt, enum analog_sub sub_idx)
void ast_callid_threadstorage_auto_clean(ast_callid callid, int callid_created)
Use in conjunction with ast_callid_threadstorage_auto. Cleans up the references and if the callid was...
char * ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
static int analog_train_echocanceller(struct analog_pvt *p)
int(*const dial_digits)(void *pvt, enum analog_sub sub, struct analog_dialoperation *dop)
void(*const hangup_polarityswitch)(void *pvt)
Switch FXS line polarity, based on answeronpolarityswitch and hanguponpolarityswitch.
int(*const check_confirmanswer)(void *pvt)
char callwait_name[AST_MAX_EXTENSION]
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)
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)
struct analog_callback analog_callbacks
static int analog_start_cid_detect(struct analog_pvt *p, int cid_signalling)
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)
ast_channel_state
ast_channel states
int(*const send_callerid)(void *pvt, int cwcid, struct ast_party_caller *caller)
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)
const char *(*const get_orig_dialstring)(void *pvt)
#define ANALOG_MATCH_DIGIT_TIMEOUT
Default time (ms) to wait, in case of ambiguous match.
void(*const all_subchannels_hungup)(void *pvt)
int ast_parking_blind_transfer_park(struct ast_bridge_channel *parker, const char *context, const char *exten, transfer_channel_cb parked_channel_cb, struct transfer_channel_data *parked_channel_data)
Perform a blind transfer to a parking extension.
struct ast_channel * ss_astchan
struct timeval ast_tvnow(void)
Returns current timeval. Meant to replace calls to gettimeofday().
unsigned int usedistinctiveringdetection
unsigned int transfertobusy
static void analog_all_subchannels_hungup(struct analog_pvt *p)
int64_t ast_tvdiff_ms(struct timeval end, struct timeval start)
Computes the difference (in milliseconds) between two struct timeval instances.
#define ast_strdup(str)
A wrapper for strdup()
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.
static void analog_publish_dnd_state(int channel, const char *status)
unsigned int hidecallerid
int ast_channel_setoption(struct ast_channel *channel, int option, void *data, int datalen, int block)
Sets an option on a channel.
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 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_frame_subclass subclass
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.
struct analog_pvt * analog_new(enum analog_sigtype signallingtype, void *private_data)
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(*const play_tone)(void *pvt, enum analog_sub sub, enum analog_tone tone)
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)
#define ast_strlen_zero(foo)
void(*const set_polarity)(void *pvt, int value)
Set FXS line polarity to 0=IDLE NZ=REVERSED.
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 confmute)(void *pvt, int mute)
int ast_callid_threadassoc_add(ast_callid callid)
Adds a known callid to thread storage of the calling thread.
#define gen_analog_field_callback(type, callback_name, def_value)
int(*const allocate_sub)(void *pvt, enum analog_sub sub)
int ast_str_set(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Set a dynamic string using variable arguments.
struct ast_party_id id
Caller party ID.
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.
int(*const check_for_conference)(void *pvt)
void *(*const get_sigpvt_bridged_channel)(struct ast_channel *chan)
static int analog_alloc_sub(struct analog_pvt *p, enum analog_sub x)
void(*const handle_notify_message)(struct ast_channel *chan, void *pvt, int cid_flags, int neon_mwievent)
struct ast_party_id ani
Automatic Number Identification (ANI)
static void * __analog_ss_thread(void *data)
void ast_channel_rings_set(struct ast_channel *chan, int value)
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.
void(*const set_needringing)(void *pvt, int value)
int(*const conf_del)(void *pvt, enum analog_sub sub)
static void * analog_get_bridged_channel(struct ast_channel *chan)
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
int(*const get_sub_fd)(void *pvt, enum analog_sub sub)
static void analog_swap_subs(struct analog_pvt *p, enum analog_sub a, enum analog_sub b)
static void analog_publish_channel_alarm_clear(int channel)
struct ast_party_connected_line * ast_channel_connected(struct ast_channel *chan)
void(*const set_dialing)(void *pvt, int is_dialing)
void(*const deadlock_avoidance_private)(void *pvt)
void(*const set_callwaiting)(void *pvt, int callwaiting_enable)
struct ast_pbx * ast_channel_pbx(const struct ast_channel *chan)
int(*const start)(void *pvt)
#define AST_MAX_EXTENSION
#define AST_CAUSE_NORMAL_CLEARING
void ast_party_number_init(struct ast_party_number *init)
Initialize the given number structure.
Caller Party information.
#define ao2_ref(o, delta)
#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]
int(*const train_echocanceller)(void *pvt)
static int analog_distinctive_ring(struct ast_channel *chan, struct analog_pvt *p, int idx, int *ringdata)
#define ast_strdupa(s)
duplicate a string in memory from the stack
int(*const dsp_reset_and_flush_digits)(void *pvt)
int analog_available(struct analog_pvt *p)
int(*const set_echocanceller)(void *pvt, int enable)
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)
char callwait_num[AST_MAX_EXTENSION]
#define AST_CAUSE_NO_ANSWER
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.
int ast_queue_hold(struct ast_channel *chan, const char *musicclass)
Queue a hold frame.
Core PBX routines and definitions.
void ast_party_number_free(struct ast_party_number *doomed)
Destroy the party number contents.
const char * analog_sigtype_to_str(enum analog_sigtype sigtype)
#define AST_CC_GENERIC_MONITOR_TYPE
int(*const have_progressdetect)(void *pvt)
char cid_num[AST_MAX_EXTENSION]
#define ast_alloca(size)
call __builtin_alloca to ensure we get gcc builtin semantics
char lastcid_name[AST_MAX_EXTENSION]
static void analog_set_inthreeway(struct analog_pvt *p, enum analog_sub sub, int inthreeway)
void(*const increase_ss_count)(void)
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)
struct analog_dialoperation dop
int analog_ss_thread_start(struct analog_pvt *p, struct ast_channel *chan)
enum analog_cid_start cid_start
static char * analog_event2str(enum analog_event event)
int analog_call(struct analog_pvt *p, struct ast_channel *ast, const char *rdest, int timeout)
int ast_pickup_call(struct ast_channel *chan)
Pickup a call.
The descriptor of a dynamic string XXX storage will be optimized later if needed We use the ts field ...
int analog_config_complete(struct analog_pvt *p)
int(*const unallocate_sub)(void *pvt, enum analog_sub sub)
void(*const set_cadence)(void *pvt, int *cidrings, struct ast_channel *chan)
int ast_parking_is_exten_park(const char *context, const char *exten)
Determine if the context/exten is a "parking" extension.
enum analog_sigtype analog_str_to_sigtype(const char *name)
static char analog_defaultozz[64]
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.
void(*const set_new_owner)(void *pvt, struct ast_channel *new_owner)
static int analog_callwait(struct analog_pvt *p)
int(*const distinctive_ring)(struct ast_channel *chan, void *pvt, int idx, int *ringdata)
int analog_answer(struct analog_pvt *p, struct ast_channel *ast)
void ast_party_name_init(struct ast_party_name *init)
Initialize the given name structure.
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)
void analog_free(struct analog_pvt *p)
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.
int(*const ring)(void *pvt)
int(*const off_hook)(void *pvt)
Set channel off hook.
static void analog_cb_handle_dtmf(struct analog_pvt *p, struct ast_channel *ast, enum analog_sub analog_index, struct ast_frame **dest)
void(*const unlock_private)(void *pvt)
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)
int(*const stop_cid_detect)(void *pvt)
int ast_parking_provider_registered(void)
Check whether a parking provider is registered.
#define ast_channel_unlock(chan)
#define ast_calloc(num, len)
A wrapper for calloc()
enum analog_cid_start analog_str_to_cidstart(const char *value)
unsigned int dahditrcallerid
void ast_hangup(struct ast_channel *chan)
Hang up a channel.
void(*const set_alarm)(void *pvt, int in_alarm)
static void analog_set_cadence(struct analog_pvt *p, struct ast_channel *chan)
int(*const set_linear_mode)(void *pvt, enum analog_sub sub, int linear_mode)
static int analog_is_off_hook(struct analog_pvt *p)
int msgstate
-1 = unknown, 0 = no messages, 1 = new messages available
int(*const has_voicemail)(void *pvt)
static void analog_set_confirmanswer(struct analog_pvt *p, int flag)
unsigned int permhidecallerid
static void analog_set_callwaiting(struct analog_pvt *p, int callwaiting_enable)
static int analog_has_voicemail(struct analog_pvt *p)
static void analog_deadlock_avoidance_private(struct analog_pvt *p)
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 set_pulsedial)(void *pvt, int flag)
struct ast_bridge_channel * ast_channel_get_bridge_channel(struct ast_channel *chan)
Get a reference to the channel's bridge pointer.
int(*const wait_event)(void *pvt)
static int analog_confmute(struct analog_pvt *p, int mute)
void ast_channel_exten_set(struct ast_channel *chan, const char *value)
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...
static int analog_wait_event(struct analog_pvt *p)
static int analog_check_waitingfordt(struct analog_pvt *p)
#define ANALOG_NEED_MFDETECT(p)
struct ast_frame ast_null_frame
int ast_waitfordigit(struct ast_channel *c, int ms)
Waits for a digit.
void(*const lock_private)(void *pvt)
static void analog_set_needringing(struct analog_pvt *p, int value)
int ast_channel_fd(const struct ast_channel *chan, int which)
#define ANALOG_FIRST_DIGIT_TIMEOUT
Default time (ms) to detect first digit.
char call_forward[AST_MAX_EXTENSION]
Structure that contains information regarding a channel in a bridge.
char * strsep(char **str, const char *delims)
static void analog_lock_private(struct analog_pvt *p)
#define ast_channel_ref(c)
Increase channel reference count.
int ast_waitfor(struct ast_channel *chan, int ms)
Wait for input on a channel.
static int analog_set_echocanceller(struct analog_pvt *p, int enable)
void(*const set_confirmanswer)(void *pvt, int flag)
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
unsigned int callwaitingcallerid
struct timeval ast_tv(ast_time_t sec, ast_suseconds_t usec)
Returns a timeval from sec, usec.
int(*const check_waitingfordt)(void *pvt)
static int analog_is_dialing(struct analog_pvt *p, enum analog_sub index)
const char * ast_channel_name(const struct ast_channel *chan)
int ast_waitstream(struct ast_channel *c, const char *breakon)
Waits for a stream to stop or digit to be pressed.
int ast_callid_threadstorage_auto(ast_callid *callid)
Checks thread storage for a callid and stores a reference if it exists. If not, then a new one will b...
char lastcid_num[AST_MAX_EXTENSION]
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.
enum ast_pbx_result ast_pbx_run(struct ast_channel *c)
Execute the PBX in the current thread.
static int analog_attempt_transfer(struct analog_pvt *p)
static void analog_increase_ss_count(void)
static int analog_have_progressdetect(struct analog_pvt *p)
struct stasis_forward * sub
#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.
static void analog_decrease_ss_count(void)
const char * ast_channel_language(const struct ast_channel *chan)
#define ANALOG_INTER_DIGIT_TIMEOUT
Default time (ms) to detect following digits.
enum analog_sigtype outsigmod
Abstract JSON element (object, array, string, int, ...).
static const struct @162 sigtypes[]
Options provided by main asterisk program.
static void analog_cancel_cidspill(struct analog_pvt *p)
#define AST_OPTION_TONE_VERIFY
unsigned int callwaitcas
TRUE if Call Waiting (CW) CPE Alert Signal (CAS) is being sent.
const char * ast_channel_context(const struct ast_channel *chan)
int ast_db_put(const char *family, const char *key, const char *value)
Store value addressed by family/key.
union ast_frame::@263 data
int(*const get_event)(void *pvt)
enum ast_frame_type frametype
static int analog_update_conf(struct analog_pvt *p)
void(*const set_inthreeway)(void *pvt, enum analog_sub sub, int inthreeway)
#define ast_channel_trylock(chan)
int ast_channel_rings(const struct ast_channel *chan)
const char * analog_cidtype_to_str(unsigned int cid_type)
struct ast_channel *(*const new_ast_channel)(void *pvt, int state, int startpbx, enum analog_sub sub, const struct ast_channel *requestor)
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 ast_flags * ast_channel_flags(struct ast_channel *chan)
struct analog_subchannel subs[3]
void(*const set_ringtimeout)(void *pvt, int ringt)
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
static int analog_canmatch_featurecode(const char *pickupexten, const char *exten)
void(*const set_outgoing)(void *pvt, int is_outgoing)
int(*const stop_callwait)(void *pvt)
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(*const dsp_set_digitmode)(void *pvt, enum analog_dsp_digitmode mode)
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)
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 cancel_cidspill)(void *pvt)
int(*const complete_conference_update)(void *pvt, int needconf)
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)
ast_callid ast_channel_callid(const struct ast_channel *chan)
void ast_channel_hangupcause_hash_set(struct ast_channel *chan, const struct ast_control_pvt_cause_code *cause_code, int datalen)
Sets the HANGUPCAUSE hash and optionally the SIP_CAUSE hash on the given channel. ...
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)
int(*const flash)(void *pvt)
static int analog_ring(struct analog_pvt *p)
unsigned int permcallwaiting
void(*const decrease_ss_count)(void)
void(*const set_waitingfordt)(void *pvt, struct ast_channel *ast)
int(*const callwait)(void *pvt)
void ast_manager_publish_event(const char *type, int class_type, struct ast_json *obj)
Publish an event to AMI.
#define ast_str_create(init_len)
Create a malloc'ed dynamic length string.
unsigned int answeronpolarityswitch
Configuration relating to call pickup.
int(*const get_callerid)(void *pvt, char *name, char *num, enum analog_event *ev, size_t timeout)
struct ast_party_number number
Subscriber phone number.