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

Defines

#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 <rmudgett@digium.com>
See Also:

Definition in file chan_dahdi.h.


Define Documentation

#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)

Definition at line 725 of file chan_dahdi.h.

Referenced by dahdi_sig2str(), and process_dahdi().

#define SIG_BRI_PTMP   (0X4000000 | DAHDI_SIG_CLEAR)

Definition at line 726 of file chan_dahdi.h.

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

#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

Definition at line 724 of file chan_dahdi.h.

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

#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

Active call

Definition at line 56 of file chan_dahdi.h.

Referenced by __dahdi_exception(), _dahdi_get_index(), analog_ss_thread(), analogsub_to_dahdisub(), attempt_transfer(), bump_gains(), check_for_conference(), close_call(), dahdi_answer(), dahdi_call(), dahdi_conf_update(), dahdi_confmute(), dahdi_destroy_channel_range(), dahdi_dial_str(), dahdi_digit_begin(), dahdi_digit_end(), dahdi_dtmf_detect_disable(), dahdi_dtmf_detect_enable(), dahdi_ec_disable(), dahdi_ec_enable(), dahdi_func_write(), dahdi_handle_event(), dahdi_hangup(), dahdi_indicate(), dahdi_master_slave_unlink(), dahdi_new(), dahdi_read(), dahdi_request(), dahdi_restart(), dahdi_ring_phone(), dahdi_set_hwgain(), dahdi_set_swgain(), dahdi_setoption(), dahdi_show_channel(), dahdi_train_ec(), destroy_dahdi_pvt(), do_monitor(), duplicate_pseudo(), find_subchannel_by_name(), get_alarms(), handle_call_incoming(), handle_call_outgoing(), handle_init_event(), handle_key_fav(), key_call(), key_dial_page(), mkintf(), mwi_send_init(), mwi_send_process_buffer(), mwi_send_process_event(), mwi_thread(), my_all_subchannels_hungup(), my_complete_conference_update(), my_flash(), my_get_callerid(), my_get_event(), my_is_off_hook(), my_off_hook(), my_set_cadence(), my_set_needringing(), my_set_polarity(), my_start(), my_start_cid_detect(), my_stop_cid_detect(), my_wait_event(), my_wink(), native_chan_changed(), native_start(), native_stop(), reload_config(), reset_conf(), restore_conference(), restore_gains(), revert_fax_buffers(), save_conference(), send_callerid(), sub_unhold(), subtype_tostr(), transfer_call_step1(), transfer_cancel_step2(), unistim_call(), unistim_do_senddigit(), unistim_hangup(), unistim_indicate(), and unistim_senddigit_end().

#define SUB_THREEWAY   2


Enumeration Type Documentation

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 115 of file chan_dahdi.h.

00115                   {
00116    DAHDI_IFLIST_NONE,   /*!< The dahdi_pvt is not in any list. */
00117    DAHDI_IFLIST_MAIN,   /*!< The dahdi_pvt is in the main interface list */
00118 #if defined(HAVE_PRI)
00119    DAHDI_IFLIST_NO_B_CHAN, /*!< The dahdi_pvt is in a no B channel interface list */
00120 #endif   /* defined(HAVE_PRI) */
00121 };

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 99 of file chan_dahdi.h.

00099              {
00100    MWI_SEND_NULL = 0,
00101    MWI_SEND_SA,
00102    MWI_SEND_SA_WAIT,
00103    MWI_SEND_PAUSE,
00104    MWI_SEND_SPILL,
00105    MWI_SEND_CLEANUP,
00106    MWI_SEND_DONE,
00107 } mwisend_states;


Function Documentation

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

Definition at line 3430 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.

03431 {
03432    int res;
03433    if (p->subs[SUB_REAL].owner == ast)
03434       res = 0;
03435    else if (p->subs[SUB_CALLWAIT].owner == ast)
03436       res = 1;
03437    else if (p->subs[SUB_THREEWAY].owner == ast)
03438       res = 2;
03439    else {
03440       res = -1;
03441       if (!nullok)
03442          ast_log(LOG_WARNING,
03443             "Unable to get index for '%s' on channel %d (%s(), line %lu)\n",
03444             ast ? ast_channel_name(ast) : "", p->channel, fname, line);
03445    }
03446    return res;
03447 }

static int dahdi_analog_lib_handles ( int  signalling,
int  radio,
int  oprmode 
) [inline, static]

Definition at line 765 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().

00766 {
00767    switch (signalling) {
00768    case SIG_FXOLS:
00769    case SIG_FXOGS:
00770    case SIG_FXOKS:
00771    case SIG_FXSLS:
00772    case SIG_FXSGS:
00773    case SIG_FXSKS:
00774    case SIG_EMWINK:
00775    case SIG_EM:
00776    case SIG_EM_E1:
00777    case SIG_FEATD:
00778    case SIG_FEATDMF:
00779    case SIG_E911:
00780    case SIG_FGC_CAMA:
00781    case SIG_FGC_CAMAMF:
00782    case SIG_FEATB:
00783    case SIG_SFWINK:
00784    case SIG_SF:
00785    case SIG_SF_FEATD:
00786    case SIG_SF_FEATDMF:
00787    case SIG_FEATDMF_TA:
00788    case SIG_SF_FEATB:
00789       break;
00790    default:
00791       /* The rest of the function should cover the remainder of signalling types */
00792       return 0;
00793    }
00794 
00795    if (radio) {
00796       return 0;
00797    }
00798 
00799    if (oprmode) {
00800       return 0;
00801    }
00802 
00803    return 1;
00804 }

void dahdi_conf_update ( struct dahdi_pvt p  ) 

Definition at line 4539 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().

04540 {
04541    int needconf = 0;
04542    int x;
04543    int useslavenative;
04544    struct dahdi_pvt *slave = NULL;
04545 
04546    useslavenative = isslavenative(p, &slave);
04547    /* Start with the obvious, general stuff */
04548    for (x = 0; x < 3; x++) {
04549       /* Look for three way calls */
04550       if ((p->subs[x].dfd > -1) && p->subs[x].inthreeway) {
04551          conf_add(p, &p->subs[x], x, 0);
04552          needconf++;
04553       } else {
04554          conf_del(p, &p->subs[x], x);
04555       }
04556    }
04557    /* If we have a slave, add him to our conference now. or DAX
04558       if this is slave native */
04559    for (x = 0; x < MAX_SLAVES; x++) {
04560       if (p->slaves[x]) {
04561          if (useslavenative)
04562             conf_add(p, &p->slaves[x]->subs[SUB_REAL], SUB_REAL, GET_CHANNEL(p));
04563          else {
04564             conf_add(p, &p->slaves[x]->subs[SUB_REAL], SUB_REAL, 0);
04565             needconf++;
04566          }
04567       }
04568    }
04569    /* If we're supposed to be in there, do so now */
04570    if (p->inconference && !p->subs[SUB_REAL].inthreeway) {
04571       if (useslavenative)
04572          conf_add(p, &p->subs[SUB_REAL], SUB_REAL, GET_CHANNEL(slave));
04573       else {
04574          conf_add(p, &p->subs[SUB_REAL], SUB_REAL, 0);
04575          needconf++;
04576       }
04577    }
04578    /* If we have a master, add ourselves to his conference */
04579    if (p->master) {
04580       if (isslavenative(p->master, NULL)) {
04581          conf_add(p->master, &p->subs[SUB_REAL], SUB_REAL, GET_CHANNEL(p->master));
04582       } else {
04583          conf_add(p->master, &p->subs[SUB_REAL], SUB_REAL, 0);
04584       }
04585    }
04586    if (!needconf) {
04587       /* Nobody is left (or should be left) in our conference.
04588          Kill it. */
04589       p->confno = -1;
04590    }
04591    ast_debug(1, "Updated conferencing on %d, with %d conference users\n", p->channel, needconf);
04592 }

void dahdi_dtmf_detect_disable ( struct dahdi_pvt p  ) 

Definition at line 6383 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().

06384 {
06385    int val = 0;
06386 
06387    p->ignoredtmf = 1;
06388 
06389    ioctl(p->subs[SUB_REAL].dfd, DAHDI_TONEDETECT, &val);
06390 
06391    if (!p->hardwaredtmf && p->dsp) {
06392       p->dsp_features &= ~DSP_FEATURE_DIGIT_DETECT;
06393       ast_dsp_set_features(p->dsp, p->dsp_features);
06394    }
06395 }

void dahdi_dtmf_detect_enable ( struct dahdi_pvt p  ) 

Definition at line 6397 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().

06398 {
06399    int val = DAHDI_TONEDETECT_ON | DAHDI_TONEDETECT_MUTE;
06400 
06401    if (p->channel == CHAN_PSEUDO)
06402       return;
06403 
06404    p->ignoredtmf = 0;
06405 
06406    ioctl(p->subs[SUB_REAL].dfd, DAHDI_TONEDETECT, &val);
06407 
06408    if (!p->hardwaredtmf && p->dsp) {
06409       p->dsp_features |= DSP_FEATURE_DIGIT_DETECT;
06410       ast_dsp_set_features(p->dsp, p->dsp_features);
06411    }
06412 }

void dahdi_ec_disable ( struct dahdi_pvt p  ) 

Definition at line 4666 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().

04667 {
04668    int res;
04669 
04670    if (p->echocanon) {
04671       struct dahdi_echocanparams ecp = { .tap_length = 0 };
04672 
04673       res = ioctl(p->subs[SUB_REAL].dfd, DAHDI_ECHOCANCEL_PARAMS, &ecp);
04674 
04675       if (res)
04676          ast_log(LOG_WARNING, "Unable to disable echo cancellation on channel %d: %s\n", p->channel, strerror(errno));
04677       else
04678          ast_debug(1, "Disabled echo cancellation on channel %d\n", p->channel);
04679    }
04680 
04681    p->echocanon = 0;
04682 }

void dahdi_ec_enable ( struct dahdi_pvt p  ) 

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

04595 {
04596    int res;
04597    if (!p)
04598       return;
04599    if (p->echocanon) {
04600       ast_debug(1, "Echo cancellation already on\n");
04601       return;
04602    }
04603    if (p->digital) {
04604       ast_debug(1, "Echo cancellation isn't required on digital connection\n");
04605       return;
04606    }
04607    if (p->echocancel.head.tap_length) {
04608 #if defined(HAVE_PRI) || defined(HAVE_SS7)
04609       switch (p->sig) {
04610 #if defined(HAVE_PRI)
04611       case SIG_PRI_LIB_HANDLE_CASES:
04612          if (((struct sig_pri_chan *) p->sig_pvt)->no_b_channel) {
04613             /*
04614              * PRI nobch pseudo channel.  Does not need ec anyway.
04615              * Does not handle ioctl(DAHDI_AUDIOMODE)
04616              */
04617             return;
04618          }
04619          /* Fall through */
04620 #endif   /* defined(HAVE_PRI) */
04621 #if defined(HAVE_SS7)
04622       case SIG_SS7:
04623 #endif   /* defined(HAVE_SS7) */
04624          {
04625             int x = 1;
04626 
04627             res = ioctl(p->subs[SUB_REAL].dfd, DAHDI_AUDIOMODE, &x);
04628             if (res)
04629                ast_log(LOG_WARNING,
04630                   "Unable to enable audio mode on channel %d (%s)\n",
04631                   p->channel, strerror(errno));
04632          }
04633          break;
04634       default:
04635          break;
04636       }
04637 #endif   /* defined(HAVE_PRI) || defined(HAVE_SS7) */
04638       res = ioctl(p->subs[SUB_REAL].dfd, DAHDI_ECHOCANCEL_PARAMS, &p->echocancel);
04639       if (res) {
04640          ast_log(LOG_WARNING, "Unable to enable echo cancellation on channel %d (%s)\n", p->channel, strerror(errno));
04641       } else {
04642          p->echocanon = 1;
04643          ast_debug(1, "Enabled echo cancellation on channel %d\n", p->channel);
04644       }
04645    } else
04646       ast_debug(1, "No echo cancellation requested\n");
04647 }

void dahdi_master_slave_link ( struct dahdi_pvt slave,
struct dahdi_pvt master 
)

Definition at line 6943 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().

06944 {
06945    int x;
06946    if (!slave || !master) {
06947       ast_log(LOG_WARNING, "Tried to link to/from NULL??\n");
06948       return;
06949    }
06950    for (x = 0; x < MAX_SLAVES; x++) {
06951       if (!master->slaves[x]) {
06952          master->slaves[x] = slave;
06953          break;
06954       }
06955    }
06956    if (x >= MAX_SLAVES) {
06957       ast_log(LOG_WARNING, "Replacing slave %d with new slave, %d\n", master->slaves[MAX_SLAVES - 1]->channel, slave->channel);
06958       master->slaves[MAX_SLAVES - 1] = slave;
06959    }
06960    if (slave->master)
06961       ast_log(LOG_WARNING, "Replacing master %d with new master, %d\n", slave->master->channel, master->channel);
06962    slave->master = master;
06963 
06964    ast_debug(1, "Making %d slave to master %d at %d\n", slave->channel, master->channel, x);
06965 }

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

Definition at line 6887 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().

06888 {
06889    /* Unlink a specific slave or all slaves/masters from a given master */
06890    int x;
06891    int hasslaves;
06892    if (!master)
06893       return;
06894    if (needlock) {
06895       ast_mutex_lock(&master->lock);
06896       if (slave) {
06897          while (ast_mutex_trylock(&slave->lock)) {
06898             DEADLOCK_AVOIDANCE(&master->lock);
06899          }
06900       }
06901    }
06902    hasslaves = 0;
06903    for (x = 0; x < MAX_SLAVES; x++) {
06904       if (master->slaves[x]) {
06905          if (!slave || (master->slaves[x] == slave)) {
06906             /* Take slave out of the conference */
06907             ast_debug(1, "Unlinking slave %d from %d\n", master->slaves[x]->channel, master->channel);
06908             conf_del(master, &master->slaves[x]->subs[SUB_REAL], SUB_REAL);
06909             conf_del(master->slaves[x], &master->subs[SUB_REAL], SUB_REAL);
06910             master->slaves[x]->master = NULL;
06911             master->slaves[x] = NULL;
06912          } else
06913             hasslaves = 1;
06914       }
06915       if (!hasslaves)
06916          master->inconference = 0;
06917    }
06918    if (!slave) {
06919       if (master->master) {
06920          /* Take master out of the conference */
06921          conf_del(master->master, &master->subs[SUB_REAL], SUB_REAL);
06922          conf_del(master, &master->master->subs[SUB_REAL], SUB_REAL);
06923          hasslaves = 0;
06924          for (x = 0; x < MAX_SLAVES; x++) {
06925             if (master->master->slaves[x] == master)
06926                master->master->slaves[x] = NULL;
06927             else if (master->master->slaves[x])
06928                hasslaves = 1;
06929          }
06930          if (!hasslaves)
06931             master->master->inconference = 0;
06932       }
06933       master->master = NULL;
06934    }
06935    dahdi_conf_update(master);
06936    if (needlock) {
06937       if (slave)
06938          ast_mutex_unlock(&slave->lock);
06939       ast_mutex_unlock(&master->lock);
06940    }
06941 }

static int dahdi_sig_pri_lib_handles ( int  signaling  )  [inline, static]

Definition at line 749 of file chan_dahdi.h.

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

00750 {
00751    int handles;
00752 
00753    switch (signaling) {
00754    case SIG_PRI_LIB_HANDLE_CASES:
00755       handles = 1;
00756       break;
00757    default:
00758       handles = 0;
00759       break;
00760    }
00761 
00762    return handles;
00763 }


Variable Documentation

const char* const subnames[]

Definition at line 746 of file chan_dahdi.c.

Referenced by native_start().


Generated on Thu Apr 16 06:29:35 2015 for Asterisk - The Open Source Telephony Project by  doxygen 1.5.6