Asterisk - The Open Source Telephony Project  18.5.0
Data Structures | Macros | Enumerations | Functions | Variables
sig_analog.h File Reference

Interface header for analog signaling module. More...

#include "asterisk/channel.h"
#include "asterisk/frame.h"
#include "asterisk/smdi.h"
Include dependency graph for sig_analog.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  analog_callback
 
struct  analog_dialoperation
 
struct  analog_pvt
 
struct  analog_subchannel
 

Macros

#define ANALOG_FIRST_DIGIT_TIMEOUT   16000
 Default time (ms) to detect first digit. More...
 
#define ANALOG_INTER_DIGIT_TIMEOUT   8000
 Default time (ms) to detect following digits. More...
 
#define ANALOG_MATCH_DIGIT_TIMEOUT   3000
 Default time (ms) to wait, in case of ambiguous match. More...
 
#define ANALOG_MAX_CID   300
 
#define ANALOG_SMDI_MD_WAIT_TIMEOUT   1500 /* 1.5 seconds */
 
#define READ_SIZE   160
 
#define RING_PATTERNS   3
 

Enumerations

enum  analog_cid_start { ANALOG_CID_START_POLARITY = 1, ANALOG_CID_START_POLARITY_IN, ANALOG_CID_START_RING, ANALOG_CID_START_DTMF_NOALERT }
 
enum  analog_dsp_digitmode { ANALOG_DIGITMODE_DTMF = 1, ANALOG_DIGITMODE_MF }
 
enum  analog_event {
  ANALOG_EVENT_NONE = 0, ANALOG_EVENT_ONHOOK, ANALOG_EVENT_RINGOFFHOOK, ANALOG_EVENT_WINKFLASH,
  ANALOG_EVENT_ALARM, ANALOG_EVENT_NOALARM, ANALOG_EVENT_DIALCOMPLETE, ANALOG_EVENT_RINGERON,
  ANALOG_EVENT_RINGEROFF, ANALOG_EVENT_HOOKCOMPLETE, ANALOG_EVENT_PULSE_START, ANALOG_EVENT_POLARITY,
  ANALOG_EVENT_RINGBEGIN, ANALOG_EVENT_EC_DISABLED, ANALOG_EVENT_REMOVED, ANALOG_EVENT_NEONMWI_ACTIVE,
  ANALOG_EVENT_NEONMWI_INACTIVE, ANALOG_EVENT_TX_CED_DETECTED, ANALOG_EVENT_RX_CED_DETECTED, ANALOG_EVENT_EC_NLP_DISABLED,
  ANALOG_EVENT_EC_NLP_ENABLED, ANALOG_EVENT_ERROR, ANALOG_EVENT_DTMFCID, ANALOG_EVENT_PULSEDIGIT = (1 << 16),
  ANALOG_EVENT_DTMFDOWN = (1 << 17), ANALOG_EVENT_DTMFUP = (1 << 18)
}
 
enum  analog_sigtype {
  ANALOG_SIG_NONE = -1, ANALOG_SIG_FXOLS = 1, ANALOG_SIG_FXOKS, ANALOG_SIG_FXOGS,
  ANALOG_SIG_FXSLS, ANALOG_SIG_FXSKS, ANALOG_SIG_FXSGS, ANALOG_SIG_EMWINK,
  ANALOG_SIG_EM, ANALOG_SIG_EM_E1, ANALOG_SIG_FEATD, ANALOG_SIG_FEATDMF,
  ANALOG_SIG_E911, ANALOG_SIG_FGC_CAMA, ANALOG_SIG_FGC_CAMAMF, ANALOG_SIG_FEATB,
  ANALOG_SIG_SFWINK, ANALOG_SIG_SF, ANALOG_SIG_SF_FEATD, ANALOG_SIG_SF_FEATDMF,
  ANALOG_SIG_FEATDMF_TA, ANALOG_SIG_SF_FEATB
}
 
enum  analog_sub { ANALOG_SUB_REAL = 0, ANALOG_SUB_CALLWAIT, ANALOG_SUB_THREEWAY }
 
enum  analog_tone {
  ANALOG_TONE_RINGTONE = 0, ANALOG_TONE_STUTTER, ANALOG_TONE_CONGESTION, ANALOG_TONE_DIALTONE,
  ANALOG_TONE_DIALRECALL, ANALOG_TONE_INFO
}
 
enum  dialop { ANALOG_DIAL_OP_REPLACE = 2 }
 

Functions

int analog_answer (struct analog_pvt *p, struct ast_channel *ast)
 
int analog_available (struct analog_pvt *p)
 
int analog_call (struct analog_pvt *p, struct ast_channel *ast, const char *rdest, int timeout)
 
const char * analog_cidstart_to_str (enum analog_cid_start cid_start)
 
const char * analog_cidtype_to_str (unsigned int cid_type)
 
int analog_config_complete (struct analog_pvt *p)
 
void analog_delete (struct analog_pvt *doomed)
 Delete the analog private structure. More...
 
int analog_dnd (struct analog_pvt *p, int flag)
 
struct ast_frameanalog_exception (struct analog_pvt *p, struct ast_channel *ast)
 
int analog_fixup (struct ast_channel *oldchan, struct ast_channel *newchan, void *newp)
 
void analog_free (struct analog_pvt *p)
 
void analog_handle_dtmf (struct analog_pvt *p, struct ast_channel *ast, enum analog_sub index, struct ast_frame **dest)
 
void * analog_handle_init_event (struct analog_pvt *i, int event)
 
int analog_hangup (struct analog_pvt *p, struct ast_channel *ast)
 
struct analog_pvtanalog_new (enum analog_sigtype signallingtype, void *private_data)
 
struct ast_channelanalog_request (struct analog_pvt *p, int *callwait, const struct ast_channel *requestor)
 
const char * analog_sigtype_to_str (enum analog_sigtype sigtype)
 
int analog_ss_thread_start (struct analog_pvt *p, struct ast_channel *ast)
 
enum analog_cid_start analog_str_to_cidstart (const char *value)
 
unsigned int analog_str_to_cidtype (const char *name)
 
enum analog_sigtype analog_str_to_sigtype (const char *name)
 

Variables

struct analog_callback analog_callbacks
 

Detailed Description

Interface header for analog signaling module.

Author
Matthew Fredrickson cresl.nos[email protected][email protected][email protected]igium[email protected].com

Definition in file sig_analog.h.

Macro Definition Documentation

◆ ANALOG_FIRST_DIGIT_TIMEOUT

#define ANALOG_FIRST_DIGIT_TIMEOUT   16000

Default time (ms) to detect first digit.

Definition at line 38 of file sig_analog.h.

Referenced by dahdi_chan_conf_default(), and process_dahdi().

◆ ANALOG_INTER_DIGIT_TIMEOUT

#define ANALOG_INTER_DIGIT_TIMEOUT   8000

Default time (ms) to detect following digits.

Definition at line 40 of file sig_analog.h.

Referenced by dahdi_chan_conf_default(), and process_dahdi().

◆ ANALOG_MATCH_DIGIT_TIMEOUT

#define ANALOG_MATCH_DIGIT_TIMEOUT   3000

Default time (ms) to wait, in case of ambiguous match.

Definition at line 42 of file sig_analog.h.

Referenced by dahdi_chan_conf_default(), and process_dahdi().

◆ ANALOG_MAX_CID

#define ANALOG_MAX_CID   300

Definition at line 33 of file sig_analog.h.

Referenced by __analog_ss_thread(), and my_get_callerid().

◆ ANALOG_SMDI_MD_WAIT_TIMEOUT

#define ANALOG_SMDI_MD_WAIT_TIMEOUT   1500 /* 1.5 seconds */

Definition at line 32 of file sig_analog.h.

Referenced by __analog_ss_thread().

◆ READ_SIZE

#define READ_SIZE   160

Definition at line 34 of file sig_analog.h.

◆ RING_PATTERNS

#define RING_PATTERNS   3

Definition at line 35 of file sig_analog.h.

Referenced by __analog_ss_thread(), and my_distinctive_ring().

Enumeration Type Documentation

◆ analog_cid_start

Enumerator
ANALOG_CID_START_POLARITY 
ANALOG_CID_START_POLARITY_IN 
ANALOG_CID_START_RING 
ANALOG_CID_START_DTMF_NOALERT 

Definition at line 119 of file sig_analog.h.

◆ analog_dsp_digitmode

Enumerator
ANALOG_DIGITMODE_DTMF 
ANALOG_DIGITMODE_MF 

Definition at line 114 of file sig_analog.h.

◆ analog_event

Enumerator
ANALOG_EVENT_NONE 
ANALOG_EVENT_ONHOOK 
ANALOG_EVENT_RINGOFFHOOK 
ANALOG_EVENT_WINKFLASH 
ANALOG_EVENT_ALARM 
ANALOG_EVENT_NOALARM 
ANALOG_EVENT_DIALCOMPLETE 
ANALOG_EVENT_RINGERON 
ANALOG_EVENT_RINGEROFF 
ANALOG_EVENT_HOOKCOMPLETE 
ANALOG_EVENT_PULSE_START 
ANALOG_EVENT_POLARITY 
ANALOG_EVENT_RINGBEGIN 
ANALOG_EVENT_EC_DISABLED 
ANALOG_EVENT_REMOVED 
ANALOG_EVENT_NEONMWI_ACTIVE 
ANALOG_EVENT_NEONMWI_INACTIVE 
ANALOG_EVENT_TX_CED_DETECTED 
ANALOG_EVENT_RX_CED_DETECTED 
ANALOG_EVENT_EC_NLP_DISABLED 
ANALOG_EVENT_EC_NLP_ENABLED 
ANALOG_EVENT_ERROR 
ANALOG_EVENT_DTMFCID 
ANALOG_EVENT_PULSEDIGIT 
ANALOG_EVENT_DTMFDOWN 
ANALOG_EVENT_DTMFUP 

Definition at line 79 of file sig_analog.h.

79  {
101  ANALOG_EVENT_ERROR, /* not a DAHDI event */
102  ANALOG_EVENT_DTMFCID, /* not a DAHDI event */
103  ANALOG_EVENT_PULSEDIGIT = (1 << 16),
104  ANALOG_EVENT_DTMFDOWN = (1 << 17),
105  ANALOG_EVENT_DTMFUP = (1 << 18),
106 };

◆ analog_sigtype

Enumerator
ANALOG_SIG_NONE 
ANALOG_SIG_FXOLS 
ANALOG_SIG_FXOKS 
ANALOG_SIG_FXOGS 
ANALOG_SIG_FXSLS 
ANALOG_SIG_FXSKS 
ANALOG_SIG_FXSGS 
ANALOG_SIG_EMWINK 
ANALOG_SIG_EM 
ANALOG_SIG_EM_E1 
ANALOG_SIG_FEATD 
ANALOG_SIG_FEATDMF 
ANALOG_SIG_E911 
ANALOG_SIG_FGC_CAMA 
ANALOG_SIG_FGC_CAMAMF 
ANALOG_SIG_FEATB 
ANALOG_SIG_SFWINK 
ANALOG_SIG_SF 
ANALOG_SIG_SF_FEATD 
ANALOG_SIG_SF_FEATDMF 
ANALOG_SIG_FEATDMF_TA 
ANALOG_SIG_SF_FEATB 

Definition at line 45 of file sig_analog.h.

45  {
46  ANALOG_SIG_NONE = -1,
47  ANALOG_SIG_FXOLS = 1,
68 };

◆ analog_sub

enum analog_sub
Enumerator
ANALOG_SUB_REAL 

Active call

ANALOG_SUB_CALLWAIT 

Call-Waiting call on hold

ANALOG_SUB_THREEWAY 

Three-way call

Definition at line 108 of file sig_analog.h.

108  {
109  ANALOG_SUB_REAL = 0, /*!< Active call */
110  ANALOG_SUB_CALLWAIT, /*!< Call-Waiting call on hold */
111  ANALOG_SUB_THREEWAY, /*!< Three-way call */
112 };

◆ analog_tone

Enumerator
ANALOG_TONE_RINGTONE 
ANALOG_TONE_STUTTER 
ANALOG_TONE_CONGESTION 
ANALOG_TONE_DIALTONE 
ANALOG_TONE_DIALRECALL 
ANALOG_TONE_INFO 

Definition at line 70 of file sig_analog.h.

◆ dialop

enum dialop
Enumerator
ANALOG_DIAL_OP_REPLACE 

Definition at line 126 of file sig_analog.h.

126  {
128 };

Function Documentation

◆ analog_answer()

int analog_answer ( struct analog_pvt p,
struct ast_channel ast 
)

Definition at line 1461 of file sig_analog.c.

References analog_answer_polarityswitch(), analog_get_index, analog_off_hook(), analog_play_tone(), analog_set_dialing(), analog_set_echocanceller(), analog_set_new_owner(), analog_set_ringtimeout(), ANALOG_SIG_E911, ANALOG_SIG_EM, ANALOG_SIG_EM_E1, ANALOG_SIG_EMWINK, ANALOG_SIG_FEATB, ANALOG_SIG_FEATD, ANALOG_SIG_FEATDMF, ANALOG_SIG_FEATDMF_TA, ANALOG_SIG_FGC_CAMA, ANALOG_SIG_FGC_CAMAMF, ANALOG_SIG_FXOGS, ANALOG_SIG_FXOKS, ANALOG_SIG_FXOLS, ANALOG_SIG_FXSGS, ANALOG_SIG_FXSKS, ANALOG_SIG_FXSLS, ANALOG_SIG_SF, ANALOG_SIG_SF_FEATB, ANALOG_SIG_SF_FEATD, ANALOG_SIG_SF_FEATDMF, ANALOG_SIG_SFWINK, ANALOG_SUB_REAL, ANALOG_SUB_THREEWAY, analog_swap_subs(), analog_train_echocanceller(), ast_channel_name(), ast_debug, ast_log, ast_setstate(), AST_STATE_RINGING, AST_STATE_UP, analog_pvt::channel, analog_pvt::hanguponpolarityswitch, analog_subchannel::inthreeway, LOG_WARNING, NULL, analog_subchannel::owner, analog_pvt::polaritydelaytv, analog_pvt::sig, and analog_pvt::subs.

Referenced by dahdi_answer().

1462 {
1463  int res = 0;
1464  int idx;
1465  int oldstate = ast_channel_state(ast);
1466 
1467  ast_debug(1, "%s %d\n", __FUNCTION__, p->channel);
1468  ast_setstate(ast, AST_STATE_UP);
1469  idx = analog_get_index(ast, p, 1);
1470  if (idx < 0) {
1471  idx = ANALOG_SUB_REAL;
1472  }
1473  switch (p->sig) {
1474  case ANALOG_SIG_FXSLS:
1475  case ANALOG_SIG_FXSGS:
1476  case ANALOG_SIG_FXSKS:
1477  analog_set_ringtimeout(p, 0);
1478  /* Fall through */
1479  case ANALOG_SIG_EM:
1480  case ANALOG_SIG_EM_E1:
1481  case ANALOG_SIG_EMWINK:
1482  case ANALOG_SIG_FEATD:
1483  case ANALOG_SIG_FEATDMF:
1484  case ANALOG_SIG_FEATDMF_TA:
1485  case ANALOG_SIG_E911:
1486  case ANALOG_SIG_FGC_CAMA:
1487  case ANALOG_SIG_FGC_CAMAMF:
1488  case ANALOG_SIG_FEATB:
1489  case ANALOG_SIG_SF:
1490  case ANALOG_SIG_SFWINK:
1491  case ANALOG_SIG_SF_FEATD:
1492  case ANALOG_SIG_SF_FEATDMF:
1493  case ANALOG_SIG_SF_FEATB:
1494  case ANALOG_SIG_FXOLS:
1495  case ANALOG_SIG_FXOGS:
1496  case ANALOG_SIG_FXOKS:
1497  /* Pick up the line */
1498  ast_debug(1, "Took %s off hook\n", ast_channel_name(ast));
1499  if (p->hanguponpolarityswitch) {
1500  gettimeofday(&p->polaritydelaytv, NULL);
1501  }
1502  res = analog_off_hook(p);
1503  analog_play_tone(p, idx, -1);
1504  analog_set_dialing(p, 0);
1505  if ((idx == ANALOG_SUB_REAL) && p->subs[ANALOG_SUB_THREEWAY].inthreeway) {
1506  if (oldstate == AST_STATE_RINGING) {
1507  ast_debug(1, "Finally swapping real and threeway\n");
1511  }
1512  }
1513 
1514  switch (p->sig) {
1515  case ANALOG_SIG_FXSLS:
1516  case ANALOG_SIG_FXSKS:
1517  case ANALOG_SIG_FXSGS:
1520  break;
1521  case ANALOG_SIG_FXOLS:
1522  case ANALOG_SIG_FXOKS:
1523  case ANALOG_SIG_FXOGS:
1525  break;
1526  default:
1527  break;
1528  }
1529  break;
1530  default:
1531  ast_log(LOG_WARNING, "Don't know how to answer signalling %d (channel %d)\n", p->sig, p->channel);
1532  res = -1;
1533  break;
1534  }
1535  ast_setstate(ast, AST_STATE_UP);
1536  return res;
1537 }
#define analog_get_index(ast, p, nullok)
Definition: sig_analog.c:407
struct timeval polaritydelaytv
Definition: sig_analog.h:342
static int analog_off_hook(struct analog_pvt *p)
Definition: sig_analog.c:617
static int analog_play_tone(struct analog_pvt *p, enum analog_sub sub, enum analog_tone tone)
Definition: sig_analog.c:438
#define LOG_WARNING
Definition: logger.h:274
static int analog_train_echocanceller(struct analog_pvt *p)
Definition: sig_analog.c:481
struct ast_channel * owner
Definition: sig_analog.h:257
ast_channel_state
ast_channel states
Definition: channelstate.h:35
#define NULL
Definition: resample.c:96
#define ast_debug(level,...)
Log a DEBUG message.
Definition: logger.h:452
#define ast_log
Definition: astobj2.c:42
static void analog_swap_subs(struct analog_pvt *p, enum analog_sub a, enum analog_sub b)
Definition: sig_analog.c:348
static void analog_answer_polarityswitch(struct analog_pvt *p)
Definition: sig_analog.c:647
unsigned int inthreeway
Definition: sig_analog.h:259
static int analog_set_echocanceller(struct analog_pvt *p, int enable)
Definition: sig_analog.c:473
const char * ast_channel_name(const struct ast_channel *chan)
int ast_setstate(struct ast_channel *chan, enum ast_channel_state)
Change the state of a channel.
Definition: channel.c:7486
static void analog_set_new_owner(struct analog_pvt *p, struct ast_channel *new_owner)
Definition: sig_analog.c:446
struct analog_subchannel subs[3]
Definition: sig_analog.h:272
unsigned int hanguponpolarityswitch
Definition: sig_analog.h:285
static void analog_set_ringtimeout(struct analog_pvt *p, int ringt)
Definition: sig_analog.c:908
static void analog_set_dialing(struct analog_pvt *p, int is_dialing)
Definition: sig_analog.c:892
enum analog_sigtype sig
Definition: sig_analog.h:266

◆ analog_available()

int analog_available ( struct analog_pvt p)

Definition at line 795 of file sig_analog.c.

References analog_subchannel::allocd, analog_is_off_hook(), ANALOG_SIG_FXOGS, ANALOG_SIG_FXOKS, ANALOG_SIG_FXOLS, ANALOG_SIG_FXSGS, ANALOG_SIG_FXSKS, ANALOG_SIG_FXSLS, ANALOG_SUB_CALLWAIT, ANALOG_SUB_THREEWAY, ast_debug, AST_STATE_RINGING, AST_STATE_UP, analog_pvt::callwaiting, analog_pvt::channel, analog_pvt::dnd, analog_pvt::guardtime, analog_subchannel::inthreeway, NULL, analog_pvt::outgoing, analog_subchannel::owner, analog_pvt::owner, analog_pvt::sig, and analog_pvt::subs.

Referenced by available().

796 {
797  int offhook;
798 
799  ast_debug(1, "%s %d\n", __FUNCTION__, p->channel);
800 
801  /* If do not disturb, definitely not */
802  if (p->dnd) {
803  return 0;
804  }
805  /* If guard time, definitely not */
806  if (p->guardtime && (time(NULL) < p->guardtime)) {
807  return 0;
808  }
809 
810  /* If no owner definitely available */
811  if (!p->owner) {
812  offhook = analog_is_off_hook(p);
813 
814  /* TDM FXO card, "onhook" means out of service (no battery on the line) */
815  if ((p->sig == ANALOG_SIG_FXSLS) || (p->sig == ANALOG_SIG_FXSKS) || (p->sig == ANALOG_SIG_FXSGS)) {
816 #ifdef DAHDI_CHECK_HOOKSTATE
817  if (offhook) {
818  return 1;
819  }
820  return 0;
821 #endif
822  /* TDM FXS card, "offhook" means someone took the hook off so it's unavailable! */
823  } else if (offhook) {
824  ast_debug(1, "Channel %d off hook, can't use\n", p->channel);
825  /* Not available when the other end is off hook */
826  return 0;
827  }
828  return 1;
829  }
830 
831  /* If it's not an FXO, forget about call wait */
832  if ((p->sig != ANALOG_SIG_FXOKS) && (p->sig != ANALOG_SIG_FXOLS) && (p->sig != ANALOG_SIG_FXOGS)) {
833  return 0;
834  }
835 
836  if (!p->callwaiting) {
837  /* If they don't have call waiting enabled, then for sure they're unavailable at this point */
838  return 0;
839  }
840 
841  if (p->subs[ANALOG_SUB_CALLWAIT].allocd) {
842  /* If there is already a call waiting call, then we can't take a second one */
843  return 0;
844  }
845 
846  if ((ast_channel_state(p->owner) != AST_STATE_UP) &&
848  /* If the current call is not up, then don't allow the call */
849  return 0;
850  }
852  /* Can't take a call wait when the three way calling hasn't been merged yet. */
853  return 0;
854  }
855  /* We're cool */
856  return 1;
857 }
struct ast_channel * owner
Definition: sig_analog.h:257
time_t guardtime
Definition: sig_analog.h:344
ast_channel_state
ast_channel states
Definition: channelstate.h:35
unsigned int allocd
Definition: sig_analog.h:261
#define NULL
Definition: resample.c:96
struct ast_channel * owner
Definition: sig_analog.h:270
#define ast_debug(level,...)
Log a DEBUG message.
Definition: logger.h:452
unsigned int outgoing
Definition: sig_analog.h:324
unsigned int callwaiting
Definition: sig_analog.h:318
unsigned int inthreeway
Definition: sig_analog.h:259
static int analog_is_off_hook(struct analog_pvt *p)
Definition: sig_analog.c:489
unsigned int dnd
Definition: sig_analog.h:321
struct analog_subchannel subs[3]
Definition: sig_analog.h:272
enum analog_sigtype sig
Definition: sig_analog.h:266

◆ analog_call()

int analog_call ( struct analog_pvt p,
struct ast_channel ast,
const char *  rdest,
int  timeout 
)

Definition at line 987 of file sig_analog.c.

References analog_callwait(), analog_defaultcic, analog_defaultozz, analog_dial_digits(), ANALOG_DIAL_OP_REPLACE, analog_get_index, analog_get_orig_dialstring(), analog_on_hook(), analog_play_tone(), analog_ring(), analog_set_cadence(), analog_set_dialing(), analog_set_outgoing(), analog_set_waitingfordt(), ANALOG_SIG_E911, ANALOG_SIG_EM, ANALOG_SIG_EM_E1, ANALOG_SIG_EMWINK, ANALOG_SIG_FEATB, ANALOG_SIG_FEATD, ANALOG_SIG_FEATDMF, ANALOG_SIG_FEATDMF_TA, ANALOG_SIG_FGC_CAMA, ANALOG_SIG_FGC_CAMAMF, ANALOG_SIG_FXOGS, ANALOG_SIG_FXOKS, ANALOG_SIG_FXOLS, ANALOG_SIG_FXSGS, ANALOG_SIG_FXSKS, ANALOG_SIG_FXSLS, ANALOG_SIG_SF, ANALOG_SIG_SF_FEATB, ANALOG_SIG_SF_FEATD, ANALOG_SIG_SF_FEATDMF, ANALOG_SIG_SFWINK, analog_start(), ANALOG_SUB_CALLWAIT, ANALOG_SUB_REAL, ANALOG_TONE_RINGTONE, analog_pvt::answeronpolarityswitch, AST_CC_CCNR, AST_CC_GENERIC_MONITOR_TYPE, AST_CC_MONITOR_ALWAYS, AST_CC_MONITOR_GENERIC, AST_CC_MONITOR_NATIVE, AST_CC_MONITOR_NEVER, ast_channel_connected(), ast_channel_get_cc_config_params(), ast_channel_name(), AST_CONTROL_BUSY, AST_CONTROL_RINGING, ast_copy_string(), ast_debug, ast_get_cc_monitor_policy(), ast_log, ast_queue_cc_frame(), ast_queue_control(), ast_setstate(), AST_STATE_BUSY, AST_STATE_DIALING, AST_STATE_DOWN, AST_STATE_RESERVED, AST_STATE_RINGING, ast_strlen_zero, ast_tvnow(), c, analog_pvt::caller, analog_pvt::callwait_name, analog_pvt::callwait_num, analog_pvt::dialdest, analog_pvt::dialednone, analog_dialoperation::dialstr, analog_pvt::dop, analog_pvt::echobreak, analog_pvt::echorest, analog_pvt::echotraining, errno, analog_pvt::finaldial, analog_pvt::hanguponpolarityswitch, ast_party_caller::id, ast_party_connected_line::id, analog_pvt::lastcid_name, analog_pvt::lastcid_num, LOG_WARNING, name, ast_party_id::name, NULL, ast_party_id::number, analog_dialoperation::op, analog_pvt::outsigmod, analog_subchannel::owner, analog_pvt::owner, pbx_builtin_getvar_helper(), analog_pvt::polaritydelaytv, analog_pvt::pulse, S_COR, analog_pvt::sig, ast_party_name::str, ast_party_number::str, analog_pvt::stripmsd, analog_pvt::subs, analog_pvt::use_callerid, ast_party_name::valid, ast_party_number::valid, and analog_pvt::whichwink.

Referenced by dahdi_call().

988 {
989  int res, idx, mysig;
990  char *c, *n, *l;
991  char dest[256]; /* must be same length as p->dialdest */
992 
993  ast_debug(1, "CALLING CID_NAME: %s CID_NUM:: %s\n",
994  S_COR(ast_channel_connected(ast)->id.name.valid, ast_channel_connected(ast)->id.name.str, ""),
995  S_COR(ast_channel_connected(ast)->id.number.valid, ast_channel_connected(ast)->id.number.str, ""));
996 
997  ast_copy_string(dest, rdest, sizeof(dest));
998  ast_copy_string(p->dialdest, rdest, sizeof(p->dialdest));
999 
1000  if ((ast_channel_state(ast) == AST_STATE_BUSY)) {
1002  return 0;
1003  }
1004 
1006  ast_log(LOG_WARNING, "analog_call called on %s, neither down nor reserved\n", ast_channel_name(ast));
1007  return -1;
1008  }
1009 
1010  p->dialednone = 0;
1011  analog_set_outgoing(p, 1);
1012 
1013  mysig = p->sig;
1014  if (p->outsigmod > -1) {
1015  mysig = p->outsigmod;
1016  }
1017 
1018  switch (mysig) {
1019  case ANALOG_SIG_FXOLS:
1020  case ANALOG_SIG_FXOGS:
1021  case ANALOG_SIG_FXOKS:
1022  if (p->owner == ast) {
1023  /* Normal ring, on hook */
1024 
1025  /* Don't send audio while on hook, until the call is answered */
1026  analog_set_dialing(p, 1);
1027  analog_set_cadence(p, ast); /* and set p->cidrings */
1028 
1029  /* [email protected] 4/3/03 mods to allow for deferred dialing */
1030  c = strchr(dest, '/');
1031  if (c) {
1032  c++;
1033  }
1034  if (c && (strlen(c) < p->stripmsd)) {
1035  ast_log(LOG_WARNING, "Number '%s' is shorter than stripmsd (%d)\n", c, p->stripmsd);
1036  c = NULL;
1037  }
1038  if (c) {
1040  snprintf(p->dop.dialstr, sizeof(p->dop.dialstr), "Tw%s", c);
1041  ast_debug(1, "FXO: setup deferred dialstring: %s\n", c);
1042  } else {
1043  p->dop.dialstr[0] = '\0';
1044  }
1045 
1046  if (analog_ring(p)) {
1047  ast_log(LOG_WARNING, "Unable to ring phone: %s\n", strerror(errno));
1048  return -1;
1049  }
1050  analog_set_dialing(p, 1);
1051  } else {
1052  /* Call waiting call */
1053  if (ast_channel_connected(ast)->id.number.valid && ast_channel_connected(ast)->id.number.str) {
1055  } else {
1056  p->callwait_num[0] = '\0';
1057  }
1058  if (ast_channel_connected(ast)->id.name.valid && ast_channel_connected(ast)->id.name.str) {
1060  } else {
1061  p->callwait_name[0] = '\0';
1062  }
1063 
1064  /* Call waiting tone instead */
1065  if (analog_callwait(p)) {
1066  return -1;
1067  }
1068  /* Make ring-back */
1070  ast_log(LOG_WARNING, "Unable to generate call-wait ring-back on channel %s\n", ast_channel_name(ast));
1071  }
1072 
1073  }
1076  if (l) {
1077  ast_copy_string(p->lastcid_num, l, sizeof(p->lastcid_num));
1078  } else {
1079  p->lastcid_num[0] = '\0';
1080  }
1081  if (n) {
1082  ast_copy_string(p->lastcid_name, n, sizeof(p->lastcid_name));
1083  } else {
1084  p->lastcid_name[0] = '\0';
1085  }
1086 
1087  if (p->use_callerid) {
1088  p->caller.id.name.str = p->lastcid_name;
1089  p->caller.id.number.str = p->lastcid_num;
1090  }
1091 
1093  idx = analog_get_index(ast, p, 0);
1094  if (idx > -1) {
1095  struct ast_cc_config_params *cc_params;
1096 
1097  /* This is where the initial ringing frame is queued for an analog call.
1098  * As such, this is a great time to offer CCNR to the caller if it's available.
1099  */
1100  cc_params = ast_channel_get_cc_config_params(p->subs[idx].owner);
1101  if (cc_params) {
1102  switch (ast_get_cc_monitor_policy(cc_params)) {
1103  case AST_CC_MONITOR_NEVER:
1104  break;
1105  case AST_CC_MONITOR_NATIVE:
1106  case AST_CC_MONITOR_ALWAYS:
1110  break;
1111  }
1112  }
1114  }
1115  break;
1116  case ANALOG_SIG_FXSLS:
1117  case ANALOG_SIG_FXSGS:
1118  case ANALOG_SIG_FXSKS:
1120  ast_debug(1, "Ignore possible polarity reversal on line seizure\n");
1121  p->polaritydelaytv = ast_tvnow();
1122  }
1123  /* fall through */
1124  case ANALOG_SIG_EMWINK:
1125  case ANALOG_SIG_EM:
1126  case ANALOG_SIG_EM_E1:
1127  case ANALOG_SIG_FEATD:
1128  case ANALOG_SIG_FEATDMF:
1129  case ANALOG_SIG_E911:
1130  case ANALOG_SIG_FGC_CAMA:
1131  case ANALOG_SIG_FGC_CAMAMF:
1132  case ANALOG_SIG_FEATB:
1133  case ANALOG_SIG_SFWINK:
1134  case ANALOG_SIG_SF:
1135  case ANALOG_SIG_SF_FEATD:
1136  case ANALOG_SIG_SF_FEATDMF:
1137  case ANALOG_SIG_FEATDMF_TA:
1138  case ANALOG_SIG_SF_FEATB:
1139  c = strchr(dest, '/');
1140  if (c) {
1141  c++;
1142  } else {
1143  c = "";
1144  }
1145  if (strlen(c) < p->stripmsd) {
1146  ast_log(LOG_WARNING, "Number '%s' is shorter than stripmsd (%d)\n", c, p->stripmsd);
1147  return -1;
1148  }
1149  res = analog_start(p);
1150  if (res < 0) {
1151  if (errno != EINPROGRESS) {
1152  return -1;
1153  }
1154  }
1155  ast_debug(1, "Dialing '%s'\n", c);
1157 
1158  c += p->stripmsd;
1159 
1160  switch (mysig) {
1161  case ANALOG_SIG_FEATD:
1163  if (l) {
1164  snprintf(p->dop.dialstr, sizeof(p->dop.dialstr), "T*%s*%s*", l, c);
1165  } else {
1166  snprintf(p->dop.dialstr, sizeof(p->dop.dialstr), "T**%s*", c);
1167  }
1168  break;
1169  case ANALOG_SIG_FEATDMF:
1171  if (l) {
1172  snprintf(p->dop.dialstr, sizeof(p->dop.dialstr), "M*00%s#*%s#", l, c);
1173  } else {
1174  snprintf(p->dop.dialstr, sizeof(p->dop.dialstr), "M*02#*%s#", c);
1175  }
1176  break;
1177  case ANALOG_SIG_FEATDMF_TA:
1178  {
1179  const char *cic = "", *ozz = "";
1180 
1181  /* If you have to go through a Tandem Access point you need to use this */
1182 #ifndef STANDALONE
1183  ozz = pbx_builtin_getvar_helper(p->owner, "FEATDMF_OZZ");
1184  if (!ozz) {
1185  ozz = analog_defaultozz;
1186  }
1187  cic = pbx_builtin_getvar_helper(p->owner, "FEATDMF_CIC");
1188  if (!cic) {
1189  cic = analog_defaultcic;
1190  }
1191 #endif
1192  if (!ozz || !cic) {
1193  ast_log(LOG_WARNING, "Unable to dial channel of type feature group D MF tandem access without CIC or OZZ set\n");
1194  return -1;
1195  }
1196  snprintf(p->dop.dialstr, sizeof(p->dop.dialstr), "M*%s%s#", ozz, cic);
1197  snprintf(p->finaldial, sizeof(p->finaldial), "M*%s#", c);
1198  p->whichwink = 0;
1199  }
1200  break;
1201  case ANALOG_SIG_E911:
1202  ast_copy_string(p->dop.dialstr, "M*911#", sizeof(p->dop.dialstr));
1203  break;
1204  case ANALOG_SIG_FGC_CAMA:
1205  snprintf(p->dop.dialstr, sizeof(p->dop.dialstr), "P%s", c);
1206  break;
1207  case ANALOG_SIG_FGC_CAMAMF:
1208  case ANALOG_SIG_FEATB:
1209  snprintf(p->dop.dialstr, sizeof(p->dop.dialstr), "M*%s#", c);
1210  break;
1211  default:
1212  if (p->pulse) {
1213  snprintf(p->dop.dialstr, sizeof(p->dop.dialstr), "P%sw", c);
1214  } else {
1215  snprintf(p->dop.dialstr, sizeof(p->dop.dialstr), "T%sw", c);
1216  }
1217  break;
1218  }
1219 
1220  if (p->echotraining && (strlen(p->dop.dialstr) > 4)) {
1221  memset(p->echorest, 'w', sizeof(p->echorest) - 1);
1222  strcpy(p->echorest + (p->echotraining / 400) + 1, p->dop.dialstr + strlen(p->dop.dialstr) - 2);
1223  p->echorest[sizeof(p->echorest) - 1] = '\0';
1224  p->echobreak = 1;
1225  p->dop.dialstr[strlen(p->dop.dialstr)-2] = '\0';
1226  } else {
1227  p->echobreak = 0;
1228  }
1229  analog_set_waitingfordt(p, ast);
1230  if (!res) {
1231  if (analog_dial_digits(p, ANALOG_SUB_REAL, &p->dop)) {
1232  analog_on_hook(p);
1233  return -1;
1234  }
1235  } else {
1236  ast_debug(1, "Deferring dialing...\n");
1237  }
1238  analog_set_dialing(p, 1);
1239  if (ast_strlen_zero(c)) {
1240  p->dialednone = 1;
1241  }
1243  break;
1244  default:
1245  ast_debug(1, "not yet implemented\n");
1246  return -1;
1247  }
1248  return 0;
1249 }
#define analog_get_index(ast, p, nullok)
Definition: sig_analog.c:407
unsigned int use_callerid
Definition: sig_analog.h:293
char * str
Subscriber phone number (Malloced)
Definition: channel.h:292
int ast_queue_control(struct ast_channel *chan, enum ast_control_frame_type control)
Queue a control frame without payload.
Definition: channel.c:1231
struct ast_party_caller caller
Definition: sig_analog.h:338
struct timeval polaritydelaytv
Definition: sig_analog.h:342
struct ast_party_id id
Connected party ID.
Definition: channel.h:459
struct ast_party_name name
Subscriber name.
Definition: channel.h:341
static int analog_start(struct analog_pvt *p)
Definition: sig_analog.c:513
static int analog_play_tone(struct analog_pvt *p, enum analog_sub sub, enum analog_tone tone)
Definition: sig_analog.c:438
int echotraining
Definition: sig_analog.h:307
#define LOG_WARNING
Definition: logger.h:274
char dialdest[256]
Definition: sig_analog.h:343
char finaldial[64]
Definition: sig_analog.h:347
char callwait_name[AST_MAX_EXTENSION]
Definition: sig_analog.h:335
struct ast_channel * owner
Definition: sig_analog.h:257
ast_channel_state
ast_channel states
Definition: channelstate.h:35
char * str
Subscriber name (Malloced)
Definition: channel.h:265
struct timeval ast_tvnow(void)
Returns current timeval. Meant to replace calls to gettimeofday().
Definition: time.h:150
static struct test_val c
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.
Definition: ccss.c:4149
#define NULL
Definition: resample.c:96
static void analog_set_outgoing(struct analog_pvt *p, int is_outgoing)
Definition: sig_analog.c:537
char echorest[20]
Definition: sig_analog.h:340
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.
Definition: channel.c:10675
static const char * analog_get_orig_dialstring(struct analog_pvt *p)
Definition: sig_analog.c:186
static void analog_set_waitingfordt(struct analog_pvt *p, struct ast_channel *ast)
Definition: sig_analog.c:916
#define ast_strlen_zero(foo)
Definition: strings.h:52
enum ast_cc_monitor_policies ast_get_cc_monitor_policy(struct ast_cc_config_params *config)
Get the cc_monitor_policy.
Definition: ccss.c:883
struct ast_channel * owner
Definition: sig_analog.h:270
Number structure.
Definition: app_followme.c:154
struct ast_party_id id
Caller party ID.
Definition: channel.h:421
int stripmsd
Definition: sig_analog.h:310
#define ast_debug(level,...)
Log a DEBUG message.
Definition: logger.h:452
#define ast_log
Definition: astobj2.c:42
static int analog_dial_digits(struct analog_pvt *p, enum analog_sub sub, struct analog_dialoperation *dop)
Definition: sig_analog.c:521
struct ast_party_connected_line * ast_channel_connected(struct ast_channel *chan)
#define S_COR(a, b, c)
returns the equivalent of logic or for strings, with an additional boolean check: second one if not e...
Definition: strings.h:85
static char analog_defaultcic[64]
Definition: sig_analog.c:65
char callwait_num[AST_MAX_EXTENSION]
Definition: sig_analog.h:334
unsigned int dialednone
Definition: sig_analog.h:319
#define AST_CC_GENERIC_MONITOR_TYPE
Definition: ccss.h:489
char lastcid_name[AST_MAX_EXTENSION]
Definition: sig_analog.h:337
static int analog_on_hook(struct analog_pvt *p)
Definition: sig_analog.c:529
struct analog_dialoperation dop
Definition: sig_analog.h:273
static char analog_defaultozz[64]
Definition: sig_analog.c:66
static int analog_callwait(struct analog_pvt *p)
Definition: sig_analog.c:868
int errno
int whichwink
Definition: sig_analog.h:346
static void analog_set_cadence(struct analog_pvt *p, struct ast_channel *chan)
Definition: sig_analog.c:885
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
Definition: strings.h:401
const char * ast_channel_name(const struct ast_channel *chan)
char lastcid_num[AST_MAX_EXTENSION]
Definition: sig_analog.h:336
int ast_setstate(struct ast_channel *chan, enum ast_channel_state)
Change the state of a channel.
Definition: channel.c:7486
enum analog_sigtype outsigmod
Definition: sig_analog.h:306
unsigned int pulse
Definition: sig_analog.h:289
unsigned char valid
TRUE if the name information is valid/present.
Definition: channel.h:280
struct analog_subchannel subs[3]
Definition: sig_analog.h:272
const char * name
Definition: sig_analog.c:70
unsigned int hanguponpolarityswitch
Definition: sig_analog.h:285
static void analog_set_dialing(struct analog_pvt *p, int is_dialing)
Definition: sig_analog.c:892
enum analog_sigtype sig
Definition: sig_analog.h:266
unsigned int echobreak
Definition: sig_analog.h:322
unsigned char valid
TRUE if the number information is valid/present.
Definition: channel.h:298
static int analog_ring(struct analog_pvt *p)
Definition: sig_analog.c:497
unsigned int answeronpolarityswitch
Definition: sig_analog.h:280
struct ast_party_number number
Subscriber phone number.
Definition: channel.h:343

◆ analog_cidstart_to_str()

const char* analog_cidstart_to_str ( enum analog_cid_start  cid_start)

Definition at line 249 of file sig_analog.c.

References ANALOG_CID_START_DTMF_NOALERT, ANALOG_CID_START_POLARITY, ANALOG_CID_START_POLARITY_IN, and ANALOG_CID_START_RING.

250 {
251  switch (cid_start) {
253  return "Ring";
255  return "Polarity";
257  return "Polarity_In";
259  return "DTMF";
260  }
261 
262  return "Unknown";
263 }

◆ analog_cidtype_to_str()

const char* analog_cidtype_to_str ( unsigned int  cid_type)

Definition at line 149 of file sig_analog.c.

References ARRAY_LEN, and cidtypes.

150 {
151  int i;
152 
153  for (i = 0; i < ARRAY_LEN(cidtypes); i++) {
154  if (cid_type == cidtypes[i].cid_type) {
155  return cidtypes[i].name;
156  }
157  }
158 
159  return "Unknown";
160 }
#define ARRAY_LEN(a)
Definition: isdn_lib.c:42
static const struct @163 cidtypes[]
unsigned int cid_type
Definition: sig_analog.c:96

◆ analog_config_complete()

int analog_config_complete ( struct analog_pvt p)

Definition at line 3963 of file sig_analog.c.

References analog_set_callwaiting(), ANALOG_SIG_FXOGS, ANALOG_SIG_FXOKS, ANALOG_SIG_FXOLS, analog_pvt::permcallwaiting, and analog_pvt::sig.

Referenced by mkintf().

3964 {
3965  /* No call waiting on non FXS channels */
3966  if ((p->sig != ANALOG_SIG_FXOKS) && (p->sig != ANALOG_SIG_FXOLS) && (p->sig != ANALOG_SIG_FXOGS)) {
3967  p->permcallwaiting = 0;
3968  }
3969 
3971 
3972  return 0;
3973 }
static void analog_set_callwaiting(struct analog_pvt *p, int callwaiting_enable)
Definition: sig_analog.c:877
enum analog_sigtype sig
Definition: sig_analog.h:266
unsigned int permcallwaiting
Definition: sig_analog.h:287

◆ analog_delete()

void analog_delete ( struct analog_pvt doomed)

Delete the analog private structure.

Since
1.8
Parameters
doomedAnalog private structure to delete.
Returns
Nothing

Definition at line 3958 of file sig_analog.c.

References ast_free.

Referenced by destroy_dahdi_pvt().

3959 {
3960  ast_free(doomed);
3961 }
#define ast_free(a)
Definition: astmm.h:182

◆ analog_dnd()

int analog_dnd ( struct analog_pvt p,
int  flag 
)

Definition at line 4019 of file sig_analog.c.

References analog_publish_dnd_state(), ast_verb, analog_pvt::channel, and analog_pvt::dnd.

Referenced by __analog_ss_thread(), and dahdi_dnd().

4020 {
4021  if (flag == -1) {
4022  return p->dnd;
4023  }
4024 
4025  p->dnd = flag;
4026 
4027  ast_verb(3, "%s DND on channel %d\n",
4028  flag ? "Enabled" : "Disabled",
4029  p->channel);
4030  analog_publish_dnd_state(p->channel, flag ? "enabled" : "disabled");
4031 
4032  return 0;
4033 }
static void analog_publish_dnd_state(int channel, const char *status)
Definition: sig_analog.c:3999
#define ast_verb(level,...)
Definition: logger.h:463
long int flag
Definition: f2c.h:83
unsigned int dnd
Definition: sig_analog.h:321

◆ analog_exception()

struct ast_frame* analog_exception ( struct analog_pvt p,
struct ast_channel ast 
)

Definition at line 3555 of file sig_analog.c.

References __analog_handle_event(), analog_event2str(), ANALOG_EVENT_HOOKCOMPLETE, ANALOG_EVENT_ONHOOK, ANALOG_EVENT_RINGEROFF, ANALOG_EVENT_RINGERON, ANALOG_EVENT_RINGOFFHOOK, ANALOG_EVENT_WINKFLASH, analog_get_event(), analog_get_index, analog_lock_private(), analog_off_hook(), analog_ring(), analog_set_dialing(), analog_set_echocanceller(), analog_set_new_owner(), analog_stop_callwait(), ANALOG_SUB_REAL, analog_unlock_private(), analog_update_conf(), ast_channel_fd(), ast_channel_lock, ast_channel_name(), ast_channel_unlock, AST_CONTROL_ANSWER, ast_debug, AST_FRAME_NULL, ast_log, ast_queue_control(), ast_queue_unhold(), ast_set_hangupsource(), ast_setstate(), AST_STATE_RINGING, AST_STATE_UP, ast_strdupa, ast_tv(), ast_verb, analog_pvt::channel, ast_frame::data, ast_frame::datalen, ast_frame::delivery, analog_subchannel::f, analog_pvt::flashtime, ast_frame::frametype, ast_frame_subclass::integer, LOG_WARNING, ast_frame::mallocd, name, NULL, ast_frame::offset, analog_subchannel::owner, analog_pvt::owner, ast_frame::ptr, ast_frame::samples, ast_frame::src, ast_frame::subclass, and analog_pvt::subs.

Referenced by dahdi_exception(), and dahdi_read().

3556 {
3557  int res;
3558  int idx;
3559  struct ast_frame *f;
3560 
3561  ast_debug(1, "%s %d\n", __FUNCTION__, p->channel);
3562 
3563  idx = analog_get_index(ast, p, 1);
3564  if (idx < 0) {
3565  idx = ANALOG_SUB_REAL;
3566  }
3567 
3568  p->subs[idx].f.frametype = AST_FRAME_NULL;
3569  p->subs[idx].f.datalen = 0;
3570  p->subs[idx].f.samples = 0;
3571  p->subs[idx].f.mallocd = 0;
3572  p->subs[idx].f.offset = 0;
3573  p->subs[idx].f.subclass.integer = 0;
3574  p->subs[idx].f.delivery = ast_tv(0,0);
3575  p->subs[idx].f.src = "dahdi_exception";
3576  p->subs[idx].f.data.ptr = NULL;
3577 
3578  if (!p->owner) {
3579  /* If nobody owns us, absorb the event appropriately, otherwise
3580  we loop indefinitely. This occurs when, during call waiting, the
3581  other end hangs up our channel so that it no longer exists, but we
3582  have neither FLASH'd nor ONHOOK'd to signify our desire to
3583  change to the other channel. */
3584  res = analog_get_event(p);
3585 
3586  /* Switch to real if there is one and this isn't something really silly... */
3587  if ((res != ANALOG_EVENT_RINGEROFF) && (res != ANALOG_EVENT_RINGERON) &&
3588  (res != ANALOG_EVENT_HOOKCOMPLETE)) {
3589  ast_debug(1, "Restoring owner of channel %d on event %d\n", p->channel, res);
3591  if (p->owner && ast != p->owner) {
3592  /*
3593  * Could this even happen?
3594  * Possible deadlock because we do not have the real-call lock.
3595  */
3596  ast_log(LOG_WARNING, "Event %s on %s is not restored owner %s\n",
3598  }
3599  if (p->owner) {
3600  ast_queue_unhold(p->owner);
3601  }
3602  }
3603  switch (res) {
3604  case ANALOG_EVENT_ONHOOK:
3606  if (p->owner) {
3607  ast_verb(3, "Channel %s still has call, ringing phone\n", ast_channel_name(p->owner));
3608  analog_ring(p);
3610  } else {
3611  ast_log(LOG_WARNING, "Absorbed %s, but nobody is left!?!?\n",
3612  analog_event2str(res));
3613  }
3614  analog_update_conf(p);
3615  break;
3618  analog_off_hook(p);
3619  if (p->owner && (ast_channel_state(p->owner) == AST_STATE_RINGING)) {
3621  analog_set_dialing(p, 0);
3622  }
3623  break;
3625  case ANALOG_EVENT_RINGERON:
3627  /* Do nothing */
3628  break;
3630  gettimeofday(&p->flashtime, NULL);
3631  if (p->owner) {
3632  ast_verb(3, "Channel %d flashed to other channel %s\n", p->channel, ast_channel_name(p->owner));
3633  if (ast_channel_state(p->owner) != AST_STATE_UP) {
3634  /* Answer if necessary */
3637  }
3639  ast_queue_unhold(p->owner);
3640  } else {
3641  ast_log(LOG_WARNING, "Absorbed %s, but nobody is left!?!?\n",
3642  analog_event2str(res));
3643  }
3644  analog_update_conf(p);
3645  break;
3646  default:
3647  ast_log(LOG_WARNING, "Don't know how to absorb event %s\n", analog_event2str(res));
3648  break;
3649  }
3650  f = &p->subs[idx].f;
3651  return f;
3652  }
3653  ast_debug(1, "Exception on %d, channel %d\n", ast_channel_fd(ast, 0), p->channel);
3654  /* If it's not us, return NULL immediately */
3655  if (ast != p->owner) {
3656  ast_log(LOG_WARNING, "We're %s, not %s\n", ast_channel_name(ast), ast_channel_name(p->owner));
3657  f = &p->subs[idx].f;
3658  return f;
3659  }
3660 
3661  f = __analog_handle_event(p, ast);
3662  if (!f) {
3663  const char *name = ast_strdupa(ast_channel_name(ast));
3664 
3665  /* Tell the CDR this DAHDI device hung up */
3667  ast_channel_unlock(ast);
3668  ast_set_hangupsource(ast, name, 0);
3669  ast_channel_lock(ast);
3671  }
3672  return f;
3673 }
#define analog_get_index(ast, p, nullok)
Definition: sig_analog.c:407
#define ast_channel_lock(chan)
Definition: channel.h:2945
int ast_queue_control(struct ast_channel *chan, enum ast_control_frame_type control)
Queue a control frame without payload.
Definition: channel.c:1231
static struct ast_frame * __analog_handle_event(struct analog_pvt *p, struct ast_channel *ast)
Definition: sig_analog.c:2685
static int analog_off_hook(struct analog_pvt *p)
Definition: sig_analog.c:617
int ast_queue_unhold(struct ast_channel *chan)
Queue an unhold frame.
Definition: channel.c:1216
#define LOG_WARNING
Definition: logger.h:274
struct ast_channel * owner
Definition: sig_analog.h:257
static int analog_get_event(struct analog_pvt *p)
Definition: sig_analog.c:194
ast_channel_state
ast_channel states
Definition: channelstate.h:35
struct timeval flashtime
Definition: sig_analog.h:345
#define NULL
Definition: resample.c:96
#define ast_verb(level,...)
Definition: logger.h:463
struct ast_frame_subclass subclass
struct ast_channel * owner
Definition: sig_analog.h:270
static void analog_unlock_private(struct analog_pvt *p)
Definition: sig_analog.c:560
#define ast_debug(level,...)
Log a DEBUG message.
Definition: logger.h:452
#define ast_log
Definition: astobj2.c:42
void ast_set_hangupsource(struct ast_channel *chan, const char *source, int force)
Set the source of the hangup in this channel and it&#39;s bridge.
Definition: channel.c:2504
const char * src
#define ast_strdupa(s)
duplicate a string in memory from the stack
Definition: astmm.h:300
static int analog_stop_callwait(struct analog_pvt *p)
Definition: sig_analog.c:859
static char * analog_event2str(enum analog_event event)
Definition: sig_analog.c:265
#define ast_channel_unlock(chan)
Definition: channel.h:2946
struct timeval delivery
int ast_channel_fd(const struct ast_channel *chan, int which)
static void analog_lock_private(struct analog_pvt *p)
Definition: sig_analog.c:567
static int analog_set_echocanceller(struct analog_pvt *p, int enable)
Definition: sig_analog.c:473
struct timeval ast_tv(ast_time_t sec, ast_suseconds_t usec)
Returns a timeval from sec, usec.
Definition: time.h:226
const char * ast_channel_name(const struct ast_channel *chan)
int ast_setstate(struct ast_channel *chan, enum ast_channel_state)
Change the state of a channel.
Definition: channel.c:7486
static void analog_set_new_owner(struct analog_pvt *p, struct ast_channel *new_owner)
Definition: sig_analog.c:446
Data structure associated with a single frame of data.
struct ast_frame f
Definition: sig_analog.h:258
union ast_frame::@263 data
enum ast_frame_type frametype
static int analog_update_conf(struct analog_pvt *p)
Definition: sig_analog.c:745
struct analog_subchannel subs[3]
Definition: sig_analog.h:272
const char * name
Definition: sig_analog.c:70
static void analog_set_dialing(struct analog_pvt *p, int is_dialing)
Definition: sig_analog.c:892
static int analog_ring(struct analog_pvt *p)
Definition: sig_analog.c:497

◆ analog_fixup()

int analog_fixup ( struct ast_channel oldchan,
struct ast_channel newchan,
void *  newp 
)

Definition at line 3981 of file sig_analog.c.

References analog_set_new_owner(), analog_update_conf(), ast_channel_name(), ast_debug, analog_pvt::channel, analog_subchannel::owner, analog_pvt::owner, and analog_pvt::subs.

Referenced by dahdi_fixup().

3982 {
3983  struct analog_pvt *new_pvt = newp;
3984  int x;
3985  ast_debug(1, "New owner for channel %d is %s\n", new_pvt->channel, ast_channel_name(newchan));
3986  if (new_pvt->owner == oldchan) {
3987  analog_set_new_owner(new_pvt, newchan);
3988  }
3989  for (x = 0; x < 3; x++) {
3990  if (new_pvt->subs[x].owner == oldchan) {
3991  new_pvt->subs[x].owner = newchan;
3992  }
3993  }
3994 
3995  analog_update_conf(new_pvt);
3996  return 0;
3997 }
struct ast_channel * owner
Definition: sig_analog.h:257
struct ast_channel * owner
Definition: sig_analog.h:270
#define ast_debug(level,...)
Log a DEBUG message.
Definition: logger.h:452
const char * ast_channel_name(const struct ast_channel *chan)
static void analog_set_new_owner(struct analog_pvt *p, struct ast_channel *new_owner)
Definition: sig_analog.c:446
static int analog_update_conf(struct analog_pvt *p)
Definition: sig_analog.c:745
struct analog_subchannel subs[3]
Definition: sig_analog.h:272

◆ analog_free()

void analog_free ( struct analog_pvt p)

Definition at line 3975 of file sig_analog.c.

References ast_free.

3976 {
3977  ast_free(p);
3978 }
#define ast_free(a)
Definition: astmm.h:182

◆ analog_handle_dtmf()

void analog_handle_dtmf ( struct analog_pvt p,
struct ast_channel ast,
enum analog_sub  index,
struct ast_frame **  dest 
)

Definition at line 1564 of file sig_analog.c.

References analog_cb_handle_dtmf(), analog_check_confirmanswer(), analog_handles_digit(), analog_send_callerid(), analog_set_confirmanswer(), ast_channel_name(), AST_CONTROL_ANSWER, ast_debug, AST_FRAME_CONTROL, AST_FRAME_DTMF_BEGIN, AST_FRAME_DTMF_END, AST_FRAME_NULL, analog_pvt::caller, analog_pvt::callwait_name, analog_pvt::callwait_num, analog_pvt::callwaitcas, analog_subchannel::f, ast_frame::frametype, ast_party_caller::id, ast_frame_subclass::integer, ast_party_id::name, ast_party_id::number, ast_party_name::str, ast_party_number::str, ast_frame::subclass, and analog_pvt::subs.

Referenced by __analog_handle_event(), and dahdi_read().

1565 {
1566  struct ast_frame *f = *dest;
1567 
1568  ast_debug(1, "%s DTMF digit: 0x%02X '%c' on %s\n",
1569  f->frametype == AST_FRAME_DTMF_BEGIN ? "Begin" : "End",
1570  (unsigned)f->subclass.integer, f->subclass.integer, ast_channel_name(ast));
1571 
1572  if (analog_check_confirmanswer(p)) {
1573  if (f->frametype == AST_FRAME_DTMF_END) {
1574  ast_debug(1, "Confirm answer on %s!\n", ast_channel_name(ast));
1575  /* Upon receiving a DTMF digit, consider this an answer confirmation instead
1576  of a DTMF digit */
1577  p->subs[idx].f.frametype = AST_FRAME_CONTROL;
1579  /* Reset confirmanswer so DTMF's will behave properly for the duration of the call */
1581  } else {
1582  p->subs[idx].f.frametype = AST_FRAME_NULL;
1583  p->subs[idx].f.subclass.integer = 0;
1584  }
1585  *dest = &p->subs[idx].f;
1586  } else if (p->callwaitcas) {
1587  if (f->frametype == AST_FRAME_DTMF_END) {
1588  if ((f->subclass.integer == 'A') || (f->subclass.integer == 'D')) {
1589  ast_debug(1, "Got some DTMF, but it's for the CAS\n");
1590  p->caller.id.name.str = p->callwait_name;
1591  p->caller.id.number.str = p->callwait_num;
1592  analog_send_callerid(p, 1, &p->caller);
1593  }
1594  if (analog_handles_digit(f)) {
1595  p->callwaitcas = 0;
1596  }
1597  }
1598  p->subs[idx].f.frametype = AST_FRAME_NULL;
1599  p->subs[idx].f.subclass.integer = 0;
1600  *dest = &p->subs[idx].f;
1601  } else {
1602  analog_cb_handle_dtmf(p, ast, idx, dest);
1603  }
1604 }
static int analog_send_callerid(struct analog_pvt *p, int cwcid, struct ast_party_caller *caller)
Definition: sig_analog.c:391
static int analog_handles_digit(struct ast_frame *f)
Definition: sig_analog.c:1539
char * str
Subscriber phone number (Malloced)
Definition: channel.h:292
struct ast_party_caller caller
Definition: sig_analog.h:338
struct ast_party_name name
Subscriber name.
Definition: channel.h:341
char callwait_name[AST_MAX_EXTENSION]
Definition: sig_analog.h:335
char * str
Subscriber name (Malloced)
Definition: channel.h:265
struct ast_frame_subclass subclass
struct ast_party_id id
Caller party ID.
Definition: channel.h:421
#define ast_debug(level,...)
Log a DEBUG message.
Definition: logger.h:452
char callwait_num[AST_MAX_EXTENSION]
Definition: sig_analog.h:334
static void analog_cb_handle_dtmf(struct analog_pvt *p, struct ast_channel *ast, enum analog_sub analog_index, struct ast_frame **dest)
Definition: sig_analog.c:669
static int analog_check_confirmanswer(struct analog_pvt *p)
Definition: sig_analog.c:939
static void analog_set_confirmanswer(struct analog_pvt *p, int flag)
Definition: sig_analog.c:932
const char * ast_channel_name(const struct ast_channel *chan)
Data structure associated with a single frame of data.
unsigned int callwaitcas
TRUE if Call Waiting (CW) CPE Alert Signal (CAS) is being sent.
Definition: sig_analog.h:332
struct ast_frame f
Definition: sig_analog.h:258
enum ast_frame_type frametype
struct analog_subchannel subs[3]
Definition: sig_analog.h:272
struct ast_party_number number
Subscriber phone number.
Definition: channel.h:343

◆ analog_handle_init_event()

void* analog_handle_init_event ( struct analog_pvt i,
int  event 
)

Definition at line 3675 of file sig_analog.c.

References __analog_ss_thread(), analog_cancel_cidspill(), ANALOG_CID_START_DTMF_NOALERT, ANALOG_CID_START_POLARITY, ANALOG_CID_START_POLARITY_IN, analog_event2str(), ANALOG_EVENT_ALARM, ANALOG_EVENT_DTMFCID, ANALOG_EVENT_NEONMWI_ACTIVE, ANALOG_EVENT_NEONMWI_INACTIVE, ANALOG_EVENT_NOALARM, ANALOG_EVENT_ONHOOK, ANALOG_EVENT_POLARITY, ANALOG_EVENT_REMOVED, ANALOG_EVENT_RINGOFFHOOK, ANALOG_EVENT_WINKFLASH, analog_get_and_handle_alarms(), analog_handle_notify_message(), analog_has_voicemail(), analog_new_ast_channel(), analog_off_hook(), analog_on_hook(), analog_play_tone(), analog_publish_channel_alarm_clear(), analog_set_alarm(), analog_set_echocanceller(), analog_set_ringtimeout(), ANALOG_SIG_E911, ANALOG_SIG_EM, ANALOG_SIG_EM_E1, ANALOG_SIG_EMWINK, ANALOG_SIG_FEATB, ANALOG_SIG_FEATD, ANALOG_SIG_FEATDMF, ANALOG_SIG_FEATDMF_TA, ANALOG_SIG_FGC_CAMA, ANALOG_SIG_FGC_CAMAMF, ANALOG_SIG_FXOGS, ANALOG_SIG_FXOKS, ANALOG_SIG_FXOLS, ANALOG_SIG_FXSGS, ANALOG_SIG_FXSKS, ANALOG_SIG_FXSLS, ANALOG_SIG_SF, ANALOG_SIG_SF_FEATB, ANALOG_SIG_SF_FEATD, ANALOG_SIG_SF_FEATDMF, ANALOG_SIG_SFWINK, analog_sigtype_to_str(), analog_start_polarityswitch(), ANALOG_SUB_REAL, ANALOG_TONE_CONGESTION, ANALOG_TONE_DIALTONE, ANALOG_TONE_RINGTONE, ANALOG_TONE_STUTTER, ast_callid_threadstorage_auto(), ast_callid_threadstorage_auto_clean(), ast_debug, ast_hangup(), ast_log, ast_pthread_create_detached, AST_STATE_PRERING, AST_STATE_RESERVED, AST_STATE_RING, ast_verb, ast_channel::callid, analog_pvt::chan_pvt, analog_pvt::channel, analog_pvt::cid_start, errno, analog_pvt::fxsoffhookstate, analog_pvt::hanguponpolarityswitch, analog_pvt::immediate, analog_pvt::inalarm, LOG_NOTICE, LOG_WARNING, NULL, analog_pvt::polarity, POLARITY_REV, analog_pvt::ringt_base, analog_pvt::sig, and analog_pvt::ss_astchan.

Referenced by do_monitor().

3676 {
3677  int res;
3678  pthread_t threadid;
3679  struct ast_channel *chan;
3680  ast_callid callid = 0;
3681  int callid_created;
3682 
3683  ast_debug(1, "channel (%d) - signaling (%d) - event (%s)\n",
3684  i->channel, i->sig, analog_event2str(event));
3685 
3686  /* Handle an event on a given channel for the monitor thread. */
3687  switch (event) {
3690  if (i->inalarm) {
3691  break;
3692  }
3693  /* Got a ring/answer. What kind of channel are we? */
3694  switch (i->sig) {
3695  case ANALOG_SIG_FXOLS:
3696  case ANALOG_SIG_FXOGS:
3697  case ANALOG_SIG_FXOKS:
3698  res = analog_off_hook(i);
3699  i->fxsoffhookstate = 1;
3700  if (res && (errno == EBUSY)) {
3701  break;
3702  }
3703  callid_created = ast_callid_threadstorage_auto(&callid);
3704 
3705  /* Cancel VMWI spill */
3707 
3708  if (i->immediate) {
3710  /* The channel is immediately up. Start right away */
3713  if (!chan) {
3714  ast_log(LOG_WARNING, "Unable to start PBX on channel %d\n", i->channel);
3716  if (res < 0) {
3717  ast_log(LOG_WARNING, "Unable to play congestion tone on channel %d\n", i->channel);
3718  }
3719  }
3720  } else {
3721  /* Check for callerid, digits, etc */
3723  i->ss_astchan = chan;
3724  if (chan) {
3725  if (analog_has_voicemail(i)) {
3727  } else {
3729  }
3730  if (res < 0)
3731  ast_log(LOG_WARNING, "Unable to play dialtone on channel %d, do you have defaultzone and loadzone defined?\n", i->channel);
3732 
3733  if (ast_pthread_create_detached(&threadid, NULL, __analog_ss_thread, i)) {
3734  ast_log(LOG_WARNING, "Unable to start simple switch thread on channel %d\n", i->channel);
3736  if (res < 0) {
3737  ast_log(LOG_WARNING, "Unable to play congestion tone on channel %d\n", i->channel);
3738  }
3739  ast_hangup(chan);
3740  }
3741  } else
3742  ast_log(LOG_WARNING, "Unable to create channel\n");
3743  }
3744  ast_callid_threadstorage_auto_clean(callid, callid_created);
3745  break;
3746  case ANALOG_SIG_FXSLS:
3747  case ANALOG_SIG_FXSGS:
3748  case ANALOG_SIG_FXSKS:
3750  /* Fall through */
3751  case ANALOG_SIG_EMWINK:
3752  case ANALOG_SIG_FEATD:
3753  case ANALOG_SIG_FEATDMF:
3754  case ANALOG_SIG_FEATDMF_TA:
3755  case ANALOG_SIG_E911:
3756  case ANALOG_SIG_FGC_CAMA:
3757  case ANALOG_SIG_FGC_CAMAMF:
3758  case ANALOG_SIG_FEATB:
3759  case ANALOG_SIG_EM:
3760  case ANALOG_SIG_EM_E1:
3761  case ANALOG_SIG_SFWINK:
3762  case ANALOG_SIG_SF_FEATD:
3763  case ANALOG_SIG_SF_FEATDMF:
3764  case ANALOG_SIG_SF_FEATB:
3765  case ANALOG_SIG_SF:
3766  callid_created = ast_callid_threadstorage_auto(&callid);
3767  /* Check for callerid, digits, etc */
3770  } else {
3772  }
3773  i->ss_astchan = chan;
3774  if (!chan) {
3775  ast_log(LOG_WARNING, "Cannot allocate new structure on channel %d\n", i->channel);
3776  } else if (ast_pthread_create_detached(&threadid, NULL, __analog_ss_thread, i)) {
3777  ast_log(LOG_WARNING, "Unable to start simple switch thread on channel %d\n", i->channel);
3779  if (res < 0) {
3780  ast_log(LOG_WARNING, "Unable to play congestion tone on channel %d\n", i->channel);
3781  }
3782  ast_hangup(chan);
3783  }
3784  ast_callid_threadstorage_auto_clean(callid, callid_created);
3785  break;
3786  default:
3787  ast_log(LOG_WARNING, "Don't know how to handle ring/answer with signalling %s on channel %d\n", analog_sigtype_to_str(i->sig), i->channel);
3789  if (res < 0) {
3790  ast_log(LOG_WARNING, "Unable to play congestion tone on channel %d\n", i->channel);
3791  }
3792  return NULL;
3793  }
3794  break;
3795  case ANALOG_EVENT_NOALARM:
3796  analog_set_alarm(i, 0);
3798  break;
3799  case ANALOG_EVENT_ALARM:
3800  analog_set_alarm(i, 1);
3802  /* fall thru intentionally */
3803  case ANALOG_EVENT_ONHOOK:
3804  /* Back on hook. Hang up. */
3805  switch (i->sig) {
3806  case ANALOG_SIG_FXOLS:
3807  case ANALOG_SIG_FXOGS:
3808  i->fxsoffhookstate = 0;
3810  /* Fall through */
3811  case ANALOG_SIG_FEATD:
3812  case ANALOG_SIG_FEATDMF:
3813  case ANALOG_SIG_FEATDMF_TA:
3814  case ANALOG_SIG_E911:
3815  case ANALOG_SIG_FGC_CAMA:
3816  case ANALOG_SIG_FGC_CAMAMF:
3817  case ANALOG_SIG_FEATB:
3818  case ANALOG_SIG_EM:
3819  case ANALOG_SIG_EM_E1:
3820  case ANALOG_SIG_EMWINK:
3821  case ANALOG_SIG_SF_FEATD:
3822  case ANALOG_SIG_SF_FEATDMF:
3823  case ANALOG_SIG_SF_FEATB:
3824  case ANALOG_SIG_SF:
3825  case ANALOG_SIG_SFWINK:
3826  case ANALOG_SIG_FXSLS:
3827  case ANALOG_SIG_FXSGS:
3828  case ANALOG_SIG_FXSKS:
3830  res = analog_play_tone(i, ANALOG_SUB_REAL, -1);
3831  analog_on_hook(i);
3832  break;
3833  case ANALOG_SIG_FXOKS:
3834  i->fxsoffhookstate = 0;
3837  /* Diddle the battery for the zhone */
3838 #ifdef ZHONE_HACK
3839  analog_off_hook(i);
3840  usleep(1);
3841 #endif
3842  res = analog_play_tone(i, ANALOG_SUB_REAL, -1);
3843  analog_on_hook(i);
3844  break;
3845  default:
3846  ast_log(LOG_WARNING, "Don't know how to handle on hook with signalling %s on channel %d\n", analog_sigtype_to_str(i->sig), i->channel);
3847  res = analog_play_tone(i, ANALOG_SUB_REAL, -1);
3848  return NULL;
3849  }
3850  break;
3851  case ANALOG_EVENT_POLARITY:
3852  switch (i->sig) {
3853  case ANALOG_SIG_FXSLS:
3854  case ANALOG_SIG_FXSKS:
3855  case ANALOG_SIG_FXSGS:
3856  callid_created = ast_callid_threadstorage_auto(&callid);
3857  /* We have already got a PR before the channel was
3858  created, but it wasn't handled. We need polarity
3859  to be REV for remote hangup detection to work.
3860  At least in Spain */
3861  if (i->hanguponpolarityswitch) {
3862  i->polarity = POLARITY_REV;
3863  }
3865  i->polarity = POLARITY_REV;
3866  ast_verb(2, "Starting post polarity CID detection on channel %d\n",
3867  i->channel);
3869  i->ss_astchan = chan;
3870  if (!chan) {
3871  ast_log(LOG_WARNING, "Cannot allocate new structure on channel %d\n", i->channel);
3872  } else if (ast_pthread_create_detached(&threadid, NULL, __analog_ss_thread, i)) {
3873  ast_log(LOG_WARNING, "Unable to start simple switch thread on channel %d\n", i->channel);
3874  ast_hangup(chan);
3875  }
3876  }
3877  ast_callid_threadstorage_auto_clean(callid, callid_created);
3878  break;
3879  default:
3881  "handle_init_event detected polarity reversal on non-FXO (ANALOG_SIG_FXS) interface %d\n",
3882  i->channel);
3883  break;
3884  }
3885  break;
3886  case ANALOG_EVENT_DTMFCID:
3887  switch (i->sig) {
3888  case ANALOG_SIG_FXSLS:
3889  case ANALOG_SIG_FXSKS:
3890  case ANALOG_SIG_FXSGS:
3891  callid_created = ast_callid_threadstorage_auto(&callid);
3893  ast_verb(2, "Starting DTMF CID detection on channel %d\n",
3894  i->channel);
3896  i->ss_astchan = chan;
3897  if (!chan) {
3898  ast_log(LOG_WARNING, "Cannot allocate new structure on channel %d\n", i->channel);
3899  } else if (ast_pthread_create_detached(&threadid, NULL, __analog_ss_thread, i)) {
3900  ast_log(LOG_WARNING, "Unable to start simple switch thread on channel %d\n", i->channel);
3901  ast_hangup(chan);
3902  }
3903  }
3904  ast_callid_threadstorage_auto_clean(callid, callid_created);
3905  break;
3906  default:
3908  "handle_init_event detected dtmfcid generation event on non-FXO (ANALOG_SIG_FXS) interface %d\n",
3909  i->channel);
3910  break;
3911  }
3912  break;
3913  case ANALOG_EVENT_REMOVED: /* destroy channel, will actually do so in do_monitor */
3914  ast_log(LOG_NOTICE, "Got ANALOG_EVENT_REMOVED. Destroying channel %d\n",
3915  i->channel);
3916  return i->chan_pvt;
3919  break;
3922  break;
3923  }
3924  return NULL;
3925 }
Main Channel structure associated with a channel.
#define POLARITY_REV
Definition: sig_analog.c:63
unsigned int immediate
Definition: sig_analog.h:286
#define ast_pthread_create_detached(a, b, c, d)
Definition: utils.h:563
int polarity
Definition: sig_analog.h:341
static int analog_off_hook(struct analog_pvt *p)
Definition: sig_analog.c:617
static int analog_play_tone(struct analog_pvt *p, enum analog_sub sub, enum analog_tone tone)
Definition: sig_analog.c:438
int ringt_base
Definition: sig_analog.h:357
#define LOG_WARNING
Definition: logger.h:274
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...
Definition: logger.c:2042
static int analog_handle_notify_message(struct ast_channel *chan, struct analog_pvt *p, int cid_flags, int neon_mwievent)
Definition: sig_analog.c:1626
static void analog_start_polarityswitch(struct analog_pvt *p)
Definition: sig_analog.c:641
Definition: astman.c:222
struct ast_channel * ss_astchan
Definition: sig_analog.h:353
unsigned int ast_callid
Definition: logger.h:87
#define NULL
Definition: resample.c:96
#define ast_verb(level,...)
Definition: logger.h:463
#define ast_debug(level,...)
Log a DEBUG message.
Definition: logger.h:452
#define ast_log
Definition: astobj2.c:42
static void * __analog_ss_thread(void *data)
Definition: sig_analog.c:1711
static void analog_publish_channel_alarm_clear(int channel)
Definition: sig_analog.c:2672
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)
Definition: sig_analog.c:454
const char * analog_sigtype_to_str(enum analog_sigtype sigtype)
Definition: sig_analog.c:123
static int analog_on_hook(struct analog_pvt *p)
Definition: sig_analog.c:529
enum analog_cid_start cid_start
Definition: sig_analog.h:311
static char * analog_event2str(enum analog_event event)
Definition: sig_analog.c:265
int errno
#define LOG_NOTICE
Definition: logger.h:263
void ast_hangup(struct ast_channel *chan)
Hang up a channel.
Definition: channel.c:2548
static int analog_has_voicemail(struct analog_pvt *p)
Definition: sig_analog.c:684
static int analog_set_echocanceller(struct analog_pvt *p, int enable)
Definition: sig_analog.c:473
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...
Definition: logger.c:2020
unsigned int inalarm
Definition: sig_analog.h:325
int fxsoffhookstate
Definition: sig_analog.h:275
static void analog_cancel_cidspill(struct analog_pvt *p)
Definition: sig_analog.c:948
static void analog_get_and_handle_alarms(struct analog_pvt *p)
Definition: sig_analog.c:1661
unsigned int hanguponpolarityswitch
Definition: sig_analog.h:285
void * chan_pvt
Definition: sig_analog.h:268
static void analog_set_ringtimeout(struct analog_pvt *p, int ringt)
Definition: sig_analog.c:908
enum analog_sigtype sig
Definition: sig_analog.h:266
static void analog_set_alarm(struct analog_pvt *p, int in_alarm)
Definition: sig_analog.c:900

◆ analog_hangup()

int analog_hangup ( struct analog_pvt p,
struct ast_channel ast 
)

Definition at line 1251 of file sig_analog.c.

References analog_subchannel::allocd, analog_all_subchannels_hungup(), ANALOG_DIGITMODE_DTMF, analog_dsp_set_digitmode(), analog_get_index, analog_hangup_polarityswitch(), analog_is_off_hook(), analog_lock_sub_owner(), analog_on_hook(), analog_play_tone(), analog_set_callwaiting(), analog_set_confirmanswer(), analog_set_dialing(), analog_set_echocanceller(), analog_set_inthreeway(), analog_set_linear_mode(), analog_set_new_owner(), analog_set_outgoing(), analog_set_pulsedial(), analog_set_ringtimeout(), ANALOG_SIG_FXOGS, ANALOG_SIG_FXOKS, ANALOG_SIG_FXOLS, ANALOG_SIG_FXSGS, ANALOG_SIG_FXSKS, ANALOG_SIG_FXSLS, analog_stop_callwait(), ANALOG_SUB_CALLWAIT, ANALOG_SUB_REAL, ANALOG_SUB_THREEWAY, analog_swap_subs(), ANALOG_TONE_CONGESTION, analog_unalloc_sub(), analog_update_conf(), ast_channel_name(), ast_channel_setoption(), ast_channel_tech_pvt(), ast_channel_unlock, AST_CONTROL_ANSWER, ast_copy_string(), ast_debug, ast_free, ast_log, AST_OPTION_TDD, AST_OPTION_TONE_VERIFY, ast_queue_control(), ast_queue_hold(), ast_queue_unhold(), AST_STATE_RESERVED, AST_STATE_UP, ast_verb, analog_pvt::callwaitcas, analog_pvt::channel, analog_pvt::cid_name, analog_pvt::cid_num, analog_pvt::cidrings, analog_pvt::guardtime, analog_pvt::hidecallerid, analog_subchannel::inthreeway, LOG_ERROR, LOG_WARNING, analog_pvt::mohsuggest, NULL, analog_pvt::onhooktime, analog_pvt::origcid_name, analog_pvt::origcid_num, analog_subchannel::owner, analog_pvt::owner, analog_pvt::permcallwaiting, analog_pvt::permhidecallerid, analog_pvt::polarity, POLARITY_IDLE, analog_pvt::sig, and analog_pvt::subs.

Referenced by dahdi_hangup().

1252 {
1253  int res;
1254  int idx, x;
1255 
1256  ast_debug(1, "%s %d\n", __FUNCTION__, p->channel);
1257  if (!ast_channel_tech_pvt(ast)) {
1258  ast_log(LOG_WARNING, "Asked to hangup channel not connected\n");
1259  return 0;
1260  }
1261 
1262  idx = analog_get_index(ast, p, 1);
1263 
1264  x = 0;
1265  if (p->origcid_num) {
1266  ast_copy_string(p->cid_num, p->origcid_num, sizeof(p->cid_num));
1267  ast_free(p->origcid_num);
1268  p->origcid_num = NULL;
1269  }
1270  if (p->origcid_name) {
1271  ast_copy_string(p->cid_name, p->origcid_name, sizeof(p->cid_name));
1272  ast_free(p->origcid_name);
1273  p->origcid_name = NULL;
1274  }
1275 
1277 
1278  ast_debug(1, "Hangup: channel: %d index = %d, normal = %d, callwait = %d, thirdcall = %d\n",
1280  if (idx > -1) {
1281  /* Real channel, do some fixup */
1282  p->subs[idx].owner = NULL;
1283  p->polarity = POLARITY_IDLE;
1284  analog_set_linear_mode(p, idx, 0);
1285  switch (idx) {
1286  case ANALOG_SUB_REAL:
1288  ast_debug(1, "Normal call hung up with both three way call and a call waiting call in place?\n");
1290  /* We had flipped over to answer a callwait and now it's gone */
1291  ast_debug(1, "We were flipped over to the callwait, moving back and unowning.\n");
1292  /* Move to the call-wait, but un-own us until they flip back. */
1296  } else {
1297  /* The three way hung up, but we still have a call wait */
1298  ast_debug(1, "We were in the threeway and have a callwait still. Ditching the threeway.\n");
1301  if (p->subs[ANALOG_SUB_REAL].inthreeway) {
1302  /* This was part of a three way call. Immediately make way for
1303  another call */
1304  ast_debug(1, "Call was complete, setting owner to former third call\n");
1307  } else {
1308  /* This call hasn't been completed yet... Set owner to NULL */
1309  ast_debug(1, "Call was incomplete, setting owner to NULL\n");
1311  }
1312  }
1313  } else if (p->subs[ANALOG_SUB_CALLWAIT].allocd) {
1314  /* Need to hold the lock for real-call, private, and call-waiting call */
1316  if (!p->subs[ANALOG_SUB_CALLWAIT].owner) {
1317  /* The call waiting call dissappeared. */
1319  break;
1320  }
1321 
1322  /* Move to the call-wait and switch back to them. */
1326  if (ast_channel_state(p->owner) != AST_STATE_UP) {
1328  }
1330  /* Unlock the call-waiting call that we swapped to real-call. */
1332  } else if (p->subs[ANALOG_SUB_THREEWAY].allocd) {
1335  if (p->subs[ANALOG_SUB_REAL].inthreeway) {
1336  /* This was part of a three way call. Immediately make way for
1337  another call */
1338  ast_debug(1, "Call was complete, setting owner to former third call\n");
1341  } else {
1342  /* This call hasn't been completed yet... Set owner to NULL */
1343  ast_debug(1, "Call was incomplete, setting owner to NULL\n");
1345  }
1346  }
1347  break;
1348  case ANALOG_SUB_CALLWAIT:
1349  /* Ditch the holding callwait call, and immediately make it available */
1351  /* Need to hold the lock for call-waiting call, private, and 3-way call */
1353 
1354  /* This is actually part of a three way, placed on hold. Place the third part
1355  on music on hold now */
1356  if (p->subs[ANALOG_SUB_THREEWAY].owner) {
1358  }
1360  /* Make it the call wait now */
1363  if (p->subs[ANALOG_SUB_CALLWAIT].owner) {
1364  /* Unlock the 3-way call that we swapped to call-waiting call. */
1366  }
1367  } else {
1369  }
1370  break;
1371  case ANALOG_SUB_THREEWAY:
1372  /* Need to hold the lock for 3-way call, private, and call-waiting call */
1375  /* The other party of the three way call is currently in a call-wait state.
1376  Start music on hold for them, and take the main guy out of the third call */
1378  if (p->subs[ANALOG_SUB_CALLWAIT].owner) {
1380  }
1381  }
1382  if (p->subs[ANALOG_SUB_CALLWAIT].owner) {
1384  }
1386  /* If this was part of a three way call index, let us make
1387  another three way call */
1389  break;
1390  default:
1391  /*
1392  * Should never happen.
1393  * This wasn't any sort of call, so how are we an index?
1394  */
1395  ast_log(LOG_ERROR, "Index found but not any type of call?\n");
1396  break;
1397  }
1398  }
1399 
1402  analog_set_ringtimeout(p, 0);
1404  analog_set_pulsedial(p, 0);
1405  analog_set_outgoing(p, 0);
1406  p->onhooktime = time(NULL);
1407  p->cidrings = 1;
1408 
1409  /* Perform low level hangup if no owner left */
1410  res = analog_on_hook(p);
1411  if (res < 0) {
1412  ast_log(LOG_WARNING, "Unable to hangup line %s\n", ast_channel_name(ast));
1413  }
1414  switch (p->sig) {
1415  case ANALOG_SIG_FXOGS:
1416  case ANALOG_SIG_FXOLS:
1417  case ANALOG_SIG_FXOKS:
1418  /* If they're off hook, try playing congestion */
1419  if (analog_is_off_hook(p)) {
1422  } else {
1424  }
1425  break;
1426  case ANALOG_SIG_FXSGS:
1427  case ANALOG_SIG_FXSLS:
1428  case ANALOG_SIG_FXSKS:
1429  /* Make sure we're not made available for at least two seconds assuming
1430  we were actually used for an inbound or outbound call. */
1431  if (ast_channel_state(ast) != AST_STATE_RESERVED) {
1432  time(&p->guardtime);
1433  p->guardtime += 2;
1434  }
1435  break;
1436  default:
1438  break;
1439  }
1440 
1442 
1443  x = 0;
1444  ast_channel_setoption(ast,AST_OPTION_TONE_VERIFY,&x,sizeof(char),0);
1445  ast_channel_setoption(ast,AST_OPTION_TDD,&x,sizeof(char),0);
1446  p->callwaitcas = 0;
1449  analog_set_dialing(p, 0);
1450  analog_update_conf(p);
1452  }
1453 
1455 
1456  ast_verb(3, "Hanging up on '%s'\n", ast_channel_name(ast));
1457 
1458  return 0;
1459 }
char cid_name[AST_MAX_EXTENSION]
Definition: sig_analog.h:314
#define POLARITY_IDLE
Definition: sig_analog.c:62
#define analog_get_index(ast, p, nullok)
Definition: sig_analog.c:407
static int analog_unalloc_sub(struct analog_pvt *p, enum analog_sub x)
Definition: sig_analog.c:381
int ast_queue_control(struct ast_channel *chan, enum ast_control_frame_type control)
Queue a control frame without payload.
Definition: channel.c:1231
void * ast_channel_tech_pvt(const struct ast_channel *chan)
int polarity
Definition: sig_analog.h:341
static int analog_set_linear_mode(struct analog_pvt *p, enum analog_sub sub, int linear_mode)
Definition: sig_analog.c:970
int ast_queue_unhold(struct ast_channel *chan)
Queue an unhold frame.
Definition: channel.c:1216
char mohsuggest[MAX_MUSICCLASS]
Definition: sig_analog.h:312
static int analog_play_tone(struct analog_pvt *p, enum analog_sub sub, enum analog_tone tone)
Definition: sig_analog.c:438
#define LOG_WARNING
Definition: logger.h:274
static void analog_lock_sub_owner(struct analog_pvt *pvt, enum analog_sub sub_idx)
Definition: sig_analog.c:601
struct ast_channel * owner
Definition: sig_analog.h:257
time_t guardtime
Definition: sig_analog.h:344
ast_channel_state
ast_channel states
Definition: channelstate.h:35
static void analog_all_subchannels_hungup(struct analog_pvt *p)
Definition: sig_analog.c:553
#define AST_OPTION_TDD
unsigned int allocd
Definition: sig_analog.h:261
#define NULL
Definition: resample.c:96
unsigned int hidecallerid
Definition: sig_analog.h:323
int ast_channel_setoption(struct ast_channel *channel, int option, void *data, int datalen, int block)
Sets an option on a channel.
Definition: channel.c:7522
static void analog_set_outgoing(struct analog_pvt *p, int is_outgoing)
Definition: sig_analog.c:537
static void analog_hangup_polarityswitch(struct analog_pvt *p)
Definition: sig_analog.c:654
#define ast_verb(level,...)
Definition: logger.h:463
struct ast_channel * owner
Definition: sig_analog.h:270
#define ast_debug(level,...)
Log a DEBUG message.
Definition: logger.h:452
#define ast_log
Definition: astobj2.c:42
int onhooktime
Definition: sig_analog.h:274
static void analog_swap_subs(struct analog_pvt *p, enum analog_sub a, enum analog_sub b)
Definition: sig_analog.c:348
static int analog_stop_callwait(struct analog_pvt *p)
Definition: sig_analog.c:859
int ast_queue_hold(struct ast_channel *chan, const char *musicclass)
Queue a hold frame.
Definition: channel.c:1191
char cid_num[AST_MAX_EXTENSION]
Definition: sig_analog.h:313
static void analog_set_inthreeway(struct analog_pvt *p, enum analog_sub sub, int inthreeway)
Definition: sig_analog.c:979
static int analog_on_hook(struct analog_pvt *p)
Definition: sig_analog.c:529
#define LOG_ERROR
Definition: logger.h:285
unsigned int inthreeway
Definition: sig_analog.h:259
char * origcid_num
Definition: sig_analog.h:348
#define ast_channel_unlock(chan)
Definition: channel.h:2946
#define ast_free(a)
Definition: astmm.h:182
static int analog_is_off_hook(struct analog_pvt *p)
Definition: sig_analog.c:489
static void analog_set_confirmanswer(struct analog_pvt *p, int flag)
Definition: sig_analog.c:932
char * origcid_name
Definition: sig_analog.h:349
unsigned int permhidecallerid
Definition: sig_analog.h:288
static void analog_set_callwaiting(struct analog_pvt *p, int callwaiting_enable)
Definition: sig_analog.c:877
static void analog_set_pulsedial(struct analog_pvt *p, int flag)
Definition: sig_analog.c:963
int cidrings
Definition: sig_analog.h:339
static int analog_set_echocanceller(struct analog_pvt *p, int enable)
Definition: sig_analog.c:473
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
Definition: strings.h:401
const char * ast_channel_name(const struct ast_channel *chan)
static void analog_set_new_owner(struct analog_pvt *p, struct ast_channel *new_owner)
Definition: sig_analog.c:446
#define AST_OPTION_TONE_VERIFY
unsigned int callwaitcas
TRUE if Call Waiting (CW) CPE Alert Signal (CAS) is being sent.
Definition: sig_analog.h:332
static int analog_update_conf(struct analog_pvt *p)
Definition: sig_analog.c:745
char x
Definition: extconf.c:81
struct analog_subchannel subs[3]
Definition: sig_analog.h:272
static void analog_set_ringtimeout(struct analog_pvt *p, int ringt)
Definition: sig_analog.c:908
static void analog_set_dialing(struct analog_pvt *p, int is_dialing)
Definition: sig_analog.c:892
static int analog_dsp_set_digitmode(struct analog_pvt *p, enum analog_dsp_digitmode mode)
Definition: sig_analog.c:661
enum analog_sigtype sig
Definition: sig_analog.h:266
unsigned int permcallwaiting
Definition: sig_analog.h:287

◆ analog_new()

struct analog_pvt* analog_new ( enum analog_sigtype  signallingtype,
void *  private_data 
)

Definition at line 3928 of file sig_analog.c.

References analog_subchannel::allocd, ANALOG_CID_START_RING, ANALOG_SIG_NONE, ANALOG_SUB_REAL, ast_calloc, analog_pvt::chan_pvt, CID_SIG_BELL, analog_pvt::cid_signalling, analog_pvt::cid_start, analog_pvt::outsigmod, analog_pvt::sig, and analog_pvt::subs.

Referenced by mkintf().

3929 {
3930  struct analog_pvt *p;
3931 
3932  p = ast_calloc(1, sizeof(*p));
3933  if (!p) {
3934  return p;
3935  }
3936 
3938  p->sig = signallingtype;
3939  p->chan_pvt = private_data;
3940 
3941  /* Some defaults for values */
3944  /* Sub real is assumed to always be alloc'd */
3945  p->subs[ANALOG_SUB_REAL].allocd = 1;
3946 
3947  return p;
3948 }
int cid_signalling
Definition: sig_analog.h:308
#define CID_SIG_BELL
Definition: callerid.h:59
unsigned int allocd
Definition: sig_analog.h:261
enum analog_cid_start cid_start
Definition: sig_analog.h:311
#define ast_calloc(num, len)
A wrapper for calloc()
Definition: astmm.h:204
enum analog_sigtype outsigmod
Definition: sig_analog.h:306
struct analog_subchannel subs[3]
Definition: sig_analog.h:272
void * chan_pvt
Definition: sig_analog.h:268
enum analog_sigtype sig
Definition: sig_analog.h:266

◆ analog_request()

struct ast_channel* analog_request ( struct analog_pvt p,
int *  callwait,
const struct ast_channel requestor 
)

Definition at line 772 of file sig_analog.c.

References analog_alloc_sub(), analog_new_ast_channel(), analog_set_outgoing(), ANALOG_SUB_CALLWAIT, ANALOG_SUB_REAL, ast_debug, ast_log, AST_STATE_RESERVED, analog_pvt::channel, LOG_ERROR, NULL, and analog_pvt::owner.

Referenced by dahdi_request().

773 {
774  struct ast_channel *ast;
775 
776  ast_debug(1, "%s %d\n", __FUNCTION__, p->channel);
777  *callwait = (p->owner != NULL);
778 
779  if (p->owner) {
781  ast_log(LOG_ERROR, "Unable to alloc subchannel\n");
782  return NULL;
783  }
784  }
785 
786  analog_set_outgoing(p, 1);
788  p->owner ? ANALOG_SUB_CALLWAIT : ANALOG_SUB_REAL, requestor);
789  if (!ast) {
790  analog_set_outgoing(p, 0);
791  }
792  return ast;
793 }
Main Channel structure associated with a channel.
#define NULL
Definition: resample.c:96
static void analog_set_outgoing(struct analog_pvt *p, int is_outgoing)
Definition: sig_analog.c:537
struct ast_channel * owner
Definition: sig_analog.h:270
#define ast_debug(level,...)
Log a DEBUG message.
Definition: logger.h:452
#define ast_log
Definition: astobj2.c:42
static int analog_alloc_sub(struct analog_pvt *p, enum analog_sub x)
Definition: sig_analog.c:368
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)
Definition: sig_analog.c:454
#define LOG_ERROR
Definition: logger.h:285

◆ analog_sigtype_to_str()

const char* analog_sigtype_to_str ( enum analog_sigtype  sigtype)

Definition at line 123 of file sig_analog.c.

References ARRAY_LEN, and sigtypes.

Referenced by __analog_ss_thread(), and analog_handle_init_event().

124 {
125  int i;
126 
127  for (i = 0; i < ARRAY_LEN(sigtypes); i++) {
128  if (sigtype == sigtypes[i].sigtype) {
129  return sigtypes[i].name;
130  }
131  }
132 
133  return "Unknown";
134 }
#define ARRAY_LEN(a)
Definition: isdn_lib.c:42
enum analog_sigtype sigtype
Definition: sig_analog.c:69
static const struct @162 sigtypes[]

◆ analog_ss_thread_start()

int analog_ss_thread_start ( struct analog_pvt p,
struct ast_channel ast 
)

Definition at line 2665 of file sig_analog.c.

References __analog_ss_thread(), ast_pthread_create_detached, and NULL.

Referenced by mwi_thread().

2666 {
2667  pthread_t threadid;
2668 
2669  return ast_pthread_create_detached(&threadid, NULL, __analog_ss_thread, p);
2670 }
#define ast_pthread_create_detached(a, b, c, d)
Definition: utils.h:563
#define NULL
Definition: resample.c:96
static void * __analog_ss_thread(void *data)
Definition: sig_analog.c:1711

◆ analog_str_to_cidstart()

enum analog_cid_start analog_str_to_cidstart ( const char *  value)

Definition at line 234 of file sig_analog.c.

References ANALOG_CID_START_DTMF_NOALERT, ANALOG_CID_START_POLARITY, ANALOG_CID_START_POLARITY_IN, and ANALOG_CID_START_RING.

235 {
236  if (!strcasecmp(value, "ring")) {
237  return ANALOG_CID_START_RING;
238  } else if (!strcasecmp(value, "polarity")) {
240  } else if (!strcasecmp(value, "polarity_in")) {
242  } else if (!strcasecmp(value, "dtmf")) {
244  }
245 
246  return 0;
247 }
int value
Definition: syslog.c:37

◆ analog_str_to_cidtype()

unsigned int analog_str_to_cidtype ( const char *  name)

Definition at line 136 of file sig_analog.c.

References ARRAY_LEN, and cidtypes.

137 {
138  int i;
139 
140  for (i = 0; i < ARRAY_LEN(cidtypes); i++) {
141  if (!strcasecmp(cidtypes[i].name, name)) {
142  return cidtypes[i].cid_type;
143  }
144  }
145 
146  return 0;
147 }
#define ARRAY_LEN(a)
Definition: isdn_lib.c:42
static const struct @163 cidtypes[]
const char * name
Definition: sig_analog.c:70

◆ analog_str_to_sigtype()

enum analog_sigtype analog_str_to_sigtype ( const char *  name)

Definition at line 110 of file sig_analog.c.

References ARRAY_LEN, and sigtypes.

111 {
112  int i;
113 
114  for (i = 0; i < ARRAY_LEN(sigtypes); i++) {
115  if (!strcasecmp(sigtypes[i].name, name)) {
116  return sigtypes[i].sigtype;
117  }
118  }
119 
120  return 0;
121 }
#define ARRAY_LEN(a)
Definition: isdn_lib.c:42
static const struct @162 sigtypes[]
const char * name
Definition: sig_analog.c:70

Variable Documentation

◆ analog_callbacks

struct analog_callback analog_callbacks

Global analog callbacks to the upper layer.

Definition at line 3355 of file chan_dahdi.c.

Referenced by analog_all_subchannels_hungup(), analog_alloc_sub(), analog_answer_polarityswitch(), analog_callwait(), analog_cancel_cidspill(), analog_cb_handle_dtmf(), analog_check_confirmanswer(), analog_check_for_conference(), analog_check_waitingfordt(), analog_confmute(), analog_deadlock_avoidance_private(), analog_decrease_ss_count(), analog_dial_digits(), analog_distinctive_ring(), analog_dsp_reset_and_flush_digits(), analog_dsp_set_digitmode(), analog_flash(), analog_get_and_handle_alarms(), analog_get_bridged_channel(), analog_get_callerid(), analog_get_event(), analog_get_orig_dialstring(), analog_get_sub_fd(), analog_handle_notify_message(), analog_hangup_polarityswitch(), analog_has_voicemail(), analog_have_progressdetect(), analog_increase_ss_count(), analog_is_dialing(), analog_is_off_hook(), analog_lock_private(), analog_new_ast_channel(), analog_off_hook(), analog_on_hook(), analog_play_tone(), analog_ring(), analog_send_callerid(), analog_set_alarm(), analog_set_cadence(), analog_set_callwaiting(), analog_set_confirmanswer(), analog_set_dialing(), analog_set_echocanceller(), analog_set_inthreeway(), analog_set_linear_mode(), analog_set_needringing(), analog_set_new_owner(), analog_set_outgoing(), analog_set_pulsedial(), analog_set_ringtimeout(), analog_set_waitingfordt(), analog_start(), analog_start_cid_detect(), analog_start_polarityswitch(), analog_stop_callwait(), analog_stop_cid_detect(), analog_swap_subs(), analog_train_echocanceller(), analog_unalloc_sub(), analog_unlock_private(), analog_update_conf(), analog_wait_event(), and analog_wink().