Asterisk - The Open Source Telephony Project GIT-master-8f1982c
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Modules Pages
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.nosp@m.ett@.nosp@m.digiu.nosp@m.m.co.nosp@m.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__)

Definition at line 888 of file chan_dahdi.h.

◆ MAX_SLAVES

#define MAX_SLAVES   4

Definition at line 95 of file chan_dahdi.h.

◆ SIG_BRI

#define SIG_BRI   (0x2000000 | DAHDI_SIG_CLEAR)

Definition at line 807 of file chan_dahdi.h.

◆ SIG_BRI_PTMP

#define SIG_BRI_PTMP   (0X4000000 | DAHDI_SIG_CLEAR)

Definition at line 808 of file chan_dahdi.h.

◆ SIG_E911

#define SIG_E911   (0x1000000 | DAHDI_SIG_EM)

Definition at line 788 of file chan_dahdi.h.

◆ SIG_EM

#define SIG_EM   DAHDI_SIG_EM

Definition at line 783 of file chan_dahdi.h.

◆ SIG_EM_E1

#define SIG_EM_E1   DAHDI_SIG_EM_E1

Definition at line 803 of file chan_dahdi.h.

◆ SIG_EMWINK

#define SIG_EMWINK   (0x0100000 | DAHDI_SIG_EM)

Definition at line 784 of file chan_dahdi.h.

◆ SIG_FEATB

#define SIG_FEATB   (0x0800000 | DAHDI_SIG_EM)

Definition at line 787 of file chan_dahdi.h.

◆ SIG_FEATD

#define SIG_FEATD   (0x0200000 | DAHDI_SIG_EM)

Definition at line 785 of file chan_dahdi.h.

◆ SIG_FEATDMF

#define SIG_FEATDMF   (0x0400000 | DAHDI_SIG_EM)

Definition at line 786 of file chan_dahdi.h.

◆ SIG_FEATDMF_TA

#define SIG_FEATDMF_TA   (0x2000000 | DAHDI_SIG_EM)

Definition at line 789 of file chan_dahdi.h.

◆ SIG_FGC_CAMA

#define SIG_FGC_CAMA   (0x4000000 | DAHDI_SIG_EM)

Definition at line 790 of file chan_dahdi.h.

◆ SIG_FGC_CAMAMF

#define SIG_FGC_CAMAMF   (0x8000000 | DAHDI_SIG_EM)

Definition at line 791 of file chan_dahdi.h.

◆ SIG_FXOGS

#define SIG_FXOGS   DAHDI_SIG_FXOGS

Definition at line 796 of file chan_dahdi.h.

◆ SIG_FXOKS

#define SIG_FXOKS   DAHDI_SIG_FXOKS

Definition at line 797 of file chan_dahdi.h.

◆ SIG_FXOLS

#define SIG_FXOLS   DAHDI_SIG_FXOLS

Definition at line 795 of file chan_dahdi.h.

◆ SIG_FXSGS

#define SIG_FXSGS   DAHDI_SIG_FXSGS

Definition at line 793 of file chan_dahdi.h.

◆ SIG_FXSKS

#define SIG_FXSKS   DAHDI_SIG_FXSKS

Definition at line 794 of file chan_dahdi.h.

◆ SIG_FXSLS

#define SIG_FXSLS   DAHDI_SIG_FXSLS

Definition at line 792 of file chan_dahdi.h.

◆ SIG_MFCR2

#define SIG_MFCR2   DAHDI_SIG_CAS

Definition at line 814 of file chan_dahdi.h.

◆ SIG_PRI

#define SIG_PRI   DAHDI_SIG_CLEAR

Definition at line 806 of file chan_dahdi.h.

◆ SIG_PRI_LIB_HANDLE_CASES

#define SIG_PRI_LIB_HANDLE_CASES
Value:
case SIG_BRI: \
#define SIG_BRI
Definition: chan_dahdi.h:807
#define SIG_BRI_PTMP
Definition: chan_dahdi.h:808
#define SIG_PRI
Definition: chan_dahdi.h:806

Definition at line 817 of file chan_dahdi.h.

◆ SIG_SF

#define SIG_SF   DAHDI_SIG_SF

Definition at line 798 of file chan_dahdi.h.

◆ SIG_SF_FEATB

#define SIG_SF_FEATB   (0x0800000 | DAHDI_SIG_SF)

Definition at line 802 of file chan_dahdi.h.

◆ SIG_SF_FEATD

#define SIG_SF_FEATD   (0x0200000 | DAHDI_SIG_SF)

Definition at line 800 of file chan_dahdi.h.

◆ SIG_SF_FEATDMF

#define SIG_SF_FEATDMF   (0x0400000 | DAHDI_SIG_SF)

Definition at line 801 of file chan_dahdi.h.

◆ SIG_SFWINK

#define SIG_SFWINK   (0x0100000 | DAHDI_SIG_SF)

Definition at line 799 of file chan_dahdi.h.

◆ SIG_SS7

#define SIG_SS7   (0x1000000 | DAHDI_SIG_CLEAR)

Definition at line 811 of file chan_dahdi.h.

◆ SUB_CALLWAIT

#define SUB_CALLWAIT   1

Call-Waiting call on hold

Definition at line 58 of file chan_dahdi.h.

◆ SUB_REAL

#define SUB_REAL   0

Active call

Definition at line 57 of file chan_dahdi.h.

◆ SUB_THREEWAY

#define SUB_THREEWAY   2

Three-way call

Definition at line 59 of file chan_dahdi.h.

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};
@ DAHDI_IFLIST_NONE
Definition: chan_dahdi.h:117
@ DAHDI_IFLIST_MAIN
Definition: chan_dahdi.h:118

◆ 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.

100 {
101 MWI_SEND_NULL = 0,
mwisend_states
Definition: chan_dahdi.h:100
@ MWI_SEND_NULL
Definition: chan_dahdi.h:101
@ MWI_SEND_SA
Definition: chan_dahdi.h:102
@ MWI_SEND_PAUSE
Definition: chan_dahdi.h:104
@ MWI_SEND_SA_WAIT
Definition: chan_dahdi.h:103
@ MWI_SEND_DONE
Definition: chan_dahdi.h:107
@ MWI_SEND_SPILL
Definition: chan_dahdi.h:105
@ MWI_SEND_CLEANUP
Definition: chan_dahdi.h:106

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 3762 of file chan_dahdi.c.

3763{
3764 int res;
3765 if (p->subs[SUB_REAL].owner == ast)
3766 res = 0;
3767 else if (p->subs[SUB_CALLWAIT].owner == ast)
3768 res = 1;
3769 else if (p->subs[SUB_THREEWAY].owner == ast)
3770 res = 2;
3771 else {
3772 res = -1;
3773 if (!nullok)
3775 "Unable to get index for '%s' on channel %d (%s(), line %lu)\n",
3776 ast ? ast_channel_name(ast) : "", p->channel, fname, line);
3777 }
3778 return res;
3779}
#define ast_log
Definition: astobj2.c:42
#define SUB_REAL
Definition: chan_dahdi.h:57
#define SUB_THREEWAY
Definition: chan_dahdi.h:59
#define SUB_CALLWAIT
Definition: chan_dahdi.h:58
const char * ast_channel_name(const struct ast_channel *chan)
#define LOG_WARNING
struct dahdi_subchannel subs[3]
Definition: chan_dahdi.h:131
int channel
Definition: chan_dahdi.h:591
struct ast_channel * owner
Definition: chan_dahdi.h:79

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

◆ dahdi_analog_lib_handles()

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

Definition at line 847 of file chan_dahdi.h.

848{
849 switch (signalling) {
850 case SIG_FXOLS:
851 case SIG_FXOGS:
852 case SIG_FXOKS:
853 case SIG_FXSLS:
854 case SIG_FXSGS:
855 case SIG_FXSKS:
856 case SIG_EMWINK:
857 case SIG_EM:
858 case SIG_EM_E1:
859 case SIG_FEATD:
860 case SIG_FEATDMF:
861 case SIG_E911:
862 case SIG_FGC_CAMA:
863 case SIG_FGC_CAMAMF:
864 case SIG_FEATB:
865 case SIG_SFWINK:
866 case SIG_SF:
867 case SIG_SF_FEATD:
868 case SIG_SF_FEATDMF:
869 case SIG_FEATDMF_TA:
870 case SIG_SF_FEATB:
871 break;
872 default:
873 /* The rest of the function should cover the remainder of signalling types */
874 return 0;
875 }
876
877 if (radio) {
878 return 0;
879 }
880
881 if (oprmode) {
882 return 0;
883 }
884
885 return 1;
886}
#define SIG_FEATB
Definition: chan_dahdi.h:787
#define SIG_FGC_CAMA
Definition: chan_dahdi.h:790
#define SIG_SFWINK
Definition: chan_dahdi.h:799
#define SIG_EMWINK
Definition: chan_dahdi.h:784
#define SIG_FXSLS
Definition: chan_dahdi.h:792
#define SIG_SF_FEATB
Definition: chan_dahdi.h:802
#define SIG_FXSKS
Definition: chan_dahdi.h:794
#define SIG_FXOGS
Definition: chan_dahdi.h:796
#define SIG_SF_FEATDMF
Definition: chan_dahdi.h:801
#define SIG_FXOKS
Definition: chan_dahdi.h:797
#define SIG_FGC_CAMAMF
Definition: chan_dahdi.h:791
#define SIG_FXSGS
Definition: chan_dahdi.h:793
#define SIG_FEATDMF
Definition: chan_dahdi.h:786
#define SIG_EM_E1
Definition: chan_dahdi.h:803
#define SIG_SF_FEATD
Definition: chan_dahdi.h:800
#define SIG_FEATD
Definition: chan_dahdi.h:785
#define SIG_FEATDMF_TA
Definition: chan_dahdi.h:789
#define SIG_FXOLS
Definition: chan_dahdi.h:795
#define SIG_E911
Definition: chan_dahdi.h:788
#define SIG_EM
Definition: chan_dahdi.h:783
#define SIG_SF
Definition: chan_dahdi.h:798

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_func_read(), dahdi_func_write(), dahdi_hangup(), dahdi_new(), dahdi_read(), dahdi_request(), destroy_dahdi_pvt(), do_monitor(), fxo_pvt(), mkintf(), mwi_thread(), and my_get_sigpvt_bridged_channel().

◆ dahdi_conf_update()

void dahdi_conf_update ( struct dahdi_pvt p)

Definition at line 4913 of file chan_dahdi.c.

4914{
4915 int needconf = 0;
4916 int x;
4917 int useslavenative;
4918 struct dahdi_pvt *slave = NULL;
4919
4920 useslavenative = isslavenative(p, &slave);
4921 /* Start with the obvious, general stuff */
4922 for (x = 0; x < 3; x++) {
4923 /* Look for three way calls */
4924 if ((p->subs[x].dfd > -1) && p->subs[x].inthreeway) {
4925 conf_add(p, &p->subs[x], x, 0);
4926 needconf++;
4927 } else {
4928 conf_del(p, &p->subs[x], x);
4929 }
4930 }
4931 /* If we have a slave, add him to our conference now. or DAX
4932 if this is slave native */
4933 for (x = 0; x < MAX_SLAVES; x++) {
4934 if (p->slaves[x]) {
4935 if (useslavenative)
4936 conf_add(p, &p->slaves[x]->subs[SUB_REAL], SUB_REAL, GET_CHANNEL(p));
4937 else {
4938 conf_add(p, &p->slaves[x]->subs[SUB_REAL], SUB_REAL, 0);
4939 needconf++;
4940 }
4941 }
4942 }
4943 /* If we're supposed to be in there, do so now */
4944 if (p->inconference && !p->subs[SUB_REAL].inthreeway) {
4945 if (useslavenative)
4946 conf_add(p, &p->subs[SUB_REAL], SUB_REAL, GET_CHANNEL(slave));
4947 else {
4948 conf_add(p, &p->subs[SUB_REAL], SUB_REAL, 0);
4949 needconf++;
4950 }
4951 }
4952 /* If we have a master, add ourselves to his conference */
4953 if (p->master) {
4954 if (isslavenative(p->master, NULL)) {
4956 } else {
4957 conf_add(p->master, &p->subs[SUB_REAL], SUB_REAL, 0);
4958 }
4959 }
4960 if (!needconf) {
4961 /* Nobody is left (or should be left) in our conference.
4962 Kill it. */
4963 p->confno = -1;
4964 }
4965 ast_debug(1, "Updated conferencing on %d, with %d conference users\n", p->channel, needconf);
4966}
static int conf_del(struct dahdi_pvt *p, struct dahdi_subchannel *c, int index)
Definition: chan_dahdi.c:4836
static int conf_add(struct dahdi_pvt *p, struct dahdi_subchannel *c, int index, int slavechannel)
Definition: chan_dahdi.c:4787
static int isslavenative(struct dahdi_pvt *p, struct dahdi_pvt **out)
Definition: chan_dahdi.c:4855
#define GET_CHANNEL(p)
Definition: chan_dahdi.c:1250
#define MAX_SLAVES
Definition: chan_dahdi.h:95
#define ast_debug(level,...)
Log a DEBUG message.
#define NULL
Definition: resample.c:96
struct dahdi_pvt * master
Definition: chan_dahdi.h:135
struct dahdi_pvt * slaves[MAX_SLAVES]
Definition: chan_dahdi.h:134
int confno
Definition: chan_dahdi.h:563
int inconference
Definition: chan_dahdi.h:136
unsigned int inthreeway
Definition: chan_dahdi.h:91

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().

◆ dahdi_dtmf_detect_disable()

void dahdi_dtmf_detect_disable ( struct dahdi_pvt p)

Definition at line 6833 of file chan_dahdi.c.

6834{
6835 int val = 0;
6836
6837 p->ignoredtmf = 1;
6838
6839 ioctl(p->subs[SUB_REAL].dfd, DAHDI_TONEDETECT, &val);
6840
6841 if (!p->hardwaredtmf && p->dsp) {
6842 p->dsp_features &= ~DSP_FEATURE_DIGIT_DETECT;
6844 }
6845}
void ast_dsp_set_features(struct ast_dsp *dsp, int features)
Select feature set.
Definition: dsp.c:1768
unsigned int ignoredtmf
TRUE if DTMF detection is disabled.
Definition: chan_dahdi.h:310
int dsp_features
DSP feature flags: DSP_FEATURE_xxx.
Definition: chan_dahdi.h:744
struct ast_dsp * dsp
Opaque DSP configuration structure.
Definition: chan_dahdi.h:700
unsigned int hardwaredtmf
TRUE if DTMF detection needs to be done by hardware.
Definition: chan_dahdi.h:295
Definition: ast_expr2.c:325

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

Referenced by dahdi_setoption(), and native_start().

◆ dahdi_dtmf_detect_enable()

void dahdi_dtmf_detect_enable ( struct dahdi_pvt p)

Definition at line 6847 of file chan_dahdi.c.

6848{
6849 int val = DAHDI_TONEDETECT_ON | DAHDI_TONEDETECT_MUTE;
6850
6851 if (p->channel == CHAN_PSEUDO)
6852 return;
6853
6854 p->ignoredtmf = 0;
6855
6856 ioctl(p->subs[SUB_REAL].dfd, DAHDI_TONEDETECT, &val);
6857
6858 if (!p->hardwaredtmf && p->dsp) {
6861 }
6862}
#define CHAN_PSEUDO
Definition: chan_dahdi.c:747
#define DSP_FEATURE_DIGIT_DETECT
Definition: dsp.h:28

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().

◆ dahdi_ec_disable()

void dahdi_ec_disable ( struct dahdi_pvt p)

Definition at line 5040 of file chan_dahdi.c.

5041{
5042 int res;
5043
5044 if (p->echocanon) {
5045 struct dahdi_echocanparams ecp = { .tap_length = 0 };
5046
5047 res = ioctl(p->subs[SUB_REAL].dfd, DAHDI_ECHOCANCEL_PARAMS, &ecp);
5048
5049 if (res)
5050 ast_log(LOG_WARNING, "Unable to disable echo cancellation on channel %d: %s\n", p->channel, strerror(errno));
5051 else
5052 ast_debug(1, "Disabled echo cancellation on channel %d\n", p->channel);
5053 }
5054
5055 p->echocanon = 0;
5056}
int errno
unsigned int echocanon
TRUE if echo cancellation is turned on.
Definition: chan_dahdi.h:272

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().

◆ dahdi_ec_enable()

void dahdi_ec_enable ( struct dahdi_pvt p)

Definition at line 4968 of file chan_dahdi.c.

4969{
4970 int res;
4971 if (!p)
4972 return;
4973 if (p->echocanon) {
4974 ast_debug(1, "Echo cancellation already on\n");
4975 return;
4976 }
4977 if (p->digital) {
4978 ast_debug(1, "Echo cancellation isn't required on digital connection\n");
4979 return;
4980 }
4981 if (p->echocancel.head.tap_length) {
4982#if defined(HAVE_PRI) || defined(HAVE_SS7)
4983 switch (p->sig) {
4984#if defined(HAVE_PRI)
4986 if (((struct sig_pri_chan *) p->sig_pvt)->no_b_channel) {
4987 /*
4988 * PRI nobch pseudo channel. Does not need ec anyway.
4989 * Does not handle ioctl(DAHDI_AUDIOMODE)
4990 */
4991 return;
4992 }
4993 /* Fall through */
4994#endif /* defined(HAVE_PRI) */
4995#if defined(HAVE_SS7)
4996 case SIG_SS7:
4997#endif /* defined(HAVE_SS7) */
4998 {
4999 int x = 1;
5000
5001 res = ioctl(p->subs[SUB_REAL].dfd, DAHDI_AUDIOMODE, &x);
5002 if (res)
5004 "Unable to enable audio mode on channel %d (%s)\n",
5005 p->channel, strerror(errno));
5006 }
5007 break;
5008 default:
5009 break;
5010 }
5011#endif /* defined(HAVE_PRI) || defined(HAVE_SS7) */
5012 res = ioctl(p->subs[SUB_REAL].dfd, DAHDI_ECHOCANCEL_PARAMS, &p->echocancel);
5013 if (res) {
5014 ast_log(LOG_WARNING, "Unable to enable echo cancellation on channel %d (%s)\n", p->channel, strerror(errno));
5015 } else {
5016 p->echocanon = 1;
5017 ast_debug(1, "Enabled echo cancellation on channel %d\n", p->channel);
5018 }
5019 } else
5020 ast_debug(1, "No echo cancellation requested\n");
5021}
#define SIG_PRI_LIB_HANDLE_CASES
Definition: chan_dahdi.h:817
#define SIG_SS7
Definition: chan_dahdi.h:811
struct dahdi_pvt::@115 echocancel
Echo cancel parameters.
void * sig_pvt
Definition: chan_dahdi.h:770
struct dahdi_echocanparams head
Definition: chan_dahdi.h:633
unsigned int digital
TRUE if the transfer capability of the call is digital.
Definition: chan_dahdi.h:260

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_init_event(), my_set_echocanceller(), and native_stop().

◆ dahdi_master_slave_link()

void dahdi_master_slave_link ( struct dahdi_pvt slave,
struct dahdi_pvt master 
)

Definition at line 7470 of file chan_dahdi.c.

7471{
7472 int x;
7473 if (!slave || !master) {
7474 ast_log(LOG_WARNING, "Tried to link to/from NULL??\n");
7475 return;
7476 }
7477 for (x = 0; x < MAX_SLAVES; x++) {
7478 if (!master->slaves[x]) {
7479 master->slaves[x] = slave;
7480 break;
7481 }
7482 }
7483 if (x >= MAX_SLAVES) {
7484 ast_log(LOG_WARNING, "Replacing slave %d with new slave, %d\n", master->slaves[MAX_SLAVES - 1]->channel, slave->channel);
7485 master->slaves[MAX_SLAVES - 1] = slave;
7486 }
7487 if (slave->master)
7488 ast_log(LOG_WARNING, "Replacing master %d with new master, %d\n", slave->master->channel, master->channel);
7489 slave->master = master;
7490
7491 ast_debug(1, "Making %d slave to master %d at %d\n", slave->channel, master->channel, x);
7492}

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

Referenced by native_start().

◆ dahdi_master_slave_unlink()

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

Definition at line 7414 of file chan_dahdi.c.

7415{
7416 /* Unlink a specific slave or all slaves/masters from a given master */
7417 int x;
7418 int hasslaves;
7419 if (!master)
7420 return;
7421 if (needlock) {
7422 ast_mutex_lock(&master->lock);
7423 if (slave) {
7424 while (ast_mutex_trylock(&slave->lock)) {
7425 DEADLOCK_AVOIDANCE(&master->lock);
7426 }
7427 }
7428 }
7429 hasslaves = 0;
7430 for (x = 0; x < MAX_SLAVES; x++) {
7431 if (master->slaves[x]) {
7432 if (!slave || (master->slaves[x] == slave)) {
7433 /* Take slave out of the conference */
7434 ast_debug(1, "Unlinking slave %d from %d\n", master->slaves[x]->channel, master->channel);
7435 conf_del(master, &master->slaves[x]->subs[SUB_REAL], SUB_REAL);
7436 conf_del(master->slaves[x], &master->subs[SUB_REAL], SUB_REAL);
7437 master->slaves[x]->master = NULL;
7438 master->slaves[x] = NULL;
7439 } else
7440 hasslaves = 1;
7441 }
7442 if (!hasslaves)
7443 master->inconference = 0;
7444 }
7445 if (!slave) {
7446 if (master->master) {
7447 /* Take master out of the conference */
7448 conf_del(master->master, &master->subs[SUB_REAL], SUB_REAL);
7449 conf_del(master, &master->master->subs[SUB_REAL], SUB_REAL);
7450 hasslaves = 0;
7451 for (x = 0; x < MAX_SLAVES; x++) {
7452 if (master->master->slaves[x] == master)
7453 master->master->slaves[x] = NULL;
7454 else if (master->master->slaves[x])
7455 hasslaves = 1;
7456 }
7457 if (!hasslaves)
7458 master->master->inconference = 0;
7459 }
7460 master->master = NULL;
7461 }
7462 dahdi_conf_update(master);
7463 if (needlock) {
7464 if (slave)
7465 ast_mutex_unlock(&slave->lock);
7466 ast_mutex_unlock(&master->lock);
7467 }
7468}
void dahdi_conf_update(struct dahdi_pvt *p)
Definition: chan_dahdi.c:4913
#define DEADLOCK_AVOIDANCE(lock)
Definition: lock.h:486
#define ast_mutex_unlock(a)
Definition: lock.h:197
#define ast_mutex_trylock(a)
Definition: lock.h:198
#define ast_mutex_lock(a)
Definition: lock.h:196
ast_mutex_t lock
Definition: chan_dahdi.h:125

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().

◆ dahdi_sig_pri_lib_handles()

static int dahdi_sig_pri_lib_handles ( int  signaling)
inlinestatic

Definition at line 831 of file chan_dahdi.h.

832{
833 int handles;
834
835 switch (signaling) {
837 handles = 1;
838 break;
839 default:
840 handles = 0;
841 break;
842 }
843
844 return handles;
845}

References SIG_PRI_LIB_HANDLE_CASES.

Referenced by 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().

Variable Documentation

◆ subnames

const char* const subnames[]
extern

Definition at line 986 of file chan_dahdi.c.

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