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

DAHDI internal API definitions. More...

#include <dahdi/user.h>
#include <dahdi/tonezone.h>
#include "asterisk/channel.h"
#include "asterisk/dsp.h"
#include "asterisk/app.h"
#include "asterisk/mwi.h"
Include dependency graph for chan_dahdi.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  dahdi_distRings
 
struct  dahdi_pvt
 
struct  dahdi_subchannel
 
struct  distRingData
 
struct  mwisend_info
 
struct  ringContextData
 

Macros

#define dahdi_get_index(ast, p, nullok)   _dahdi_get_index(ast, p, nullok, __PRETTY_FUNCTION__, __LINE__)
 
#define MAX_SLAVES   4
 
#define SIG_BRI   (0x2000000 | DAHDI_SIG_CLEAR)
 
#define SIG_BRI_PTMP   (0X4000000 | DAHDI_SIG_CLEAR)
 
#define SIG_E911   (0x1000000 | DAHDI_SIG_EM)
 
#define SIG_EM   DAHDI_SIG_EM
 
#define SIG_EM_E1   DAHDI_SIG_EM_E1
 
#define SIG_EMWINK   (0x0100000 | DAHDI_SIG_EM)
 
#define SIG_FEATB   (0x0800000 | DAHDI_SIG_EM)
 
#define SIG_FEATD   (0x0200000 | DAHDI_SIG_EM)
 
#define SIG_FEATDMF   (0x0400000 | DAHDI_SIG_EM)
 
#define SIG_FEATDMF_TA   (0x2000000 | DAHDI_SIG_EM)
 
#define SIG_FGC_CAMA   (0x4000000 | DAHDI_SIG_EM)
 
#define SIG_FGC_CAMAMF   (0x8000000 | DAHDI_SIG_EM)
 
#define SIG_FXOGS   DAHDI_SIG_FXOGS
 
#define SIG_FXOKS   DAHDI_SIG_FXOKS
 
#define SIG_FXOLS   DAHDI_SIG_FXOLS
 
#define SIG_FXSGS   DAHDI_SIG_FXSGS
 
#define SIG_FXSKS   DAHDI_SIG_FXSKS
 
#define SIG_FXSLS   DAHDI_SIG_FXSLS
 
#define SIG_MFCR2   DAHDI_SIG_CAS
 
#define SIG_PRI   DAHDI_SIG_CLEAR
 
#define SIG_PRI_LIB_HANDLE_CASES
 
#define SIG_SF   DAHDI_SIG_SF
 
#define SIG_SF_FEATB   (0x0800000 | DAHDI_SIG_SF)
 
#define SIG_SF_FEATD   (0x0200000 | DAHDI_SIG_SF)
 
#define SIG_SF_FEATDMF   (0x0400000 | DAHDI_SIG_SF)
 
#define SIG_SFWINK   (0x0100000 | DAHDI_SIG_SF)
 
#define SIG_SS7   (0x1000000 | DAHDI_SIG_CLEAR)
 
#define SUB_CALLWAIT   1
 
#define SUB_REAL   0
 
#define SUB_THREEWAY   2
 

Enumerations

enum  DAHDI_IFLIST { DAHDI_IFLIST_NONE, DAHDI_IFLIST_MAIN }
 
enum  mwisend_states {
  MWI_SEND_NULL = 0, MWI_SEND_SA, MWI_SEND_SA_WAIT, MWI_SEND_PAUSE,
  MWI_SEND_SPILL, MWI_SEND_CLEANUP, MWI_SEND_DONE
}
 

Functions

int _dahdi_get_index (struct ast_channel *ast, struct dahdi_pvt *p, int nullok, const char *fname, unsigned long line)
 
static int dahdi_analog_lib_handles (int signalling, int radio, int oprmode)
 
void dahdi_conf_update (struct dahdi_pvt *p)
 
void dahdi_dtmf_detect_disable (struct dahdi_pvt *p)
 
void dahdi_dtmf_detect_enable (struct dahdi_pvt *p)
 
void dahdi_ec_disable (struct dahdi_pvt *p)
 
void dahdi_ec_enable (struct dahdi_pvt *p)
 
void dahdi_master_slave_link (struct dahdi_pvt *slave, struct dahdi_pvt *master)
 
void dahdi_master_slave_unlink (struct dahdi_pvt *slave, struct dahdi_pvt *master, int needlock)
 
static int dahdi_sig_pri_lib_handles (int signaling)
 

Variables

const char *const subnames []
 

Detailed Description

DAHDI internal API definitions.

Author
Richard Mudgett rmudg[email protected][email protected][email protected]digiu[email protected]m.co[email protected]m

See Also:

Definition in file chan_dahdi.h.

Macro Definition Documentation

◆ dahdi_get_index

#define dahdi_get_index (   ast,
  p,
  nullok 
)    _dahdi_get_index(ast, p, nullok, __PRETTY_FUNCTION__, __LINE__)

◆ MAX_SLAVES

#define MAX_SLAVES   4

◆ SIG_BRI

#define SIG_BRI   (0x2000000 | DAHDI_SIG_CLEAR)

Definition at line 746 of file chan_dahdi.h.

Referenced by dahdi_sig2str(), and process_dahdi().

◆ SIG_BRI_PTMP

#define SIG_BRI_PTMP   (0X4000000 | DAHDI_SIG_CLEAR)

Definition at line 747 of file chan_dahdi.h.

Referenced by dahdi_sig2str(), mkintf(), and process_dahdi().

◆ SIG_E911

#define SIG_E911   (0x1000000 | DAHDI_SIG_EM)

◆ SIG_EM

#define SIG_EM   DAHDI_SIG_EM

◆ SIG_EM_E1

#define SIG_EM_E1   DAHDI_SIG_EM_E1

◆ SIG_EMWINK

#define SIG_EMWINK   (0x0100000 | DAHDI_SIG_EM)

◆ SIG_FEATB

#define SIG_FEATB   (0x0800000 | DAHDI_SIG_EM)

◆ SIG_FEATD

#define SIG_FEATD   (0x0200000 | DAHDI_SIG_EM)

◆ SIG_FEATDMF

#define SIG_FEATDMF   (0x0400000 | DAHDI_SIG_EM)

◆ SIG_FEATDMF_TA

#define SIG_FEATDMF_TA   (0x2000000 | DAHDI_SIG_EM)

◆ SIG_FGC_CAMA

#define SIG_FGC_CAMA   (0x4000000 | DAHDI_SIG_EM)

◆ SIG_FGC_CAMAMF

#define SIG_FGC_CAMAMF   (0x8000000 | DAHDI_SIG_EM)

◆ SIG_FXOGS

#define SIG_FXOGS   DAHDI_SIG_FXOGS

◆ SIG_FXOKS

#define SIG_FXOKS   DAHDI_SIG_FXOKS

◆ SIG_FXOLS

#define SIG_FXOLS   DAHDI_SIG_FXOLS

◆ SIG_FXSGS

#define SIG_FXSGS   DAHDI_SIG_FXSGS

◆ SIG_FXSKS

#define SIG_FXSKS   DAHDI_SIG_FXSKS

◆ SIG_FXSLS

#define SIG_FXSLS   DAHDI_SIG_FXSLS

◆ SIG_MFCR2

#define SIG_MFCR2   DAHDI_SIG_CAS

◆ SIG_PRI

#define SIG_PRI   DAHDI_SIG_CLEAR

Definition at line 745 of file chan_dahdi.h.

Referenced by dahdi_indicate(), dahdi_sig2str(), mkintf(), and process_dahdi().

◆ SIG_PRI_LIB_HANDLE_CASES

#define SIG_PRI_LIB_HANDLE_CASES

◆ SIG_SF

#define SIG_SF   DAHDI_SIG_SF

◆ SIG_SF_FEATB

#define SIG_SF_FEATB   (0x0800000 | DAHDI_SIG_SF)

◆ SIG_SF_FEATD

#define SIG_SF_FEATD   (0x0200000 | DAHDI_SIG_SF)

◆ SIG_SF_FEATDMF

#define SIG_SF_FEATDMF   (0x0400000 | DAHDI_SIG_SF)

◆ SIG_SFWINK

#define SIG_SFWINK   (0x0100000 | DAHDI_SIG_SF)

◆ SIG_SS7

#define SIG_SS7   (0x1000000 | DAHDI_SIG_CLEAR)

◆ SUB_CALLWAIT

#define SUB_CALLWAIT   1

◆ SUB_REAL

#define SUB_REAL   0

◆ SUB_THREEWAY

#define SUB_THREEWAY   2

Enumeration Type Documentation

◆ DAHDI_IFLIST

Specify the lists dahdi_pvt can be put in.

Enumerator
DAHDI_IFLIST_NONE 

The dahdi_pvt is not in any list.

DAHDI_IFLIST_MAIN 

The dahdi_pvt is in the main interface list

Definition at line 116 of file chan_dahdi.h.

116  {
117  DAHDI_IFLIST_NONE, /*!< The dahdi_pvt is not in any list. */
118  DAHDI_IFLIST_MAIN, /*!< The dahdi_pvt is in the main interface list */
119 #if defined(HAVE_PRI)
120  DAHDI_IFLIST_NO_B_CHAN, /*!< The dahdi_pvt is in a no B channel interface list */
121 #endif /* defined(HAVE_PRI) */
122 };

◆ mwisend_states

Enumerator
MWI_SEND_NULL 
MWI_SEND_SA 
MWI_SEND_SA_WAIT 
MWI_SEND_PAUSE 
MWI_SEND_SPILL 
MWI_SEND_CLEANUP 
MWI_SEND_DONE 

Definition at line 100 of file chan_dahdi.h.

Function Documentation

◆ _dahdi_get_index()

int _dahdi_get_index ( struct ast_channel ast,
struct dahdi_pvt p,
int  nullok,
const char *  fname,
unsigned long  line 
)

Definition at line 3431 of file chan_dahdi.c.

References ast_channel_name(), ast_log, dahdi_pvt::channel, LOG_WARNING, dahdi_subchannel::owner, SUB_CALLWAIT, SUB_REAL, SUB_THREEWAY, and dahdi_pvt::subs.

3432 {
3433  int res;
3434  if (p->subs[SUB_REAL].owner == ast)
3435  res = 0;
3436  else if (p->subs[SUB_CALLWAIT].owner == ast)
3437  res = 1;
3438  else if (p->subs[SUB_THREEWAY].owner == ast)
3439  res = 2;
3440  else {
3441  res = -1;
3442  if (!nullok)
3444  "Unable to get index for '%s' on channel %d (%s(), line %lu)\n",
3445  ast ? ast_channel_name(ast) : "", p->channel, fname, line);
3446  }
3447  return res;
3448 }
struct dahdi_subchannel subs[3]
Definition: chan_dahdi.h:131
#define SUB_THREEWAY
Definition: chan_dahdi.h:59
#define LOG_WARNING
Definition: logger.h:274
#define ast_log
Definition: astobj2.c:42
struct ast_channel * owner
Definition: chan_dahdi.h:79
#define SUB_REAL
Definition: chan_dahdi.h:57
const char * ast_channel_name(const struct ast_channel *chan)
int channel
Definition: chan_dahdi.h:538
#define SUB_CALLWAIT
Definition: chan_dahdi.h:58

◆ dahdi_analog_lib_handles()

static int dahdi_analog_lib_handles ( int  signalling,
int  radio,
int  oprmode 
)
inlinestatic

Definition at line 786 of file chan_dahdi.h.

References SIG_E911, SIG_EM, SIG_EM_E1, SIG_EMWINK, SIG_FEATB, SIG_FEATD, SIG_FEATDMF, SIG_FEATDMF_TA, SIG_FGC_CAMA, SIG_FGC_CAMAMF, SIG_FXOGS, SIG_FXOKS, SIG_FXOLS, SIG_FXSGS, SIG_FXSKS, SIG_FXSLS, SIG_SF, SIG_SF_FEATB, SIG_SF_FEATD, SIG_SF_FEATDMF, and SIG_SFWINK.

Referenced by action_transfer(), action_transferhangup(), available(), dahdi_answer(), dahdi_call(), dahdi_dnd(), dahdi_exception(), dahdi_fixup(), dahdi_hangup(), dahdi_new(), dahdi_read(), dahdi_request(), destroy_dahdi_pvt(), do_monitor(), mkintf(), mwi_thread(), and my_get_sigpvt_bridged_channel().

787 {
788  switch (signalling) {
789  case SIG_FXOLS:
790  case SIG_FXOGS:
791  case SIG_FXOKS:
792  case SIG_FXSLS:
793  case SIG_FXSGS:
794  case SIG_FXSKS:
795  case SIG_EMWINK:
796  case SIG_EM:
797  case SIG_EM_E1:
798  case SIG_FEATD:
799  case SIG_FEATDMF:
800  case SIG_E911:
801  case SIG_FGC_CAMA:
802  case SIG_FGC_CAMAMF:
803  case SIG_FEATB:
804  case SIG_SFWINK:
805  case SIG_SF:
806  case SIG_SF_FEATD:
807  case SIG_SF_FEATDMF:
808  case SIG_FEATDMF_TA:
809  case SIG_SF_FEATB:
810  break;
811  default:
812  /* The rest of the function should cover the remainder of signalling types */
813  return 0;
814  }
815 
816  if (radio) {
817  return 0;
818  }
819 
820  if (oprmode) {
821  return 0;
822  }
823 
824  return 1;
825 }
#define SIG_FXOGS
Definition: chan_dahdi.h:735
#define SIG_SF_FEATDMF
Definition: chan_dahdi.h:740
#define SIG_EM
Definition: chan_dahdi.h:722
#define SIG_FXOKS
Definition: chan_dahdi.h:736
#define SIG_FEATB
Definition: chan_dahdi.h:726
#define SIG_FEATDMF_TA
Definition: chan_dahdi.h:728
#define SIG_SF
Definition: chan_dahdi.h:737
#define SIG_EMWINK
Definition: chan_dahdi.h:723
#define SIG_FGC_CAMAMF
Definition: chan_dahdi.h:730
#define SIG_FEATD
Definition: chan_dahdi.h:724
#define SIG_E911
Definition: chan_dahdi.h:727
#define SIG_FXSGS
Definition: chan_dahdi.h:732
#define SIG_SF_FEATD
Definition: chan_dahdi.h:739
#define SIG_SFWINK
Definition: chan_dahdi.h:738
#define SIG_FGC_CAMA
Definition: chan_dahdi.h:729
#define SIG_SF_FEATB
Definition: chan_dahdi.h:741
#define SIG_FXSKS
Definition: chan_dahdi.h:733
#define SIG_FXSLS
Definition: chan_dahdi.h:731
#define SIG_FXOLS
Definition: chan_dahdi.h:734
#define SIG_FEATDMF
Definition: chan_dahdi.h:725
#define SIG_EM_E1
Definition: chan_dahdi.h:742

◆ dahdi_conf_update()

void dahdi_conf_update ( struct dahdi_pvt p)

Definition at line 4583 of file chan_dahdi.c.

References ast_debug, dahdi_pvt::channel, conf_add(), conf_del(), dahdi_pvt::confno, dahdi_subchannel::dfd, GET_CHANNEL, dahdi_pvt::inconference, dahdi_subchannel::inthreeway, isslavenative(), dahdi_pvt::master, MAX_SLAVES, NULL, dahdi_pvt::slaves, SUB_REAL, and dahdi_pvt::subs.

Referenced by __dahdi_exception(), dahdi_fixup(), dahdi_handle_event(), dahdi_hangup(), dahdi_master_slave_unlink(), mkintf(), and native_start().

4584 {
4585  int needconf = 0;
4586  int x;
4587  int useslavenative;
4588  struct dahdi_pvt *slave = NULL;
4589 
4590  useslavenative = isslavenative(p, &slave);
4591  /* Start with the obvious, general stuff */
4592  for (x = 0; x < 3; x++) {
4593  /* Look for three way calls */
4594  if ((p->subs[x].dfd > -1) && p->subs[x].inthreeway) {
4595  conf_add(p, &p->subs[x], x, 0);
4596  needconf++;
4597  } else {
4598  conf_del(p, &p->subs[x], x);
4599  }
4600  }
4601  /* If we have a slave, add him to our conference now. or DAX
4602  if this is slave native */
4603  for (x = 0; x < MAX_SLAVES; x++) {
4604  if (p->slaves[x]) {
4605  if (useslavenative)
4606  conf_add(p, &p->slaves[x]->subs[SUB_REAL], SUB_REAL, GET_CHANNEL(p));
4607  else {
4608  conf_add(p, &p->slaves[x]->subs[SUB_REAL], SUB_REAL, 0);
4609  needconf++;
4610  }
4611  }
4612  }
4613  /* If we're supposed to be in there, do so now */
4614  if (p->inconference && !p->subs[SUB_REAL].inthreeway) {
4615  if (useslavenative)
4616  conf_add(p, &p->subs[SUB_REAL], SUB_REAL, GET_CHANNEL(slave));
4617  else {
4618  conf_add(p, &p->subs[SUB_REAL], SUB_REAL, 0);
4619  needconf++;
4620  }
4621  }
4622  /* If we have a master, add ourselves to his conference */
4623  if (p->master) {
4624  if (isslavenative(p->master, NULL)) {
4626  } else {
4627  conf_add(p->master, &p->subs[SUB_REAL], SUB_REAL, 0);
4628  }
4629  }
4630  if (!needconf) {
4631  /* Nobody is left (or should be left) in our conference.
4632  Kill it. */
4633  p->confno = -1;
4634  }
4635  ast_debug(1, "Updated conferencing on %d, with %d conference users\n", p->channel, needconf);
4636 }
static int conf_del(struct dahdi_pvt *p, struct dahdi_subchannel *c, int index)
Definition: chan_dahdi.c:4506
#define MAX_SLAVES
Definition: chan_dahdi.h:95
struct dahdi_subchannel subs[3]
Definition: chan_dahdi.h:131
struct dahdi_pvt * master
Definition: chan_dahdi.h:135
static int conf_add(struct dahdi_pvt *p, struct dahdi_subchannel *c, int index, int slavechannel)
Definition: chan_dahdi.c:4457
#define NULL
Definition: resample.c:96
int inconference
Definition: chan_dahdi.h:136
#define ast_debug(level,...)
Log a DEBUG message.
Definition: logger.h:452
struct dahdi_pvt * slaves[MAX_SLAVES]
Definition: chan_dahdi.h:134
#define GET_CHANNEL(p)
Definition: chan_dahdi.c:1053
unsigned int inthreeway
Definition: chan_dahdi.h:91
#define SUB_REAL
Definition: chan_dahdi.h:57
int confno
Definition: chan_dahdi.h:510
static int isslavenative(struct dahdi_pvt *p, struct dahdi_pvt **out)
Definition: chan_dahdi.c:4525
char x
Definition: extconf.c:81
int channel
Definition: chan_dahdi.h:538

◆ dahdi_dtmf_detect_disable()

void dahdi_dtmf_detect_disable ( struct dahdi_pvt p)

Definition at line 6473 of file chan_dahdi.c.

References ast_dsp_set_features(), dahdi_subchannel::dfd, dahdi_pvt::dsp, DSP_FEATURE_DIGIT_DETECT, dahdi_pvt::dsp_features, dahdi_pvt::hardwaredtmf, dahdi_pvt::ignoredtmf, SUB_REAL, and dahdi_pvt::subs.

Referenced by dahdi_setoption(), and native_start().

6474 {
6475  int val = 0;
6476 
6477  p->ignoredtmf = 1;
6478 
6479  ioctl(p->subs[SUB_REAL].dfd, DAHDI_TONEDETECT, &val);
6480 
6481  if (!p->hardwaredtmf && p->dsp) {
6484  }
6485 }
struct dahdi_subchannel subs[3]
Definition: chan_dahdi.h:131
Definition: ast_expr2.c:325
unsigned int hardwaredtmf
TRUE if DTMF detection needs to be done by hardware.
Definition: chan_dahdi.h:263
#define DSP_FEATURE_DIGIT_DETECT
Definition: dsp.h:28
int dsp_features
DSP feature flags: DSP_FEATURE_xxx.
Definition: chan_dahdi.h:683
struct ast_dsp * dsp
Opaque DSP configuration structure.
Definition: chan_dahdi.h:639
#define SUB_REAL
Definition: chan_dahdi.h:57
void ast_dsp_set_features(struct ast_dsp *dsp, int features)
Select feature set.
Definition: dsp.c:1755
unsigned int ignoredtmf
TRUE if DTMF detection is disabled.
Definition: chan_dahdi.h:278

◆ dahdi_dtmf_detect_enable()

void dahdi_dtmf_detect_enable ( struct dahdi_pvt p)

Definition at line 6487 of file chan_dahdi.c.

References ast_dsp_set_features(), CHAN_PSEUDO, dahdi_pvt::channel, dahdi_subchannel::dfd, dahdi_pvt::dsp, DSP_FEATURE_DIGIT_DETECT, dahdi_pvt::dsp_features, dahdi_pvt::hardwaredtmf, dahdi_pvt::ignoredtmf, SUB_REAL, and dahdi_pvt::subs.

Referenced by dahdi_setoption(), and native_stop().

6488 {
6489  int val = DAHDI_TONEDETECT_ON | DAHDI_TONEDETECT_MUTE;
6490 
6491  if (p->channel == CHAN_PSEUDO)
6492  return;
6493 
6494  p->ignoredtmf = 0;
6495 
6496  ioctl(p->subs[SUB_REAL].dfd, DAHDI_TONEDETECT, &val);
6497 
6498  if (!p->hardwaredtmf && p->dsp) {
6501  }
6502 }
struct dahdi_subchannel subs[3]
Definition: chan_dahdi.h:131
Definition: ast_expr2.c:325
unsigned int hardwaredtmf
TRUE if DTMF detection needs to be done by hardware.
Definition: chan_dahdi.h:263
#define DSP_FEATURE_DIGIT_DETECT
Definition: dsp.h:28
int dsp_features
DSP feature flags: DSP_FEATURE_xxx.
Definition: chan_dahdi.h:683
#define CHAN_PSEUDO
Definition: chan_dahdi.c:556
struct ast_dsp * dsp
Opaque DSP configuration structure.
Definition: chan_dahdi.h:639
#define SUB_REAL
Definition: chan_dahdi.h:57
void ast_dsp_set_features(struct ast_dsp *dsp, int features)
Select feature set.
Definition: dsp.c:1755
unsigned int ignoredtmf
TRUE if DTMF detection is disabled.
Definition: chan_dahdi.h:278
int channel
Definition: chan_dahdi.h:538

◆ dahdi_ec_disable()

void dahdi_ec_disable ( struct dahdi_pvt p)

Definition at line 4710 of file chan_dahdi.c.

References ast_debug, ast_log, dahdi_pvt::channel, dahdi_subchannel::dfd, dahdi_pvt::echocanon, errno, LOG_WARNING, SUB_REAL, and dahdi_pvt::subs.

Referenced by __dahdi_exception(), dahdi_func_write(), dahdi_handle_event(), dahdi_hangup(), dahdi_setoption(), handle_init_event(), my_set_echocanceller(), and native_start().

4711 {
4712  int res;
4713 
4714  if (p->echocanon) {
4715  struct dahdi_echocanparams ecp = { .tap_length = 0 };
4716 
4717  res = ioctl(p->subs[SUB_REAL].dfd, DAHDI_ECHOCANCEL_PARAMS, &ecp);
4718 
4719  if (res)
4720  ast_log(LOG_WARNING, "Unable to disable echo cancellation on channel %d: %s\n", p->channel, strerror(errno));
4721  else
4722  ast_debug(1, "Disabled echo cancellation on channel %d\n", p->channel);
4723  }
4724 
4725  p->echocanon = 0;
4726 }
struct dahdi_subchannel subs[3]
Definition: chan_dahdi.h:131
#define LOG_WARNING
Definition: logger.h:274
#define ast_debug(level,...)
Log a DEBUG message.
Definition: logger.h:452
#define ast_log
Definition: astobj2.c:42
int errno
#define SUB_REAL
Definition: chan_dahdi.h:57
unsigned int echocanon
TRUE if echo cancellation is turned on.
Definition: chan_dahdi.h:248
int channel
Definition: chan_dahdi.h:538

◆ dahdi_ec_enable()

void dahdi_ec_enable ( struct dahdi_pvt p)

Definition at line 4638 of file chan_dahdi.c.

References ast_debug, ast_log, dahdi_pvt::channel, dahdi_subchannel::dfd, dahdi_pvt::digital, dahdi_pvt::echocancel, dahdi_pvt::echocanon, errno, dahdi_pvt::head, LOG_WARNING, dahdi_pvt::sig, SIG_PRI_LIB_HANDLE_CASES, dahdi_pvt::sig_pvt, SIG_SS7, SUB_REAL, and dahdi_pvt::subs.

Referenced by __dahdi_exception(), analog_ss_thread(), dahdi_func_write(), dahdi_handle_event(), dahdi_setoption(), handle_clear_alarms(), handle_init_event(), my_set_echocanceller(), and native_stop().

4639 {
4640  int res;
4641  if (!p)
4642  return;
4643  if (p->echocanon) {
4644  ast_debug(1, "Echo cancellation already on\n");
4645  return;
4646  }
4647  if (p->digital) {
4648  ast_debug(1, "Echo cancellation isn't required on digital connection\n");
4649  return;
4650  }
4651  if (p->echocancel.head.tap_length) {
4652 #if defined(HAVE_PRI) || defined(HAVE_SS7)
4653  switch (p->sig) {
4654 #if defined(HAVE_PRI)
4656  if (((struct sig_pri_chan *) p->sig_pvt)->no_b_channel) {
4657  /*
4658  * PRI nobch pseudo channel. Does not need ec anyway.
4659  * Does not handle ioctl(DAHDI_AUDIOMODE)
4660  */
4661  return;
4662  }
4663  /* Fall through */
4664 #endif /* defined(HAVE_PRI) */
4665 #if defined(HAVE_SS7)
4666  case SIG_SS7:
4667 #endif /* defined(HAVE_SS7) */
4668  {
4669  int x = 1;
4670 
4671  res = ioctl(p->subs[SUB_REAL].dfd, DAHDI_AUDIOMODE, &x);
4672  if (res)
4674  "Unable to enable audio mode on channel %d (%s)\n",
4675  p->channel, strerror(errno));
4676  }
4677  break;
4678  default:
4679  break;
4680  }
4681 #endif /* defined(HAVE_PRI) || defined(HAVE_SS7) */
4682  res = ioctl(p->subs[SUB_REAL].dfd, DAHDI_ECHOCANCEL_PARAMS, &p->echocancel);
4683  if (res) {
4684  ast_log(LOG_WARNING, "Unable to enable echo cancellation on channel %d (%s)\n", p->channel, strerror(errno));
4685  } else {
4686  p->echocanon = 1;
4687  ast_debug(1, "Enabled echo cancellation on channel %d\n", p->channel);
4688  }
4689  } else
4690  ast_debug(1, "No echo cancellation requested\n");
4691 }
unsigned int digital
TRUE if the transfer capability of the call is digital.
Definition: chan_dahdi.h:236
struct dahdi_subchannel subs[3]
Definition: chan_dahdi.h:131
#define LOG_WARNING
Definition: logger.h:274
void * sig_pvt
Definition: chan_dahdi.h:709
#define ast_debug(level,...)
Log a DEBUG message.
Definition: logger.h:452
#define ast_log
Definition: astobj2.c:42
#define SIG_SS7
Definition: chan_dahdi.h:750
struct dahdi_pvt::@110 echocancel
Echo cancel parameters.
int errno
#define SUB_REAL
Definition: chan_dahdi.h:57
#define SIG_PRI_LIB_HANDLE_CASES
Definition: chan_dahdi.h:756
struct dahdi_echocanparams head
Definition: chan_dahdi.h:580
unsigned int echocanon
TRUE if echo cancellation is turned on.
Definition: chan_dahdi.h:248
int channel
Definition: chan_dahdi.h:538

◆ dahdi_master_slave_link()

void dahdi_master_slave_link ( struct dahdi_pvt slave,
struct dahdi_pvt master 
)

Definition at line 7037 of file chan_dahdi.c.

References ast_debug, ast_log, dahdi_pvt::channel, LOG_WARNING, dahdi_pvt::master, MAX_SLAVES, and dahdi_pvt::slaves.

Referenced by native_start().

7038 {
7039  int x;
7040  if (!slave || !master) {
7041  ast_log(LOG_WARNING, "Tried to link to/from NULL??\n");
7042  return;
7043  }
7044  for (x = 0; x < MAX_SLAVES; x++) {
7045  if (!master->slaves[x]) {
7046  master->slaves[x] = slave;
7047  break;
7048  }
7049  }
7050  if (x >= MAX_SLAVES) {
7051  ast_log(LOG_WARNING, "Replacing slave %d with new slave, %d\n", master->slaves[MAX_SLAVES - 1]->channel, slave->channel);
7052  master->slaves[MAX_SLAVES - 1] = slave;
7053  }
7054  if (slave->master)
7055  ast_log(LOG_WARNING, "Replacing master %d with new master, %d\n", slave->master->channel, master->channel);
7056  slave->master = master;
7057 
7058  ast_debug(1, "Making %d slave to master %d at %d\n", slave->channel, master->channel, x);
7059 }
#define MAX_SLAVES
Definition: chan_dahdi.h:95
struct dahdi_pvt * master
Definition: chan_dahdi.h:135
#define LOG_WARNING
Definition: logger.h:274
#define ast_debug(level,...)
Log a DEBUG message.
Definition: logger.h:452
#define ast_log
Definition: astobj2.c:42
struct dahdi_pvt * slaves[MAX_SLAVES]
Definition: chan_dahdi.h:134
int channel
Definition: chan_dahdi.h:538

◆ dahdi_master_slave_unlink()

void dahdi_master_slave_unlink ( struct dahdi_pvt slave,
struct dahdi_pvt master,
int  needlock 
)

Definition at line 6981 of file chan_dahdi.c.

References ast_debug, ast_mutex_lock, ast_mutex_trylock, ast_mutex_unlock, dahdi_pvt::channel, conf_del(), dahdi_conf_update(), DEADLOCK_AVOIDANCE, dahdi_pvt::inconference, dahdi_pvt::lock, dahdi_pvt::master, MAX_SLAVES, NULL, dahdi_pvt::slaves, SUB_REAL, and dahdi_pvt::subs.

Referenced by dahdi_fixup(), and native_stop().

6982 {
6983  /* Unlink a specific slave or all slaves/masters from a given master */
6984  int x;
6985  int hasslaves;
6986  if (!master)
6987  return;
6988  if (needlock) {
6989  ast_mutex_lock(&master->lock);
6990  if (slave) {
6991  while (ast_mutex_trylock(&slave->lock)) {
6992  DEADLOCK_AVOIDANCE(&master->lock);
6993  }
6994  }
6995  }
6996  hasslaves = 0;
6997  for (x = 0; x < MAX_SLAVES; x++) {
6998  if (master->slaves[x]) {
6999  if (!slave || (master->slaves[x] == slave)) {
7000  /* Take slave out of the conference */
7001  ast_debug(1, "Unlinking slave %d from %d\n", master->slaves[x]->channel, master->channel);
7002  conf_del(master, &master->slaves[x]->subs[SUB_REAL], SUB_REAL);
7003  conf_del(master->slaves[x], &master->subs[SUB_REAL], SUB_REAL);
7004  master->slaves[x]->master = NULL;
7005  master->slaves[x] = NULL;
7006  } else
7007  hasslaves = 1;
7008  }
7009  if (!hasslaves)
7010  master->inconference = 0;
7011  }
7012  if (!slave) {
7013  if (master->master) {
7014  /* Take master out of the conference */
7015  conf_del(master->master, &master->subs[SUB_REAL], SUB_REAL);
7016  conf_del(master, &master->master->subs[SUB_REAL], SUB_REAL);
7017  hasslaves = 0;
7018  for (x = 0; x < MAX_SLAVES; x++) {
7019  if (master->master->slaves[x] == master)
7020  master->master->slaves[x] = NULL;
7021  else if (master->master->slaves[x])
7022  hasslaves = 1;
7023  }
7024  if (!hasslaves)
7025  master->master->inconference = 0;
7026  }
7027  master->master = NULL;
7028  }
7029  dahdi_conf_update(master);
7030  if (needlock) {
7031  if (slave)
7032  ast_mutex_unlock(&slave->lock);
7033  ast_mutex_unlock(&master->lock);
7034  }
7035 }
static int conf_del(struct dahdi_pvt *p, struct dahdi_subchannel *c, int index)
Definition: chan_dahdi.c:4506
#define MAX_SLAVES
Definition: chan_dahdi.h:95
struct dahdi_subchannel subs[3]
Definition: chan_dahdi.h:131
#define DEADLOCK_AVOIDANCE(lock)
Definition: lock.h:374
struct dahdi_pvt * master
Definition: chan_dahdi.h:135
#define ast_mutex_lock(a)
Definition: lock.h:187
#define NULL
Definition: resample.c:96
void dahdi_conf_update(struct dahdi_pvt *p)
Definition: chan_dahdi.c:4583
int inconference
Definition: chan_dahdi.h:136
#define ast_debug(level,...)
Log a DEBUG message.
Definition: logger.h:452
struct dahdi_pvt * slaves[MAX_SLAVES]
Definition: chan_dahdi.h:134
#define ast_mutex_trylock(a)
Definition: lock.h:189
ast_mutex_t lock
Definition: chan_dahdi.h:125
#define SUB_REAL
Definition: chan_dahdi.h:57
int channel
Definition: chan_dahdi.h:538
#define ast_mutex_unlock(a)
Definition: lock.h:188

◆ dahdi_sig_pri_lib_handles()

static int dahdi_sig_pri_lib_handles ( int  signaling)
inlinestatic

Definition at line 770 of file chan_dahdi.h.

References SIG_PRI_LIB_HANDLE_CASES.

Referenced by action_dahdishowchannels(), dahdi_call(), dahdi_cc_callback(), dahdi_digit_end(), dahdi_fixup(), dahdi_handle_event(), dahdi_hangup(), dahdi_new(), dahdi_queryoption(), dahdi_read(), dahdi_request(), dahdi_sendtext(), dahdi_setoption(), handle_alarms(), handle_clear_alarms(), mkintf(), and native_start().

771 {
772  int handles;
773 
774  switch (signaling) {
776  handles = 1;
777  break;
778  default:
779  handles = 0;
780  break;
781  }
782 
783  return handles;
784 }
#define SIG_PRI_LIB_HANDLE_CASES
Definition: chan_dahdi.h:756

Variable Documentation

◆ subnames

const char* const subnames[]

Definition at line 795 of file chan_dahdi.c.

Referenced by alloc_sub(), dahdi_new(), and native_start().