57#if defined(__NetBSD__) || defined(__FreeBSD__)
60#include <sys/sysmacros.h>
76#error "Upgrade your libpri"
82#if !defined(LIBSS7_ABI_COMPATIBILITY)
83#error "Upgrade your libss7"
84#elif LIBSS7_ABI_COMPATIBILITY != 2
85#error "Your installed libss7 is not compatible"
89#if defined(HAVE_OPENR2)
91#define SIG_MFCR2_MAX_CHANNELS 672
603#define SMDI_MD_WAIT_TIMEOUT 1500
606"0 db (CSU)/0-133 feet (DSX-1)",
607"133-266 feet (DSX-1)",
608"266-399 feet (DSX-1)",
609"399-533 feet (DSX-1)",
610"533-655 feet (DSX-1)",
622 .resync_threshold = 1000,
640#define DEFAULT_CIDRINGS 1
642#define AST_LAW(p) (((p)->law == DAHDI_LAW_ALAW) ? ast_format_alaw : ast_format_ulaw)
646#define NEED_MFDETECT(p) (((p)->sig == SIG_FEATDMF) || ((p)->sig == SIG_FEATDMF_TA) || ((p)->sig == SIG_E911) || ((p)->sig == SIG_FGC_CAMA) || ((p)->sig == SIG_FGC_CAMAMF) || ((p)->sig == SIG_FEATB))
648static const char tdesc[] =
"DAHDI Telephony"
649#if defined(HAVE_PRI) || defined(HAVE_SS7) || defined(HAVE_OPENR2)
651 #if defined(HAVE_PRI)
654 #if defined(HAVE_SS7)
655 #if defined(HAVE_PRI)
660 #if defined(HAVE_OPENR2)
661 #if defined(HAVE_PRI) || defined(HAVE_SS7)
669static const char config[] =
"chan_dahdi.conf";
672#define NUM_SPANS DAHDI_MAX_SPANS
677#define CHAN_PSEUDO -2
679#define CALLPROGRESS_PROGRESS 1
680#define CALLPROGRESS_FAX_OUTGOING 2
681#define CALLPROGRESS_FAX_INCOMING 4
682#define CALLPROGRESS_FAX (CALLPROGRESS_FAX_INCOMING | CALLPROGRESS_FAX_OUTGOING)
684#define NUM_CADENCE_MAX 25
691 { { 125, 125, 2000, 4000 } },
692 { { 250, 250, 500, 1000, 250, 250, 500, 4000 } },
693 { { 125, 125, 125, 125, 125, 4000 } },
694 { { 1000, 500, 2500, 5000 } },
711#define ISTRUNK(p) ((p->sig == SIG_FXSLS) || (p->sig == SIG_FXSKS) || \
712 (p->sig == SIG_FXSGS) || (p->sig == SIG_PRI))
714#define CANBUSYDETECT(p) (ISTRUNK(p) || (p->sig & (SIG_EM | SIG_EM_E1 | SIG_SF)) )
715#define CANPROGRESSDETECT(p) (ISTRUNK(p) || (p->sig & (SIG_EM | SIG_EM_E1 | SIG_SF)) )
722#ifndef HAVE_DAHDI_LINEREVERSE_VMWI
736#define REPORT_CHANNEL_ALARMS 1
737#define REPORT_SPAN_ALARMS 2
741static int pridebugfd = -1;
742static char pridebugfilename[1024] =
"";
776 if (ioctl(fd, DAHDI_GETEVENT, &j) == -1)
785 i = DAHDI_IOMUX_SIGEVENT;
786 if (ioctl(fd, DAHDI_IOMUX, &i) == -1)
788 if (ioctl(fd, DAHDI_GETEVENT, &j) == -1)
796#define MASK_AVAIL (1 << 0)
797#define MASK_INUSE (1 << 1)
799#define CALLWAITING_SILENT_SAMPLES ((300 * 8) / READ_SIZE)
800#define CALLWAITING_REPEAT_SAMPLES ((10000 * 8) / READ_SIZE)
801#define CALLWAITING_SUPPRESS_SAMPLES ((100 * 8) / READ_SIZE)
802#define CIDCW_EXPIRE_SAMPLES ((500 * 8) / READ_SIZE)
803#define MIN_MS_SINCE_FLASH ((2000) )
804#define DEFAULT_RINGT ((8000 * 8) / READ_SIZE)
805#define DEFAULT_DIALTONE_DETECT_TIMEOUT ((10000 * 8) / READ_SIZE)
819static struct dahdi_ss7 linksets[
NUM_SPANS];
821static int cur_ss7type = -1;
822static int cur_slc = -1;
823static int cur_linkset = -1;
824static int cur_pointcode = -1;
825static int cur_cicbeginswith = -1;
826static int cur_adjpointcode = -1;
827static int cur_networkindicator = -1;
828static int cur_defaultdpc = -1;
832struct dahdi_mfcr2_conf {
833 openr2_variant_t variant;
835 int metering_pulse_timeout;
838#if defined(OR2_LIB_INTERFACE) && OR2_LIB_INTERFACE > 2
842#if defined(OR2_LIB_INTERFACE) && OR2_LIB_INTERFACE > 3
843 int dtmf_end_timeout;
845 signed int get_ani_first:2;
846#if defined(OR2_LIB_INTERFACE) && OR2_LIB_INTERFACE > 1
847 signed int skip_category_request:2;
849 unsigned int call_files:1;
850 unsigned int allow_collect_calls:1;
851 unsigned int charge_calls:1;
852 unsigned int accept_on_offer:1;
853 unsigned int forced_release:1;
854 unsigned int double_answer:1;
855 signed int immediate_accept:2;
856#if defined(OR2_LIB_INTERFACE) && OR2_LIB_INTERFACE > 2
857 signed int dtmf_dialing:2;
858 signed int dtmf_detection:2;
860 char logdir[OR2_MAX_PATH];
861 char r2proto_file[OR2_MAX_PATH];
862 openr2_log_level_t loglevel;
863 openr2_calling_party_category_t category;
870 openr2_context_t *protocol_context;
875 struct dahdi_mfcr2_conf
conf;
879 struct dahdi_mfcr2 mfcr2;
887static int r2links_count = 0;
895 int mastertrunkgroup;
902#if defined(HAVE_PRI_CCSS)
904static const char dahdi_pri_cc_type[] =
"DAHDI/PRI";
913#define POLARITY_IDLE 0
914#define POLARITY_REV 1
934static struct dahdi_parms_pseudo {
955 struct dahdi_pri pri;
959 struct dahdi_ss7 ss7;
963 struct dahdi_mfcr2_conf mfcr2;
999 .switchtype = PRI_SWITCH_NI2,
1000 .dialplan = PRI_UNKNOWN + 1,
1001 .localdialplan = PRI_NATIONAL_ISDN + 1,
1002 .nodetype = PRI_CPE,
1005#if defined(HAVE_PRI_CCSS)
1006 .cc_ptmp_recall_mode = 1,
1007 .cc_qsig_signaling_link_req = 1,
1008 .cc_qsig_signaling_link_rsp = 1,
1014 .internationalprefix =
"",
1015 .nationalprefix =
"",
1017 .privateprefix =
"",
1018 .unknownprefix =
"",
1020 .resetinterval = -1,
1023#if defined(HAVE_SS7)
1025 .called_nai = SS7_NAI_NATIONAL,
1026 .calling_nai = SS7_NAI_NATIONAL,
1027 .internationalprefix =
"",
1028 .nationalprefix =
"",
1029 .subscriberprefix =
"",
1030 .unknownprefix =
"",
1031 .networkroutedprefix =
""
1036 .variant = OR2_VAR_ITU,
1037 .mfback_timeout = -1,
1038 .metering_pulse_timeout = -1,
1041 .get_ani_first = -1,
1042#if defined(OR2_LIB_INTERFACE) && OR2_LIB_INTERFACE > 1
1043 .skip_category_request = -1,
1046 .allow_collect_calls = 0,
1048 .accept_on_offer = 1,
1049 .forced_release = 0,
1051 .immediate_accept = -1,
1052#if defined(OR2_LIB_INTERFACE) && OR2_LIB_INTERFACE > 2
1054 .dtmf_detection = -1,
1055 .dtmf_time_on = OR2_DEFAULT_DTMF_ON,
1056 .dtmf_time_off = OR2_DEFAULT_DTMF_OFF,
1058#if defined(OR2_LIB_INTERFACE) && OR2_LIB_INTERFACE > 3
1059 .dtmf_end_timeout = -1,
1063 .loglevel = OR2_LOG_ERROR | OR2_LOG_WARNING,
1064 .category = OR2_CALLING_PARTY_CATEGORY_NATIONAL_SUBSCRIBER
1068 .context =
"default",
1073 .mohinterpret =
"default",
1076 .transfertobusy = 1,
1079 .ani_info_digits = 2,
1080 .ani_wink_time = 1000,
1081 .ani_timeout = 10000,
1085 .dahditrcallerid = 0,
1094 .echocancel.head.tap_length = 1,
1102#ifdef HAVE_DAHDI_LINEREVERSE_VMWI
1105 .polarityonanswerdelay = 600,
1109 .buf_policy = DAHDI_POLICY_IMMEDIATE,
1128 .ignore_failed_channels = 1,
1129 .smdi_port =
"/dev/ttyS0",
1138 const char *
data,
int *cause);
1159 .description =
tdesc,
1180#define GET_CHANNEL(p) ((p)->channel)
1237 return DAHDI_TONE_RINGTONE;
1239 return DAHDI_TONE_STUTTER;
1241 return DAHDI_TONE_CONGESTION;
1243 return DAHDI_TONE_DIALTONE;
1245 return DAHDI_TONE_DIALRECALL;
1247 return DAHDI_TONE_INFO;
1257 switch (analogsub) {
1286 struct doomed_pri *
entry;
1292 ast_debug(4,
"Destroying span %d from doomed queue.\n",
1294 pri_destroy_span(
entry->pri);
1313static void pri_queue_for_destruction(
struct sig_pri_span *pri)
1315 struct doomed_pri *
entry;
1319 if (
entry->pri == pri) {
1332 ast_debug(4,
"Queue span %d for destruction.\n", pri->
span);
1355 struct dahdi_dialoperation zo = {
1361 for (offset = 0; offset <
sizeof(zo.dialstr) - 1; ++offset) {
1368 if (offset >=
sizeof(zo.dialstr) - 3) {
1372 zo.dialstr[offset] =
'w';
1374 zo.dialstr[offset] =
'w';
1377 zo.dialstr[offset] = *pos++;
1381 ast_debug(1,
"Channel %d: Dial str '%s' expanded to '%s' sent to DAHDI_DIAL.\n",
1382 pvt->
channel, dial_str, zo.dialstr);
1433 struct pollfd poller;
1437 unsigned char buf[256];
1442 poller.events = POLLPRI | POLLIN;
1445 res = poll(&poller, 1, timeout);
1447 if (poller.revents & POLLPRI) {
1452 if (poller.revents & POLLIN) {
1464 if (analog_p->
ringt > 0) {
1465 if (!(--analog_p->
ringt)) {
1528 unsigned char buf[256];
1536 int checkaftercid = 0;
1537 const char *matched_context;
1541 if (ringdata ==
NULL) {
1542 ringdata = curRingData;
1550 for (receivedRingT = 0; receivedRingT <
RING_PATTERNS; receivedRingT++)
1551 ringdata[receivedRingT] = 0;
1555 ast_verb(3,
"Detecting post-CID distinctive ring\n");
1559 i = DAHDI_IOMUX_READ | DAHDI_IOMUX_SIGEVENT;
1560 res = ioctl(p->
subs[idx].
dfd, DAHDI_IOMUX, &i);
1566 if (i & DAHDI_IOMUX_SIGEVENT) {
1569 if (res == DAHDI_EVENT_NOALARM) {
1572 }
else if (res == DAHDI_EVENT_RINGOFFHOOK) {
1574 ringdata[receivedRingT] = analog_p->
ringt;
1585 }
else if (i & DAHDI_IOMUX_READ) {
1588 if (
errno != ELAST) {
1595 if (analog_p->
ringt > 0) {
1596 if (!(--analog_p->
ringt)) {
1605 ast_verb(3,
"Detected ring pattern: %d,%d,%d\n", ringdata[0], ringdata[1], ringdata[2]);
1607 for (counter = 0; counter < 3; counter++) {
1611 ast_verb(3,
"Checking %d,%d,%d with +/- %d range\n",
1616 for (counter1 = 0; counter1 < 3; counter1++) {
1620 ast_verb(3,
"Pattern ignore (-1) detected, so matching pattern %d regardless.\n",
1621 ringdata[counter1]);
1623 }
else if (ring - range <= ringdata[counter1] && ringdata[counter1] <= ring + range) {
1624 ast_verb(3,
"Ring pattern %d is in range: %d to %d\n",
1625 ringdata[counter1], ring - range, ring + range);
1633 if (distMatches == 3) {
1636 ast_verb(3,
"Matched Distinctive Ring context %s\n", matched_context);
1642 if (strcmp(p->
context, matched_context) != 0) {
1730 ast_verb(3,
"CPE supports Call Waiting Caller*ID. Sending '%s/%s'\n",
1806 ast_log(
LOG_ERROR,
"We used a sub other than SUB_REAL (incorrect assumption sir)\n");
1823 ast_debug(1,
"%s DTMF digit: 0x%02X '%c' on %s\n",
1833 struct dahdi_bufferinfo bi = {
1840 if ((res = ioctl(p->
subs[idx].
dfd, DAHDI_SET_BUFINFO, &bi)) < 0) {
1878 ast_debug(1,
"Already in a fax extension, not redirecting\n");
1887 *dest = &p->
subs[idx].
f;
1917 if (!channel_string) {
1927 "DAHDIGroup: %llu\r\n"
1929 "DAHDIChannel: %s\r\n",
1950 "channel", dahdi_channel);
1974 snprintf(ch_name,
sizeof(ch_name),
"no-media (%d)", p->
channel);
1977 strcpy(ch_name,
"pseudo");
1980 snprintf(ch_name,
sizeof(ch_name),
"%d", p->
channel);
1994static void my_ami_channel_event(
void *pvt,
struct ast_channel *chan)
2054 return p->
subs[dahdi_sub].
dfd;
2097#if defined(HAVE_PRI) || defined(HAVE_SS7)
2098static void my_set_digital(
void *pvt,
int is_digital)
2106#if defined(HAVE_SS7)
2107static void my_set_inservice(
void *pvt,
int is_inservice)
2115#if defined(HAVE_SS7)
2116static void my_set_locallyblocked(
void *pvt,
int is_blocked)
2124#if defined(HAVE_SS7)
2125static void my_set_remotelyblocked(
void *pvt,
int is_blocked)
2238 p->
owner = new_owner;
2289 for (i = 0; i < 3; i++) {
2326 int needconf = needconference;
2433#if defined(HAVE_PRI) || defined(HAVE_SS7)
2434static int dahdi_setlaw(
int dfd,
int law)
2437 res = ioctl(dfd, DAHDI_SETLAW, &
law);
2444#if defined(HAVE_PRI)
2483 newlaw = DAHDI_LAW_ALAW;
2486 newlaw = DAHDI_LAW_MULAW;
2496#if defined(HAVE_PRI) || defined(HAVE_SS7)
2504static void my_pri_ss7_open_media(
void *p)
2515 res = ioctl(dfd, DAHDI_AUDIOMODE, &set_val);
2522 res = dahdi_setlaw(dfd, pvt->
law);
2544#if defined(HAVE_PRI)
2555static void my_pri_dial_digits(
void *p,
const char *dial_string)
2557 char dial_str[DAHDI_MAX_DTMF_BUF];
2561 snprintf(dial_str,
sizeof(dial_str),
"T%s", dial_string);
2611 case DAHDI_EVENT_ONHOOK:
2614 case DAHDI_EVENT_RINGOFFHOOK:
2617 case DAHDI_EVENT_WINKFLASH:
2620 case DAHDI_EVENT_ALARM:
2623 case DAHDI_EVENT_NOALARM:
2626 case DAHDI_EVENT_DIALCOMPLETE:
2629 case DAHDI_EVENT_RINGERON:
2632 case DAHDI_EVENT_RINGEROFF:
2635 case DAHDI_EVENT_HOOKCOMPLETE:
2638 case DAHDI_EVENT_PULSE_START:
2641 case DAHDI_EVENT_POLARITY:
2644 case DAHDI_EVENT_RINGBEGIN:
2647 case DAHDI_EVENT_EC_DISABLED:
2650 case DAHDI_EVENT_REMOVED:
2653 case DAHDI_EVENT_NEONMWI_ACTIVE:
2656 case DAHDI_EVENT_NEONMWI_INACTIVE:
2659#ifdef HAVE_DAHDI_ECHOCANCEL_FAX_MODE
2660 case DAHDI_EVENT_TX_CED_DETECTED:
2663 case DAHDI_EVENT_RX_CED_DETECTED:
2666 case DAHDI_EVENT_EC_NLP_DISABLED:
2669 case DAHDI_EVENT_EC_NLP_ENABLED:
2673 case DAHDI_EVENT_PULSEDIGIT:
2676 case DAHDI_EVENT_DTMFDOWN:
2679 case DAHDI_EVENT_DTMFUP:
2683 switch(
event & 0xFFFF0000) {
2684 case DAHDI_EVENT_PULSEDIGIT:
2685 case DAHDI_EVENT_DTMFDOWN:
2686 case DAHDI_EVENT_DTMFUP:
2728 struct dahdi_params par;
2730 memset(&par, 0,
sizeof(par));
2737 par.rxisoffhook = 0;
2747 return (par.rxbits > -1) || par.rxisoffhook;
2750 return par.rxisoffhook;
2777 int func = DAHDI_FLASH;
2845 struct dahdi_params dahdip;
2853 memset(&dahdip, 0,
sizeof(dahdip));
2860 if (!(dahdip.sigtype & __DAHDI_SIG_FXO)) {
2883 snprintf(buffer, buflen,
"%d", pvt->
polarity);
2898 if (!strcasecmp(
value,
"idle")) {
2900 }
else if (!strcasecmp(
value,
"reverse")) {
2924 int x = DAHDI_START;
2939 ast_log(
LOG_ERROR,
"Trying to dial_digits '%s' on channel %d subchannel %u\n",
2966 if (ioctl(p->
subs[index].
dfd, DAHDI_DIALING, &x)) {
2967 ast_debug(1,
"DAHDI_DIALING ioctl failed!\n");
2980#if defined(HAVE_PRI)
2981static void my_pri_fixup_chans(
void *chan_old,
void *chan_new)
2988 if (new_chan->
owner) {
2995 new_chan->
dsp = old_chan->
dsp;
3009 new_chan->
law = old_chan->
law;
3014#if defined(HAVE_PRI)
3015static int sig_pri_tone_to_dahditone(
enum sig_pri_tone tone)
3019 return DAHDI_TONE_RINGTONE;
3021 return DAHDI_TONE_STUTTER;
3023 return DAHDI_TONE_CONGESTION;
3025 return DAHDI_TONE_DIALTONE;
3027 return DAHDI_TONE_DIALRECALL;
3029 return DAHDI_TONE_INFO;
3031 return DAHDI_TONE_BUSY;
3038#if defined(HAVE_PRI)
3039static void my_handle_dchan_exception(
struct sig_pri_span *pri,
int index)
3043 ioctl(pri->
fds[index], DAHDI_GETEVENT, &x);
3045 case DAHDI_EVENT_NONE:
3047 case DAHDI_EVENT_ALARM:
3048 case DAHDI_EVENT_NOALARM:
3060 case DAHDI_EVENT_ALARM:
3063 case DAHDI_EVENT_NOALARM:
3066 case DAHDI_EVENT_REMOVED:
3067 pri_queue_for_destruction(pri);
3075#if defined(HAVE_PRI)
3076static int my_pri_play_tone(
void *pvt,
enum sig_pri_tone tone)
3080 return tone_zone_play_tone(p->
subs[
SUB_REAL].
dfd, sig_pri_tone_to_dahditone(tone));
3084#if defined(HAVE_PRI) || defined(HAVE_SS7)
3093static void my_set_callerid(
void *pvt,
const struct ast_party_caller *caller)
3108 if (caller->
id.
tag) {
3113 sizeof(p->cid_ani));
3118#if defined(HAVE_PRI) || defined(HAVE_SS7)
3127static void my_set_dnid(
void *pvt,
const char *
dnid)
3135#if defined(HAVE_PRI)
3144static void my_set_rdnis(
void *pvt,
const char *
rdnis)
3152#if defined(HAVE_PRI)
3179static void my_pri_make_cc_dialstring(
void *priv,
char *
buf,
size_t buf_size)
3200 snprintf(
buf, buf_size,
"%s/i%d-",
args.tech, pvt->pri->span);
3203 if (isdigit(
args.group[0]) ||
args.group[0] ==
'i' || strchr(
args.group,
'!')) {
3210 snprintf(
buf, buf_size,
"%s/i%d-%s",
args.tech, pvt->pri->span,
args.group);
3214#if defined(HAVE_PRI)
3224static void dahdi_pri_update_span_devstate(
struct sig_pri_span *pri)
3227 unsigned num_b_chans;
3236 for (idx = pri->
numchans; idx--;) {
3260#if defined(THRESHOLD_DEVSTATE_PLACEHOLDER)
3264 }
else if (!in_use) {
3266 }
else if (!pri->user_busy_threshold) {
3272 if (pri->threshold_devstate != new_state) {
3273 pri->threshold_devstate = new_state;
3280#if defined(HAVE_PRI)
3286static void my_module_ref(
void)
3292#if defined(HAVE_PRI)
3298static void my_module_unref(
void)
3304#if defined(HAVE_PRI)
3305#if defined(HAVE_PRI_CALL_WAITING)
3306static void my_pri_init_config(
void *priv,
struct sig_pri_span *pri);
3308static int dahdi_new_pri_nobch_channel(
struct sig_pri_span *pri);
3313 .play_tone = my_pri_play_tone,
3319 .new_ast_channel = my_new_pri_ast_channel,
3320 .fixup_chans = my_pri_fixup_chans,
3324 .set_digital = my_set_digital,
3325 .set_callerid = my_set_callerid,
3326 .set_dnid = my_set_dnid,
3327 .set_rdnis = my_set_rdnis,
3328 .new_nobch_intf = dahdi_new_pri_nobch_channel,
3329#if defined(HAVE_PRI_CALL_WAITING)
3330 .init_config = my_pri_init_config,
3333 .make_cc_dialstring = my_pri_make_cc_dialstring,
3334 .update_span_devstate = dahdi_pri_update_span_devstate,
3335 .module_ref = my_module_ref,
3336 .module_unref = my_module_unref,
3337 .dial_digits = my_pri_dial_digits,
3338 .open_media = my_pri_ss7_open_media,
3339 .ami_channel_event = my_ami_channel_event,
3340 .destroy_later = pri_queue_for_destruction,
3344#if defined(HAVE_SS7)
3353static void my_handle_link_exception(
struct sig_ss7_linkset *linkset,
int which)
3357 if (ioctl(linkset->
fds[which], DAHDI_GETEVENT, &
event)) {
3359 linkset->
span, which);
3363 case DAHDI_EVENT_NONE:
3365 case DAHDI_EVENT_ALARM:
3370 case DAHDI_EVENT_NOALARM:
3383#if defined(HAVE_SS7)
3384static void my_ss7_set_loopback(
void *pvt,
int enable)
3395#if defined(HAVE_SS7)
3415 if (linksets[idx].
ss7.ss7 ==
ss7) {
3416 return &linksets[idx].ss7;
3423#if defined(HAVE_SS7)
3466 newlaw = DAHDI_LAW_ALAW;
3469 newlaw = DAHDI_LAW_MULAW;
3476#if defined(HAVE_SS7)
3477static int sig_ss7_tone_to_dahditone(
enum sig_ss7_tone tone)
3481 return DAHDI_TONE_RINGTONE;
3483 return DAHDI_TONE_STUTTER;
3485 return DAHDI_TONE_CONGESTION;
3487 return DAHDI_TONE_DIALTONE;
3489 return DAHDI_TONE_DIALRECALL;
3491 return DAHDI_TONE_INFO;
3493 return DAHDI_TONE_BUSY;
3500#if defined(HAVE_SS7)
3501static int my_ss7_play_tone(
void *pvt,
enum sig_ss7_tone tone)
3505 return tone_zone_play_tone(p->
subs[
SUB_REAL].
dfd, sig_ss7_tone_to_dahditone(tone));
3509#if defined(HAVE_SS7)
3517 .set_loopback = my_ss7_set_loopback,
3519 .new_ast_channel = my_new_ss7_ast_channel,
3520 .play_tone = my_ss7_play_tone,
3522 .handle_link_exception = my_handle_link_exception,
3526 .set_digital = my_set_digital,
3527 .set_inservice = my_set_inservice,
3528 .set_locallyblocked = my_set_locallyblocked,
3529 .set_remotelyblocked = my_set_remotelyblocked,
3530 .set_callerid = my_set_callerid,
3531 .set_dnid = my_set_dnid,
3532 .open_media = my_pri_ss7_open_media,
3533 .find_linkset = my_ss7_find_linkset,
3603#define gen_pvt_field_callback(type, field) \
3604 static type my_get_##field(void *pvt) \
3606 struct dahdi_pvt *p = pvt; \
3614#undef gen_pvt_field_callback
3684 .get_firstdigit_timeout = my_get_firstdigit_timeout,
3685 .get_matchdigit_timeout = my_get_matchdigit_timeout,
3686 .get_interdigit_timeout = my_get_interdigit_timeout,
3705 "Unable to get index for '%s' on channel %d (%s(), line %lu)\n",
3798#if defined(HAVE_PRI)
3813static void mfcr2_queue_for_destruction(
const struct dahdi_pvt *p)
3815 const struct dahdi_mfcr2 *r2link = p->mfcr2;
3816 struct r2link_entry *cur;
3819 if (r2link == &cur->mfcr2) {
3829static int dahdi_r2_answer(
struct dahdi_pvt *p)
3835#if defined(OR2_LIB_INTERFACE) && OR2_LIB_INTERFACE > 1
3837 int wants_double_answer =
ast_true(double_answer) ? 1 : 0;
3838 if (!double_answer) {
3841 res = openr2_chan_answer_call(p->r2chan);
3842 }
else if (wants_double_answer) {
3843 res = openr2_chan_answer_call_with_mode(p->r2chan, OR2_ANSWER_DOUBLE);
3845 res = openr2_chan_answer_call_with_mode(p->r2chan, OR2_ANSWER_SIMPLE);
3848 res = openr2_chan_answer_call(p->r2chan);
3856static openr2_calling_party_category_t dahdi_r2_get_channel_category(
struct ast_channel *
c)
3858 openr2_calling_party_category_t cat;
3862 ast_debug(1,
"No MFC/R2 category specified for chan %s, using default %s\n",
3864 return p->mfcr2_category;
3866 if ((cat = openr2_proto_get_category(catstr)) == OR2_CALLING_PARTY_CATEGORY_UNKNOWN) {
3867 ast_log(
LOG_WARNING,
"Invalid category specified '%s' for chan %s, using default %s\n",
3868 catstr,
ast_channel_name(
c), openr2_proto_get_category_string(p->mfcr2_category));
3869 return p->mfcr2_category;
3871 ast_debug(1,
"Using category %s\n", catstr);
3875static void dahdi_r2_on_call_init(openr2_chan_t *r2chan)
3877 struct dahdi_pvt *p = openr2_chan_get_client_data(r2chan);
3886 ast_log(
LOG_ERROR,
"Collision of calls on chan %d detected!.\n", openr2_chan_get_number(r2chan));
3896 p->mfcr2_ani_index =
'\0';
3897 p->mfcr2_dnis_index =
'\0';
3898 p->mfcr2_dnis_matched = 0;
3899 p->mfcr2_answer_pending = 0;
3900 p->mfcr2_call_accepted = 0;
3902 ast_verbose(
"New MFC/R2 call detected on chan %d.\n", openr2_chan_get_number(r2chan));
3905static void dahdi_r2_on_hardware_alarm(openr2_chan_t *r2chan,
int alarm)
3908 struct dahdi_pvt *p = openr2_chan_get_client_data(r2chan);
3913 if (res == DAHDI_ALARM_NOTOPEN) {
3914 mfcr2_queue_for_destruction(p);
3923static void dahdi_r2_on_os_error(openr2_chan_t *r2chan,
int errorcode)
3925 struct dahdi_pvt *p = openr2_chan_get_client_data(r2chan);
3927 ast_log(
LOG_ERROR,
"OS error on chan %d: %s\n", openr2_chan_get_number(r2chan), strerror(errorcode));
3930 if (errorcode == ENODEV) {
3931 struct dahdi_mfcr2 *r2link = p->mfcr2;
3940static void dahdi_r2_on_protocol_error(openr2_chan_t *r2chan, openr2_protocol_error_t reason)
3942 struct dahdi_pvt *p = openr2_chan_get_client_data(r2chan);
3943 ast_log(
LOG_ERROR,
"MFC/R2 protocol error on chan %d: %s\n", openr2_chan_get_number(r2chan), openr2_proto_get_error(reason));
3953static void dahdi_r2_disconnect_call(
struct dahdi_pvt *p, openr2_call_disconnect_cause_t cause)
3955 if (openr2_chan_disconnect_call(p->r2chan, cause)) {
3956 ast_log(
LOG_NOTICE,
"Bad! failed to disconnect call on channel %d with reason %s, hope for the best!\n",
3957 p->
channel, openr2_proto_get_disconnect_string(cause));
3959 openr2_chan_set_idle(p->r2chan);
3966static void dahdi_r2_on_call_offered(openr2_chan_t *r2chan,
const char *ani,
const char *dnis, openr2_calling_party_category_t category)
3972 ast_verbose(
"MFC/R2 call offered on chan %d. ANI = %s, DNIS = %s, Category = %s\n",
3973 openr2_chan_get_number(r2chan), ani ? ani :
"(restricted)", dnis,
3974 openr2_proto_get_category_string(category));
3975 p = openr2_chan_get_client_data(r2chan);
3977 if (!p->mfcr2_allow_collect_calls && category == OR2_CALLING_PARTY_CATEGORY_COLLECT_CALL) {
3979 dahdi_r2_disconnect_call(p, OR2_CAUSE_COLLECT_CALL_REJECTED);
3980 goto dahdi_r2_on_call_offered_cleanup;
3983 p->mfcr2_recvd_category = category;
3986 ast_debug(1,
"No CID allowed in configuration, CID is being cleared!\n");
3991 if (p->
immediate || !openr2_context_get_max_dnis(openr2_chan_get_context(r2chan))) {
3992 ast_debug(1,
"Setting exten => s because of immediate or 0 DNIS configured\n");
3998 ast_log(
LOG_NOTICE,
"MFC/R2 call on channel %d requested non-existent extension '%s' in context '%s'. Rejecting call.\n",
4000 dahdi_r2_disconnect_call(p, OR2_CAUSE_UNALLOCATED_NUMBER);
4001 goto dahdi_r2_on_call_offered_cleanup;
4003 if (!p->mfcr2_accept_on_offer) {
4010 goto dahdi_r2_on_call_offered_cleanup;
4013 dahdi_r2_disconnect_call(p, OR2_CAUSE_OUT_OF_ORDER);
4014 }
else if (p->mfcr2_charge_calls) {
4015 ast_debug(1,
"Accepting MFC/R2 call with charge on chan %d\n", p->
channel);
4016 openr2_chan_accept_call(r2chan, OR2_CALL_WITH_CHARGE);
4018 ast_debug(1,
"Accepting MFC/R2 call with no charge on chan %d\n", p->
channel);
4019 openr2_chan_accept_call(r2chan, OR2_CALL_NO_CHARGE);
4022dahdi_r2_on_call_offered_cleanup:
4026static void dahdi_r2_on_call_end(openr2_chan_t *r2chan)
4028 struct dahdi_pvt *p = openr2_chan_get_client_data(r2chan);
4035static void dahdi_r2_on_call_accepted(openr2_chan_t *r2chan, openr2_call_mode_t mode)
4041 p = openr2_chan_get_client_data(r2chan);
4043 p->mfcr2_call_accepted = 1;
4045 if (OR2_DIR_BACKWARD == openr2_chan_get_direction(r2chan)) {
4046 ast_verbose(
"MFC/R2 call has been accepted on backward channel %d\n", openr2_chan_get_number(r2chan));
4051 if (!p->mfcr2_accept_on_offer) {
4052 openr2_chan_disable_read(r2chan);
4053 if (p->mfcr2_answer_pending) {
4054 ast_debug(1,
"Answering MFC/R2 call after accepting it on chan %d\n", openr2_chan_get_number(r2chan));
4057 goto dahdi_r2_on_call_accepted_cleanup;
4063 openr2_chan_disable_read(r2chan);
4064 goto dahdi_r2_on_call_accepted_cleanup;
4068 dahdi_r2_disconnect_call(p, OR2_CAUSE_OUT_OF_ORDER);
4069 goto dahdi_r2_on_call_accepted_cleanup;
4076 openr2_chan_disable_read(r2chan);
4078dahdi_r2_on_call_accepted_cleanup:
4082static void dahdi_r2_on_call_answered(openr2_chan_t *r2chan)
4084 struct dahdi_pvt *p = openr2_chan_get_client_data(r2chan);
4085 ast_verbose(
"MFC/R2 call has been answered on channel %d\n", openr2_chan_get_number(r2chan));
4089static void dahdi_r2_on_call_read(openr2_chan_t *r2chan,
const unsigned char *
buf,
int buflen)
4094static int dahdi_r2_cause_to_ast_cause(openr2_call_disconnect_cause_t cause)
4097 case OR2_CAUSE_BUSY_NUMBER:
4099 case OR2_CAUSE_NETWORK_CONGESTION:
4101 case OR2_CAUSE_OUT_OF_ORDER:
4103 case OR2_CAUSE_UNALLOCATED_NUMBER:
4105 case OR2_CAUSE_NO_ANSWER:
4107 case OR2_CAUSE_NORMAL_CLEARING:
4109 case OR2_CAUSE_UNSPECIFIED:
4115static void dahdi_r2_on_call_disconnect(openr2_chan_t *r2chan, openr2_call_disconnect_cause_t cause)
4117 struct dahdi_pvt *p = openr2_chan_get_client_data(r2chan);
4120 int datalen =
sizeof(*cause_code);
4122 ast_verbose(
"MFC/R2 call disconnected on channel %d\n", openr2_chan_get_number(r2chan));
4127 dahdi_r2_disconnect_call(p, OR2_CAUSE_NORMAL_CLEARING);
4131 snprintf(cause_str,
sizeof(cause_str),
"R2 DISCONNECT (%s)", openr2_proto_get_disconnect_string(cause));
4132 datalen += strlen(cause_str);
4134 memset(cause_code, 0, datalen);
4135 cause_code->
ast_cause = dahdi_r2_cause_to_ast_cause(cause);
4147 }
else if (openr2_chan_get_direction(r2chan) == OR2_DIR_FORWARD) {
4150 case OR2_CAUSE_BUSY_NUMBER:
4153 case OR2_CAUSE_NETWORK_CONGESTION:
4154 case OR2_CAUSE_OUT_OF_ORDER:
4155 case OR2_CAUSE_UNALLOCATED_NUMBER:
4156 case OR2_CAUSE_NO_ANSWER:
4157 case OR2_CAUSE_UNSPECIFIED:
4158 case OR2_CAUSE_NORMAL_CLEARING:
4173static void dahdi_r2_write_log(openr2_log_level_t level,
char *logmessage)
4176 case OR2_LOG_NOTICE:
4179 case OR2_LOG_WARNING:
4185 case OR2_LOG_STACK_TRACE:
4186 case OR2_LOG_MF_TRACE:
4187 case OR2_LOG_CAS_TRACE:
4189 case OR2_LOG_EX_DEBUG:
4199static void dahdi_r2_on_line_blocked(openr2_chan_t *r2chan)
4201 struct dahdi_pvt *p = openr2_chan_get_client_data(r2chan);
4205 ast_log(
LOG_NOTICE,
"Far end blocked on chan %d\n", openr2_chan_get_number(r2chan));
4208static void dahdi_r2_on_line_idle(openr2_chan_t *r2chan)
4210 struct dahdi_pvt *p = openr2_chan_get_client_data(r2chan);
4214 ast_log(
LOG_NOTICE,
"Far end unblocked on chan %d\n", openr2_chan_get_number(r2chan));
4217static void dahdi_r2_on_context_log(openr2_context_t *r2context, openr2_log_level_t level,
const char *fmt, va_list ap)
4218 __attribute__((format (printf, 3, 0)));
4219static void dahdi_r2_on_context_log(openr2_context_t *r2context, openr2_log_level_t level,
const char *fmt, va_list ap)
4221#define CONTEXT_TAG "Context - "
4223 char completemsg[
sizeof(
logmsg) * 2];
4225 snprintf(completemsg,
sizeof(completemsg), CONTEXT_TAG
"%s",
logmsg);
4226 dahdi_r2_write_log(level, completemsg);
4230static void dahdi_r2_on_chan_log(openr2_chan_t *r2chan, openr2_log_level_t level,
const char *fmt, va_list ap)
4231 __attribute__((format (printf, 3, 0)));
4232static void dahdi_r2_on_chan_log(openr2_chan_t *r2chan, openr2_log_level_t level,
const char *fmt, va_list ap)
4234#define CHAN_TAG "Chan "
4236 char completemsg[
sizeof(
logmsg) * 2];
4238 snprintf(completemsg,
sizeof(completemsg), CHAN_TAG
"%d - %s", openr2_chan_get_number(r2chan),
logmsg);
4239 dahdi_r2_write_log(level, completemsg);
4243static int dahdi_r2_on_dnis_digit_received(openr2_chan_t *r2chan,
char digit)
4245 struct dahdi_pvt *p = openr2_chan_get_client_data(r2chan);
4252 p->mfcr2_dnis_index++;
4253 p->
exten[p->mfcr2_dnis_index] = 0;
4254 p->
rdnis[p->mfcr2_dnis_index] = 0;
4256 if ((p->mfcr2_dnis_matched ||
4265static void dahdi_r2_on_ani_digit_received(openr2_chan_t *r2chan,
char digit)
4267 struct dahdi_pvt *p = openr2_chan_get_client_data(r2chan);
4270 p->mfcr2_ani_index++;
4271 p->
cid_num[p->mfcr2_ani_index] = 0;
4272 p->
cid_name[p->mfcr2_ani_index] = 0;
4275static void dahdi_r2_on_billing_pulse_received(openr2_chan_t *r2chan)
4277 ast_verbose(
"MFC/R2 billing pulse received on channel %d\n", openr2_chan_get_number(r2chan));
4280static openr2_event_interface_t dahdi_r2_event_iface = {
4281 .on_call_init = dahdi_r2_on_call_init,
4282 .on_call_offered = dahdi_r2_on_call_offered,
4283 .on_call_accepted = dahdi_r2_on_call_accepted,
4284 .on_call_answered = dahdi_r2_on_call_answered,
4285 .on_call_disconnect = dahdi_r2_on_call_disconnect,
4286 .on_call_end = dahdi_r2_on_call_end,
4287 .on_call_read = dahdi_r2_on_call_read,
4288 .on_hardware_alarm = dahdi_r2_on_hardware_alarm,
4289 .on_os_error = dahdi_r2_on_os_error,
4290 .on_protocol_error = dahdi_r2_on_protocol_error,
4291 .on_line_blocked = dahdi_r2_on_line_blocked,
4292 .on_line_idle = dahdi_r2_on_line_idle,
4294 .on_context_log = (openr2_handle_context_logging_func)dahdi_r2_on_context_log,
4295 .on_dnis_digit_received = dahdi_r2_on_dnis_digit_received,
4296 .on_ani_digit_received = dahdi_r2_on_ani_digit_received,
4298 .on_billing_pulse_received = dahdi_r2_on_billing_pulse_received
4301static inline int16_t dahdi_r2_alaw_to_linear(uint8_t sample)
4306static inline uint8_t dahdi_r2_linear_to_alaw(
int sample)
4311static openr2_transcoder_interface_t dahdi_r2_transcode_iface = {
4312 dahdi_r2_alaw_to_linear,
4313 dahdi_r2_linear_to_alaw
4354 for (
x = 0;
x < strlen(fn);
x++) {
4355 if (!isdigit(fn[
x])) {
4366 fn =
"/dev/dahdi/channel";
4368 fd = open(fn, O_RDWR | O_NONBLOCK);
4374 if (ioctl(fd, DAHDI_SPECIFY, &chan)) {
4383 if (ioctl(fd, DAHDI_SET_BLOCKSIZE, &
bs) == -1) {
4402 chan_pvt->
subs[sub_num].
dfd = -1;
4405#if defined(HAVE_PRI)
4406static void dahdi_close_pri_fd(
struct dahdi_pri *pri,
int fd_num)
4409 pri->pri.fds[fd_num] = -1;
4413#if defined(HAVE_SS7)
4414static void dahdi_close_ss7_fd(
struct dahdi_ss7 *ss7,
int fd_num)
4417 ss7->ss7.fds[fd_num] = -1;
4423 return ioctl(dfd, DAHDI_SETLINEAR, &linear);
4429 struct dahdi_bufferinfo bi;
4442 res = ioctl(p->
subs[x].
dfd, DAHDI_GET_BUFINFO, &bi);
4447 res = ioctl(p->
subs[x].
dfd, DAHDI_SET_BUFINFO, &bi);
4484 return DAHDI_TONE_DTMF_BASE + (
digit -
'0');
4486 return DAHDI_TONE_DTMF_A + (
digit -
'A');
4488 return DAHDI_TONE_DTMF_A + (
digit -
'a');
4489 else if (
digit ==
'*')
4490 return DAHDI_TONE_DTMF_s;
4491 else if (
digit ==
'#')
4492 return DAHDI_TONE_DTMF_p;
4531 char dial_str[] = {
'T',
digit,
'\0' };
4542 dtmf = DAHDI_FLUSH_WRITE;
4545 ast_log(
LOG_WARNING,
"Unable to flush the DAHDI write buffer to send DTMF on channel %d: %s\n",
4549 ast_debug(1,
"Channel %s started VLDTMF digit '%c'\n",
4584 ast_debug(1,
"Channel %s ending VLDTMF digit '%c'\n",
4610 "Hook Transition Complete",
4615 "Polarity Reversal",
4623 { DAHDI_ALARM_RED,
"Red Alarm" },
4624 { DAHDI_ALARM_YELLOW,
"Yellow Alarm" },
4625 { DAHDI_ALARM_BLUE,
"Blue Alarm" },
4626 { DAHDI_ALARM_RECOVER,
"Recovering" },
4627 { DAHDI_ALARM_LOOPBACK,
"Loopback" },
4628 { DAHDI_ALARM_NOTOPEN,
"Not Open" },
4629 { DAHDI_ALARM_NONE,
"None" },
4639 return alm ?
"Unknown Alarm" :
"No Alarm";
4644 static char buf[256];
4653 static char buf[256];
4656 return "E & M Immediate";
4658 return "E & M Wink";
4662 return "Feature Group D (DTMF)";
4664 return "Feature Group D (MF)";
4666 return "Feature Group D (MF) Tandem Access";
4668 return "Feature Group B (MF)";
4672 return "FGC/CAMA (Dialpulse)";
4674 return "FGC/CAMA (MF)";
4676 return "FXS Loopstart";
4678 return "FXS Groundstart";
4680 return "FXS Kewlstart";
4682 return "FXO Loopstart";
4684 return "FXO Groundstart";
4686 return "FXO Kewlstart";
4690 return "ISDN BRI Point to Point";
4692 return "ISDN BRI Point to MultiPoint";
4698 return "SF (Tone) Immediate";
4700 return "SF (Tone) Wink";
4702 return "SF (Tone) with Feature Group D (DTMF)";
4704 return "SF (Tone) with Feature Group D (MF)";
4706 return "SF (Tone) with Feature Group B (MF)";
4710 snprintf(
buf,
sizeof(
buf),
"Unknown signalling %d", sig);
4715#define sig2str dahdi_sig2str
4721 struct dahdi_confinfo zi;
4723 memset(&zi, 0,
sizeof(zi));
4726 if (slavechannel > 0) {
4728 zi.confmode = DAHDI_CONF_DIGITALMON;
4729 zi.confno = slavechannel;
4733 zi.confmode = DAHDI_CONF_REALANDPSEUDO | DAHDI_CONF_TALKER | DAHDI_CONF_LISTENER |
4734 DAHDI_CONF_PSEUDO_TALKER | DAHDI_CONF_PSEUDO_LISTENER;
4736 zi.confmode = DAHDI_CONF_CONF | DAHDI_CONF_TALKER | DAHDI_CONF_LISTENER;
4739 if ((zi.confno ==
c->curconf.confno) && (zi.confmode ==
c->curconf.confmode))
4743 if (ioctl(
c->dfd, DAHDI_SETCONF, &zi)) {
4744 ast_log(
LOG_WARNING,
"Failed to add %d to conference %d/%d: %s\n",
c->dfd, zi.confmode, zi.confno, strerror(
errno));
4747 if (slavechannel < 1) {
4751 ast_debug(1,
"Added %d to conference %d/%d\n",
c->dfd,
c->curconf.confmode,
c->curconf.confno);
4758 if ((p->
channel ==
c->curconf.confno) && (
c->curconf.confmode == DAHDI_CONF_DIGITALMON))
4761 if ((p->
confno > 0) && (p->
confno ==
c->curconf.confno) && (
c->curconf.confmode & DAHDI_CONF_TALKER))
4768 struct dahdi_confinfo zi;
4775 memset(&zi, 0,
sizeof(zi));
4776 if (ioctl(
c->dfd, DAHDI_SETCONF, &zi)) {
4777 ast_log(
LOG_WARNING,
"Failed to drop %d from conference %d/%d: %s\n",
c->dfd,
c->curconf.confmode,
c->curconf.confno, strerror(
errno));
4780 ast_debug(1,
"Removed %d from conference %d/%d\n",
c->dfd,
c->curconf.confmode,
c->curconf.confno);
4781 memcpy(&
c->curconf, &zi,
sizeof(
c->curconf));
4793 for (x = 0; x < 3; x++) {
4801 if (useslavenative) {
4820 else if (slave->
law != p->
law) {
4826 return useslavenative;
4834 struct dahdi_confinfo zi;
4836 memset(&zi, 0,
sizeof(zi));
4852 for (x = 0; x < 3; x++) {
4895 ast_debug(1,
"Updated conferencing on %d, with %d conference users\n", p->
channel, needconf);
4904 ast_debug(1,
"Echo cancellation already on\n");
4908 ast_debug(1,
"Echo cancellation isn't required on digital connection\n");
4912#if defined(HAVE_PRI) || defined(HAVE_SS7)
4914#if defined(HAVE_PRI)
4925#if defined(HAVE_SS7)
4934 "Unable to enable audio mode on channel %d (%s)\n",
4950 ast_debug(1,
"No echo cancellation requested\n");
4966 ast_debug(1,
"No echo training requested\n");
4975 struct dahdi_echocanparams ecp = { .tap_length = 0 };
4990 struct dahdi_hwgain hwgain;
4992 hwgain.newgain = gain * 10.0;
4993 hwgain.tx = tx_direction;
4994 return ioctl(fd, DAHDI_SET_HWGAIN, &hwgain) < 0;
5001 float shallow, steep;
5002 float max = SHRT_MAX;
5004 neg = (sample < 0 ? -1 : 1);
5006 shallow = neg*(
max-
max/drc)+(
float)sample/drc;
5007 if (fabsf(steep) < fabsf(shallow)) {
5018static void fill_txgain(
struct dahdi_gains *g,
float gain,
float drc,
int law)
5023 float linear_gain = pow(10.0, gain / 20.0);
5026 case DAHDI_LAW_ALAW:
5027 for (j = 0; j <
ARRAY_LEN(g->txgain); j++) {
5033 k = (float)k * linear_gain;
5036 }
else if (k < -32768) {
5045 case DAHDI_LAW_MULAW:
5046 for (j = 0; j <
ARRAY_LEN(g->txgain); j++) {
5052 k = (float)k * linear_gain;
5055 }
else if (k < -32768) {
5068static void fill_rxgain(
struct dahdi_gains *g,
float gain,
float drc,
int law)
5072 float linear_gain = pow(10.0, gain / 20.0);
5075 case DAHDI_LAW_ALAW:
5076 for (j = 0; j <
ARRAY_LEN(g->rxgain); j++) {
5082 k = (float)k * linear_gain;
5085 }
else if (k < -32768) {
5094 case DAHDI_LAW_MULAW:
5095 for (j = 0; j <
ARRAY_LEN(g->rxgain); j++) {
5101 k = (float)k * linear_gain;
5104 }
else if (k < -32768) {
5118 struct dahdi_gains g;
5121 memset(&g, 0,
sizeof(g));
5122 res = ioctl(fd, DAHDI_GETGAINS, &g);
5130 return ioctl(fd, DAHDI_SETGAINS, &g);
5135 struct dahdi_gains g;
5138 memset(&g, 0,
sizeof(g));
5139 res = ioctl(fd, DAHDI_GETGAINS, &g);
5147 return ioctl(fd, DAHDI_SETGAINS, &g);
5150static int set_actual_gain(
int fd,
float rxgain,
float txgain,
float rxdrc,
float txdrc,
int law)
5187 res = ioctl(fd, DAHDI_HOOK, &x);
5190 if (
errno == EINPROGRESS)
5204#if defined(HAVE_PRI) || defined(HAVE_SS7)
5206#if defined(HAVE_PRI)
5214#if defined(HAVE_SS7)
5238 struct dahdi_confinfo
c;
5251 memset(&
c, 0,
sizeof(
c));
5252 c.confmode = DAHDI_CONF_NORMAL;
5258 ast_debug(1,
"Disabled conferencing\n");
5272 ast_debug(1,
"Restored conferencing\n");
5305 ast_debug(6,
"MWI manual override active on channel %d: pretending that it should be %s\n",
5336 if (
errno == EAGAIN)
5415#if defined(HAVE_PRI)
5422 subaddr = strchr(p->
exten,
':');
5451 x = DAHDI_FLUSH_READ | DAHDI_FLUSH_WRITE;
5466 (p->
law == DAHDI_LAW_ALAW) ? PRI_LAYER_1_ALAW : PRI_LAYER_1_ULAW);
5472#if defined(HAVE_SS7)
5504 openr2_calling_party_category_t chancat;
5523 chancat = dahdi_r2_get_channel_category(ast);
5524 callres = openr2_chan_make_call(p->r2chan, l, (
c + p->
stripmsd), chancat);
5525 if (-1 == callres) {
5530 p->mfcr2_call_accepted = 0;
5531 p->mfcr2_progress_sent = 0;
5605 }
else if (
iflist == pvt) {
5613 }
else if (
ifend == pvt) {
5624#if defined(HAVE_PRI)
5677#if defined(HAVE_PRI)
5715#if defined(HAVE_PRI)
5723static void dahdi_unlink_pri_pvt(
struct dahdi_pvt *pvt)
5734 for (idx = 0; idx <
pri->numchans; ++idx) {
5745#if defined(HAVE_SS7)
5753static void dahdi_unlink_ss7_pvt(
struct dahdi_pvt *pvt)
5764 for (idx = 0; idx <
ss7->numchans; ++idx) {
5775#if defined(HAVE_OPENR2)
5782static void dahdi_unlink_mfcr2_pvt(
struct dahdi_pvt *pvt)
5785 struct dahdi_mfcr2 *mfcr2;
5786 int should_destroy_link = 0;
5791 openr2_chan_disable_read(pvt->r2chan);
5795 for (idx = 0; idx < mfcr2->numchans; ++idx) {
5796 if (mfcr2->pvts[idx] == pvt) {
5797 ast_debug(1,
"Removing MFC/R2 channel %d from the mfcr2 link\n", pvt->
channel);
5798 mfcr2->pvts[idx] =
NULL;
5799 mfcr2->live_chans--;
5803 if (!mfcr2->live_chans) {
5804 ast_debug(1,
"MFC/R2 link is now empty\n");
5805 should_destroy_link = 1;
5809 if (should_destroy_link) {
5810 ast_debug(1,
"MFC/R2 link is now empty\n");
5811 mfcr2_queue_for_destruction(pvt);
5839#if defined(HAVE_PRI)
5840 dahdi_unlink_pri_pvt(p);
5842#if defined(HAVE_SS7)
5843 dahdi_unlink_ss7_pvt(p);
5845#if defined(HAVE_OPENR2)
5846 dahdi_unlink_mfcr2_pvt(p);
5854#if defined(HAVE_PRI)
5855 case DAHDI_IFLIST_NO_B_CHAN:
5857 dahdi_nobch_extract(p->pri, p);
5868#if defined(HAVE_PRI)
5873#if defined(HAVE_SS7)
5916 for (i = 0; i < 3; i++) {
5928#if defined(HAVE_PRI)
5944#if defined(HAVE_PRI_SERVICE_MESSAGES)
5946 char db_chan_name[20];
5951 snprintf(db_chan_name,
sizeof(db_chan_name),
"%s/%d:%d", dahdi_db, p->
span, chan);
5952 if (!
ast_db_get(db_chan_name, SRVST_DBKEY, db_answer,
sizeof(db_answer))) {
5953 sscanf(db_answer,
"%1c:%30d", &
state, &why);
5963 ast_verb(3,
"Unregistered channel %d\n", chan);
5968#if defined(HAVE_PRI)
5971 if (!pris[
span].dchannels[0]) {
5987#if defined(HAVE_PRI)
5988static char *dahdi_send_keypad_facility_app =
"DAHDISendKeypadFacility";
5990static int dahdi_send_keypad_facility_exec(
struct ast_channel *chan,
const char *digits)
5996 ast_debug(1,
"No digit string sent to application!\n");
6003 ast_debug(1,
"Unable to find technology private\n");
6013#if defined(HAVE_PRI)
6014#if defined(HAVE_PRI_PROG_W_CAUSE)
6015static char *dahdi_send_callrerouting_facility_app =
"DAHDISendCallreroutingFacility";
6017static int dahdi_send_callrerouting_facility_exec(
struct ast_channel *chan,
const char *data)
6030 ast_debug(1,
"No data sent to application!\n");
6034 ast_debug(1,
"Only DAHDI technology accepted!\n");
6039 ast_debug(1,
"Unable to find technology private\n");
6046 ast_debug(1,
"callrerouting attempted on non-ISDN channel %s\n",
6055 ast_log(
LOG_WARNING,
"callrerouting facility requires at least destination number argument\n");
6060 ast_log(
LOG_WARNING,
"Callrerouting Facility without original called number argument\n");
6065 ast_log(
LOG_NOTICE,
"Callrerouting Facility without diversion reason argument, defaulting to unknown\n");
6084#if defined(HAVE_OPENR2)
6085static const char *
const dahdi_accept_r2_call_app =
"DAHDIAcceptR2Call";
6087static int dahdi_accept_r2_call_exec(
struct ast_channel *chan,
const char *data)
6090 openr2_call_mode_t accept_mode;
6091 int res, timeout, maxloops;
6100 ast_debug(1,
"No data sent to application!\n");
6105 ast_debug(1,
"Only DAHDI technology accepted!\n");
6111 ast_debug(1,
"Unable to find technology private!\n");
6119 ast_log(
LOG_WARNING,
"DAHDIAcceptR2Call requires 'yes' or 'no' for the charge parameter\n");
6124 if (!p->mfcr2 || !p->mfcr2call) {
6130 if (p->mfcr2_call_accepted) {
6135 accept_mode =
ast_true(
args.charge) ? OR2_CALL_WITH_CHARGE : OR2_CALL_NO_CHARGE;
6136 if (openr2_chan_accept_call(p->r2chan, accept_mode)) {
6147 while (maxloops > 0) {
6176 if (p->mfcr2_call_accepted) {
6178 ast_debug(1,
"Accepted MFC/R2 call!\n");
6189static openr2_call_disconnect_cause_t dahdi_ast_cause_to_r2_cause(
int cause)
6191 openr2_call_disconnect_cause_t r2cause = OR2_CAUSE_NORMAL_CLEARING;
6196 r2cause = OR2_CAUSE_BUSY_NUMBER;
6201 r2cause = OR2_CAUSE_NETWORK_CONGESTION;
6205 r2cause = OR2_CAUSE_UNALLOCATED_NUMBER;
6210 r2cause = OR2_CAUSE_OUT_OF_ORDER;
6215 r2cause = OR2_CAUSE_NO_ANSWER;
6219 r2cause = OR2_CAUSE_NORMAL_CLEARING;
6222 ast_debug(1,
"ast cause %d resulted in openr2 cause %d/%s\n",
6223 cause, r2cause, openr2_proto_get_disconnect_string(r2cause));
6232 struct dahdi_bufferinfo bi = {
6240 if ((bpres = ioctl(p->
subs[
SUB_REAL].
dfd, DAHDI_SET_BUFINFO, &bi)) < 0) {
6257 struct dahdi_params par;
6285#if defined(HAVE_PRI)
6348#if defined(HAVE_SS7)
6427 ast_debug(1,
"Hangup: channel: %d index = %d, normal = %d, callwait = %d, thirdcall = %d\n",
6444 ast_debug(1,
"Normal call hung up with both three way call and a call waiting call in place?\n");
6447 ast_debug(1,
"We were flipped over to the callwait, moving back and not owning.\n");
6454 ast_debug(1,
"We were in the threeway and have a callwait still. Ditching the threeway.\n");
6460 ast_debug(1,
"Call was complete, setting owner to former third call\n");
6464 ast_debug(1,
"Call was incomplete, setting owner to NULL\n");
6483 ast_debug(1,
"Call was complete, setting owner to former third call\n");
6487 ast_debug(1,
"Call was incomplete, setting owner to NULL\n");
6548 if (p->mfcr2 && p->mfcr2call && openr2_chan_get_direction(p->r2chan) != OR2_DIR_STOPPED) {
6551 if (openr2_chan_get_direction(p->r2chan) == OR2_DIR_BACKWARD && p->mfcr2_forced_release) {
6552 dahdi_r2_disconnect_call(p, OR2_CAUSE_FORCED_RELEASE);
6555 int r2cause_user = r2causestr ? atoi(r2causestr) : 0;
6556 openr2_call_disconnect_cause_t r2cause = r2cause_user ? dahdi_ast_cause_to_r2_cause(r2cause_user)
6558 dahdi_r2_disconnect_call(p, r2cause);
6560 }
else if (p->mfcr2call) {
6586 memset(&par, 0,
sizeof(par));
6591 ast_debug(1,
"Hanging up channel %d, offhook = %d\n", p->
channel, par.rxisoffhook);
6594 if ((par.rxisoffhook) && (!(p->
radio || (p->
oprmode < 0))))
6677 ast_debug(1,
"Channel %d is no longer eligible for reorigination (went back on hook or became in use)\n", p->
channel);
6722#if defined(HAVE_PRI)
6727#if defined(HAVE_SS7)
6734 if (!p->mfcr2_call_accepted) {
6737 p->mfcr2_answer_pending = 1;
6738 if (p->mfcr2_charge_calls) {
6739 ast_debug(1,
"Accepting MFC/R2 call with charge before answering on chan %d\n", p->
channel);
6740 openr2_chan_accept_call(p->r2chan, OR2_CALL_WITH_CHARGE);
6742 ast_debug(1,
"Accepting MFC/R2 call with no charge before answering on chan %d\n", p->
channel);
6743 openr2_chan_accept_call(p->r2chan, OR2_CALL_NO_CHARGE);
6779 int val = DAHDI_TONEDETECT_ON | DAHDI_TONEDETECT_MUTE;
6800 if (!p || !data || (*datalen < 1)) {
6811 *cp = p->
tdd ? 1 : 0;
6825#if defined(HAVE_PRI)
6826#if defined(HAVE_PRI_CCSS)
6854 if (!p || !data || (datalen < 1)) {
6861 scp = (
signed char *) data;
6870 scp = (
signed char *) data;
6908 ast_debug(1,
"Set option TDD MODE, value: %s(%d) on %s\n",
6913 unsigned char mybuf[41000];
6915 int size, res, fd,
len;
6916 struct pollfd fds[1];
6919 memset(
buf, 0x7f,
sizeof(mybuf));
6935 fds[0].events = POLLPRI | POLLOUT;
6937 res = poll(fds, 1, -1);
6943 if (fds[0].revents & POLLPRI)
6945 if (!(fds[0].revents & POLLOUT)) {
6949 res = write(fd,
buf, size);
6951 if (res == -1)
return -1;
6975 ast_debug(1,
"Set option RELAX DTMF, value: %s(%d) on %s\n",
6980#if defined(HAVE_PRI)
7020 ast_debug(1,
"Set Operator Services mode, value: %d on %s/%s\n",
7073 if (!strcasecmp(data,
"rxgain")) {
7077 }
else if (!strcasecmp(data,
"txgain")) {
7081 }
else if (!strcasecmp(data,
"dahdi_channel")) {
7085 }
else if (!strcasecmp(data,
"dahdi_span")) {
7089 }
else if (!strcasecmp(data,
"dahdi_group")) {
7093 }
else if (!strcasecmp(data,
"dahdi_type")) {
7096#if defined(HAVE_OPENR2)
7101#if defined(HAVE_PRI)
7109#if defined(HAVE_SS7)
7120#if defined(HAVE_PRI)
7121#if defined(HAVE_PRI_REVERSE_CHARGE)
7122 }
else if (!strcasecmp(data,
"reversecharge")) {
7135#if defined(HAVE_PRI_SETUP_KEYPAD)
7136 }
else if (!strcasecmp(data,
"keypad_digits")) {
7150 }
else if (!strcasecmp(data,
"no_media_path")) {
7167 }
else if (!strcasecmp(data,
"dialmode")) {
7205 char policy_str[21] =
"";
7207 if ((res = sscanf(parse,
"%30d,%20s", num_buffers, policy_str)) != 2) {
7211 if (*num_buffers < 0) {
7215 if (!strcasecmp(policy_str,
"full")) {
7216 *policy = DAHDI_POLICY_WHEN_FULL;
7217 }
else if (!strcasecmp(policy_str,
"immediate")) {
7218 *policy = DAHDI_POLICY_IMMEDIATE;
7219#if defined(HAVE_DAHDI_HALF_FULL)
7220 }
else if (!strcasecmp(policy_str,
"half")) {
7221 *policy = DAHDI_POLICY_HALF_FULL;
7241 if (!strcasecmp(data,
"buffers")) {
7242 int num_bufs, policy;
7245 struct dahdi_bufferinfo bi = {
7246 .txbufpolicy = policy,
7247 .rxbufpolicy = policy,
7249 .numbufs = num_bufs,
7253 if ((bpres = ioctl(p->
subs[
SUB_REAL].
dfd, DAHDI_SET_BUFINFO, &bi)) < 0) {
7261 }
else if (!strcasecmp(data,
"echocan_mode")) {
7262 if (!strcasecmp(
value,
"on")) {
7266 }
else if (!strcasecmp(
value,
"off")) {
7270#ifdef HAVE_DAHDI_ECHOCANCEL_FAX_MODE
7271 }
else if (!strcasecmp(
value,
"fax")) {
7282 }
else if (!strcasecmp(
value,
"voice")) {
7298 }
else if (!strcasecmp(data,
"dialmode")) {
7309 if (!strcasecmp(
value,
"pulse")) {
7311 }
else if (!strcasecmp(
value,
"dtmf") || !strcasecmp(
value,
"tone")) {
7313 }
else if (!strcasecmp(
value,
"none")) {
7315 }
else if (!strcasecmp(
value,
"both")) {
7322 }
else if (!strcasecmp(data,
"waitfordialtone")) {
7362 if (!slave || (master->
slaves[x] == slave)) {
7403 if (!slave || !master) {
7408 if (!master->
slaves[x]) {
7409 master->
slaves[x] = slave;
7432 if (p->
owner == oldchan) {
7435 for (x = 0; x < 3; x++) {
7445#if defined(HAVE_PRI)
7449#if defined(HAVE_SS7)
7518 ast_verb(3,
"TRANSFERRING %s to %s\n",
7543 struct dahdi_confinfo ci;
7547 memset(&ci, 0,
sizeof(ci));
7556 ast_verb(3,
"Avoiding 3-way call when in an external conference\n");
7570 struct dahdi_spaninfo zi;
7571 struct dahdi_params params;
7573 memset(&zi, 0,
sizeof(zi));
7574 zi.spanno = p->
span;
7577 if (zi.alarms != DAHDI_ALARM_NONE)
7585 memset(¶ms, 0,
sizeof(params));
7586 if ((res = ioctl(p->
subs[
SUB_REAL].
dfd, DAHDI_GET_PARAMS, ¶ms)) >= 0)
7587 return params.chan_alarms;
7591 return DAHDI_ALARM_NONE;
7599 ast_debug(1,
"%s DTMF digit: 0x%02X '%c' on %s\n",
7616 *dest = &p->
subs[idx].
f;
7620 ast_debug(1,
"Got some DTMF, but it's for the CAS\n");
7629 *dest = &p->
subs[idx].
f;
7636 struct dahdi_bufferinfo bi = {
7643 if ((res = ioctl(p->
subs[idx].
dfd, DAHDI_SET_BUFINFO, &bi)) < 0) {
7681 ast_debug(1,
"Already in a fax extension, not redirecting\n");
7690 *dest = &p->
subs[idx].
f;
7700 "Alarm", alarm_txt);
7719 "Alarm", alarm_txt);
7729 const char *alarm_str;
7731#if defined(HAVE_PRI)
7772 p->
subs[idx].
f.
src =
"dahdi_handle_event";
7774 f = &p->
subs[idx].
f;
7784 if (res & (DAHDI_EVENT_PULSEDIGIT | DAHDI_EVENT_DTMFUP)) {
7785 p->
pulsedial = (res & DAHDI_EVENT_PULSEDIGIT) ? 1 : 0;
7787#if defined(HAVE_PRI)
7805 if (res & DAHDI_EVENT_DTMFDOWN) {
7806 ast_debug(1,
"DTMF Down '%c'\n", res & 0xff);
7807#if defined(HAVE_PRI)
7822 return &p->
subs[idx].
f;
7826 case DAHDI_EVENT_EC_DISABLED:
7830#ifdef HAVE_DAHDI_ECHOCANCEL_FAX_MODE
7831 case DAHDI_EVENT_TX_CED_DETECTED:
7832 ast_verb(3,
"Channel %d detected a CED tone towards the network.\n", p->
channel);
7834 case DAHDI_EVENT_RX_CED_DETECTED:
7835 ast_verb(3,
"Channel %d detected a CED tone from the network.\n", p->
channel);
7837 case DAHDI_EVENT_EC_NLP_DISABLED:
7838 ast_verb(3,
"Channel %d echo canceler disabled its NLP.\n", p->
channel);
7840 case DAHDI_EVENT_EC_NLP_ENABLED:
7841 ast_verb(3,
"Channel %d echo canceler enabled its NLP.\n", p->
channel);
7844 case DAHDI_EVENT_BITSCHANGED:
7850 openr2_chan_handle_cas(p->r2chan);
7856 case DAHDI_EVENT_PULSE_START:
7859 tone_zone_play_tone(p->
subs[idx].
dfd, -1);
7861 case DAHDI_EVENT_DIALCOMPLETE:
7863#if defined(HAVE_PRI)
7868 if (ioctl(p->
subs[idx].
dfd, DAHDI_DIALING, &x) == -1) {
7869 ast_debug(1,
"DAHDI_DIALING ioctl failed on %s: %s\n",
7894 if (ioctl(p->
subs[idx].
dfd,DAHDI_DIALING,&x) == -1) {
7903 p->
dop.op = DAHDI_DIAL_OP_REPLACE;
7922 ast_debug(1,
"Done dialing, but waiting for progress detection before doing more...\n");
7947 case DAHDI_EVENT_ALARM:
7949#if defined(HAVE_PRI)
7954#if defined(HAVE_SS7)
7966 if (!p->pri || !p->pri->pri || pri_get_timer(p->pri->pri, PRI_TIMER_T309) < 0) {
7972#if defined(HAVE_SS7)
7980 case DAHDI_EVENT_ONHOOK:
8014 ast_verb(3,
"Channel %d still has (callwait) call, ringing phone\n", p->
channel);
8029 unsigned int mssinceflash;
8040 if (p->
owner != ast) {
8050 ast_debug(1,
"Last flash was %u ms ago\n", mssinceflash);
8057 ast_debug(1,
"Looks like a bounced flash, hanging up both calls on %d\n", p->
channel);
8103 case DAHDI_EVENT_RINGOFFHOOK:
8133 int numchars = snprintf(p->
dop.dialstr,
sizeof(p->
dop.dialstr),
"M*0%s#",
c);
8134 if (numchars >=
sizeof(p->
dop.dialstr)) {
8141 if (strlen(p->
dop.dialstr) > 4) {
8146 p->
dop.dialstr[strlen(p->
dop.dialstr)-2] =
'\0';
8155 return &p->
subs[idx].
f;
8187 p->
dop.dialstr[0] =
'\0';
8190 ast_debug(1,
"Sent FXO deferred digit string: %s\n", p->
dop.dialstr);
8195 p->
dop.dialstr[0] =
'\0';
8199 return &p->
subs[idx].
f;
8206 return &p->
subs[idx].
f;
8219 res = tone_zone_play_tone(p->
subs[
SUB_REAL].
dfd, DAHDI_TONE_DIALTONE);
8234 ast_debug(1,
"Setting IDLE polarity due "
8235 "to ring. Old polarity was %d\n",
8278 case DAHDI_EVENT_RINGBEGIN:
8289 case DAHDI_EVENT_RINGERON:
8291 case DAHDI_EVENT_NOALARM:
8293#if defined(HAVE_PRI)
8298#if defined(HAVE_SS7)
8309 case DAHDI_EVENT_WINKFLASH:
8311 if (p->
radio)
break;
8315 struct dahdi_params par;
8317 memset(&par, 0,
sizeof(par));
8320 if (!par.rxisoffhook)
8338 ast_debug(1,
"Winkflash, index: %d, normal: %d, callwait: %d, thirdcall: %d\n",
8402 ast_debug(1,
"Flash when call not up or ringing\n");
8433 res = tone_zone_play_tone(p->
subs[
SUB_REAL].
dfd, DAHDI_TONE_DIALRECALL);
8441 res = tone_zone_play_tone(p->
subs[
SUB_REAL].
dfd, DAHDI_TONE_CONGESTION);
8457 ast_debug(1,
"Got flash with three way call up, dropping last call on %d\n", p->
channel);
8475 ast_verb(3,
"Building conference call with %s and %s\n",
8525 snprintf(p->
dop.dialstr,
sizeof(p->
dop.dialstr),
"M*%d%s#",
8534 ast_log(
LOG_WARNING,
"Received unexpected wink on channel of type SIG_FEATDMF_TA\n");
8551 p->
dop.dialstr[0] =
'\0';
8554 ast_debug(1,
"Sent deferred digit string: %s\n", p->
dop.dialstr);
8556 p->
dop.dialstr[0] =
'\0';
8562 case DAHDI_EVENT_HOOKCOMPLETE:
8580 p->
dop.dialstr[0] =
'\0';
8583 ast_debug(1,
"Sent deferred digit string: %s\n", p->
dop.dialstr);
8585 p->
dop.dialstr[0] =
'\0';
8586 p->
dop.op = DAHDI_DIAL_OP_REPLACE;
8596 ast_debug(1,
"Got hook complete in MF FGD, waiting for wink now on channel %d\n",p->
channel);
8602 case DAHDI_EVENT_POLARITY:
8614 ast_debug(1,
"Answering on polarity switch!\n");
8629 ast_debug(1,
"Polarity Reversal event occured - DEBUG 1: channel %d, state %u, pol= %d, aonp= %d, honp= %d, pdelay= %d, tv= %" PRIi64
"\n", p->
channel,
ast_channel_state(ast), p->
polarity, p->
answeronpolarityswitch, p->
hanguponpolarityswitch, p->
polarityonanswerdelay,
ast_tvdiff_ms(
ast_tvnow(), p->
polaritydelaytv) );
8632 ast_debug(1,
"Polarity Reversal detected and now Hanging up on channel %d\n", p->
channel);
8643 ast_debug(1,
"Polarity Reversal event occured - DEBUG 2: channel %d, state %u, pol= %d, aonp= %d, honp= %d, pdelay= %d, tv= %" PRIi64
"\n", p->
channel,
ast_channel_state(ast), p->
polarity, p->
answeronpolarityswitch, p->
hanguponpolarityswitch, p->
polarityonanswerdelay,
ast_tvdiff_ms(
ast_tvnow(), p->
polaritydelaytv) );
8646 ast_debug(1,
"Dunno what to do with event %d on channel %d\n", res, p->
channel);
8648 return &p->
subs[idx].
f;
8670 p->
subs[idx].
f.
src =
"dahdi_exception";
8686 if ((res != DAHDI_EVENT_RINGEROFF) && (res != DAHDI_EVENT_RINGERON) &&
8687 (res != DAHDI_EVENT_HOOKCOMPLETE)) {
8688 ast_debug(1,
"Restoring owner of channel %d on event %d\n", p->
channel, res);
8696 case DAHDI_EVENT_ONHOOK:
8708 case DAHDI_EVENT_RINGOFFHOOK:
8716 case DAHDI_EVENT_HOOKCOMPLETE:
8717 case DAHDI_EVENT_RINGERON:
8718 case DAHDI_EVENT_RINGEROFF:
8721 case DAHDI_EVENT_WINKFLASH:
8728 if (usedindex > -1) {
8745 f = &p->
subs[idx].
f;
8751 if (ast != p->
owner) {
8755 f = &p->
subs[idx].
f;
8849 struct dahdi_params ps;
8851 memset(&ps, 0,
sizeof(ps));
8867 return &p->
subs[idx].
f;
8870 if (!(--p->
ringt)) {
8878 openr2_chan_process_event(p->r2chan);
8879 if (OR2_DIR_FORWARD == openr2_chan_get_direction(p->r2chan)) {
8883 if (p->mfcr2_call_accepted &&
8884 !p->mfcr2_progress_sent &&
8886 ast_debug(1,
"Enqueuing progress frame after R2 accept in chan %d\n", p->
channel);
8888 p->mfcr2_progress_sent = 1;
8901 return &p->
subs[idx].
f;
8910 return &p->
subs[idx].
f;
8919 return &p->
subs[idx].
f;
8928 return &p->
subs[idx].
f;
8931 if (p->mfcr2 && openr2_chan_get_read_enabled(p->r2chan)) {
8947 return &p->
subs[idx].
f;
8957 return &p->
subs[idx].
f;
8967 return &p->
subs[idx].
f;
9009 if (
errno == EAGAIN) {
9012 return &p->
subs[idx].
f;
9013 }
else if (
errno == ELAST) {
9055 return &p->
subs[idx].
f;
9063 ast_verb(3,
"CPE does not support Call Waiting Caller*ID.\n");
9120 ast_debug(1,
"Channel driver fax CNG detection timeout on %s\n",
9165 ast_debug(1,
"Absorbing inband %s DTMF digit: 0x%02X '%c' on %s\n",
9188 ast_debug(1,
"Got 10 samples of dialtone!\n");
9192 p->
dop.dialstr[0] =
'\0';
9197 ast_debug(1,
"Sent deferred digit string: %s\n", p->
dop.dialstr);
9199 p->
dop.dialstr[0] =
'\0';
9200 p->
dop.op = DAHDI_DIAL_OP_REPLACE;
9209 f = &p->
subs[idx].
f;
9260 res = write(fd,
buf, size);
9303 ast_debug(5,
"Dropping frame since I'm still dialing on %s...\n",
9309 ast_debug(5,
"Dropping frame since there is no active owner on %s...\n",
9315 ast_debug(5,
"Dropping frame since I've still got a callerid spill on %s...\n",
9357 int func = DAHDI_FLASH;
9362#if defined(HAVE_PRI)
9368#if defined(HAVE_SS7)
9378 if (p->mfcr2 && !p->mfcr2_call_accepted) {
9387 switch (condition) {
9389 res = tone_zone_play_tone(p->
subs[idx].
dfd, DAHDI_TONE_BUSY);
9392 res = tone_zone_play_tone(p->
subs[idx].
dfd, DAHDI_TONE_RINGTONE);
9450 p->
dop.dialstr[0] =
'\0';
9463 res = tone_zone_play_tone(p->
subs[idx].
dfd, -1);
9473#if defined(HAVE_PRI)
9488#if defined(HAVE_PRI)
9489 }
else if (i->pri) {
9491 y = ++i->pri->new_chan_seq;
9509 for (x = 0; x < 3; ++x) {
9547#if defined(HAVE_PRI)
9566 tmp =
ast_channel_alloc(0,
state, i->
cid_num, i->
cid_name, i->
accountcode, i->
exten, i->
context, assignedids, requestor, i->
amaflags,
"DAHDI/%s",
ast_str_buffer(chan_name));
9580#if defined(HAVE_PRI)
9588 if (law == DAHDI_LAW_ALAW) {
9598 ? DAHDI_LAW_ALAW : DAHDI_LAW_MULAW;
9633 x = DAHDI_TONEDETECT_ON | DAHDI_TONEDETECT_MUTE;
9634 if (ioctl(i->
subs[idx].
dfd, DAHDI_TONEDETECT, &x)) {
9652#if defined(HAVE_PRI) || defined(HAVE_SS7)
9715#if defined(HAVE_PRI) || defined(HAVE_SS7)
9744 dashptr = strrchr(device_name,
'-');
9751 for (v = i->
vars ; v ; v = v->
next)
9791 if (strchr(term,
c))
9803 j = DAHDI_IOMUX_SIGEVENT;
9805 if (ioctl(p->
subs[idx].
dfd,DAHDI_IOMUX,&j) == -1)
return(-1);
9807 if (j & DAHDI_IOMUX_SIGEVENT)
break;
9810 if (ioctl(p->
subs[idx].
dfd,DAHDI_GETEVENT,&j) == -1)
return(-1);
9850 return dahdichan->
dnd;
9855 ast_verb(3,
"%s DND on channel %d\n",
9856 flag?
"Enabled" :
"Disabled",
9864 int extlen = strlen(exten);
9870 if (extlen < strlen(pickupexten) && !strncmp(pickupexten, exten, extlen)) {
9874 if (exten[0] ==
'*' && extlen < 3) {
9895 unsigned char buf[256];
9916 const char *pickupexten;
9940 ast_log(
LOG_ERROR,
"Unable to retrieve pickup configuration options. Unable to detect call pickup extension\n");
9943 pickupexten =
ast_strdupa(pickup_cfg->pickupexten);
9968 res = tone_zone_play_tone(p->
subs[idx].
dfd, -1);
9978 memset(dtmfbuf, 0,
sizeof(dtmfbuf));
9993 res =
my_getsigstr(chan, dtmfbuf + strlen(dtmfbuf),
"*", 3000);
10003 if (res <= 0)
break;
10012 if ((p->
sig ==
SIG_FEATDMF) && (dtmfbuf[1] !=
'0') && (strlen(dtmfbuf) != 14))
10018 if (res <= 0)
break;
10026 res =
my_getsigstr(chan, dtmfbuf + strlen(dtmfbuf),
"#", 3000);
10043 res =
my_getsigstr(chan, dtmfbuf + strlen(dtmfbuf),
"*", 3000);
10050 dtmfbuf[
len] =
'\0';
10059 ast_debug(1,
"waitfordigit returned < 0...\n");
10063 dtmfbuf[
len++] = res;
10064 dtmfbuf[
len] =
'\0';
10076 }
else if (res < 0) {
10077 ast_debug(1,
"Got hung up before digits finished\n");
10092 if ((res > 0) && (strlen(anibuf) > 2)) {
10093 if (anibuf[strlen(anibuf) - 1] ==
'#')
10094 anibuf[strlen(anibuf) - 1] = 0;
10105 if (exten[0] ==
'*') {
10106 char *stringp=
NULL;
10110 s1 =
strsep(&stringp,
"*");
10111 s2 =
strsep(&stringp,
"*");
10124 if (exten[0] ==
'*') {
10125 char *stringp=
NULL;
10129 s1 =
strsep(&stringp,
"#");
10130 s2 =
strsep(&stringp,
"#");
10144 if (exten[0] ==
'*') {
10145 char *stringp=
NULL;
10149 s1 =
strsep(&stringp,
"#");
10150 s2 =
strsep(&stringp,
"#");
10151 if (s2 && (*(s2 + 1) ==
'0')) {
10161 if (exten[0] ==
'*') {
10162 char *stringp=
NULL;
10166 s1 =
strsep(&stringp,
"#");
10200 res = tone_zone_play_tone(p->
subs[idx].
dfd, DAHDI_TONE_CONGESTION);
10206 res = tone_zone_play_tone(p->
subs[idx].
dfd, DAHDI_TONE_INFO);
10214 res = tone_zone_play_tone(p->
subs[idx].
dfd, DAHDI_TONE_CONGESTION);
10229 int is_exten_parking = 0;
10239 ast_debug(1,
"waitfordigit returned < 0...\n");
10240 res = tone_zone_play_tone(p->
subs[idx].
dfd, -1);
10244 ast_debug(1,
"waitfordigit returned '%c' (%d), timeout = %d\n", res, res, timeout);
10249 tone_zone_play_tone(p->
subs[idx].
dfd, -1);
10251 tone_zone_play_tone(p->
subs[idx].
dfd, DAHDI_TONE_DIALTONE);
10262 res = tone_zone_play_tone(p->
subs[idx].
dfd, DAHDI_TONE_DIALRECALL);
10266 res = tone_zone_play_tone(p->
subs[idx].
dfd, -1);
10268 memset(exten, 0,
sizeof(exten));
10269 res = tone_zone_play_tone(p->
subs[idx].
dfd, DAHDI_TONE_DIALTONE);
10273 res = tone_zone_play_tone(p->
subs[idx].
dfd, -1);
10292 res = tone_zone_play_tone(p->
subs[idx].
dfd, DAHDI_TONE_CONGESTION);
10301 }
else if (res == 0) {
10302 ast_debug(1,
"not enough digits (and no ambiguous match)...\n");
10303 res = tone_zone_play_tone(p->
subs[idx].
dfd, DAHDI_TONE_CONGESTION);
10307 }
else if (p->
callwaiting && !strcmp(exten,
"*70")) {
10311 res = tone_zone_play_tone(p->
subs[idx].
dfd, DAHDI_TONE_DIALRECALL);
10317 ioctl(p->
subs[idx].
dfd,DAHDI_CONFDIAG,&
len);
10318 memset(exten, 0,
sizeof(exten));
10321 }
else if (!strcmp(exten, pickupexten)) {
10337 ast_debug(1,
"No call pickup possible...\n");
10338 res = tone_zone_play_tone(p->
subs[idx].
dfd, DAHDI_TONE_CONGESTION);
10349 }
else if (!p->
hidecallerid && !strcmp(exten,
"*67")) {
10357 res = tone_zone_play_tone(p->
subs[idx].
dfd, DAHDI_TONE_DIALRECALL);
10363 memset(exten, 0,
sizeof(exten));
10365 }
else if (p->
callreturn && !strcmp(exten,
"*69")) {
10366 res = tone_zone_play_tone(p->
subs[idx].
dfd, DAHDI_TONE_DIALRECALL);
10368 }
else if (!strcmp(exten,
"*78")) {
10371 res = tone_zone_play_tone(p->
subs[idx].
dfd, DAHDI_TONE_DIALRECALL);
10373 memset(exten, 0,
sizeof(exten));
10375 }
else if (!strcmp(exten,
"*79")) {
10378 res = tone_zone_play_tone(p->
subs[idx].
dfd, DAHDI_TONE_DIALRECALL);
10380 memset(exten, 0,
sizeof(exten));
10383 res = tone_zone_play_tone(p->
subs[idx].
dfd, DAHDI_TONE_DIALRECALL);
10385 memset(exten, 0,
sizeof(exten));
10388 ast_verb(3,
"Cancelling call forwarding on channel %d\n", p->
channel);
10389 res = tone_zone_play_tone(p->
subs[idx].
dfd, DAHDI_TONE_DIALRECALL);
10392 memset(exten, 0,
sizeof(exten));
10405 if (bridge_channel) {
10424 }
else if (p->
hidecallerid && !strcmp(exten,
"*82")) {
10429 res = tone_zone_play_tone(p->
subs[idx].
dfd, DAHDI_TONE_DIALRECALL);
10435 memset(exten, 0,
sizeof(exten));
10437 }
else if (!strcmp(exten,
"*0")) {
10444 if (nbridge && bridged) {
10447 if (nbridge && pbridge &&
10451 int func = DAHDI_FLASH;
10453 p->
dop.dialstr[0] =
'\0';
10466 tone_zone_play_tone(p->
subs[idx].
dfd, DAHDI_TONE_CONGESTION);
10468 tone_zone_play_tone(p->
subs[idx].
dfd, -1);
10486 tone_zone_play_tone(p->
subs[idx].
dfd, -1);
10496 if (smdi_msg !=
NULL) {
10499 if (smdi_msg->
type ==
'B')
10501 else if (smdi_msg->
type ==
'N')
10549 "Exiting simple switch\n");
10574 ast_debug(1,
"CID got string '%s'\n", dtmfbuf);
10587 struct timeval start;
10598 i = DAHDI_IOMUX_READ | DAHDI_IOMUX_SIGEVENT;
10599 if ((res = ioctl(p->
subs[idx].
dfd, DAHDI_IOMUX, &i))) {
10605 if (i & DAHDI_IOMUX_SIGEVENT) {
10608 if (res == DAHDI_EVENT_NOALARM) {
10613 if (res == DAHDI_EVENT_RINGBEGIN) {
10621 }
else if (i & DAHDI_IOMUX_READ) {
10624 if (
errno != ELAST) {
10645 "Failed to decode CallerID on channel '%s'\n",
10650 else if (samples > (8000 * 10))
10674 "Exiting simple switch\n");
10695 for (receivedRingT = 0; receivedRingT <
ARRAY_LEN(curRingData); receivedRingT++)
10696 curRingData[receivedRingT] = 0;
10707 i = DAHDI_IOMUX_READ | DAHDI_IOMUX_SIGEVENT;
10708 if ((res = ioctl(p->
subs[idx].
dfd, DAHDI_IOMUX, &i))) {
10714 if (i & DAHDI_IOMUX_SIGEVENT) {
10717 if (res == DAHDI_EVENT_NOALARM) {
10723 curRingData[receivedRingT] = p->
ringt;
10729 if (++receivedRingT ==
ARRAY_LEN(curRingData))
10731 }
else if (i & DAHDI_IOMUX_READ) {
10734 if (
errno != ELAST) {
10742 if (p->
ringt > 0) {
10743 if (!(--p->
ringt)) {
10751 ast_verb(3,
"Detected ring pattern: %d,%d,%d\n",curRingData[0],curRingData[1],curRingData[2]);
10752 for (counter = 0; counter < 3; counter++) {
10756 for (counter1 = 0; counter1 < 3; counter1++) {
10759 ast_verb(3,
"Pattern ignore (-1) detected, so matching pattern %d regardless.\n",
10760 curRingData[counter1]);
10764 ast_verb(3,
"Ring pattern matched in range: %d to %d\n",
10771 if (distMatches == 3) {
10789 "state, but I have nothing to do. "
10790 "Terminating simple switch, should be "
10791 "restarted by the actual ring.\n",
10800 struct timeval start;
10813 "Exiting simple switch\n");
10837 ast_debug(1,
"CID is '%s', flags %d\n",
10856 for (receivedRingT = 0; receivedRingT <
ARRAY_LEN(curRingData); receivedRingT++)
10857 curRingData[receivedRingT] = 0;
10870 i = DAHDI_IOMUX_READ | DAHDI_IOMUX_SIGEVENT;
10871 if ((res = ioctl(p->
subs[idx].
dfd, DAHDI_IOMUX, &i))) {
10877 if (i & DAHDI_IOMUX_SIGEVENT) {
10880 if (res == DAHDI_EVENT_NOALARM) {
10885 ast_debug(1,
"Hanging up due to polarity reversal on channel %d while detecting callerid\n", p->
channel);
10894 curRingData[receivedRingT] = p->
ringt;
10900 if (++receivedRingT ==
ARRAY_LEN(curRingData))
10902 }
else if (i & DAHDI_IOMUX_READ) {
10905 if (
errno != ELAST) {
10913 if (p->
ringt > 0) {
10914 if (!(--p->
ringt)) {
10927 "Failed to decode CallerID on channel '%s'\n",
10932 else if (
samples > (8000 * 10))
10942 for (receivedRingT = 0; receivedRingT < 3; receivedRingT++) {
10943 curRingData[receivedRingT] = 0;
10946 ast_verb(3,
"Detecting post-CID distinctive ring\n");
10948 i = DAHDI_IOMUX_READ | DAHDI_IOMUX_SIGEVENT;
10949 if ((res = ioctl(p->
subs[idx].
dfd, DAHDI_IOMUX, &i))) {
10955 if (i & DAHDI_IOMUX_SIGEVENT) {
10958 if (res == DAHDI_EVENT_NOALARM) {
10964 curRingData[receivedRingT] = p->
ringt;
10970 if (++receivedRingT ==
ARRAY_LEN(curRingData))
10972 }
else if (i & DAHDI_IOMUX_READ) {
10975 if (
errno != ELAST) {
10983 if (p->
ringt > 0) {
10984 if (!(--p->
ringt)) {
10994 ast_verb(3,
"Detected ring pattern: %d,%d,%d\n",curRingData[0],curRingData[1],curRingData[2]);
10996 for (counter = 0; counter < 3; counter++) {
11000 ast_verb(3,
"Checking %d,%d,%d\n",
11005 for (counter1 = 0; counter1 < 3; counter1++) {
11008 ast_verb(3,
"Pattern ignore (-1) detected, so matching pattern %d regardless.\n",
11009 curRingData[counter1]);
11014 ast_verb(3,
"Ring pattern matched in range: %d to %d\n",
11020 if (distMatches == 3) {
11067 res = tone_zone_play_tone(p->
subs[idx].
dfd, DAHDI_TONE_CONGESTION);
11071 res = tone_zone_play_tone(p->
subs[idx].
dfd, DAHDI_TONE_CONGESTION);
11097 for (x = 0; x <
len; x++)
11107 pthread_t threadid;
11112 unsigned int spill_done = 0;
11113 int spill_result = -1;
11116 goto quit_no_clean;
11124 i = DAHDI_IOMUX_READ | DAHDI_IOMUX_SIGEVENT;
11130 if (i & DAHDI_IOMUX_SIGEVENT) {
11133 int callid_created;
11141 case DAHDI_EVENT_NEONMWI_ACTIVE:
11142 case DAHDI_EVENT_NEONMWI_INACTIVE:
11143 case DAHDI_EVENT_NONE:
11144 case DAHDI_EVENT_BITSCHANGED:
11146 case DAHDI_EVENT_NOALARM:
11155 case DAHDI_EVENT_ALARM:
11193 goto quit_no_clean;
11195 }
else if (i & DAHDI_IOMUX_READ) {
11197 if (
errno != ELAST) {
11212 }
else if (spill_result) {
11222 if (samples > (8000 * 4))
11227 if (spill_result == 1) {
11264#ifdef HAVE_DAHDI_LINEREVERSE_VMWI
11266 if (pvt->mwisend_rpas) {
11269 }
else if (pvt->mwisend_fsk) {
11297 x = DAHDI_FLUSH_BOTH;
11301#ifdef HAVE_DAHDI_LINEREVERSE_VMWI
11302 if (pvt->mwisend_fsk) {
11307#ifdef HAVE_DAHDI_LINEREVERSE_VMWI
11315 struct timeval now;
11339#ifdef HAVE_DAHDI_LINEREVERSE_VMWI
11340 if (pvt->mwisend_fsk) {
11342 gettimeofday(&now,
NULL);
11346#ifdef HAVE_DAHDI_LINEREVERSE_VMWI
11354 if (0 < num_read) {
11407 case DAHDI_EVENT_RINGEROFF:
11424 case DAHDI_EVENT_RINGOFFHOOK:
11434 case DAHDI_EVENT_RINGERON:
11435 case DAHDI_EVENT_HOOKCOMPLETE:
11449 int destroyed_first = 0;
11450 int destroyed_last = 0;
11457 int x = DAHDI_FLASH;
11459 if (cur->
channel > destroyed_last) {
11460 destroyed_last = cur->
channel;
11462 if (destroyed_first < 1 || cur->
channel < destroyed_first) {
11463 destroyed_first = cur->
channel;
11474 if (destroyed_first > start || destroyed_last <
end) {
11475 ast_debug(1,
"Asked to destroy %d-%d, destroyed %d-%d,\n",
11476 start,
end, destroyed_first, destroyed_last);
11481static void dahdi_r2_destroy_nodev(
void)
11483 struct r2link_entry *cur;
11487 struct dahdi_mfcr2 *r2 = &cur->mfcr2;
11488 ast_debug(3,
"About to destroy %d DAHDI channels of MFC/R2 link.\n", r2->numchans);
11489 for (i = 0; i < r2->numchans; i++) {
11502 pthread_cancel(r2->r2master);
11503 pthread_join(r2->r2master,
NULL);
11505 openr2_context_delete(r2->protocol_context);
11535 ast_debug(1,
"channel range caps: %d - %d\n", start,
end);
11540 "channel range %d-%d is occupied\n",
11549 struct dahdi_pri *pri = pris + x;
11551 if (!pris[x].pri.pvts[0]) {
11555 int channo = pri->dchannels[i];
11560 if (!pri->pri.fds[i]) {
11563 if (channo >= start && channo <=
end) {
11565 "channel range %d-%d is occupied by span %d\n",
11566 start,
end, x + 1);
11574 !
conf.chan.cc_params) {
11579 conf.wanted_channels_start = start;
11582 conf.wanted_channels_end =
end;
11598 pthread_t threadid;
11601 int callid_created;
11606 case DAHDI_EVENT_NONE:
11607 case DAHDI_EVENT_BITSCHANGED:
11609 case DAHDI_EVENT_WINKFLASH:
11610 case DAHDI_EVENT_RINGOFFHOOK:
11612 if (i->
radio)
break;
11619 if (res && (
errno == EBUSY)) {
11633 res = tone_zone_play_tone(i->
subs[
SUB_REAL].
dfd, DAHDI_TONE_RINGTONE);
11637 res = tone_zone_play_tone(i->
subs[
SUB_REAL].
dfd, DAHDI_TONE_CONGESTION);
11646 res = tone_zone_play_tone(i->
subs[
SUB_REAL].
dfd, DAHDI_TONE_STUTTER);
11648 res = tone_zone_play_tone(i->
subs[
SUB_REAL].
dfd, DAHDI_TONE_DIALTONE);
11650 ast_log(
LOG_WARNING,
"Unable to play dialtone on channel %d, do you have defaultzone and loadzone defined?\n", i->
channel);
11653 res = tone_zone_play_tone(i->
subs[
SUB_REAL].
dfd, DAHDI_TONE_CONGESTION);
11696 res = tone_zone_play_tone(i->
subs[
SUB_REAL].
dfd, DAHDI_TONE_CONGESTION);
11707 res = tone_zone_play_tone(i->
subs[
SUB_REAL].
dfd, DAHDI_TONE_CONGESTION);
11713 case DAHDI_EVENT_NOALARM:
11715#if defined(HAVE_PRI)
11722#if defined(HAVE_SS7)
11733 case DAHDI_EVENT_ALARM:
11735#if defined(HAVE_PRI)
11742#if defined(HAVE_SS7)
11754 case DAHDI_EVENT_ONHOOK:
11800 case DAHDI_EVENT_POLARITY:
11814 ast_verb(2,
"Starting post polarity "
11815 "CID detection on channel %d\n",
11829 "polarity reversal on non-FXO (SIG_FXS) "
11830 "interface %d\n", i->
channel);
11833 case DAHDI_EVENT_REMOVED:
11835 "Got DAHDI_EVENT_REMOVED. Destroying channel %d\n",
11838 case DAHDI_EVENT_NEONMWI_ACTIVE:
11844 case DAHDI_EVENT_NEONMWI_INACTIVE:
11855 struct pollfd **pfds = arg;
11861 int count, res, res2, spoint, pollres=0;
11865 time_t thispass = 0, lastpass = 0;
11868 struct pollfd *pfds=
NULL;
11869 int lastalloc = -1;
11874 if (pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS,
NULL)) {
11880 pthread_setcancelstate(PTHREAD_CANCEL_DISABLE,
NULL);
11886 if (!pfds || (lastalloc !=
ifcount)) {
11913 pfds[count].events = POLLPRI;
11914 pfds[count].revents = 0;
11918 pfds[count].events |= POLLIN;
11926 pfds[count].events = POLLPRI;
11927 pfds[count].revents = 0;
11932 pfds[count].events |= POLLIN;
11943 pthread_setcancelstate(PTHREAD_CANCEL_ENABLE,
NULL);
11944 pthread_testcancel();
11946 res = poll(pfds, count, 1000);
11947 pthread_testcancel();
11948 pthread_setcancelstate(PTHREAD_CANCEL_DISABLE,
NULL);
11961 lastpass = thispass;
11962 thispass = time(
NULL);
11973 if (thispass != lastpass) {
11980 && !
last->mwisendactive
11981 && (
last->sig & __DAHDI_SIG_FXO)
11994 res2 = ioctl(
last->subs[
SUB_REAL].dfd, DAHDI_VMWI, &res);
11997 ast_debug(3,
"Unable to control message waiting led on channel %d: %s\n",
last->channel, strerror(
errno));
12000 ast_debug(5,
"Initiating MWI FSK spill on channel %d\n",
last->channel);
12030 if (pollres & POLLIN) {
12046 pthread_attr_t attr;
12047 pthread_t threadid;
12050 pthread_attr_init(&attr);
12051 pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
12056 memcpy(mtd->
buf,
buf, res);
12069 struct timeval now;
12077 gettimeofday(&now,
NULL);
12084 pthread_t threadid;
12119 if (pollres & POLLPRI) {
12146 ast_debug(1,
"Woah! Went back on hook before reoriginate could happen on channel %d\n", i->
channel);
12149 res = DAHDI_EVENT_RINGOFFHOOK;
12164 dahdi_r2_destroy_nodev();
12168 pthread_cleanup_pop(1);
12199#if defined(HAVE_PRI)
12200static int pri_resolve_span(
int *
span,
int channel,
int offset,
struct dahdi_spaninfo *si)
12205 trunkgroup = pris[*
span].mastertrunkgroup;
12220 }
else if (pris[*
span].mastertrunkgroup) {
12221 ast_log(
LOG_WARNING,
"Unable to use span %d implicitly since it is already part of trunk group %d\n", *
span, pris[*
span].mastertrunkgroup);
12224 if (si->totalchans == 31) {
12226 pris[*
span].dchannels[0] = 16 + offset;
12227 }
else if (si->totalchans == 24) {
12229 pris[*
span].dchannels[0] = 24 + offset;
12230 }
else if (si->totalchans == 3) {
12232 pris[*
span].dchannels[0] = 3 + offset;
12234 ast_log(
LOG_WARNING,
"Unable to use span %d, since the D-channel cannot be located (unexpected span size of %d channels)\n", *
span, si->totalchans);
12245#if defined(HAVE_PRI)
12246static int pri_create_trunkgroup(
int trunkgroup,
int *
channels)
12248 struct dahdi_spaninfo si;
12249 struct dahdi_params p;
12256 ast_log(
LOG_WARNING,
"Trunk group %d already exists on span %d, Primary d-channel %d\n", trunkgroup, x + 1, pris[x].dchannels[0]);
12263 memset(&si, 0,
sizeof(si));
12264 memset(&p, 0,
sizeof(p));
12265 fd = open(
"/dev/dahdi/channel", O_RDWR);
12271 if (ioctl(fd, DAHDI_SPECIFY, &x)) {
12276 if (ioctl(fd, DAHDI_GET_PARAMS, &p)) {
12281 if (ioctl(fd, DAHDI_SPANSTAT, &si)) {
12286 span = p.spanno - 1;
12292 if (pris[span].pri.
pvts[0]) {
12293 ast_log(
LOG_WARNING,
"Span %d is already provisioned with channels (implicit PRI maybe?)\n", span + 1);
12298 pris[span].pri.trunkgroup = trunkgroup;
12301 pris[ospan].dchannels[y] =
channels[y];
12302 pris[span].pri.span = span + 1;
12309#if defined(HAVE_PRI)
12310static int pri_create_spanmap(
int span,
int trunkgroup,
int logicalspan)
12312 if (pris[span].mastertrunkgroup) {
12313 ast_log(
LOG_WARNING,
"Span %d is already part of trunk group %d, cannot add to trunk group %d\n", span + 1, pris[span].mastertrunkgroup, trunkgroup);
12316 pris[span].mastertrunkgroup = trunkgroup;
12317 pris[span].prilogicalspan = logicalspan;
12322#if defined(HAVE_SS7)
12323static unsigned int parse_pointcode(
const char *pcstring)
12325 unsigned int code1, code2, code3;
12328 numvals = sscanf(pcstring,
"%30d-%30d-%30d", &code1, &code2, &code3);
12332 return (code1 << 16) | (code2 << 8) | code3;
12338#if defined(HAVE_SS7)
12339static struct dahdi_ss7 * ss7_resolve_linkset(
int linkset)
12341 if ((linkset < 0) || (linkset >=
NUM_SPANS))
12344 return &linksets[linkset - 1];
12349static void dahdi_r2_destroy_links(
void)
12351 struct r2link_entry *cur;
12356 ast_debug(3,
"MFC/R2 link #%d queued for destruction\n", cur->mfcr2.index);
12362 dahdi_r2_destroy_nodev();
12366#define R2_LINK_CAPACITY 30
12369 struct r2link_entry *cur =
NULL;
12377 if (memcmp(&
conf->mfcr2, &cur->mfcr2.conf,
sizeof(
conf->mfcr2))) {
12378 ast_debug(3,
"Need new R2 link because of: Configuration change\n");
12380 }
else if (cur->mfcr2.numchans == R2_LINK_CAPACITY) {
12381 ast_debug(3,
"Need new R2 link because of: Capacity (%d)\n", R2_LINK_CAPACITY);
12386 struct r2link_entry *
tmp =
NULL;
12387 int new_idx = r2links_count + 1;
12389 for (i = 1; i <= r2links_count; i++) {
12392 if (i ==
tmp->mfcr2.index) {
12407 cur->mfcr2.index = new_idx;
12410 ast_debug(3,
"Created new R2 link #%d (now have %d)\n", new_idx, r2links_count);
12417static int dahdi_r2_set_context(
struct dahdi_mfcr2 *r2_link,
const struct dahdi_chan_conf *
conf)
12419 char tmplogdir[] =
"/tmp";
12420 char logdir[OR2_MAX_PATH];
12423 r2_link->protocol_context = openr2_context_new(
NULL, &dahdi_r2_event_iface,
12424 &dahdi_r2_transcode_iface,
conf->mfcr2.variant,
conf->mfcr2.max_ani,
12425 conf->mfcr2.max_dnis);
12426 if (!r2_link->protocol_context) {
12429 openr2_context_set_log_level(r2_link->protocol_context,
conf->mfcr2.loglevel);
12430 openr2_context_set_ani_first(r2_link->protocol_context,
conf->mfcr2.get_ani_first);
12431#if defined(OR2_LIB_INTERFACE) && OR2_LIB_INTERFACE > 1
12432 openr2_context_set_skip_category_request(r2_link->protocol_context,
conf->mfcr2.skip_category_request);
12434 openr2_context_set_mf_threshold(r2_link->protocol_context,
threshold);
12435 openr2_context_set_mf_back_timeout(r2_link->protocol_context,
conf->mfcr2.mfback_timeout);
12436 openr2_context_set_metering_pulse_timeout(r2_link->protocol_context,
conf->mfcr2.metering_pulse_timeout);
12437 openr2_context_set_double_answer(r2_link->protocol_context,
conf->mfcr2.double_answer);
12438 openr2_context_set_immediate_accept(r2_link->protocol_context,
conf->mfcr2.immediate_accept);
12439#if defined(OR2_LIB_INTERFACE) && OR2_LIB_INTERFACE > 2
12440 openr2_context_set_dtmf_dialing(r2_link->protocol_context,
conf->mfcr2.dtmf_dialing,
conf->mfcr2.dtmf_time_on,
conf->mfcr2.dtmf_time_off);
12441 openr2_context_set_dtmf_detection(r2_link->protocol_context,
conf->mfcr2.dtmf_detection);
12443#if defined(OR2_LIB_INTERFACE) && OR2_LIB_INTERFACE > 3
12444 openr2_context_set_dtmf_detection_end_timeout(r2_link->protocol_context,
conf->mfcr2.dtmf_end_timeout);
12447 if (openr2_context_set_log_directory(r2_link->protocol_context, tmplogdir)) {
12448 ast_log(
LOG_ERROR,
"Failed setting default MFC/R2 log directory %s\n", tmplogdir);
12452 if (snres >=
sizeof(logdir)) {
12453 ast_log(
LOG_ERROR,
"MFC/R2 logging directory truncated, using %s\n", tmplogdir);
12454 if (openr2_context_set_log_directory(r2_link->protocol_context, tmplogdir)) {
12455 ast_log(
LOG_ERROR,
"Failed setting default MFC/R2 log directory %s\n", tmplogdir);
12458 if (openr2_context_set_log_directory(r2_link->protocol_context, logdir)) {
12464 if (openr2_context_configure_from_advanced_file(r2_link->protocol_context,
conf->mfcr2.r2proto_file)) {
12465 ast_log(
LOG_ERROR,
"Failed to configure r2context from advanced configuration file %s\n",
conf->mfcr2.r2proto_file);
12469 memcpy(&r2_link->conf, &
conf->mfcr2,
sizeof(r2_link->conf));
12503 struct dahdi_bufferinfo bi;
12506#if defined(HAVE_PRI)
12512 struct dahdi_params p;
12513#if defined(HAVE_PRI)
12514 struct dahdi_spaninfo si;
12517#if defined(HAVE_SS7)
12523 if (!
tmp->destroy) {
12537 if (!here && reloading != 1) {
12543 if (!
tmp->cc_params) {
12549 for (x = 0; x < 3; x++)
12550 tmp->subs[x].dfd = -1;
12552 tmp->priindication_oob =
conf->chan.priindication_oob;
12556 int chan_sig =
conf->chan.sig;
12559 if (reloading &&
tmp->vars) {
12569 snprintf(fn,
sizeof(fn),
"%d",
channel);
12573 while (
tmp->subs[
SUB_REAL].dfd < 0 && reloading == 2 && count < 1000 &&
errno != ENXIO) {
12584 memset(&p, 0,
sizeof(p));
12585 res = ioctl(
tmp->subs[
SUB_REAL].dfd, DAHDI_GET_PARAMS, &p);
12591 if (
conf->is_sig_auto)
12593 if (p.sigtype != (chan_sig & 0x3ffff)) {
12598 tmp->law_default = p.curlaw;
12599 tmp->law = p.curlaw;
12600 tmp->span = p.spanno;
12601#if defined(HAVE_PRI)
12602 span = p.spanno - 1;
12607 tmp->sig = chan_sig;
12608 tmp->outsigmod =
conf->chan.outsigmod;
12616 tmp->sig_pvt = analog_p;
12618#if defined(HAVE_SS7)
12620 struct dahdi_ss7 *ss7;
12623 if (ioctl(
tmp->subs[
SUB_REAL].dfd, DAHDI_AUDIOMODE, &clear)) {
12624 ast_log(
LOG_ERROR,
"Unable to set clear mode on clear channel %d of span %d: %s\n", channel, p.spanno, strerror(
errno));
12629 ss7 = ss7_resolve_linkset(cur_linkset);
12635 ss7->ss7.span = cur_linkset;
12636 if (cur_cicbeginswith < 0) {
12646 tmp->sig_pvt = ss7_chan;
12647 tmp->ss7 = &ss7->ss7;
12650 ss7_chan->
cic = cur_cicbeginswith++;
12653 ss7_chan->
dpc = cur_defaultdpc;
12655 ss7->ss7.pvts[ss7->ss7.numchans++] = ss7_chan;
12657 ast_copy_string(ss7->ss7.internationalprefix,
conf->ss7.ss7.internationalprefix,
sizeof(ss7->ss7.internationalprefix));
12658 ast_copy_string(ss7->ss7.nationalprefix,
conf->ss7.ss7.nationalprefix,
sizeof(ss7->ss7.nationalprefix));
12659 ast_copy_string(ss7->ss7.subscriberprefix,
conf->ss7.ss7.subscriberprefix,
sizeof(ss7->ss7.subscriberprefix));
12660 ast_copy_string(ss7->ss7.unknownprefix,
conf->ss7.ss7.unknownprefix,
sizeof(ss7->ss7.unknownprefix));
12661 ast_copy_string(ss7->ss7.networkroutedprefix,
conf->ss7.ss7.networkroutedprefix,
sizeof(ss7->ss7.networkroutedprefix));
12663 ss7->ss7.called_nai =
conf->ss7.ss7.called_nai;
12664 ss7->ss7.calling_nai =
conf->ss7.ss7.calling_nai;
12669 struct dahdi_mfcr2 *r2_link;
12670 struct r2link_entry *r2_le = dahdi_r2_get_link(
conf);
12671 r2_link = &r2_le->mfcr2;
12677 if (!r2_link->protocol_context && dahdi_r2_set_context(r2_link,
conf)) {
12682 if (r2_link->numchans ==
ARRAY_LEN(r2_link->pvts)) {
12687 r2_link->pvts[r2_link->numchans++] =
tmp;
12688 tmp->r2chan = openr2_chan_new_from_fd(r2_link->protocol_context,
12691 if (!
tmp->r2chan) {
12692 openr2_liberr_t err = openr2_context_get_last_error(r2_link->protocol_context);
12693 ast_log(
LOG_ERROR,
"Cannot create OpenR2 channel: %s\n", openr2_context_error_string(err));
12697 r2_link->live_chans++;
12698 tmp->mfcr2 = r2_link;
12699 if (
conf->mfcr2.call_files) {
12700 openr2_chan_enable_call_files(
tmp->r2chan);
12702 openr2_chan_set_client_data(
tmp->r2chan,
tmp);
12704 openr2_chan_set_logging_func(
tmp->r2chan, (openr2_logging_func_t)dahdi_r2_on_chan_log);
12705 openr2_chan_set_log_level(
tmp->r2chan,
conf->mfcr2.loglevel);
12706 tmp->mfcr2_category =
conf->mfcr2.category;
12707 tmp->mfcr2_charge_calls =
conf->mfcr2.charge_calls;
12708 tmp->mfcr2_allow_collect_calls =
conf->mfcr2.allow_collect_calls;
12709 tmp->mfcr2_forced_release =
conf->mfcr2.forced_release;
12710 tmp->mfcr2_accept_on_offer =
conf->mfcr2.accept_on_offer;
12711 tmp->mfcr2call = 0;
12712 tmp->mfcr2_dnis_index = 0;
12713 tmp->mfcr2_ani_index = 0;
12721 int myswitchtype = 0;
12724 if (ioctl(
tmp->subs[
SUB_REAL].dfd, DAHDI_AUDIOMODE, &offset)) {
12725 ast_log(
LOG_ERROR,
"Unable to set clear mode on clear channel %d of span %d: %s\n", channel, p.spanno, strerror(
errno));
12730 ast_log(
LOG_ERROR,
"Channel %d does not lie on a span I know of (%d)\n", channel, span);
12735 if (ioctl(
tmp->subs[
SUB_REAL].dfd,DAHDI_SPANSTAT,&si) == -1) {
12741 tmp->logicalspan = pris[span].prilogicalspan;
12742 pri_resolve_span(&span, channel, (channel - p.chanpos), &si);
12744 ast_log(
LOG_WARNING,
"Channel %d: Unable to find locate channel/trunk group!\n", channel);
12748 myswitchtype =
conf->pri.pri.switchtype;
12753 if (pris[x].dchannels[y] ==
tmp->channel) {
12759 if (!matchesdchan) {
12760 if (pris[span].pri.
nodetype && (pris[span].pri.nodetype !=
conf->pri.pri.nodetype)) {
12765 if (pris[span].pri.
switchtype && (pris[span].pri.switchtype != myswitchtype)) {
12770 if ((pris[span].pri.
dialplan) && (pris[span].pri.dialplan !=
conf->pri.pri.dialplan)) {
12771 ast_log(
LOG_ERROR,
"Span %d is already a %s dialing plan\n", span + 1, pris[span].pri.
dialplan == -1 ?
"Dynamically set dialplan in ISDN" : pri_plan2str(pris[span].pri.
dialplan));
12785 if (pris[span].pri.
minunused && (pris[span].pri.minunused !=
conf->pri.pri.minunused)) {
12786 ast_log(
LOG_ERROR,
"Span %d already has minunused of %d.\n", span + 1,
conf->pri.pri.minunused);
12790 if (pris[span].pri.
minidle && (pris[span].pri.minidle !=
conf->pri.pri.minidle)) {
12796 ast_log(
LOG_ERROR,
"Unable to add channel %d: Too many channels in trunk group %d!\n", channel,
12802 pri_chan =
sig_pri_chan_new(
tmp, &pris[span].pri,
tmp->logicalspan, p.chanpos, pris[span].mastertrunkgroup);
12807 tmp->sig_pvt = pri_chan;
12808 tmp->pri = &pris[span].pri;
12810 tmp->priexclusive =
conf->chan.priexclusive;
12812 if (!
tmp->pri->cc_params) {
12814 if (!
tmp->pri->cc_params) {
12820 conf->chan.cc_params);
12822 pris[span].pri.sig = chan_sig;
12823 pris[span].pri.nodetype =
conf->pri.pri.nodetype;
12824 pris[span].pri.switchtype = myswitchtype;
12825 pris[span].pri.nsf =
conf->pri.pri.nsf;
12826 pris[span].pri.dialplan =
conf->pri.pri.dialplan;
12827 pris[span].pri.localdialplan =
conf->pri.pri.localdialplan;
12828 pris[span].pri.cpndialplan =
conf->pri.pri.cpndialplan;
12829 pris[span].pri.pvts[pris[span].pri.numchans++] =
tmp->sig_pvt;
12830 pris[span].pri.minunused =
conf->pri.pri.minunused;
12831 pris[span].pri.minidle =
conf->pri.pri.minidle;
12832 pris[span].pri.overlapdial =
conf->pri.pri.overlapdial;
12833 pris[span].pri.qsigchannelmapping =
conf->pri.pri.qsigchannelmapping;
12834 pris[span].pri.discardremoteholdretrieval =
conf->pri.pri.discardremoteholdretrieval;
12835#if defined(HAVE_PRI_SERVICE_MESSAGES)
12836 pris[span].pri.enable_service_message_support =
conf->pri.pri.enable_service_message_support;
12838#ifdef HAVE_PRI_INBANDDISCONNECT
12839 pris[span].pri.inbanddisconnect =
conf->pri.pri.inbanddisconnect;
12841#if defined(HAVE_PRI_CALL_HOLD)
12842 pris[span].pri.hold_disconnect_transfer =
12843 conf->pri.pri.hold_disconnect_transfer;
12845#if defined(HAVE_PRI_CCSS)
12846 pris[span].pri.cc_ptmp_recall_mode =
12847 conf->pri.pri.cc_ptmp_recall_mode;
12848 pris[span].pri.cc_qsig_signaling_link_req =
12849 conf->pri.pri.cc_qsig_signaling_link_req;
12850 pris[span].pri.cc_qsig_signaling_link_rsp =
12851 conf->pri.pri.cc_qsig_signaling_link_rsp;
12853#if defined(HAVE_PRI_CALL_WAITING)
12854 pris[span].pri.max_call_waiting_calls =
12855 conf->pri.pri.max_call_waiting_calls;
12856 pris[span].pri.allow_call_waiting_calls =
12857 conf->pri.pri.allow_call_waiting_calls;
12859 pris[span].pri.transfer =
conf->chan.transfer;
12860 pris[span].pri.facilityenable =
conf->pri.pri.facilityenable;
12861#if defined(HAVE_PRI_L2_PERSISTENCE)
12862 pris[span].pri.l2_persistence =
conf->pri.pri.l2_persistence;
12864 pris[span].pri.colp_send =
conf->pri.pri.colp_send;
12865#if defined(HAVE_PRI_AOC_EVENTS)
12866 pris[span].pri.aoc_passthrough_flag =
conf->pri.pri.aoc_passthrough_flag;
12867 pris[span].pri.aoce_delayhangup =
conf->pri.pri.aoce_delayhangup;
12870 pris[span].pri.layer1_ignored =
conf->pri.pri.layer1_ignored;
12873 pris[span].pri.layer1_ignored = 0;
12875 pris[span].pri.append_msn_to_user_tag =
conf->pri.pri.append_msn_to_user_tag;
12876 pris[span].pri.inband_on_setup_ack =
conf->pri.pri.inband_on_setup_ack;
12877 pris[span].pri.inband_on_proceeding =
conf->pri.pri.inband_on_proceeding;
12878 ast_copy_string(pris[span].pri.initial_user_tag,
conf->chan.cid_tag,
sizeof(pris[span].pri.initial_user_tag));
12879 ast_copy_string(pris[span].pri.msn_list,
conf->pri.pri.msn_list,
sizeof(pris[span].pri.msn_list));
12880#if defined(HAVE_PRI_MWI)
12882 conf->pri.pri.mwi_mailboxes,
12883 sizeof(pris[span].pri.mwi_mailboxes));
12885 conf->pri.pri.mwi_vm_boxes,
12886 sizeof(pris[span].pri.mwi_vm_boxes));
12888 conf->pri.pri.mwi_vm_numbers,
12889 sizeof(pris[span].pri.mwi_vm_numbers));
12891 ast_copy_string(pris[span].pri.idledial,
conf->pri.pri.idledial,
sizeof(pris[span].pri.idledial));
12892 ast_copy_string(pris[span].pri.idleext,
conf->pri.pri.idleext,
sizeof(pris[span].pri.idleext));
12893 ast_copy_string(pris[span].pri.internationalprefix,
conf->pri.pri.internationalprefix,
sizeof(pris[span].pri.internationalprefix));
12894 ast_copy_string(pris[span].pri.nationalprefix,
conf->pri.pri.nationalprefix,
sizeof(pris[span].pri.nationalprefix));
12895 ast_copy_string(pris[span].pri.localprefix,
conf->pri.pri.localprefix,
sizeof(pris[span].pri.localprefix));
12896 ast_copy_string(pris[span].pri.privateprefix,
conf->pri.pri.privateprefix,
sizeof(pris[span].pri.privateprefix));
12897 ast_copy_string(pris[span].pri.unknownprefix,
conf->pri.pri.unknownprefix,
sizeof(pris[span].pri.unknownprefix));
12898 pris[span].pri.moh_signaling =
conf->pri.pri.moh_signaling;
12899 pris[span].pri.resetinterval =
conf->pri.pri.resetinterval;
12900#if defined(HAVE_PRI_DISPLAY_TEXT)
12901 pris[span].pri.display_flags_send =
conf->pri.pri.display_flags_send;
12902 pris[span].pri.display_flags_receive =
conf->pri.pri.display_flags_receive;
12904#if defined(HAVE_PRI_MCID)
12905 pris[span].pri.mcid_send =
conf->pri.pri.mcid_send;
12907 pris[span].pri.force_restart_unavailable_chans =
conf->pri.pri.force_restart_unavailable_chans;
12908#if defined(HAVE_PRI_DATETIME_SEND)
12909 pris[span].pri.datetime_send =
conf->pri.pri.datetime_send;
12912 for (x = 0; x < PRI_MAX_TIMERS; x++) {
12913 pris[span].pri.pritimers[x] =
conf->pri.pri.pritimers[x];
12916#if defined(HAVE_PRI_CALL_WAITING)
12918 pris[span].pri.ch_cfg.stripmsd =
conf->chan.stripmsd;
12919 pris[span].pri.ch_cfg.hidecallerid =
conf->chan.hidecallerid;
12920 pris[span].pri.ch_cfg.hidecalleridname =
conf->chan.hidecalleridname;
12921 pris[span].pri.ch_cfg.immediate =
conf->chan.immediate;
12922 pris[span].pri.ch_cfg.priexclusive =
conf->chan.priexclusive;
12923 pris[span].pri.ch_cfg.priindication_oob =
conf->chan.priindication_oob;
12924 pris[span].pri.ch_cfg.use_callerid =
conf->chan.use_callerid;
12925 pris[span].pri.ch_cfg.use_callingpres =
conf->chan.use_callingpres;
12926 ast_copy_string(pris[span].pri.ch_cfg.context,
conf->chan.context,
sizeof(pris[span].pri.ch_cfg.context));
12927 ast_copy_string(pris[span].pri.ch_cfg.mohinterpret,
conf->chan.mohinterpret,
sizeof(pris[span].pri.ch_cfg.mohinterpret));
12940 chan_sig =
tmp->sig;
12942 memset(&p, 0,
sizeof(p));
12943 res = ioctl(
tmp->subs[
SUB_REAL].dfd, DAHDI_GET_PARAMS, &p);
12947 switch (chan_sig) {
12971 p.channo = channel;
12975 p.debouncetime = 5;
12977 p.channo = channel;
12979 if (
conf->timing.prewinktime >= 0)
12980 p.prewinktime =
conf->timing.prewinktime;
12981 if (
conf->timing.preflashtime >= 0)
12982 p.preflashtime =
conf->timing.preflashtime;
12983 if (
conf->timing.winktime >= 0)
12984 p.winktime =
conf->timing.winktime;
12985 if (
conf->timing.flashtime >= 0)
12986 p.flashtime =
conf->timing.flashtime;
12987 if (
conf->timing.starttime >= 0)
12988 p.starttime =
conf->timing.starttime;
12989 if (
conf->timing.rxwinktime >= 0)
12990 p.rxwinktime =
conf->timing.rxwinktime;
12991 if (
conf->timing.rxflashtime >= 0)
12992 p.rxflashtime =
conf->timing.rxflashtime;
12993 if (
conf->timing.debouncetime >= 0)
12994 p.debouncetime =
conf->timing.debouncetime;
13000 res = ioctl(
tmp->subs[
SUB_REAL].dfd, DAHDI_SET_PARAMS, &p);
13009 memset(&bi, 0,
sizeof(bi));
13010 res = ioctl(
tmp->subs[
SUB_REAL].dfd, DAHDI_GET_BUFINFO, &bi);
13012 bi.txbufpolicy =
conf->chan.buf_policy;
13013 bi.rxbufpolicy =
conf->chan.buf_policy;
13014 bi.numbufs =
conf->chan.buf_no;
13015 res = ioctl(
tmp->subs[
SUB_REAL].dfd, DAHDI_SET_BUFINFO, &bi);
13022 tmp->buf_policy =
conf->chan.buf_policy;
13023 tmp->buf_no =
conf->chan.buf_no;
13024 tmp->usefaxbuffers =
conf->chan.usefaxbuffers;
13025 tmp->faxbuf_policy =
conf->chan.faxbuf_policy;
13026 tmp->faxbuf_no =
conf->chan.faxbuf_no;
13031 tmp->bufsize = bi.bufsize;
13034 tmp->immediate =
conf->chan.immediate;
13035 tmp->immediatering =
conf->chan.immediatering;
13036 tmp->transfertobusy =
conf->chan.transfertobusy;
13037 tmp->dialmode =
conf->chan.dialmode;
13038 if (chan_sig & __DAHDI_SIG_FXS) {
13039 tmp->mwimonitor_fsk =
conf->chan.mwimonitor_fsk;
13040 tmp->mwimonitor_neon =
conf->chan.mwimonitor_neon;
13041 tmp->mwimonitor_rpas =
conf->chan.mwimonitor_rpas;
13044 tmp->firstradio = 0;
13046 tmp->permcallwaiting =
conf->chan.callwaiting;
13048 tmp->permcallwaiting = 0;
13051 tmp->drings =
conf->chan.drings;
13054 if (
tmp->drings.ringnum[0].range == 0)
13055 tmp->drings.ringnum[0].range = 10;
13056 if (
tmp->drings.ringnum[1].range == 0)
13057 tmp->drings.ringnum[1].range = 10;
13058 if (
tmp->drings.ringnum[2].range == 0)
13059 tmp->drings.ringnum[2].range = 10;
13062 tmp->callwaitingcallerid =
conf->chan.callwaitingcallerid;
13063 tmp->threewaycalling =
conf->chan.threewaycalling;
13064 tmp->threewaysilenthold =
conf->chan.threewaysilenthold;
13065 tmp->calledsubscriberheld =
conf->chan.calledsubscriberheld;
13067 tmp->use_smdi =
conf->chan.use_smdi;
13068 tmp->permhidecallerid =
conf->chan.hidecallerid;
13069 tmp->hidecalleridname =
conf->chan.hidecalleridname;
13070 tmp->callreturn =
conf->chan.callreturn;
13071 tmp->echocancel =
conf->chan.echocancel;
13072 tmp->echotraining =
conf->chan.echotraining;
13073 tmp->pulse =
conf->chan.pulse;
13074 if (
tmp->echocancel.head.tap_length) {
13075 tmp->echocanbridged =
conf->chan.echocanbridged;
13077 if (
conf->chan.echocanbridged)
13078 ast_log(
LOG_NOTICE,
"echocancelwhenbridged requires echocancel to be enabled; ignoring\n");
13079 tmp->echocanbridged = 0;
13081 tmp->busydetect =
conf->chan.busydetect;
13082 tmp->busycount =
conf->chan.busycount;
13083 tmp->busy_cadence =
conf->chan.busy_cadence;
13084 tmp->callprogress =
conf->chan.callprogress;
13085 tmp->waitfordialtone =
conf->chan.waitfordialtone;
13086 tmp->dialtone_detect =
conf->chan.dialtone_detect;
13087 tmp->faxdetect_timeout =
conf->chan.faxdetect_timeout;
13088 tmp->firstdigit_timeout =
conf->chan.firstdigit_timeout;
13089 tmp->interdigit_timeout =
conf->chan.interdigit_timeout;
13090 tmp->matchdigit_timeout =
conf->chan.matchdigit_timeout;
13091 tmp->cancallforward =
conf->chan.cancallforward;
13092 tmp->dtmfrelax =
conf->chan.dtmfrelax;
13093 tmp->callwaiting =
tmp->permcallwaiting;
13094 tmp->hidecallerid =
tmp->permhidecallerid;
13095 tmp->channel = channel;
13096 tmp->stripmsd =
conf->chan.stripmsd;
13097 tmp->use_callerid =
conf->chan.use_callerid;
13098 tmp->cid_signalling =
conf->chan.cid_signalling;
13099 tmp->cid_start =
conf->chan.cid_start;
13100 tmp->dahditrcallerid =
conf->chan.dahditrcallerid;
13101 tmp->restrictcid =
conf->chan.restrictcid;
13102 tmp->use_callingpres =
conf->chan.use_callingpres;
13103 if (
tmp->usedistinctiveringdetection) {
13104 if (!
tmp->use_callerid) {
13106 tmp->use_callerid = 1;
13111 if (!
tmp->use_smdi) {
13116 if (
tmp->use_smdi) {
13118 if (!(
tmp->smdi_iface)) {
13119 ast_log(
LOG_ERROR,
"Invalid SMDI port specfied, disabling SMDI support\n");
13125 tmp->amaflags =
conf->chan.amaflags;
13128 tmp->propconfno = -1;
13130 tmp->canpark =
conf->chan.canpark;
13131 tmp->transfer =
conf->chan.transfer;
13144 tmp->cid_num[0] =
'\0';
13145 tmp->cid_name[0] =
'\0';
13147#if defined(HAVE_PRI)
13149 tmp->cid_tag[0] =
'\0';
13155 tmp->cid_subaddr[0] =
'\0';
13164#ifdef HAVE_DAHDI_LINEREVERSE_VMWI
13165 tmp->mwisend_setting =
conf->chan.mwisend_setting;
13166 tmp->mwisend_fsk =
conf->chan.mwisend_fsk;
13167 tmp->mwisend_rpas =
conf->chan.mwisend_rpas;
13170 tmp->group =
conf->chan.group;
13171 tmp->callgroup =
conf->chan.callgroup;
13172 tmp->pickupgroup=
conf->chan.pickupgroup;
13177 if (
conf->chan.vars) {
13179 for (v =
conf->chan.vars ; v ; v = v->
next) {
13183 tmp->vars = tmpvar;
13188 tmp->hwrxgain_enabled =
conf->chan.hwrxgain_enabled;
13189 tmp->hwtxgain_enabled =
conf->chan.hwtxgain_enabled;
13190 tmp->hwrxgain =
conf->chan.hwrxgain;
13191 tmp->hwtxgain =
conf->chan.hwtxgain;
13192 tmp->cid_rxgain =
conf->chan.cid_rxgain;
13193 tmp->rxgain =
conf->chan.rxgain;
13194 tmp->txgain =
conf->chan.txgain;
13195 tmp->txdrc =
conf->chan.txdrc;
13196 tmp->rxdrc =
conf->chan.rxdrc;
13197 tmp->tonezone =
conf->chan.tonezone;
13199 if (
tmp->hwrxgain_enabled) {
13202 if (
tmp->hwtxgain_enabled) {
13210 switch (chan_sig) {
13221 ioctl(
tmp->subs[
SUB_REAL].dfd,DAHDI_SETTONEZONE,&
tmp->tonezone);
13224 switch (
tmp->sig) {
13230#if defined(HAVE_SS7)
13237 analog_p =
tmp->sig_pvt;
13248 tmp->polarityonanswerdelay =
conf->chan.polarityonanswerdelay;
13249 tmp->answeronpolarityswitch =
conf->chan.answeronpolarityswitch;
13250 tmp->ani_info_digits =
conf->chan.ani_info_digits;
13251 tmp->ani_wink_time =
conf->chan.ani_wink_time;
13252 tmp->ani_timeout =
conf->chan.ani_timeout;
13253 tmp->hanguponpolarityswitch =
conf->chan.hanguponpolarityswitch;
13254 tmp->reoriginate =
conf->chan.reoriginate;
13255 tmp->sendcalleridafter =
conf->chan.sendcalleridafter;
13259 tmp->locallyblocked = 0;
13260 tmp->remotelyblocked = 0;
13261 switch (
tmp->sig) {
13262#if defined(HAVE_PRI)
13264 tmp->inservice = 1;
13265#if defined(HAVE_PRI_SERVICE_MESSAGES)
13268 char db_chan_name[20];
13275 snprintf(db_chan_name,
sizeof(db_chan_name),
"%s/%d:%d", dahdi_db,
tmp->span,
tmp->channel);
13276 if (!
ast_db_get(db_chan_name, SRVST_DBKEY, db_answer,
sizeof(db_answer))) {
13280 if (
tmp->pri->enable_service_message_support) {
13283 sscanf(db_answer,
"%1c:%30u", &
state, why);
13286 *why &= (SRVST_NEAREND | SRVST_FAREND);
13296#if defined(HAVE_SS7)
13298 tmp->inservice = 0;
13306 tmp->inservice = 1;
13311 switch (
tmp->sig) {
13312#if defined(HAVE_PRI)
13332#if defined(HAVE_SS7)
13354 analog_p =
tmp->sig_pvt;
13386 switch (
conf->chan.cid_start) {
13404 if (chan_sig & __DAHDI_SIG_FXO) {
13405 memset(&p, 0,
sizeof(p));
13406 res = ioctl(
tmp->subs[
SUB_REAL].dfd, DAHDI_GET_PARAMS, &p);
13410#ifdef HAVE_DAHDI_LINEREVERSE_VMWI
13411 res = ioctl(
tmp->subs[
SUB_REAL].dfd, DAHDI_VMWI_CONFIG, &
tmp->mwisend_setting);
13424#if defined(HAVE_PRI)
13430 dahdi_pseudo_parms.buf_no =
tmp->buf_no;
13431 dahdi_pseudo_parms.buf_policy =
tmp->buf_policy;
13432 dahdi_pseudo_parms.faxbuf_no =
tmp->faxbuf_no;
13433 dahdi_pseudo_parms.faxbuf_policy =
tmp->faxbuf_policy;
13437 if (
tmp && !here) {
13446#if defined(HAVE_PRI)
13449 if (!p->pri || p->pri->
span != span) {
13452 if (!groupmatch && channelmatch == -1) {
13461 if ((p->
group & groupmatch) != groupmatch)
13467 if (channelmatch != -1) {
13468 if (p->
channel != channelmatch)
13471 *channelmatched = 1;
13488#if defined(HAVE_PRI)
13500#if defined(HAVE_SS7)
13517 if (p->mfcr2call) {
13530#if defined(HAVE_PRI)
13531#if defined(HAVE_PRI_CALL_WAITING)
13546 pvt->
stripmsd = pri->ch_cfg.stripmsd;
13549 pvt->
immediate = pri->ch_cfg.immediate;
13560#if defined(HAVE_PRI)
13573static int dahdi_new_pri_nobch_channel(
struct sig_pri_span *pri)
13580 struct dahdi_bufferinfo bi;
13585 for (pvt_idx = 0; pvt_idx < pri->
numchans; ++pvt_idx) {
13586 if (!pri->
pvts[pvt_idx]) {
13614 pvt->
buf_no = dahdi_pseudo_parms.buf_no;
13615 pvt->
buf_policy = dahdi_pseudo_parms.buf_policy;
13616 pvt->
faxbuf_no = dahdi_pseudo_parms.faxbuf_no;
13637 pri->
pvts[pvt_idx] = chan;
13641 ast_log(
LOG_ERROR,
"Unable to open no B channel interface pseudo channel: %s\n",
13646 memset(&bi, 0,
sizeof(bi));
13652 bi.numbufs = pvt->
buf_no;
13656 "Unable to set buffer policy on no B channel interface: %s\n",
13661 "Unable to check buffer policy on no B channel interface: %s\n",
13668 pvt->
channel = nobch_channel;
13672 dahdi_nobch_insert(pri, pvt);
13686 struct dahdi_bufferinfo bi;
13717 bi.numbufs = src->
buf_no;
13754 char *subdir =
NULL;
13798 memset(param, 0,
sizeof(*param));
13801 if (strchr(
args.group,
'!') !=
NULL) {
13803 while ((s = strchr(
prev,
'!')) !=
NULL) {
13807 *(
prev - 1) =
'\0';
13808 subdir =
args.group;
13810 }
else if (
args.group[0] ==
'i') {
13812 res = sscanf(
args.group + 1,
"%30d", &x);
13820 s = strchr(
args.group,
'-');
13825 args.group = s + 1;
13828 if (toupper(
args.group[0]) ==
'G' || toupper(
args.group[0])==
'R') {
13830 s =
args.group + 1;
13831 res = sscanf(s,
"%30d%1c%30d", &x, ¶m->
opt, ¶m->
cadence);
13838 if (toupper(
args.group[0]) ==
'G') {
13839 if (
args.group[0] ==
'G') {
13850 if (
args.group[0] ==
'R') {
13865 if (!strcasecmp(s,
"pseudo")) {
13870 res = sscanf(s,
"%30d%1c%30d", &x, ¶m->
opt, ¶m->
cadence);
13882 snprintf(path,
sizeof(path),
"/dev/dahdi/%s/%d",
13884 if (stat(path, &stbuf) < 0) {
13886 path, strerror(
errno));
13889 if (!S_ISCHR(stbuf.st_mode)) {
13900 if (param->
opt ==
'r' && res < 3) {
13910 const char *
data,
int *cause)
13916 int channelmatched = 0;
13917 int foundowner = 0;
13918 int groupmatched = 0;
13919#if defined(HAVE_PRI) || defined(HAVE_SS7)
13920 int transcapdigital = 0;
13937 while (p && !
tmp) {
13953 if (p->mfcr2call) {
13955 ast_debug(1,
"Yay!, someone just beat us in the race for channel %d.\n", p->
channel);
13971 switch (start.
opt) {
13984#if defined(HAVE_PRI) || defined(HAVE_SS7)
14011#if defined(HAVE_SS7)
14020#if defined(HAVE_PRI)
14023#if defined(HAVE_PRI_CALL_WAITING)
14062 if (cause && !
tmp) {
14063 if (callwait || (channelmatched && foundowner)) {
14065 }
else if (groupmatched) {
14091#if defined(HAVE_PRI)
14092 const char *device;
14098 if (*device !=
'I') {
14102 res = sscanf(device,
"I%30u", &span);
14103 if (res != 1 || !span ||
NUM_SPANS < span) {
14107 device = strchr(device,
'/');
14117#if defined(THRESHOLD_DEVSTATE_PLACEHOLDER)
14119 if (!strcmp(device,
"congestion"))
14122 return pris[span - 1].pri.congestion_devstate;
14124#if defined(THRESHOLD_DEVSTATE_PLACEHOLDER)
14125 else if (!strcmp(device,
"threshold")) {
14126 return pris[span - 1].pri.threshold_devstate;
14156 int groupmatched = 0;
14157 int channelmatched = 0;
14171 const char *monitor_type;
14181#if defined(HAVE_PRI)
14187 snprintf(full_device_name,
sizeof(full_device_name),
14188 "DAHDI/I%d/congestion", p->pri->
span);
14192#if defined(HAVE_PRI)
14197 snprintf(full_device_name,
sizeof(full_device_name),
"DAHDI/%s",
14205 dash = strrchr(full_device_name,
'-');
14210 snprintf(dialstring,
sizeof(dialstring),
"DAHDI/%s", dest);
14220#
if defined(HAVE_PRI)
14225 monitor_type, full_device_name, dialstring,
NULL);
14233 if (p == exitpvt) {
14241#if defined(HAVE_SS7)
14242static void dahdi_ss7_message(
struct ss7 *ss7,
char *s)
14248 if (linksets[i].ss7.ss7 == ss7) {
14258#if defined(HAVE_SS7)
14259static void dahdi_ss7_error(
struct ss7 *ss7,
char *s)
14265 if (linksets[i].ss7.ss7 == ss7) {
14275#if defined(HAVE_OPENR2)
14276static void *mfcr2_monitor(
void *data)
14278 struct dahdi_mfcr2 *mfcr2 = data;
14296 for (i = 0; i < mfcr2->numchans; i++) {
14297 pvt = mfcr2->pvts[i];
14301 openr2_chan_set_idle(pvt->r2chan);
14302 openr2_chan_handle_cas(pvt->r2chan);
14308 for (i = 0; i < mfcr2->numchans; i++) {
14309 pollers[i].revents = 0;
14310 pollers[i].events = 0;
14311 pvt = mfcr2->pvts[i];
14318 if (mfcr2->nodev) {
14321 if (!pvt->r2chan) {
14326 openr2_chan_enable_read(pvt->r2chan);
14327 pollers[i].events = POLLIN | POLLPRI;
14334 if (pollsize == 0) {
14336 ast_debug(1,
"Monitor thread going idle since everybody has an owner\n");
14339 poll(
NULL, 0, maxsleep);
14345 pthread_testcancel();
14346 res = poll(pollers, mfcr2->numchans, maxsleep);
14347 pthread_testcancel();
14348 if ((res < 0) && (
errno != EINTR)) {
14353 pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &oldstate);
14354 for (i = 0; i < mfcr2->numchans; i++) {
14355 pvt = mfcr2->pvts[i];
14359 if (pollers[i].revents & POLLPRI || pollers[i].revents & POLLIN) {
14360 openr2_chan_process_event(pvt->r2chan);
14363 pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, &oldstate);
14370#if defined(HAVE_PRI)
14371static void dahdi_pri_message(
struct pri *pri,
char *s)
14377 int dchancount = 0;
14382 if (pris[x].pri.dchans[y]) {
14386 if (pris[x].pri.dchans[y] == pri) {
14397 if (1 < dchancount) {
14411 if (pridebugfd >= 0) {
14412 if (write(pridebugfd, s, strlen(s)) < 0) {
14421#if defined(HAVE_PRI)
14422static void dahdi_pri_error(
struct pri *pri,
char *s)
14428 int dchancount = 0;
14433 if (pris[x].pri.dchans[y]) {
14437 if (pris[x].pri.dchans[y] == pri) {
14448 if (1 < dchancount) {
14462 if (pridebugfd >= 0) {
14463 if (write(pridebugfd, s, strlen(s)) < 0) {
14472#if defined(HAVE_PRI)
14473static int prepare_pri(
struct dahdi_pri *pri)
14476 struct dahdi_params p;
14477 struct dahdi_bufferinfo bi;
14478 struct dahdi_spaninfo si;
14481 if (!pri->dchannels[i])
14483 if (pri->pri.fds[i] >= 0) {
14487 pri->pri.fds[i] = open(
"/dev/dahdi/channel", O_RDWR);
14488 if ((pri->pri.fds[i] < 0)) {
14490 pri->pri.fds[i], strerror(
errno));
14493 x = pri->dchannels[i];
14494 res = ioctl(pri->pri.fds[i], DAHDI_SPECIFY, &x);
14496 dahdi_close_pri_fd(pri, i);
14500 memset(&p, 0,
sizeof(p));
14501 res = ioctl(pri->pri.fds[i], DAHDI_GET_PARAMS, &p);
14503 dahdi_close_pri_fd(pri, i);
14507 if ((p.sigtype != DAHDI_SIG_HDLCFCS) && (p.sigtype != DAHDI_SIG_HARDHDLC)) {
14508 dahdi_close_pri_fd(pri, i);
14512 memset(&si, 0,
sizeof(si));
14513 res = ioctl(pri->pri.fds[i], DAHDI_SPANSTAT, &si);
14515 dahdi_close_pri_fd(pri, i);
14523 memset(&bi, 0,
sizeof(bi));
14524 bi.txbufpolicy = DAHDI_POLICY_IMMEDIATE;
14525 bi.rxbufpolicy = DAHDI_POLICY_IMMEDIATE;
14528 if (ioctl(pri->pri.fds[i], DAHDI_SET_BUFINFO, &bi)) {
14530 dahdi_close_pri_fd(pri, i);
14533 pri->pri.dchan_logical_span[i] = pris[p.spanno - 1].prilogicalspan;
14539#if defined(HAVE_PRI)
14540static char *complete_span_helper(
const char *line,
const char *
word,
int pos,
int state,
int rpos)
14548 for (which = span = 0; span <
NUM_SPANS; span++) {
14549 if (pris[span].pri.pri && ++which >
state) {
14560#if defined(HAVE_PRI)
14561static char *complete_span_4(
const char *line,
const char *
word,
int pos,
int state)
14563 return complete_span_helper(line,
word,pos,
state,3);
14567#if defined(HAVE_PRI)
14573 e->
command =
"pri set debug file";
14574 e->
usage =
"Usage: pri set debug file [output-file]\n"
14575 " Sends PRI debug output to the specified output file\n";
14588 ast_cli(
a->fd,
"Unable to open '%s' for writing\n",
a->argv[4]);
14594 if (pridebugfd >= 0)
14600 ast_cli(
a->fd,
"PRI debug output will be sent to '%s'\n",
a->argv[4]);
14605#if defined(HAVE_PRI)
14606static int action_pri_debug_file_set(
struct mansession *s,
const struct message *m)
14623 if (pridebugfd >= 0) {
14628 ast_copy_string(pridebugfilename, output_file,
sizeof(pridebugfilename));
14630 astman_send_ack(s, m,
"PRI debug output will now be sent to requested file.");
14636#if defined(HAVE_PRI)
14637static int action_pri_debug_file_unset(
struct mansession *s,
const struct message *m)
14641 if (pridebugfd >= 0) {
14654#if defined(HAVE_PRI)
14663 e->
command =
"pri set debug {on|off|hex|intense|0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15} span";
14665 "Usage: pri set debug {<level>|on|off|hex|intense} span <span>\n"
14666 " Enables debugging on a given PRI span\n"
14667 " Level is a bitmap of the following values:\n"
14668 " 1 General debugging incl. state changes\n"
14669 " 2 Decoded Q.931 messages\n"
14670 " 4 Decoded Q.921 messages\n"
14671 " 8 Raw hex dumps of Q.921 frames\n"
14672 " on - equivalent to 3\n"
14673 " hex - equivalent to 8\n"
14674 " intense - equivalent to 15\n";
14677 return complete_span_4(
a->line,
a->word,
a->pos,
a->n);
14683 if (!strcasecmp(
a->argv[3],
"on")) {
14685 }
else if (!strcasecmp(
a->argv[3],
"off")) {
14687 }
else if (!strcasecmp(
a->argv[3],
"intense")) {
14689 }
else if (!strcasecmp(
a->argv[3],
"hex")) {
14692 level = atoi(
a->argv[3]);
14694 span = atoi(
a->argv[5]);
14695 if ((span < 1) || (span >
NUM_SPANS)) {
14696 ast_cli(
a->fd,
"Invalid span %s. Should be a number %d to %d\n",
a->argv[5], 1,
NUM_SPANS);
14699 if (!pris[span-1].pri.pri) {
14700 ast_cli(
a->fd,
"No PRI running on span %d\n", span);
14705 if (level & 2) debugmask |= PRI_DEBUG_Q931_DUMP;
14706 if (level & 4) debugmask |= PRI_DEBUG_Q921_DUMP;
14707 if (level & 8) debugmask |= PRI_DEBUG_Q921_RAW;
14711 if (pris[span - 1].pri.dchans[x]) {
14712 pri_set_debug(pris[span - 1].pri.dchans[x], debugmask);
14718 if (0 <= pridebugfd) {
14721 ast_cli(
a->fd,
"Disabled PRI debug output to file '%s'\n",
14726 pris[span - 1].pri.debug = (level) ? 1 : 0;
14727 ast_cli(
a->fd,
"%s debugging on span %d\n", (level) ?
"Enabled" :
"Disabled", span);
14732#if defined(HAVE_PRI)
14752 if (!strcasecmp(level,
"on")) {
14754 }
else if (!strcasecmp(level,
"off")) {
14756 }
else if (!strcasecmp(level,
"intense")) {
14758 }
else if (!strcasecmp(level,
"hex")) {
14761 if (sscanf(level,
"%30d", &level_val) != 1) {
14767 if (sscanf(span,
"%30d", &span_val) != 1) {
14771 if ((span_val < 1) || (span_val >
NUM_SPANS)) {
14773 char id_text[256] =
"";
14776 snprintf(id_text,
sizeof(id_text),
"ActionID: %s\r\n",
id);
14781 "Message: Invalid span '%s' - Should be a number from 1 to %d\r\n"
14789 if (!pris[span_val-1].pri.pri) {
14794 if (level_val & 1) {
14797 if (level_val & 2) {
14798 debugmask |= PRI_DEBUG_Q931_DUMP;
14800 if (level_val & 4) {
14801 debugmask |= PRI_DEBUG_Q921_DUMP;
14803 if (level_val & 8) {
14804 debugmask |= PRI_DEBUG_Q921_RAW;
14809 if (pris[span_val - 1].pri.dchans[x]) {
14810 pri_set_debug(pris[span_val - 1].pri.dchans[x], debugmask);
14814 pris[span_val - 1].pri.debug = (level_val) ? 1 : 0;
14821#if defined(HAVE_PRI)
14822#if defined(HAVE_PRI_SERVICE_MESSAGES)
14828 int x, y, fd =
a->fd;
14829 int interfaceid = 0;
14830 char db_chan_name[20], db_answer[15];
14832 struct dahdi_pri *pri;
14834 if (
a->argc < 5 ||
a->argc > 6)
14836 if (strchr(
a->argv[4],
':')) {
14837 if (sscanf(
a->argv[4],
"%30d:%30d", &trunkgroup, &channel) != 2)
14839 if ((trunkgroup < 1) || (channel < 1))
14843 if (pris[x].pri.trunkgroup == trunkgroup) {
14849 ast_cli(fd,
"No such trunk group %d\n", trunkgroup);
14853 channel = atoi(
a->argv[4]);
14856 interfaceid = atoi(
a->argv[5]);
14861 if (pris[x].dchannels[y] == channel) {
14863 if (pri->pri.enable_service_message_support) {
14865 pri_maintenance_service(pri->pri.pri, interfaceid, -1, changestatus);
14869 "\n\tThis operation has not been enabled in chan_dahdi.conf, set 'service_message_support=yes' to use this operation.\n"
14870 "\tNote only 4ESS, 5ESS, and NI2 switch types are supported.\n\n");
14880 if (
tmp->pri &&
tmp->channel == channel) {
14883 if (!
tmp->pri->enable_service_message_support) {
14886 "\n\tThis operation has not been enabled in chan_dahdi.conf, set 'service_message_support=yes' to use this operation.\n"
14887 "\tNote only 4ESS, 5ESS, and NI2 switch types are supported.\n\n");
14890 snprintf(db_chan_name,
sizeof(db_chan_name),
"%s/%d:%d", dahdi_db,
tmp->span, channel);
14892 switch(changestatus) {
14896 *why &= ~SRVST_NEAREND;
14898 snprintf(db_answer,
sizeof(db_answer),
"%s:%u", SRVST_TYPE_OOS, *why);
14899 ast_db_put(db_chan_name, SRVST_DBKEY, db_answer);
14901 dahdi_pri_update_span_devstate(
tmp->pri);
14908 *why |= SRVST_NEAREND;
14909 snprintf(db_answer,
sizeof(db_answer),
"%s:%u", SRVST_TYPE_OOS, *why);
14910 ast_db_put(db_chan_name, SRVST_DBKEY, db_answer);
14911 dahdi_pri_update_span_devstate(
tmp->pri);
14919 pri_maintenance_bservice(
tmp->pri->pri,
tmp->sig_pvt, changestatus);
14926 ast_cli(fd,
"Unable to find given channel %d, possibly not a PRI\n",
channel);
14934 e->
command =
"pri service enable channel";
14936 "Usage: pri service enable channel <channel> [<interface id>]\n"
14937 " Send an AT&T / NFAS / CCS ANSI T1.607 maintenance message\n"
14938 " to restore a channel to service, with optional interface id\n"
14939 " as agreed upon with remote switch operator\n";
14944 return handle_pri_service_generic(e, cmd,
a, 0);
14951 e->
command =
"pri service disable channel";
14953 "Usage: pri service disable channel <chan num> [<interface id>]\n"
14954 " Send an AT&T / NFAS / CCS ANSI T1.607 maintenance message\n"
14955 " to remove a channel from service, with optional interface id\n"
14956 " as agreed upon with remote switch operator\n";
14961 return handle_pri_service_generic(e, cmd,
a, 2);
14966#if defined(HAVE_PRI)
14973 e->
command =
"pri show channels";
14975 "Usage: pri show channels\n"
14976 " Displays PRI channel information such as the current mapping\n"
14977 " of DAHDI B channels to Asterisk channel names and which calls\n"
14978 " are on hold or call-waiting. Calls on hold or call-waiting\n"
14979 " are not associated with any B channel.\n";
14989 for (span = 0; span <
NUM_SPANS; ++span) {
14990 if (pris[span].
pri.
pri) {
14998#if defined(HAVE_PRI)
15005 e->
command =
"pri show spans";
15007 "Usage: pri show spans\n"
15008 " Displays PRI span information\n";
15017 for (span = 0; span <
NUM_SPANS; span++) {
15018 if (pris[span].
pri.
pri) {
15026#if defined(HAVE_PRI)
15027#define container_of(ptr, type, member) \
15028 ((type *)((char *)(ptr) - offsetof(type, member)))
15045 struct dahdi_pri* dahdi_pri;
15046 pthread_t master = pri->
master;
15051 ast_debug(2,
"About to destroy DAHDI channels of span %d.\n", pri->
span);
15052 for (i = 0; i < pri->
numchans; i++) {
15064 cancel_code = pthread_cancel(master);
15065 pthread_kill(master, SIGURG);
15067 "Waiting to join thread of span %d "
15068 "with pid=%p cancel_code=%d\n",
15069 pri->
span, (
void *)master, cancel_code);
15070 res = pthread_join(master,
NULL);
15079 ast_debug(4,
"closing pri_fd %d\n", i);
15080 dahdi_close_pri_fd(dahdi_pri, i);
15081 dahdi_pri->dchannels[i] = 0;
15087static char *handle_pri_destroy_span(
struct ast_cli_entry *e,
int cmd,
15096 e->
command =
"pri destroy span";
15098 "Usage: pri destroy span <span>\n"
15099 " Destorys D-channel of span and its B-channels.\n"
15100 " DON'T USE THIS UNLESS YOU KNOW WHAT YOU ARE DOING.\n";
15103 return complete_span_4(
a->line,
a->word,
a->pos,
a->n);
15109 res = sscanf(
a->argv[3],
"%30d", &
span);
15110 if ((res != 1) || span < 1 || span >
NUM_SPANS) {
15112 "Invalid span '%s'. Should be a number from %d to %d\n",
15122 pri_destroy_span(
pri);
15128#if defined(HAVE_PRI)
15135 e->
command =
"pri show span";
15137 "Usage: pri show span <span>\n"
15138 " Displays PRI Information on a given PRI span\n";
15141 return complete_span_4(
a->line,
a->word,
a->pos,
a->n);
15146 span = atoi(
a->argv[3]);
15148 ast_cli(
a->fd,
"Invalid span '%s'. Should be a number from %d to %d\n",
a->argv[3], 1,
NUM_SPANS);
15162#if defined(HAVE_PRI)
15172 e->
command =
"pri show debug";
15174 "Usage: pri show debug\n"
15175 " Show the debug state of pri spans\n";
15184 if (pris[
span].
pri.dchans[x]) {
15186 ast_cli(
a->fd,
"Span %d: Debug: %s\tIntense: %s\n",
span+1, (
debug&PRI_DEBUG_Q931_STATE)?
"Yes" :
"No" ,(
debug&PRI_DEBUG_Q921_RAW)?
"Yes" :
"No" );
15194 if (pridebugfd >= 0)
15195 ast_cli(
a->fd,
"Logging PRI debug to file %s\n", pridebugfilename);
15199 ast_cli(
a->fd,
"No PRI running\n");
15204#if defined(HAVE_PRI)
15209 e->
command =
"pri show version";
15211 "Usage: pri show version\n"
15212 "Show libpri version information\n";
15218 ast_cli(
a->fd,
"libpri version: %s\n", pri_get_version());
15224#if defined(HAVE_PRI)
15226 AST_CLI_DEFINE(handle_pri_debug,
"Enables PRI debugging on a span"),
15227#if defined(HAVE_PRI_SERVICE_MESSAGES)
15228 AST_CLI_DEFINE(handle_pri_service_enable_channel,
"Return a channel to service"),
15229 AST_CLI_DEFINE(handle_pri_service_disable_channel,
"Remove a channel from service"),
15231 AST_CLI_DEFINE(handle_pri_show_channels,
"Displays PRI channel information"),
15232 AST_CLI_DEFINE(handle_pri_show_spans,
"Displays PRI span information"),
15233 AST_CLI_DEFINE(handle_pri_show_span,
"Displays PRI span information"),
15235 AST_CLI_DEFINE(handle_pri_show_debug,
"Displays current PRI debug settings"),
15236 AST_CLI_DEFINE(handle_pri_set_debug_file,
"Sends PRI debug output to the specified file"),
15247 e->
command =
"mfcr2 show version";
15249 "Usage: mfcr2 show version\n"
15250 " Shows the version of the OpenR2 library being used.\n";
15255 ast_cli(
a->fd,
"OpenR2 version: %s, revision: %s\n", openr2_get_version(), openr2_get_revision());
15261#define FORMAT "%4s %40s\n"
15263 int numvariants = 0;
15264 const openr2_variant_entry_t *variants;
15267 e->
command =
"mfcr2 show variants";
15269 "Usage: mfcr2 show variants\n"
15270 " Shows the list of MFC/R2 variants supported.\n";
15275 if (!(variants = openr2_proto_get_variant_list(&numvariants))) {
15276 ast_cli(
a->fd,
"Failed to get list of variants.\n");
15280 for (i = 0; i < numvariants; i++) {
15289#define FORMAT "%4s %4s %-7.7s %-7.7s %-8.8s %-9.9s %-16.16s %-8.8s %-8.8s\n"
15290 int filtertype = 0;
15297 openr2_context_t *r2context;
15298 openr2_variant_t r2variant;
15301 e->
command =
"mfcr2 show channels [group|context]";
15303 "Usage: mfcr2 show channels [group <group> | context <context>]\n"
15304 " Shows the DAHDI channels configured with MFC/R2 signaling.\n";
15309 if (!((
a->argc == 3) || (
a->argc == 5))) {
15312 if (
a->argc == 5) {
15313 if (!strcasecmp(
a->argv[3],
"group")) {
15314 targetnum = atoi(
a->argv[4]);
15315 if ((targetnum < 0) || (targetnum > 63))
15317 targetnum = 1 << targetnum;
15319 }
else if (!strcasecmp(
a->argv[3],
"context")) {
15325 ast_cli(
a->fd,
FORMAT,
"Chan",
"Link#",
"Variant",
"Max ANI",
"Max DNIS",
"ANI First",
"Immediate Accept",
"Tx CAS",
"Rx CAS");
15332 switch(filtertype) {
15334 if (p->
group != targetnum) {
15339 if (strcasecmp(p->
context,
a->argv[4])) {
15347 r2context = openr2_chan_get_context(p->r2chan);
15348 r2variant = openr2_context_get_variant(r2context);
15349 snprintf(channo,
sizeof(channo),
"%d", p->
channel);
15350 snprintf(linkno,
sizeof(linkno),
"%d", p->mfcr2->index);
15351 snprintf(anino,
sizeof(anino),
"%d", openr2_context_get_max_ani(r2context));
15352 snprintf(dnisno,
sizeof(dnisno),
"%d", openr2_context_get_max_dnis(r2context));
15353 ast_cli(
a->fd,
FORMAT, channo, linkno, openr2_proto_get_variant_string(r2variant),
15354 anino, dnisno, openr2_context_get_ani_first(r2context) ?
"Yes" :
"No",
15355 openr2_context_get_immediate_accept(r2context) ?
"Yes" :
"No",
15356 openr2_chan_get_tx_cas_string(p->r2chan), openr2_chan_get_rx_cas_string(p->r2chan));
15367 char *toklevel =
NULL;
15368 char *saveptr =
NULL;
15369 char *logval =
NULL;
15370 openr2_log_level_t loglevel = OR2_LOG_NOTHING;
15371 openr2_log_level_t tmplevel = OR2_LOG_NOTHING;
15374 e->
command =
"mfcr2 set debug";
15376 "Usage: mfcr2 set debug <loglevel> <channel>\n"
15377 " Set a new logging level for the specified channel.\n"
15378 " If no channel is specified the logging level will be applied to all channels.\n";
15386 channo = (
a->argc == 5) ? atoi(
a->argv[4]) : -1;
15388 toklevel = strtok_r(logval,
",", &saveptr);
15389 if (-1 == (tmplevel = openr2_log_get_level(toklevel))) {
15390 ast_cli(
a->fd,
"Invalid MFC/R2 logging level '%s'.\n",
a->argv[3]);
15392 }
else if (OR2_LOG_NOTHING == tmplevel) {
15393 loglevel = tmplevel;
15395 loglevel |= tmplevel;
15396 while ((toklevel = strtok_r(
NULL,
",", &saveptr))) {
15397 if (-1 == (tmplevel = openr2_log_get_level(toklevel))) {
15398 ast_cli(
a->fd,
"Ignoring invalid logging level: '%s'.\n", toklevel);
15401 loglevel |= tmplevel;
15409 if ((channo != -1) && (p->
channel != channo )) {
15412 openr2_chan_set_log_level(p->r2chan, loglevel);
15413 if (channo != -1) {
15414 ast_cli(
a->fd,
"MFC/R2 debugging set to '%s' for channel %d.\n",
a->argv[3], p->
channel);
15418 if ((channo != -1) && !p) {
15419 ast_cli(
a->fd,
"MFC/R2 channel %d not found.\n", channo);
15421 if (channo == -1) {
15422 ast_cli(
a->fd,
"MFC/R2 debugging set to '%s' for all channels.\n",
a->argv[3]);
15434 e->
command =
"mfcr2 call files [on|off]";
15436 "Usage: mfcr2 call files [on|off] <channel>\n"
15437 " Enable call files creation on the specified channel.\n"
15438 " If no channel is specified call files creation policy will be applied to all channels.\n";
15446 channo = (
a->argc == 5) ? atoi(
a->argv[4]) : -1;
15452 if ((channo != -1) && (p->
channel != channo )) {
15456 openr2_chan_enable_call_files(p->r2chan);
15458 openr2_chan_disable_call_files(p->r2chan);
15460 if (channo != -1) {
15462 ast_cli(
a->fd,
"MFC/R2 call files enabled for channel %d.\n", p->
channel);
15464 ast_cli(
a->fd,
"MFC/R2 call files disabled for channel %d.\n", p->
channel);
15469 if ((channo != -1) && !p) {
15470 ast_cli(
a->fd,
"MFC/R2 channel %d not found.\n", channo);
15472 if (channo == -1) {
15474 ast_cli(
a->fd,
"MFC/R2 Call files enabled for all channels.\n");
15476 ast_cli(
a->fd,
"MFC/R2 Call files disabled for all channels.\n");
15489 e->
command =
"mfcr2 set idle";
15491 "Usage: mfcr2 set idle <channel>\n"
15492 " DON'T USE THIS UNLESS YOU KNOW WHAT YOU ARE DOING.\n"
15493 " Force the given channel into IDLE state.\n"
15494 " If no channel is specified, all channels will be set to IDLE.\n";
15499 channo = (
a->argc == 4) ? atoi(
a->argv[3]) : -1;
15505 if ((channo != -1) && (p->
channel != channo )) {
15508 openr2_chan_set_idle(p->r2chan);
15513 if (channo != -1) {
15517 if ((channo != -1) && !p) {
15518 ast_cli(
a->fd,
"MFC/R2 channel %d not found.\n", channo);
15530 e->
command =
"mfcr2 set blocked";
15532 "Usage: mfcr2 set blocked <channel>\n"
15533 " DON'T USE THIS UNLESS YOU KNOW WHAT YOU ARE DOING.\n"
15534 " Force the given channel into BLOCKED state.\n"
15535 " If no channel is specified, all channels will be set to BLOCKED.\n";
15540 channo = (
a->argc == 4) ? atoi(
a->argv[3]) : -1;
15546 if ((channo != -1) && (p->
channel != channo )) {
15549 openr2_chan_set_blocked(p->r2chan);
15553 if (channo != -1) {
15557 if ((channo != -1) && !p) {
15558 ast_cli(
a->fd,
"MFC/R2 channel %d not found.\n", channo);
15564static void mfcr2_show_links_of(
struct ast_cli_args *
a,
struct r2links *list_head,
const char *title)
15566#define FORMAT "%-5s %-10s %-15s %-10s %s\n"
15571 char live_chans_str[5];
15572 char channel_list[R2_LINK_CAPACITY * 4];
15573 struct r2link_entry *cur;
15575 ast_cli(
a->fd,
FORMAT,
"Index",
"Thread",
"Dahdi-Device",
"Channels",
"Channel-List");
15577 struct dahdi_mfcr2 *mfcr2 = &cur->mfcr2;
15578 const char *thread_status =
NULL;
15585 if (mfcr2->r2master == 0L) {
15586 thread_status =
"zero";
15588 thread_status =
"none";
15590 thread_status =
"created";
15592 snprintf(index,
sizeof(index),
"%d", mfcr2->index);
15593 snprintf(live_chans_str,
sizeof(live_chans_str),
"%d", mfcr2->live_chans);
15599 for (i = 0; i < mfcr2->numchans &&
len <
sizeof(channel_list) - 1; i++) {
15606 if (prev_channo && prev_channo == channo - 1) {
15607 prev_channo = channo;
15611 if (inside_range) {
15613 len += snprintf(channel_list +
len,
sizeof(channel_list) -
len - 1,
"-%d,%d", prev_channo, channo);
15615 }
else if (prev_channo) {
15617 len += snprintf(channel_list +
len,
sizeof(channel_list) -
len - 1,
",%d", channo);
15620 len += snprintf(channel_list +
len,
sizeof(channel_list) -
len - 1,
"%d", channo);
15622 prev_channo = channo;
15625 if (inside_range) {
15627 len += snprintf(channel_list +
len,
sizeof(channel_list) -
len - 1,
"-%d", channo);
15629 }
else if (prev_channo) {
15631 len += snprintf(channel_list +
len,
sizeof(channel_list) -
len - 1,
",%d", channo);
15637 (mfcr2->nodev) ?
"MISSING" :
"OK",
15650 e->
command =
"mfcr2 show links";
15652 "Usage: mfcr2 show links\n"
15653 " Shows the DAHDI MFC/R2 links.\n";
15658 if (
a->argc != 3) {
15661 mfcr2_show_links_of(
a, &r2links,
"Live links\n");
15662 mfcr2_show_links_of(
a, &nodev_r2links,
"Links to be removed (device missing)\n");
15669 int wanted_link_index;
15670 int found_link = 0;
15671 struct r2link_entry *cur =
NULL;
15675 e->
command =
"mfcr2 destroy link";
15677 "Usage: mfcr2 destroy link <index-number>\n"
15678 " Destorys D-channel of link and its B-channels.\n"
15679 " DON'T USE THIS UNLESS YOU KNOW WHAT YOU ARE DOING.\n";
15687 res = sscanf(
a->argv[3],
"%30d", &wanted_link_index);
15688 if ((res != 1) || wanted_link_index < 1) {
15690 "Invalid link index '%s'. Should be a positive number\n",
a->argv[3]);
15695 struct dahdi_mfcr2 *mfcr2 = &cur->mfcr2;
15696 if (wanted_link_index == mfcr2->index) {
15704 if (! found_link) {
15705 ast_cli(
a->fd,
"No link found with index %d.\n", wanted_link_index);
15712 AST_CLI_DEFINE(handle_mfcr2_version,
"Show OpenR2 library version"),
15713 AST_CLI_DEFINE(handle_mfcr2_show_variants,
"Show supported MFC/R2 variants"),
15714 AST_CLI_DEFINE(handle_mfcr2_show_channels,
"Show MFC/R2 channels"),
15716 AST_CLI_DEFINE(handle_mfcr2_set_debug,
"Set MFC/R2 channel logging level"),
15717 AST_CLI_DEFINE(handle_mfcr2_call_files,
"Enable/Disable MFC/R2 call files"),
15718 AST_CLI_DEFINE(handle_mfcr2_set_idle,
"Reset MFC/R2 channel forcing it to IDLE"),
15719 AST_CLI_DEFINE(handle_mfcr2_set_blocked,
"Reset MFC/R2 channel forcing it to BLOCKED"),
15720 AST_CLI_DEFINE(handle_mfcr2_destroy_link,
"Destroy given MFC/R2 link"),
15731 e->
command =
"dahdi destroy channels";
15733 "Usage: dahdi destroy channels <from_channel> [<to_channel>]\n"
15734 " DON'T USE THIS UNLESS YOU KNOW WHAT YOU ARE DOING. Immediately removes a given channel, whether it is in use or not\n";
15739 if ((
a->argc < 4) ||
a->argc > 5) {
15742 start = atoi(
a->argv[3]);
15744 ast_cli(
a->fd,
"Invalid starting channel number %s.\n",
15748 if (
a->argc == 5) {
15749 end = atoi(
a->argv[4]);
15751 ast_cli(
a->fd,
"Invalid ending channel number %s.\n",
15761 "range end (%d) is smaller than range start (%d)\n",
15777 e->
command =
"dahdi create channels";
15778 e->
usage =
"Usage: dahdi create channels <from> [<to>] - a range of channels\n"
15779 " dahdi create channels new - add channels not yet created\n"
15780 "For ISDN and SS7 the range should include complete spans.\n";
15785 if ((
a->argc < 4) ||
a->argc > 5) {
15788 if (
a->argc == 4 && !strcmp(
a->argv[3],
"new")) {
15792 start = atoi(
a->argv[3]);
15794 ast_cli(
a->fd,
"Invalid starting channel number '%s'.\n",
15798 if (
a->argc == 5) {
15799 end = atoi(
a->argv[4]);
15801 ast_cli(
a->fd,
"Invalid ending channel number '%s'.\n",
15810 "range end (%d) is smaller than range start (%d)\n",
15848#if defined(HAVE_PRI) || defined(HAVE_SS7)
15855 ast_verb(1,
"Destroying channels and reloading DAHDI configuration.\n");
15857 ast_verb(4,
"Initial softhangup of all DAHDI channels complete.\n");
15859 dahdi_r2_destroy_links();
15862#if defined(HAVE_PRI)
15865 cancel_code = pthread_cancel(pris[i].pri.
master);
15866 pthread_kill(pris[i].pri.
master, SIGURG);
15867 ast_debug(4,
"Waiting to join thread of span %d with pid=%p, cancel_code=%d\n", i, (
void *) pris[i].pri.
master, cancel_code);
15869 ast_debug(4,
"Joined thread of span %d\n", i);
15874#if defined(HAVE_SS7)
15877 cancel_code = pthread_cancel(linksets[i].ss7.master);
15878 pthread_kill(linksets[i].ss7.master, SIGURG);
15879 ast_debug(4,
"Waiting to join thread of span %d with pid=%p, cancel_code=%d\n", i, (
void *) linksets[i].ss7.master, cancel_code);
15880 pthread_join(linksets[i].ss7.master,
NULL);
15881 ast_debug(4,
"Joined thread of span %d\n", i);
15890 ast_debug(4,
"Waiting to join monitor thread with pid=%p, cancel_code=%d\n", (
void *)
monitor_thread, cancel_code);
15892 ast_debug(4,
"Joined monitor thread\n");
15898 int x = DAHDI_FLASH;
15914 ast_verb(4,
"Final softhangup of all DAHDI channels complete.\n");
15924 dahdi_close_pri_fd(&(pris[i]), j);
15927 memset(pris, 0,
sizeof(pris));
15931 pri_set_error(dahdi_pri_error);
15932 pri_set_message(dahdi_pri_message);
15934#if defined(HAVE_SS7)
15937 dahdi_close_ss7_fd(&(linksets[i]), j);
15940 memset(linksets, 0,
sizeof(linksets));
15944 ss7_set_error(dahdi_ss7_error);
15945 ss7_set_message(dahdi_ss7_message);
15965 e->
command =
"dahdi restart";
15967 "Usage: dahdi restart\n"
15968 " Restarts the DAHDI channels: destroys them all and then\n"
15969 " re-reads them from chan_dahdi.conf.\n"
15970 " Note that this will STOP any running CALL on DAHDI channels.\n"
15996#define FORMAT "%7s %4d %-20.20s %-10.10s %-15.15s %-8.8s %-20.20s %-10.10s %-10.10s %-12.12s %-32.32s\n"
15997#define FORMAT2 "%7s %4s %-20.20s %-10.10s %-15.15s %-8.8s %-20.20s %-10.10s %-10.10s %-12.12s %-32.32s\n"
15999 int filtertype = 0;
16006 e->
command =
"dahdi show channels [group|context]";
16008 "Usage: dahdi show channels [ group <group> | context <context> ]\n"
16009 " Shows a list of available channels with optional filtering\n"
16010 " <group> must be a number between 0 and 63\n";
16018 if (!((
a->argc == 3) || (
a->argc == 5))) {
16022 if (
a->argc == 5) {
16023 if (!strcasecmp(
a->argv[3],
"group")) {
16024 targetnum = atoi(
a->argv[4]);
16025 if (63 < targetnum) {
16030 }
else if (!strcasecmp(
a->argv[3],
"context")) {
16035 ast_cli(
a->fd,
FORMAT2,
"Chan",
"Span",
"Signalling",
"Extension",
"Context",
"Language",
"MOH Interpret",
"Blocked",
"In Service",
"Alarms",
"Description");
16040 switch(filtertype) {
16042 if (!(
tmp->group & targetnum)) {
16047 if (strcasecmp(
tmp->context,
a->argv[4])) {
16055 if (
tmp->channel > 0) {
16056 snprintf(tmps,
sizeof(tmps),
"%d",
tmp->channel);
16062 blockstr[0] =
tmp->locallyblocked ?
'L' :
' ';
16063 blockstr[1] =
tmp->remotelyblocked ?
'R' :
' ';
16064 blockstr[2] =
'\0';
16066 ast_cli(
a->fd,
FORMAT, tmps,
tmp->span,
sig2str(
tmp->sig),
tmp->exten,
tmp->context,
tmp->language,
tmp->mohinterpret, blockstr,
tmp->inservice ?
"Yes" :
"No",
16079 struct dahdi_confinfo ci;
16080 struct dahdi_params ps;
16087 e->
command =
"dahdi show channel";
16089 "Usage: dahdi show channel <chan num>\n"
16090 " Detailed information about a given channel\n";
16099 channel = atoi(
a->argv[3]);
16103 if (
tmp->channel == channel) {
16105 ast_cli(
a->fd,
"Description: %s\n",
tmp->description);
16109 ast_cli(
a->fd,
"Dialing: %s\n",
tmp->dialing ?
"yes" :
"no");
16112 ast_cli(
a->fd,
"Calling TON: %d\n",
tmp->cid_ton);
16113#if defined(HAVE_PRI)
16114#if defined(HAVE_PRI_SUBADDR)
16115 ast_cli(
a->fd,
"Caller ID subaddress: %s\n",
tmp->cid_subaddr);
16118 ast_cli(
a->fd,
"Caller ID name: %s\n",
tmp->cid_name);
16123 for (v =
tmp->vars ; v ; v = v->
next)
16135 ast_cli(
a->fd,
"Propagated Conference: %d\n",
tmp->propconfno);
16136 ast_cli(
a->fd,
"Real in conference: %d\n",
tmp->inconference);
16137 ast_cli(
a->fd,
"DSP: %s\n",
tmp->dsp ?
"yes" :
"no");
16138 ast_cli(
a->fd,
"Busy Detection: %s\n",
tmp->busydetect ?
"yes" :
"no");
16139 if (
tmp->busydetect) {
16140#if defined(BUSYDETECT_TONEONLY)
16141 ast_cli(
a->fd,
" Busy Detector Helper: BUSYDETECT_TONEONLY\n");
16142#elif defined(BUSYDETECT_COMPARE_TONE_AND_SILENCE)
16143 ast_cli(
a->fd,
" Busy Detector Helper: BUSYDETECT_COMPARE_TONE_AND_SILENCE\n");
16145#ifdef BUSYDETECT_DEBUG
16146 ast_cli(
a->fd,
" Busy Detector Debug: Enabled\n");
16148 ast_cli(
a->fd,
" Busy Count: %d\n",
tmp->busycount);
16149 ast_cli(
a->fd,
" Busy Pattern: %d,%d,%d,%d\n",
tmp->busy_cadence.pattern[0],
tmp->busy_cadence.pattern[1], (
tmp->busy_cadence.length == 4) ?
tmp->busy_cadence.pattern[2] : 0, (
tmp->busy_cadence.length == 4) ?
tmp->busy_cadence.pattern[3] : 0);
16151 ast_cli(
a->fd,
"TDD: %s\n",
tmp->tdd ?
"yes" :
"no");
16152 ast_cli(
a->fd,
"Relax DTMF: %s\n",
tmp->dtmfrelax ?
"yes" :
"no");
16153 ast_cli(
a->fd,
"Dialing/CallwaitCAS: %d/%d\n",
tmp->dialing,
tmp->callwaitcas);
16154 ast_cli(
a->fd,
"Default law: %s\n",
tmp->law_default == DAHDI_LAW_MULAW ?
"ulaw" :
tmp->law_default == DAHDI_LAW_ALAW ?
"alaw" :
"unknown");
16155 ast_cli(
a->fd,
"Fax Handled: %s\n",
tmp->faxhandled ?
"yes" :
"no");
16156 ast_cli(
a->fd,
"Pulse phone: %s\n",
tmp->pulsedial ?
"yes" :
"no");
16157 if (
tmp->hwrxgain_enabled) {
16158 snprintf(hwrxgain,
sizeof(hwrxgain),
"%.1f",
tmp->hwrxgain);
16162 if (
tmp->hwtxgain_enabled) {
16163 snprintf(hwtxgain,
sizeof(hwtxgain),
"%.1f",
tmp->hwtxgain);
16167 ast_cli(
a->fd,
"HW Gains (RX/TX): %s/%s\n", hwrxgain, hwtxgain);
16168 ast_cli(
a->fd,
"SW Gains (RX/TX): %.2f/%.2f\n",
tmp->rxgain,
tmp->txgain);
16169 ast_cli(
a->fd,
"Dynamic Range Compression (RX/TX): %.2f/%.2f\n",
tmp->rxdrc,
tmp->txdrc);
16171 ast_cli(
a->fd,
"Echo Cancellation:\n");
16173 if (
tmp->echocancel.head.tap_length) {
16174 ast_cli(
a->fd,
"\t%u taps\n",
tmp->echocancel.head.tap_length);
16175 for (x = 0; x <
tmp->echocancel.head.param_count; x++) {
16176 ast_cli(
a->fd,
"\t\t%s: %dd\n",
tmp->echocancel.params[x].name,
tmp->echocancel.params[x].value);
16178 ast_cli(
a->fd,
"\t%scurrently %s\n",
tmp->echocanbridged ?
"" :
"(unless TDM bridged) ",
tmp->echocanon ?
"ON" :
"OFF");
16182 ast_cli(
a->fd,
"Wait for dialtone: %dms\n",
tmp->waitfordialtone);
16184 ast_cli(
a->fd,
"Master Channel: %d\n",
tmp->master->channel);
16186 if (
tmp->slaves[x])
16187 ast_cli(
a->fd,
"Slave Channel: %d\n",
tmp->slaves[x]->channel);
16191 char calldir[OR2_MAX_PATH];
16192 openr2_context_t *r2context = openr2_chan_get_context(
tmp->r2chan);
16193 openr2_variant_t r2variant = openr2_context_get_variant(r2context);
16194 ast_cli(
a->fd,
"MFC/R2 MF State: %s\n", openr2_chan_get_mf_state_string(
tmp->r2chan));
16195 ast_cli(
a->fd,
"MFC/R2 MF Group: %s\n", openr2_chan_get_mf_group_string(
tmp->r2chan));
16196 ast_cli(
a->fd,
"MFC/R2 State: %s\n", openr2_chan_get_r2_state_string(
tmp->r2chan));
16197 ast_cli(
a->fd,
"MFC/R2 Call State: %s\n", openr2_chan_get_call_state_string(
tmp->r2chan));
16198 ast_cli(
a->fd,
"MFC/R2 Call Files Enabled: %s\n", openr2_chan_get_call_files_enabled(
tmp->r2chan) ?
"Yes" :
"No");
16199 ast_cli(
a->fd,
"MFC/R2 Variant: %s\n", openr2_proto_get_variant_string(r2variant));
16200 ast_cli(
a->fd,
"MFC/R2 Max ANI: %d\n", openr2_context_get_max_ani(r2context));
16201 ast_cli(
a->fd,
"MFC/R2 Max DNIS: %d\n", openr2_context_get_max_dnis(r2context));
16202#if defined(OR2_LIB_INTERFACE) && OR2_LIB_INTERFACE > 2
16203 ast_cli(
a->fd,
"MFC/R2 DTMF Dialing: %s\n", openr2_context_get_dtmf_dialing(r2context,
NULL,
NULL) ?
"Yes" :
"No");
16204 ast_cli(
a->fd,
"MFC/R2 DTMF Detection: %s\n", openr2_context_get_dtmf_detection(r2context) ?
"Yes" :
"No");
16206 ast_cli(
a->fd,
"MFC/R2 Get ANI First: %s\n", openr2_context_get_ani_first(r2context) ?
"Yes" :
"No");
16207#if defined(OR2_LIB_INTERFACE) && OR2_LIB_INTERFACE > 1
16208 ast_cli(
a->fd,
"MFC/R2 Skip Category Request: %s\n", openr2_context_get_skip_category_request(r2context) ?
"Yes" :
"No");
16210 ast_cli(
a->fd,
"MFC/R2 Immediate Accept: %s\n", openr2_context_get_immediate_accept(r2context) ?
"Yes" :
"No");
16211 ast_cli(
a->fd,
"MFC/R2 Accept on Offer: %s\n",
tmp->mfcr2_accept_on_offer ?
"Yes" :
"No");
16212 ast_cli(
a->fd,
"MFC/R2 Charge Calls: %s\n",
tmp->mfcr2_charge_calls ?
"Yes" :
"No");
16213 ast_cli(
a->fd,
"MFC/R2 Allow Collect Calls: %s\n",
tmp->mfcr2_allow_collect_calls ?
"Yes" :
"No");
16214 ast_cli(
a->fd,
"MFC/R2 Forced Release: %s\n",
tmp->mfcr2_forced_release ?
"Yes" :
"No");
16215 ast_cli(
a->fd,
"MFC/R2 MF Back Timeout: %dms\n", openr2_context_get_mf_back_timeout(r2context));
16216 ast_cli(
a->fd,
"MFC/R2 R2 Metering Pulse Timeout: %dms\n", openr2_context_get_metering_pulse_timeout(r2context));
16217 ast_cli(
a->fd,
"MFC/R2 Rx CAS: %s\n", openr2_chan_get_rx_cas_string(
tmp->r2chan));
16218 ast_cli(
a->fd,
"MFC/R2 Tx CAS: %s\n", openr2_chan_get_tx_cas_string(
tmp->r2chan));
16219 ast_cli(
a->fd,
"MFC/R2 MF Tx Signal: %d\n", openr2_chan_get_tx_mf_signal(
tmp->r2chan));
16220 ast_cli(
a->fd,
"MFC/R2 MF Rx Signal: %d\n", openr2_chan_get_rx_mf_signal(
tmp->r2chan));
16221 ast_cli(
a->fd,
"MFC/R2 Call Files Directory: %s\n", openr2_context_get_log_directory(r2context, calldir,
sizeof(calldir)));
16224#if defined(HAVE_SS7)
16245 if (
tmp->logicalspan)
16246 ast_cli(
a->fd,
"PRI Logical Span: %d\n",
tmp->logicalspan);
16248 ast_cli(
a->fd,
"PRI Logical Span: Implicit\n");
16251 memset(&ci, 0,
sizeof(ci));
16252 ps.channo =
tmp->channel;
16254 memset(&ci, 0,
sizeof(ci));
16255 if (!ioctl(
tmp->subs[
SUB_REAL].dfd, DAHDI_GETCONF, &ci)) {
16256 ast_cli(
a->fd,
"Actual Confinfo: Num/%d, Mode/0x%04x\n", ci.confno, (
unsigned)ci.confmode);
16258 if (!ioctl(
tmp->subs[
SUB_REAL].dfd, DAHDI_GETCONFMUTE, &x)) {
16259 ast_cli(
a->fd,
"Actual Confmute: %s\n", x ?
"Yes" :
"No");
16261 memset(&ps, 0,
sizeof(ps));
16262 if (ioctl(
tmp->subs[
SUB_REAL].dfd, DAHDI_GET_PARAMS, &ps) < 0) {
16265 ast_cli(
a->fd,
"Hookstate (FXS only): %s\n", ps.rxisoffhook ?
"Offhook" :
"Onhook");
16283 e->
command =
"dahdi show cadences";
16285 "Usage: dahdi show cadences\n"
16286 " Shows all cadences currently defined\n";
16293 char tmp[16], tmp2[64];
16294 snprintf(
tmp,
sizeof(
tmp),
"r%d: ", i + 1);
16297 for (j = 0; j < 16; j++) {
16298 if (
cadences[i].ringcadence[j] == 0)
16306 strncat(output,
",",
sizeof(output) - strlen(output) - 1);
16307 strncat(output, tmp2,
sizeof(output) - strlen(output) - 1);
16316 alarmstr[0] =
'\0';
16317 if (spaninfo->alarms > 0) {
16318 if (spaninfo->alarms & DAHDI_ALARM_BLUE) {
16319 strcat(alarmstr,
"BLU/");
16321 if (spaninfo->alarms & DAHDI_ALARM_YELLOW) {
16322 strcat(alarmstr,
"YEL/");
16324 if (spaninfo->alarms & DAHDI_ALARM_RED) {
16325 strcat(alarmstr,
"RED/");
16327 if (spaninfo->alarms & DAHDI_ALARM_LOOPBACK) {
16328 strcat(alarmstr,
"LB/");
16330 if (spaninfo->alarms & DAHDI_ALARM_RECOVER) {
16331 strcat(alarmstr,
"REC/");
16333 if (spaninfo->alarms & DAHDI_ALARM_NOTOPEN) {
16334 strcat(alarmstr,
"NOP/");
16336 if (!strlen(alarmstr)) {
16337 strcat(alarmstr,
"UUU/");
16339 if (strlen(alarmstr)) {
16341 alarmstr[strlen(alarmstr) - 1] =
'\0';
16344 if (spaninfo->numchans) {
16345 strcpy(alarmstr,
"OK");
16347 strcpy(alarmstr,
"UNCONFIGURED");
16355 #define FORMAT "%4d %-40.40s %-7.7s %-6d %-6d %-6d %-3.3s %-4.4s %-8.8s %s\n"
16356 #define FORMAT2 "%4s %-40.40s %-7.7s %-6.6s %-6.6s %-6.6s %-3.3s %-4.4s %-8.8s %s\n"
16362 struct dahdi_spaninfo s;
16366 e->
command =
"dahdi show status";
16368 "Usage: dahdi show status\n"
16369 " Shows a list of DAHDI cards with status\n";
16374 ctl = open(
"/dev/dahdi/ctl", O_RDWR);
16376 ast_cli(
a->fd,
"No DAHDI found. Unable to open /dev/dahdi/ctl: %s\n", strerror(
errno));
16379 ast_cli(
a->fd,
FORMAT2,
"Span",
"Description",
"Alarms",
"IRQ",
"bpviol",
"CRC",
"Framing",
"Coding",
"Options",
"LBO");
16381 for (span = 1; span < DAHDI_MAX_SPANS; ++span) {
16383 res = ioctl(ctl, DAHDI_SPANSTAT, &s);
16388 ast_cli(
a->fd,
FORMAT, span, s.desc, alarmstr, s.irqmisses, s.bpvcount, s.crc4count,
16389 s.lineconfig & DAHDI_CONFIG_D4 ?
"D4" :
16390 s.lineconfig & DAHDI_CONFIG_ESF ?
"ESF" :
16391 s.lineconfig & DAHDI_CONFIG_CCS ?
"CCS" :
16393 s.lineconfig & DAHDI_CONFIG_B8ZS ?
"B8ZS" :
16394 s.lineconfig & DAHDI_CONFIG_HDB3 ?
"HDB3" :
16395 s.lineconfig & DAHDI_CONFIG_AMI ?
"AMI" :
16397 s.lineconfig & DAHDI_CONFIG_CRC4 ?
16398 s.lineconfig & DAHDI_CONFIG_NOTOPEN ?
"CRC4/YEL" :
"CRC4" :
16399 s.lineconfig & DAHDI_CONFIG_NOTOPEN ?
"YEL" :
"",
16412 int pseudo_fd = -1;
16413 struct dahdi_versioninfo vi;
16417 e->
command =
"dahdi show version";
16419 "Usage: dahdi show version\n"
16420 " Shows the DAHDI version in use\n";
16425 if ((pseudo_fd = open(
"/dev/dahdi/ctl", O_RDONLY)) < 0) {
16426 ast_cli(
a->fd,
"Failed to open control file to get version.\n");
16430 strcpy(vi.version,
"Unknown");
16431 strcpy(vi.echo_canceller,
"Unknown");
16433 if (ioctl(pseudo_fd, DAHDI_GETVERSION, &vi))
16434 ast_cli(
a->fd,
"Failed to get DAHDI version: %s\n", strerror(
errno));
16436 ast_cli(
a->fd,
"DAHDI Version: %s Echo Canceller: %s\n", vi.version, vi.echo_canceller);
16452 e->
command =
"dahdi set hwgain {rx|tx}";
16454 "Usage: dahdi set hwgain <rx|tx> <chan#> <gain>\n"
16455 " Sets the hardware gain on a given channel and overrides the\n"
16456 " value provided at module loadtime. Changes take effect\n"
16457 " immediately whether the channel is in use or not.\n"
16459 " <rx|tx> which direction do you want to change (relative to our module)\n"
16460 " <chan num> is the channel number relative to the device\n"
16461 " <gain> is the gain in dB (e.g. -3.5 for -3.5dB)\n"
16464 " * hwgain is only supportable by hardware with analog ports because\n"
16465 " hwgain works on the analog side of an analog-digital conversion.\n";
16474 if (!strcasecmp(
"rx",
a->argv[3]))
16476 else if (!strcasecmp(
"tx",
a->argv[3]))
16482 gain = atof(
a->argv[5]);
16495 ast_cli(
a->fd,
"Unable to set the hardware gain for channel %d: %s\n",
channel, strerror(
errno));
16499 ast_cli(
a->fd,
"Hardware %s gain set to %.1f dB on channel %d.\n",
16500 tx ?
"tx" :
"rx", gain,
channel);
16503 tmp->hwtxgain_enabled = 1;
16504 tmp->hwtxgain = gain;
16506 tmp->hwrxgain_enabled = 1;
16507 tmp->hwrxgain = gain;
16532 e->
command =
"dahdi set swgain {rx|tx}";
16534 "Usage: dahdi set swgain <rx|tx> <chan#> <gain>\n"
16535 " Sets the software gain on a given channel and overrides the\n"
16536 " value provided at module loadtime. Changes take effect\n"
16537 " immediately whether the channel is in use or not.\n"
16539 " <rx|tx> which direction do you want to change (relative to our module)\n"
16540 " <chan num> is the channel number relative to the device\n"
16541 " <gain> is the gain in dB (e.g. -3.5 for -3.5dB)\n";
16550 if (!strcasecmp(
"rx",
a->argv[3]))
16552 else if (!strcasecmp(
"tx",
a->argv[3]))
16558 gain = atof(
a->argv[5]);
16575 ast_cli(
a->fd,
"Unable to set the software gain for channel %d\n",
channel);
16580 ast_cli(
a->fd,
"Software %s gain set to %.2f dB on channel %d.\n",
16581 tx ?
"tx" :
"rx", gain,
channel);
16584 tmp->txgain = gain;
16586 tmp->rxgain = gain;
16608 e->
command =
"dahdi set dnd";
16610 "Usage: dahdi set dnd <chan#> <on|off>\n"
16611 " Sets/resets DND (Do Not Disturb) mode on a channel.\n"
16612 " Changes take effect immediately.\n"
16613 " <chan num> is the channel number\n"
16614 " <on|off> Enable or disable DND mode?\n"
16624 if ((
channel = atoi(
a->argv[3])) <= 0) {
16625 ast_cli(
a->fd,
"Expected channel number, got '%s'\n",
a->argv[3]);
16634 ast_cli(
a->fd,
"Expected 'on' or 'off', got '%s'\n",
a->argv[4]);
16639 for (dahdi_chan =
iflist; dahdi_chan; dahdi_chan = dahdi_chan->
next) {
16666 e->
command =
"dahdi set mwi";
16668 "Usage: dahdi set mwi <chan#> <on|off|reset>\n"
16669 " Sets/unsets MWI (Message Waiting Indicator) manually on a channel.\n"
16670 " This may be used regardless of whether the channel is assigned any mailboxes.\n"
16671 " When active, this setting will override the voicemail status to set MWI.\n"
16672 " Once cleared, the voicemail status will resume control of MWI.\n"
16673 " Changes are queued for when the channel is idle and persist until cleared.\n"
16674 " <chan num> is the channel number\n"
16675 " <on|off|reset> Enable, disable, or reset Message Waiting Indicator override?\n"
16685 if ((
channel = atoi(
a->argv[3])) <= 0) {
16686 ast_cli(
a->fd,
"Expected channel number, got '%s'\n",
a->argv[3]);
16694 }
else if (!strcmp(
a->argv[4],
"reset")) {
16697 ast_cli(
a->fd,
"Expected 'on' or 'off' or 'reset', got '%s'\n",
a->argv[4]);
16702 for (dahdi_chan =
iflist; dahdi_chan; dahdi_chan = dahdi_chan->
next) {
16709 ast_cli(
a->fd,
"MWI '%s' queued for channel %d\n", on ?
"enable" :
"disable",
channel);
16787 if (sscanf(
channel,
"%30d", &chan_num) != 1) {
16903 for (i = 0; i < strlen(
number); i++) {
16918 int dahdichanquery;
16920 if (!dahdichannel || sscanf(dahdichannel,
"%30d", &dahdichanquery) != 1) {
16922 dahdichanquery = -1;
16927 snprintf(idText,
sizeof(idText),
"ActionID: %s\r\n",
id);
16935 if (
tmp->channel > 0) {
16939 if (dahdichanquery > 0 &&
tmp->channel != dahdichanquery)
16947 "Event: DAHDIShowChannels\r\n"
16948 "DAHDIChannel: %d\r\n"
16951 "AccountCode: %s\r\n"
16952 "Signalling: %s\r\n"
16953 "SignallingCode: %d\r\n"
16957 "Description: %s\r\n"
16969 tmp->description, idText);
16972 "Event: DAHDIShowChannels\r\n"
16973 "DAHDIChannel: %d\r\n"
16974 "Signalling: %s\r\n"
16975 "SignallingCode: %d\r\n"
16979 "Description: %s\r\n"
16986 tmp->description, idText);
17008 struct dahdi_spaninfo spaninfo;
17010 ctl = open(
"/dev/dahdi/ctl", O_RDWR);
17018 snprintf(idText,
sizeof(idText),
"ActionID: %s\r\n",
id);
17022 for (span = 1; span < DAHDI_MAX_SPANS; ++span) {
17023 spaninfo.spanno = span;
17024 res = ioctl(ctl, DAHDI_SPANSTAT, &spaninfo);
17031 "Event: DAHDIShowStatus\r\n"
17033 "Description: %s\r\n"
17044 span, spaninfo.desc, alarmstr, spaninfo.irqmisses, spaninfo.bpvcount, spaninfo.crc4count,
17045 spaninfo.lineconfig & DAHDI_CONFIG_D4 ?
"D4" :
17046 spaninfo.lineconfig & DAHDI_CONFIG_ESF ?
"ESF" :
17047 spaninfo.lineconfig & DAHDI_CONFIG_CCS ?
"CCS" :
17049 spaninfo.lineconfig & DAHDI_CONFIG_B8ZS ?
"B8ZS" :
17050 spaninfo.lineconfig & DAHDI_CONFIG_HDB3 ?
"HDB3" :
17051 spaninfo.lineconfig & DAHDI_CONFIG_AMI ?
"AMI" :
17053 spaninfo.lineconfig & DAHDI_CONFIG_CRC4 ?
17054 spaninfo.lineconfig & DAHDI_CONFIG_NOTOPEN ?
"CRC4/YEL" :
"CRC4" :
17055 spaninfo.lineconfig & DAHDI_CONFIG_NOTOPEN ?
"YEL" :
"",
17067#if defined(HAVE_PRI)
17073 struct dahdi_pri *dspan;
17076 char action_id[256];
17077 const char *show_cmd =
"PRIShowSpans";
17081 span_query = atoi(span_str);
17087 snprintf(action_id,
sizeof(action_id),
"ActionID: %s\r\n",
id);
17089 action_id[0] =
'\0';
17095 for (idx = 0; idx <
ARRAY_LEN(pris); ++idx) {
17096 dspan = &pris[idx];
17099 if (0 < span_query && dspan->pri.span != span_query) {
17103 if (dspan->pri.pri) {
17116#if defined(HAVE_SS7)
17117static int linkset_addsigchan(
int sigchan)
17119 struct dahdi_ss7 *link;
17122 struct dahdi_params params;
17123 struct dahdi_bufferinfo bi;
17124 struct dahdi_spaninfo si;
17130 if (cur_ss7type < 0) {
17134 if (cur_pointcode < 0) {
17138 if (cur_adjpointcode < 0) {
17142 if (cur_defaultdpc < 0) {
17146 if (cur_networkindicator < 0) {
17150 link = ss7_resolve_linkset(cur_linkset);
17160 curfd = link->ss7.numsigchans;
17163 link->ss7.fds[curfd] = open(
"/dev/dahdi/channel", O_RDWR, 0600);
17164 if (link->ss7.fds[curfd] < 0) {
17169 if (ioctl(link->ss7.fds[curfd], DAHDI_SPECIFY, &sigchan) == -1) {
17170 dahdi_close_ss7_fd(link, curfd);
17177 memset(¶ms, 0,
sizeof(params));
17178 res = ioctl(link->ss7.fds[curfd], DAHDI_GET_PARAMS, ¶ms);
17180 dahdi_close_ss7_fd(link, curfd);
17181 ast_log(
LOG_ERROR,
"Unable to get parameters for sigchan %d (%s)\n", sigchan,
17185 if (params.sigtype != DAHDI_SIG_HDLCFCS
17186 && params.sigtype != DAHDI_SIG_HARDHDLC
17187 && params.sigtype != DAHDI_SIG_MTP2) {
17188 dahdi_close_ss7_fd(link, curfd);
17194 memset(&bi, 0,
sizeof(bi));
17195 bi.txbufpolicy = DAHDI_POLICY_IMMEDIATE;
17196 bi.rxbufpolicy = DAHDI_POLICY_IMMEDIATE;
17199 if (ioctl(link->ss7.fds[curfd], DAHDI_SET_BUFINFO, &bi)) {
17200 ast_log(
LOG_ERROR,
"Unable to set appropriate buffering on channel %d: %s\n",
17201 sigchan, strerror(
errno));
17202 dahdi_close_ss7_fd(link, curfd);
17207 memset(&si, 0,
sizeof(si));
17208 res = ioctl(link->ss7.fds[curfd], DAHDI_SPANSTAT, &si);
17210 dahdi_close_ss7_fd(link, curfd);
17211 ast_log(
LOG_ERROR,
"Unable to get span state for sigchan %d (%s)\n", sigchan,
17216 (params.sigtype == DAHDI_SIG_MTP2)
17217 ? SS7_TRANSPORT_DAHDIMTP2
17218 : SS7_TRANSPORT_DAHDIDCHAN,
17219 si.alarms, cur_networkindicator, cur_pointcode, cur_adjpointcode, cur_slc);
17221 dahdi_close_ss7_fd(link, curfd);
17225 ++link->ss7.numsigchans;
17231#if defined(HAVE_SS7)
17237 e->
command =
"ss7 set debug {on|off} linkset";
17239 "Usage: ss7 set debug {on|off} linkset <linkset>\n"
17240 " Enables debugging on a given SS7 linkset\n";
17250 span = atoi(
a->argv[5]);
17251 if ((span < 1) || (span >
NUM_SPANS)) {
17252 ast_cli(
a->fd,
"Invalid linkset %s. Should be a number from %d to %d\n",
a->argv[5], 1,
NUM_SPANS);
17255 if (!linksets[span-1].ss7.ss7) {
17256 ast_cli(
a->fd,
"No SS7 running on linkset %d\n", span);
17258 if (!strcasecmp(
a->argv[3],
"on")) {
17259 linksets[span - 1].ss7.debug = 1;
17261 ast_cli(
a->fd,
"Enabled debugging on linkset %d\n", span);
17263 linksets[span - 1].ss7.debug = 0;
17264 ss7_set_debug(linksets[span-1].ss7.ss7, 0);
17265 ast_cli(
a->fd,
"Disabled debugging on linkset %d\n", span);
17273#if defined(HAVE_SS7)
17283 e->
command =
"ss7 {block|unblock} cic";
17285 "Usage: ss7 {block|unblock} cic <linkset> <dpc> <CIC>\n"
17286 " Sends a remote {blocking|unblocking} request for the given CIC on the specified linkset\n";
17292 if (
a->argc == 6) {
17293 linkset = atoi(
a->argv[3]);
17298 if (!strcasecmp(
a->argv[1],
"block")) {
17300 }
else if (strcasecmp(
a->argv[1],
"unblock")) {
17304 if ((linkset < 1) || (linkset >
NUM_SPANS)) {
17305 ast_cli(
a->fd,
"Invalid linkset %s. Should be a number %d to %d\n",
a->argv[3], 1,
NUM_SPANS);
17309 if (!linksets[linkset-1].ss7.ss7) {
17310 ast_cli(
a->fd,
"No SS7 running on linkset %d\n", linkset);
17314 cic = atoi(
a->argv[5]);
17316 ast_cli(
a->fd,
"Invalid CIC specified!\n");
17320 dpc = atoi(
a->argv[4]);
17322 ast_cli(
a->fd,
"Invalid DPC specified!\n");
17326 for (i = 0; i < linksets[linkset-1].ss7.numchans; i++) {
17327 if (linksets[linkset-1].ss7.pvts[i] && linksets[linkset-1].ss7.pvts[i]->cic == cic && linksets[linkset-1].ss7.pvts[i]->dpc == dpc) {
17328 blocked = linksets[linkset-1].ss7.pvts[i]->locallyblocked;
17331 ast_cli(
a->fd,
"Unable to allocate new ss7call\n");
17333 ast_cli(
a->fd,
"Sent %sblocking request for linkset %d on CIC %d DPC %d\n", (do_block) ?
"" :
"un", linkset, cic, dpc);
17335 }
else if (!do_block && blocked) {
17336 ast_cli(
a->fd,
"CIC %d is hardware locally blocked!\n", cic);
17338 ast_cli(
a->fd,
"CIC %d %s locally blocked\n", cic, do_block ?
"already" :
"is not");
17344 ast_cli(
a->fd,
"Invalid CIC specified!\n");
17349#if defined(HAVE_SS7)
17361 e->
command =
"ss7 {reset|block|unblock} linkset";
17363 "Usage: ss7 {reset|block|unblock} linkset <linkset number>\n"
17364 " Sends a remote {reset|blocking|unblocking} request for all CICs on the given linkset\n";
17370 if (
a->argc == 4) {
17371 linkset = atoi(
a->argv[3]);
17376 if (!strcasecmp(
a->argv[1],
"block")) {
17377 do_what = DO_BLOCK;
17378 }
else if (!strcasecmp(
a->argv[1],
"unblock")) {
17379 do_what = DO_UNBLOCK;
17380 }
else if (!strcasecmp(
a->argv[1],
"reset")) {
17381 do_what = DO_RESET;
17386 if ((linkset < 1) || (linkset >
NUM_SPANS)) {
17387 ast_cli(
a->fd,
"Invalid linkset %s. Should be a number %d to %d\n",
a->argv[3], 1,
NUM_SPANS);
17391 if (!linksets[linkset - 1].ss7.ss7) {
17392 ast_cli(
a->fd,
"No SS7 running on linkset %d\n", linkset);
17396 for (i = 0; i < linksets[linkset - 1].ss7.numchans; i++) {
17398 if (linksets[linkset - 1].ss7.pvts[i]) {
17403 ast_cli(
a->fd,
"Sent remote %s request on CIC %d\n",
17404 (do_what == DO_BLOCK) ?
"blocking" :
"unblocking",
17405 linksets[linkset - 1].ss7.pvts[i]->cic);
17410 linksets[linkset - 1].ss7.pvts[i]->cic,
17411 linksets[linkset - 1].ss7.pvts[i]->dpc)) {
17412 ast_cli(
a->fd,
"Sent reset request on CIC %d\n",
17413 linksets[linkset - 1].ss7.pvts[i]->cic);
17424#if defined(HAVE_SS7)
17427 int linkset, cic, range, chanpos;
17428 int i, dpc, orient = 0;
17430 unsigned char state[255];
17434 e->
command =
"ss7 {block|unblock} group";
17436 "Usage: ss7 {block|unblock} group <linkset> <dpc> <1st. CIC> <range> [H]\n"
17437 " Sends a remote {blocking|unblocking} request for CIC range on the specified linkset\n";
17443 if (
a->argc == 7 ||
a->argc == 8) {
17444 linkset = atoi(
a->argv[3]);
17449 if (!strcasecmp(
a->argv[1],
"block")) {
17451 }
else if (strcasecmp(
a->argv[1],
"unblock")) {
17455 if (
a->argc == 8) {
17456 if (!strcasecmp(
a->argv[7],
"H")) {
17463 if ((linkset < 1) || (linkset >
NUM_SPANS)) {
17464 ast_cli(
a->fd,
"Invalid linkset %s. Should be a number %d to %d\n",
a->argv[4], 1,
NUM_SPANS);
17468 if (!linksets[linkset-1].ss7.ss7) {
17469 ast_cli(
a->fd,
"No SS7 running on linkset %d\n", linkset);
17473 cic = atoi(
a->argv[5]);
17475 ast_cli(
a->fd,
"Invalid CIC specified!\n");
17479 range = atoi(
a->argv[6]);
17481 if (range < 1 || range > (linksets[linkset - 1].ss7.type == SS7_ANSI ? 24 : 31)) {
17482 ast_cli(
a->fd,
"Invalid range specified!\n");
17486 dpc = atoi(
a->argv[4]);
17488 ast_cli(
a->fd,
"Invalid DPC specified!\n");
17495 ast_cli(
a->fd,
"Invalid CIC/RANGE\n");
17500 for (i = 0; i <= range; ++i) {
17507 ast_cli(
a->fd,
"Unable allocate new ss7call\n");
17509 ast_cli(
a->fd,
"Sending remote%s %sblocking request linkset %d on CIC %d range %d\n",
17510 orient ?
" hardware" :
"", do_block ?
"" :
"un", linkset, cic, range);
17517 pthread_kill(linksets[linkset-1].ss7.master, SIGURG);
17523#if defined(HAVE_SS7)
17526 int linkset, cic, range;
17531 e->
command =
"ss7 reset group";
17533 "Usage: ss7 reset group <linkset> <dpc> <1st CIC> <range>\n"
17534 " Send a GRS for the given CIC range on the specified linkset\n";
17540 if (
a->argc == 7) {
17541 linkset = atoi(
a->argv[3]);
17546 if ((linkset < 1) || (linkset >
NUM_SPANS)) {
17547 ast_cli(
a->fd,
"Invalid linkset %s. Should be a number %d to %d\n",
a->argv[4], 1,
NUM_SPANS);
17551 if (!linksets[linkset-1].ss7.ss7) {
17552 ast_cli(
a->fd,
"No SS7 running on linkset %d\n", linkset);
17556 cic = atoi(
a->argv[5]);
17559 ast_cli(
a->fd,
"Invalid CIC specified!\n");
17563 range = atoi(
a->argv[6]);
17564 if (range < 1 || range > (linksets[linkset - 1].ss7.type == SS7_ANSI ? 24 : 31)) {
17565 ast_cli(
a->fd,
"Invalid range specified!\n");
17569 dpc = atoi(
a->argv[4]);
17571 ast_cli(
a->fd,
"Invalid DPC specified!\n");
17578 ast_cli(
a->fd,
"Invalid CIC/RANGE\n");
17583 ast_cli(
a->fd,
"Unable to allocate new ss7call\n");
17585 ast_cli(
a->fd,
"GRS sent ... \n");
17592 pthread_kill(linksets[linkset-1].ss7.master, SIGURG);
17598#if defined(HAVE_SS7)
17605 e->
command =
"ss7 show calls";
17607 "Usage: ss7 show calls <linkset>\n"
17608 " Show SS7 calls on the specified linkset\n";
17614 if (
a->argc == 4) {
17615 linkset = atoi(
a->argv[3]);
17620 if ((linkset < 1) || (linkset >
NUM_SPANS)) {
17621 ast_cli(
a->fd,
"Invalid linkset %s. Should be a number %d to %d\n",
a->argv[3], 1,
NUM_SPANS);
17625 if (!linksets[linkset-1].ss7.ss7) {
17626 ast_cli(
a->fd,
"No SS7 running on linkset %d\n", linkset);
17631 isup_show_calls(linksets[linkset-1].ss7.ss7, &
ast_cli,
a->fd);
17638#if defined(HAVE_SS7)
17641 int linkset, cic, res;
17646 e->
command =
"ss7 reset cic";
17648 "Usage: ss7 reset cic <linkset> <dpc> <CIC>\n"
17649 " Send a RSC for the given CIC on the specified linkset\n";
17655 if (
a->argc == 6) {
17656 linkset = atoi(
a->argv[3]);
17661 if ((linkset < 1) || (linkset >
NUM_SPANS)) {
17662 ast_cli(
a->fd,
"Invalid linkset %s. Should be a number %d to %d\n",
a->argv[3], 1,
NUM_SPANS);
17666 if (!linksets[linkset-1].ss7.ss7) {
17667 ast_cli(
a->fd,
"No SS7 running on linkset %d\n", linkset);
17671 cic = atoi(
a->argv[5]);
17674 ast_cli(
a->fd,
"Invalid CIC specified!\n");
17678 dpc = atoi(
a->argv[4]);
17680 ast_cli(
a->fd,
"Invalid DPC specified!\n");
17686 ast_cli(
a->fd,
"%s RSC for linkset %d on CIC %d DPC %d\n", res ?
"Sent" :
"Failed", linkset, cic, dpc);
17692#if defined(HAVE_SS7)
17697 unsigned int arg = 0;
17704 "Usage: ss7 mtp3 <linkset> <slc> coo|coa|cbd|cba|eco|eca|tfp|tfa|lin|lun|lia|lua|lid|lfu <arg>\n"
17705 " Send a NET MNG message\n"
17706 " WARNING!!! WARNING!!! We are not a STP, just for testing/development purposes\n";
17716 linkset = atoi(
a->argv[2]);
17717 if ((linkset < 1) || (linkset >
NUM_SPANS)) {
17718 ast_cli(
a->fd,
"Invalid linkset %s. Should be a number %d to %d\n",
a->argv[2], 1,
NUM_SPANS);
17721 if (!linksets[linkset-1].ss7.ss7) {
17722 ast_cli(
a->fd,
"No SS7 running on linkset %d\n", linkset);
17726 slc = atoi(
a->argv[3]);
17728 if (
a->argc == 6) {
17729 arg = atoi(
a->argv[5]);
17733 res = mtp3_net_mng(linksets[linkset-1].ss7.ss7, slc,
a->argv[4], arg);
17738 pthread_kill(linksets[linkset-1].ss7.master, SIGURG);
17747#if defined(HAVE_SS7)
17751 unsigned int slc = 0;
17755 e->
command =
"ss7 restart mtp3";
17757 "Usage: ss7 restart mtp3 <linkset> <slc>\n"
17768 linkset = atoi(
a->argv[3]);
17769 if ((linkset < 1) || (linkset >
NUM_SPANS)) {
17770 ast_cli(
a->fd,
"Invalid linkset %s. Should be a number %d to %d\n",
a->argv[2], 1,
NUM_SPANS);
17773 if (!linksets[linkset-1].ss7.ss7) {
17774 ast_cli(
a->fd,
"No SS7 running on linkset %d\n", linkset);
17778 slc = atoi(
a->argv[4]);
17781 mtp3_init_restart(linksets[linkset-1].ss7.ss7, slc);
17786 pthread_kill(linksets[linkset-1].ss7.master, SIGURG);
17793#if defined(HAVE_SS7)
17800 e->
command =
"ss7 show linkset";
17802 "Usage: ss7 show linkset <span>\n"
17803 " Shows the status of an SS7 linkset.\n";
17813 linkset = atoi(
a->argv[3]);
17814 if ((linkset < 1) || (linkset >
NUM_SPANS)) {
17815 ast_cli(
a->fd,
"Invalid linkset %s. Should be a number %d to %d\n",
a->argv[3], 1,
NUM_SPANS);
17818 ss7 = &linksets[linkset - 1].ss7;
17820 ast_cli(
a->fd,
"No SS7 running on linkset %d\n", linkset);
17826 ast_cli(
a->fd,
"SS7 calling nai: %i\n",
ss7->calling_nai);
17827 ast_cli(
a->fd,
"SS7 called nai: %i\n",
ss7->called_nai);
17828 ast_cli(
a->fd,
"SS7 nationalprefix: %s\n",
ss7->nationalprefix);
17829 ast_cli(
a->fd,
"SS7 internationalprefix: %s\n",
ss7->internationalprefix);
17830 ast_cli(
a->fd,
"SS7 unknownprefix: %s\n",
ss7->unknownprefix);
17831 ast_cli(
a->fd,
"SS7 networkroutedprefix: %s\n",
ss7->networkroutedprefix);
17832 ast_cli(
a->fd,
"SS7 subscriberprefix: %s\n",
ss7->subscriberprefix);
17839#if defined(HAVE_SS7)
17846 e->
command =
"ss7 show channels";
17848 "Usage: ss7 show channels\n"
17849 " Displays SS7 channel information at a glance.\n";
17855 if (
a->argc != 3) {
17860 for (linkset = 0; linkset <
NUM_SPANS; ++linkset) {
17861 if (linksets[linkset].
ss7.ss7) {
17869#if defined(HAVE_SS7)
17872#define FORMAT "%5s %5s %6s %12s %-12s\n"
17873#define FORMAT2 "%5i %5i %6i %12s %-12s\n"
17874 int i, linkset, dpc = 0;
17881 e->
command =
"ss7 show cics";
17883 "Usage: ss7 show cics <linkset> [dpc]\n"
17884 " Shows the cics of an SS7 linkset.\n";
17890 if (
a->argc < 4 ||
a->argc > 5) {
17894 linkset = atoi(
a->argv[3]);
17896 if ((linkset < 1) || (linkset >
NUM_SPANS)) {
17897 ast_cli(
a->fd,
"Invalid linkset %s. Should be a number %d to %d\n",
a->argv[3], 1,
NUM_SPANS);
17901 if (!linksets[linkset-1].
ss7.ss7) {
17902 ast_cli(
a->fd,
"No SS7 running on linkset %d\n", linkset);
17905 ss7 = &linksets[linkset-1].ss7;
17907 if (
a->argc == 5) {
17908 dpc = atoi(
a->argv[4]);
17910 ast_cli(
a->fd,
"Invalid DPC specified!\n");
17915 ast_cli(
a->fd,
FORMAT,
"CIC",
"DPC",
"DAHDI",
"STATE",
"BLOCKING");
17917 for (i = 0; i <
ss7->numchans; i++) {
17918 if (!dpc || (
ss7->pvts[i] &&
ss7->pvts[i]->dpc == dpc)) {
17926 state =
"NotInServ";
17932 strcpy(blocking,
"L:");
17934 strcat(blocking,
"M");
17936 strcat(blocking,
" ");
17940 strcat(blocking,
"H");
17942 strcat(blocking,
" ");
17945 strcpy(blocking,
" ");
17949 strcat(blocking,
" R:");
17951 strcat(blocking,
"M");
17953 strcat(blocking,
" ");
17957 strcat(blocking,
"H");
17959 strcat(blocking,
" ");
17973#if defined(HAVE_SS7)
17978 e->
command =
"ss7 show version";
17980 "Usage: ss7 show version\n"
17981 " Show the libss7 version\n";
17987 ast_cli(
a->fd,
"libss7 version: %s\n", ss7_get_version());
17993#if defined(HAVE_SS7)
17995 AST_CLI_DEFINE(handle_ss7_debug,
"Enables SS7 debugging on a linkset"),
17996 AST_CLI_DEFINE(handle_ss7_cic_blocking,
"Blocks/Unblocks the given CIC"),
17997 AST_CLI_DEFINE(handle_ss7_linkset_mng,
"Resets/Blocks/Unblocks all CICs on a linkset"),
17998 AST_CLI_DEFINE(handle_ss7_group_blocking,
"Blocks/Unblocks the given CIC range"),
18000 AST_CLI_DEFINE(handle_ss7_group_reset,
"Resets the given CIC range"),
18003 AST_CLI_DEFINE(handle_ss7_show_linkset,
"Shows the status of a linkset"),
18004 AST_CLI_DEFINE(handle_ss7_show_channels,
"Displays SS7 channel information"),
18011#if defined(HAVE_PRI)
18012#if defined(HAVE_PRI_CCSS)
18059#if defined(HAVE_PRI)
18060#if defined(HAVE_PRI_CCSS)
18072static void dahdi_pri_cc_agent_destructor(
struct ast_cc_agent *agent)
18081#if defined(HAVE_PRI)
18082#if defined(HAVE_PRI_CCSS)
18084 .
type = dahdi_pri_cc_type,
18085 .init = dahdi_pri_cc_agent_init,
18094 .destructor = dahdi_pri_cc_agent_destructor,
18099#if defined(HAVE_PRI)
18100#if defined(HAVE_PRI_CCSS)
18102 .
type = dahdi_pri_cc_type,
18116#if defined(HAVE_PRI) || defined(HAVE_SS7)
18123 pthread_cancel(pris[i].pri.
master);
18124 pthread_kill(pris[i].pri.
master, SIGURG);
18129#ifdef HAVE_PRI_PROG_W_CAUSE
18133#if defined(HAVE_SS7)
18136 pthread_cancel(linksets[i].ss7.
master);
18137 pthread_kill(linksets[i].ss7.
master, SIGURG);
18142#if defined(HAVE_OPENR2)
18143 dahdi_r2_destroy_links();
18159#if defined(HAVE_PRI)
18186#if defined(HAVE_PRI)
18192 dahdi_close_pri_fd(&(pris[i]), j);
18196#if defined(HAVE_PRI_CCSS)
18203#if defined(HAVE_SS7)
18209 dahdi_close_ss7_fd(&(linksets[i]), j);
18211 if (linksets[i].ss7.
ss7) {
18212 ss7_destroy(linksets[i].ss7.
ss7);
18213 linksets[i].ss7.ss7 =
NULL;
18229#if defined(HAVE_PRI) || defined(HAVE_SS7)
18236#if defined(HAVE_SS7)
18246 int x, start, finish;
18249 if ((
reload == 0) && (
conf->chan.sig < 0) && !
conf->is_sig_auto) {
18250 ast_log(
LOG_ERROR,
"Signalling must be specified before any channels are.\n");
18256 while ((chan =
strsep(&
c,
","))) {
18257 if (sscanf(chan,
"%30d-%30d", &start, &finish) == 2) {
18259 }
else if (sscanf(chan,
"%30d", &start)) {
18262 }
else if (!strcasecmp(chan,
"pseudo")) {
18268 if (finish < start) {
18275 for (x = start; x <= finish; x++) {
18276 if (
conf->wanted_channels_start &&
18277 (x < conf->wanted_channels_start ||
18278 x >
conf->wanted_channels_end)
18288 (
reload == 1) ?
"reconfigure" :
"register",
value);
18302#define MAX_CHANLIST_LEN 80
18307 char *
params[DAHDI_MAX_ECHOCANPARAMS + 1];
18308 unsigned int param_count;
18320 if ((x == 32) || (x == 64) || (x == 128) || (x == 256) || (x == 512) || (x == 1024))
18327 for (x = 1; x < param_count; x++) {
18334 ast_log(
LOG_WARNING,
"Invalid echocancel parameter supplied at line %u: '%s'\n", line, params[x]);
18339 ast_log(
LOG_WARNING,
"Invalid echocancel parameter supplied at line %u: '%s'\n", line, param.name);
18347 ast_log(
LOG_WARNING,
"Invalid echocancel parameter value supplied at line %u: '%s'\n", line, param.value);
18355#if defined(HAVE_PRI)
18356#if defined(HAVE_PRI_DISPLAY_TEXT)
18366static unsigned long dahdi_display_text_option(
const char *
value)
18376 opt_str =
strsep(&val_str,
",");
18385 if (!strcasecmp(opt_str,
"block")) {
18386 options |= PRI_DISPLAY_OPTION_BLOCK;
18387 }
else if (!strcasecmp(opt_str,
"name_initial")) {
18388 options |= PRI_DISPLAY_OPTION_NAME_INITIAL;
18389 }
else if (!strcasecmp(opt_str,
"name_update")) {
18390 options |= PRI_DISPLAY_OPTION_NAME_UPDATE;
18391 }
else if (!strcasecmp(opt_str,
"name")) {
18392 options |= (PRI_DISPLAY_OPTION_NAME_INITIAL | PRI_DISPLAY_OPTION_NAME_UPDATE);
18393 }
else if (!strcasecmp(opt_str,
"text")) {
18394 options |= PRI_DISPLAY_OPTION_TEXT;
18402#if defined(HAVE_PRI)
18403#if defined(HAVE_PRI_DATETIME_SEND)
18413static int dahdi_datetime_send_option(
const char *
value)
18417 option = PRI_DATE_TIME_SEND_DEFAULT;
18420 option = PRI_DATE_TIME_SEND_NO;
18421 }
else if (!strcasecmp(
value,
"date")) {
18422 option = PRI_DATE_TIME_SEND_DATE;
18423 }
else if (!strcasecmp(
value,
"date_hh")) {
18424 option = PRI_DATE_TIME_SEND_DATE_HH;
18425 }
else if (!strcasecmp(
value,
"date_hhmm")) {
18426 option = PRI_DATE_TIME_SEND_DATE_HHMM;
18427 }
else if (!strcasecmp(
value,
"date_hhmmss")) {
18428 option = PRI_DATE_TIME_SEND_DATE_HHMMSS;
18437#define PROC_DAHDI_OPT_NOCHAN (1 << 0)
18439#define PROC_DAHDI_OPT_NOWARN (1 << 1)
18443 int count_pattern = 0;
18449 if (!sscanf(v->
value,
"%30d", &norval) && count_pattern == 0) {
18450 ast_log(
LOG_ERROR,
"busypattern= expects either busypattern=tonelength,quietlength or busypattern=t1length, q1length, t2length, q2length at line %d.\n", v->
lineno);
18454 busy_cadence->
pattern[count_pattern] = norval;
18457 if (count_pattern == 4) {
18461 temp = strchr(v->
value,
',');
18462 if (temp ==
NULL) {
18465 v->
value = temp + 1;
18467 busy_cadence->
length = count_pattern;
18469 if (count_pattern % 2 != 0) {
18471 ast_log(
LOG_ERROR,
"busypattern= expects either busypattern=tonelength,quietlength or busypattern=t1length, q1length, t2length, q2length at line %d.\n", v->
lineno);
18485 for (; v; v = v->
next) {
18490 if (!strcasecmp(v->
name,
"channel") || !strcasecmp(v->
name,
"channels")) {
18504 }
else if (!strcasecmp(v->
name,
"ignore_failed_channels")) {
18506 }
else if (!strcasecmp(v->
name,
"buffers")) {
18512 }
else if (!strcasecmp(v->
name,
"faxbuffers")) {
18516 }
else if (!strcasecmp(v->
name,
"dahdichan")) {
18519 }
else if (!strcasecmp(v->
name,
"usedistinctiveringdetection")) {
18521 }
else if (!strcasecmp(v->
name,
"distinctiveringaftercid")) {
18523 }
else if (!strcasecmp(v->
name,
"dring1context")) {
18525 }
else if (!strcasecmp(v->
name,
"dring2context")) {
18527 }
else if (!strcasecmp(v->
name,
"dring3context")) {
18529 }
else if (!strcasecmp(v->
name,
"dring1range")) {
18531 }
else if (!strcasecmp(v->
name,
"dring2range")) {
18533 }
else if (!strcasecmp(v->
name,
"dring3range")) {
18535 }
else if (!strcasecmp(v->
name,
"dring1")) {
18537 }
else if (!strcasecmp(v->
name,
"dring2")) {
18539 }
else if (!strcasecmp(v->
name,
"dring3")) {
18541 }
else if (!strcasecmp(v->
name,
"usecallerid")) {
18543 }
else if (!strcasecmp(v->
name,
"cidsignalling")) {
18544 if (!strcasecmp(v->
value,
"bell"))
18546 else if (!strcasecmp(v->
value,
"v23"))
18548 else if (!strcasecmp(v->
value,
"dtmf"))
18550 else if (!strcasecmp(v->
value,
"smdi"))
18552 else if (!strcasecmp(v->
value,
"v23_jp"))
18556 }
else if (!strcasecmp(v->
name,
"cidstart")) {
18557 if (!strcasecmp(v->
value,
"ring"))
18559 else if (!strcasecmp(v->
value,
"polarity_in"))
18561 else if (!strcasecmp(v->
value,
"polarity"))
18563 else if (!strcasecmp(v->
value,
"dtmf"))
18567 }
else if (!strcasecmp(v->
name,
"threewaycalling")) {
18569 }
else if (!strcasecmp(v->
name,
"threewaysilenthold")) {
18571 }
else if (!strcasecmp(v->
name,
"cancallforward")) {
18573 }
else if (!strcasecmp(v->
name,
"relaxdtmf")) {
18578 }
else if (!strcasecmp(v->
name,
"mailbox")) {
18580 }
else if (!strcasecmp(v->
name,
"description")) {
18582 }
else if (!strcasecmp(v->
name,
"hasvoicemail")) {
18588 if (strchr(cat,
'@')) {
18592 "%s@default", cat);
18595 }
else if (!strcasecmp(v->
name,
"adsi")) {
18597 }
else if (!strcasecmp(v->
name,
"usesmdi")) {
18599 }
else if (!strcasecmp(v->
name,
"smdiport")) {
18601 }
else if (!strcasecmp(v->
name,
"transfer")) {
18603 }
else if (!strcasecmp(v->
name,
"canpark")) {
18605 }
else if (!strcasecmp(v->
name,
"echocancelwhenbridged")) {
18607 }
else if (!strcasecmp(v->
name,
"busydetect")) {
18609 }
else if (!strcasecmp(v->
name,
"busycount")) {
18611 }
else if (!strcasecmp(v->
name,
"busypattern")) {
18613 }
else if (!strcasecmp(v->
name,
"calledsubscriberheld")) {
18615 }
else if (!strcasecmp(v->
name,
"callprogress")) {
18619 }
else if (!strcasecmp(v->
name,
"waitfordialtone")) {
18621 }
else if (!strcasecmp(v->
name,
"dialtone_detect")) {
18622 if (!strcasecmp(v->
value,
"always")) {
18631 }
else if (!strcasecmp(v->
name,
"faxdetect")) {
18633 if (!strcasecmp(v->
value,
"incoming")) {
18635 }
else if (!strcasecmp(v->
value,
"outgoing")) {
18639 }
else if (!strcasecmp(v->
name,
"faxdetect_timeout")) {
18643 }
else if (!strcasecmp(v->
name,
"firstdigit_timeout")) {
18648 }
else if (!strcasecmp(v->
name,
"interdigit_timeout")) {
18653 }
else if (!strcasecmp(v->
name,
"matchdigit_timeout")) {
18658 }
else if (!strcasecmp(v->
name,
"echocancel")) {
18660 }
else if (!strcasecmp(v->
name,
"echotraining")) {
18661 if (sscanf(v->
value,
"%30d", &y) == 1) {
18662 if ((y < 10) || (y > 4000)) {
18671 }
else if (!strcasecmp(v->
name,
"hidecallerid")) {
18673 }
else if (!strcasecmp(v->
name,
"hidecalleridname")) {
18675 }
else if (!strcasecmp(v->
name,
"pulsedial")) {
18677 }
else if (!strcasecmp(v->
name,
"callreturn")) {
18679 }
else if (!strcasecmp(v->
name,
"callwaiting")) {
18681 }
else if (!strcasecmp(v->
name,
"callwaitingcallerid")) {
18683 }
else if (!strcasecmp(v->
name,
"context")) {
18685 }
else if (!strcasecmp(v->
name,
"language")) {
18687 }
else if (!strcasecmp(v->
name,
"progzone")) {
18689 }
else if (!strcasecmp(v->
name,
"mohinterpret")
18690 ||!strcasecmp(v->
name,
"musiconhold") || !strcasecmp(v->
name,
"musicclass")) {
18692 }
else if (!strcasecmp(v->
name,
"mohsuggest")) {
18694 }
else if (!strcasecmp(v->
name,
"parkinglot")) {
18696 }
else if (!strcasecmp(v->
name,
"stripmsd")) {
18697 ast_log(
LOG_NOTICE,
"Configuration option \"%s\" has been deprecated. Please use dialplan instead\n", v->
name);
18699 }
else if (!strcasecmp(v->
name,
"jitterbuffers")) {
18701 }
else if (!strcasecmp(v->
name,
"group")) {
18703 }
else if (!strcasecmp(v->
name,
"callgroup")) {
18707 if (!strcasecmp(v->
value,
"none"))
18711 }
else if (!strcasecmp(v->
name,
"pickupgroup")) {
18715 if (!strcasecmp(v->
value,
"none"))
18719 }
else if (!strcasecmp(v->
name,
"namedcallgroup")) {
18721 ast_log(
LOG_WARNING,
"Only FXO signalled channels may belong to a named call group\n");
18724 }
else if (!strcasecmp(v->
name,
"namedpickupgroup")) {
18726 ast_log(
LOG_WARNING,
"Only FXO signalled channels may belong to a named pickup group\n");
18729 }
else if (!strcasecmp(v->
name,
"setvar")) {
18731 char *varval =
NULL;
18733 char varname[strlen(v->
value) + 1];
18734 strcpy(varname, v->
value);
18735 if ((varval = strchr(varname,
'='))) {
18745 }
else if (!strcasecmp(v->
name,
"immediate")) {
18747 }
else if (!strcasecmp(v->
name,
"immediatering")) {
18749 }
else if (!strcasecmp(v->
name,
"transfertobusy")) {
18751 }
else if (!strcasecmp(v->
name,
"dialmode")) {
18752 if (!strcasecmp(v->
value,
"pulse")) {
18754 }
else if (!strcasecmp(v->
value,
"dtmf") || !strcasecmp(v->
value,
"tone")) {
18756 }
else if (!strcasecmp(v->
value,
"none")) {
18761 }
else if (!strcasecmp(v->
name,
"mwimonitor")) {
18778 }
else if (!strcasecmp(v->
name,
"hwrxgain")) {
18780 if (strcasecmp(v->
value,
"disabled")) {
18787 }
else if (!strcasecmp(v->
name,
"hwtxgain")) {
18789 if (strcasecmp(v->
value,
"disabled")) {
18796 }
else if (!strcasecmp(v->
name,
"cid_rxgain")) {
18800 }
else if (!strcasecmp(v->
name,
"rxgain")) {
18804 }
else if (!strcasecmp(v->
name,
"txgain")) {
18808 }
else if (!strcasecmp(v->
name,
"txdrc")) {
18812 }
else if (!strcasecmp(v->
name,
"rxdrc")) {
18816 }
else if (!strcasecmp(v->
name,
"tonezone")) {
18820 }
else if (!strcasecmp(v->
name,
"callerid")) {
18821 if (!strcasecmp(v->
value,
"asreceived")) {
18827 }
else if (!strcasecmp(v->
name,
"fullname")) {
18829 }
else if (!strcasecmp(v->
name,
"cid_number")) {
18831 }
else if (!strcasecmp(v->
name,
"cid_tag")) {
18833 }
else if (!strcasecmp(v->
name,
"useincomingcalleridondahditransfer")) {
18835 }
else if (!strcasecmp(v->
name,
"restrictcid")) {
18837 }
else if (!strcasecmp(v->
name,
"usecallingpres")) {
18839 }
else if (!strcasecmp(v->
name,
"accountcode")) {
18841 }
else if (!strcasecmp(v->
name,
"amaflags")) {
18847 }
else if (!strcasecmp(v->
name,
"polarityonanswerdelay")) {
18849 }
else if (!strcasecmp(v->
name,
"answeronpolarityswitch")) {
18851 }
else if (!strcasecmp(v->
name,
"ani_info_digits")) {
18853 }
else if (!strcasecmp(v->
name,
"ani_wink_time")) {
18855 }
else if (!strcasecmp(v->
name,
"ani_timeout")) {
18857 }
else if (!strcasecmp(v->
name,
"hanguponpolarityswitch")) {
18859 }
else if (!strcasecmp(v->
name,
"autoreoriginate")) {
18861 }
else if (!strcasecmp(v->
name,
"sendcalleridafter")) {
18863 }
else if (!strcasecmp(v->
name,
"mwimonitornotify")) {
18867 }
else if (!strcasecmp(v->
name,
"mwisendtype")) {
18868#ifndef HAVE_DAHDI_LINEREVERSE_VMWI
18869 if (!strcasecmp(v->
value,
"rpas")) {
18876 memset(&confp->
chan.mwisend_setting, 0,
sizeof(confp->
chan.mwisend_setting));
18878 confp->
chan.mwisend_fsk = 0;
18880 confp->
chan.mwisend_fsk = 1;
18883 confp->
chan.mwisend_rpas = 1;
18885 confp->
chan.mwisend_rpas = 0;
18888 confp->
chan.mwisend_setting.vmwi_type |= DAHDI_VMWI_LREV;
18891 confp->
chan.mwisend_setting.vmwi_type |= DAHDI_VMWI_HVDC;
18894 confp->
chan.mwisend_setting.vmwi_type |= DAHDI_VMWI_HVAC;
18897 }
else if (
reload != 1) {
18898 if (!strcasecmp(v->
name,
"signalling") || !strcasecmp(v->
name,
"signaling")) {
18906 if (!strcasecmp(v->
value,
"em")) {
18908 }
else if (!strcasecmp(v->
value,
"em_e1")) {
18910 }
else if (!strcasecmp(v->
value,
"em_w")) {
18912 }
else if (!strcasecmp(v->
value,
"fxs_ls")) {
18914 }
else if (!strcasecmp(v->
value,
"fxs_gs")) {
18916 }
else if (!strcasecmp(v->
value,
"fxs_ks")) {
18918 }
else if (!strcasecmp(v->
value,
"fxo_ls")) {
18920 }
else if (!strcasecmp(v->
value,
"fxo_gs")) {
18922 }
else if (!strcasecmp(v->
value,
"fxo_ks")) {
18924 }
else if (!strcasecmp(v->
value,
"fxs_rx")) {
18927 }
else if (!strcasecmp(v->
value,
"fxo_rx")) {
18930 }
else if (!strcasecmp(v->
value,
"fxs_tx")) {
18933 }
else if (!strcasecmp(v->
value,
"fxo_tx")) {
18936 }
else if (!strcasecmp(v->
value,
"em_rx")) {
18939 }
else if (!strcasecmp(v->
value,
"em_tx")) {
18942 }
else if (!strcasecmp(v->
value,
"em_rxtx")) {
18945 }
else if (!strcasecmp(v->
value,
"em_txrx")) {
18948 }
else if (!strcasecmp(v->
value,
"sf")) {
18950 }
else if (!strcasecmp(v->
value,
"sf_w")) {
18952 }
else if (!strcasecmp(v->
value,
"sf_featd")) {
18954 }
else if (!strcasecmp(v->
value,
"sf_featdmf")) {
18956 }
else if (!strcasecmp(v->
value,
"sf_featb")) {
18958 }
else if (!strcasecmp(v->
value,
"sf")) {
18960 }
else if (!strcasecmp(v->
value,
"sf_rx")) {
18963 }
else if (!strcasecmp(v->
value,
"sf_tx")) {
18966 }
else if (!strcasecmp(v->
value,
"sf_rxtx")) {
18969 }
else if (!strcasecmp(v->
value,
"sf_txrx")) {
18972 }
else if (!strcasecmp(v->
value,
"featd")) {
18974 }
else if (!strcasecmp(v->
value,
"featdmf")) {
18976 }
else if (!strcasecmp(v->
value,
"featdmf_ta")) {
18978 }
else if (!strcasecmp(v->
value,
"e911")) {
18980 }
else if (!strcasecmp(v->
value,
"fgccama")) {
18982 }
else if (!strcasecmp(v->
value,
"fgccamamf")) {
18984 }
else if (!strcasecmp(v->
value,
"featb")) {
18987 }
else if (!strcasecmp(v->
value,
"pri_net")) {
18989 confp->pri.pri.nodetype = PRI_NETWORK;
18990 }
else if (!strcasecmp(v->
value,
"pri_cpe")) {
18992 confp->pri.pri.nodetype = PRI_CPE;
18993 }
else if (!strcasecmp(v->
value,
"bri_cpe")) {
18995 confp->pri.pri.nodetype = PRI_CPE;
18996 }
else if (!strcasecmp(v->
value,
"bri_net")) {
18998 confp->pri.pri.nodetype = PRI_NETWORK;
18999 }
else if (!strcasecmp(v->
value,
"bri_cpe_ptmp")) {
19001 confp->pri.pri.nodetype = PRI_CPE;
19002 }
else if (!strcasecmp(v->
value,
"bri_net_ptmp")) {
19003#if defined(HAVE_PRI_CALL_HOLD)
19005 confp->pri.pri.nodetype = PRI_NETWORK;
19007 ast_log(
LOG_WARNING,
"How cool would it be if someone implemented this mode! For now, sucks for you. (line %d)\n", v->
lineno);
19010#if defined(HAVE_SS7)
19011 }
else if (!strcasecmp(v->
value,
"ss7")) {
19015 }
else if (!strcasecmp(v->
value,
"mfcr2")) {
19018 }
else if (!strcasecmp(v->
value,
"auto")) {
19026 }
else if (!strcasecmp(v->
name,
"outsignalling") || !strcasecmp(v->
name,
"outsignaling")) {
19027 if (!strcasecmp(v->
value,
"em")) {
19029 }
else if (!strcasecmp(v->
value,
"em_e1")) {
19031 }
else if (!strcasecmp(v->
value,
"em_w")) {
19033 }
else if (!strcasecmp(v->
value,
"sf")) {
19035 }
else if (!strcasecmp(v->
value,
"sf_w")) {
19037 }
else if (!strcasecmp(v->
value,
"sf_featd")) {
19039 }
else if (!strcasecmp(v->
value,
"sf_featdmf")) {
19041 }
else if (!strcasecmp(v->
value,
"sf_featb")) {
19043 }
else if (!strcasecmp(v->
value,
"sf")) {
19045 }
else if (!strcasecmp(v->
value,
"featd")) {
19047 }
else if (!strcasecmp(v->
value,
"featdmf")) {
19049 }
else if (!strcasecmp(v->
value,
"featdmf_ta")) {
19051 }
else if (!strcasecmp(v->
value,
"e911")) {
19053 }
else if (!strcasecmp(v->
value,
"fgccama")) {
19055 }
else if (!strcasecmp(v->
value,
"fgccamamf")) {
19057 }
else if (!strcasecmp(v->
value,
"featb")) {
19063 }
else if (!strcasecmp(v->
name,
"pridialplan")) {
19064 if (!strcasecmp(v->
value,
"national")) {
19065 confp->pri.pri.dialplan = PRI_NATIONAL_ISDN + 1;
19066 }
else if (!strcasecmp(v->
value,
"unknown")) {
19067 confp->pri.pri.dialplan = PRI_UNKNOWN + 1;
19068 }
else if (!strcasecmp(v->
value,
"private")) {
19069 confp->pri.pri.dialplan = PRI_PRIVATE + 1;
19070 }
else if (!strcasecmp(v->
value,
"international")) {
19071 confp->pri.pri.dialplan = PRI_INTERNATIONAL_ISDN + 1;
19072 }
else if (!strcasecmp(v->
value,
"local")) {
19073 confp->pri.pri.dialplan = PRI_LOCAL_ISDN + 1;
19074 }
else if (!strcasecmp(v->
value,
"dynamic")) {
19075 confp->pri.pri.dialplan = -1;
19076 }
else if (!strcasecmp(v->
value,
"redundant")) {
19077 confp->pri.pri.dialplan = -2;
19081 }
else if (!strcasecmp(v->
name,
"prilocaldialplan")) {
19082 if (!strcasecmp(v->
value,
"national")) {
19083 confp->pri.pri.localdialplan = PRI_NATIONAL_ISDN + 1;
19084 }
else if (!strcasecmp(v->
value,
"unknown")) {
19085 confp->pri.pri.localdialplan = PRI_UNKNOWN + 1;
19086 }
else if (!strcasecmp(v->
value,
"private")) {
19087 confp->pri.pri.localdialplan = PRI_PRIVATE + 1;
19088 }
else if (!strcasecmp(v->
value,
"international")) {
19089 confp->pri.pri.localdialplan = PRI_INTERNATIONAL_ISDN + 1;
19090 }
else if (!strcasecmp(v->
value,
"local")) {
19091 confp->pri.pri.localdialplan = PRI_LOCAL_ISDN + 1;
19092 }
else if (!strcasecmp(v->
value,
"from_channel")) {
19093 confp->pri.pri.localdialplan = 0;
19094 }
else if (!strcasecmp(v->
value,
"dynamic")) {
19095 confp->pri.pri.localdialplan = -1;
19096 }
else if (!strcasecmp(v->
value,
"redundant")) {
19097 confp->pri.pri.localdialplan = -2;
19101 }
else if (!strcasecmp(v->
name,
"pricpndialplan")) {
19102 if (!strcasecmp(v->
value,
"national")) {
19103 confp->pri.pri.cpndialplan = PRI_NATIONAL_ISDN + 1;
19104 }
else if (!strcasecmp(v->
value,
"unknown")) {
19105 confp->pri.pri.cpndialplan = PRI_UNKNOWN + 1;
19106 }
else if (!strcasecmp(v->
value,
"private")) {
19107 confp->pri.pri.cpndialplan = PRI_PRIVATE + 1;
19108 }
else if (!strcasecmp(v->
value,
"international")) {
19109 confp->pri.pri.cpndialplan = PRI_INTERNATIONAL_ISDN + 1;
19110 }
else if (!strcasecmp(v->
value,
"local")) {
19111 confp->pri.pri.cpndialplan = PRI_LOCAL_ISDN + 1;
19112 }
else if (!strcasecmp(v->
value,
"from_channel")) {
19113 confp->pri.pri.cpndialplan = 0;
19114 }
else if (!strcasecmp(v->
value,
"dynamic")) {
19115 confp->pri.pri.cpndialplan = -1;
19116 }
else if (!strcasecmp(v->
value,
"redundant")) {
19117 confp->pri.pri.cpndialplan = -2;
19121 }
else if (!strcasecmp(v->
name,
"switchtype")) {
19122 if (!strcasecmp(v->
value,
"national"))
19123 confp->pri.pri.switchtype = PRI_SWITCH_NI2;
19124 else if (!strcasecmp(v->
value,
"ni1"))
19125 confp->pri.pri.switchtype = PRI_SWITCH_NI1;
19126 else if (!strcasecmp(v->
value,
"dms100"))
19127 confp->pri.pri.switchtype = PRI_SWITCH_DMS100;
19128 else if (!strcasecmp(v->
value,
"4ess"))
19129 confp->pri.pri.switchtype = PRI_SWITCH_ATT4ESS;
19130 else if (!strcasecmp(v->
value,
"5ess"))
19131 confp->pri.pri.switchtype = PRI_SWITCH_LUCENT5E;
19132 else if (!strcasecmp(v->
value,
"euroisdn"))
19133 confp->pri.pri.switchtype = PRI_SWITCH_EUROISDN_E1;
19134 else if (!strcasecmp(v->
value,
"qsig"))
19135 confp->pri.pri.switchtype = PRI_SWITCH_QSIG;
19140 }
else if (!strcasecmp(v->
name,
"msn")) {
19142 sizeof(confp->pri.pri.msn_list));
19143 }
else if (!strcasecmp(v->
name,
"nsf")) {
19144 if (!strcasecmp(v->
value,
"sdn"))
19145 confp->pri.pri.nsf = PRI_NSF_SDN;
19146 else if (!strcasecmp(v->
value,
"megacom"))
19147 confp->pri.pri.nsf = PRI_NSF_MEGACOM;
19148 else if (!strcasecmp(v->
value,
"tollfreemegacom"))
19149 confp->pri.pri.nsf = PRI_NSF_TOLL_FREE_MEGACOM;
19150 else if (!strcasecmp(v->
value,
"accunet"))
19151 confp->pri.pri.nsf = PRI_NSF_ACCUNET;
19152 else if (!strcasecmp(v->
value,
"none"))
19153 confp->pri.pri.nsf = PRI_NSF_NONE;
19156 confp->pri.pri.nsf = PRI_NSF_NONE;
19158 }
else if (!strcasecmp(v->
name,
"priindication")) {
19159 if (!strcasecmp(v->
value,
"outofband"))
19161 else if (!strcasecmp(v->
value,
"inband"))
19164 ast_log(
LOG_WARNING,
"'%s' is not a valid pri indication value, should be 'inband' or 'outofband' at line %d.\n",
19166 }
else if (!strcasecmp(v->
name,
"priexclusive")) {
19168 }
else if (!strcasecmp(v->
name,
"internationalprefix")) {
19169 ast_copy_string(confp->pri.pri.internationalprefix, v->
value,
sizeof(confp->pri.pri.internationalprefix));
19170 }
else if (!strcasecmp(v->
name,
"nationalprefix")) {
19171 ast_copy_string(confp->pri.pri.nationalprefix, v->
value,
sizeof(confp->pri.pri.nationalprefix));
19172 }
else if (!strcasecmp(v->
name,
"localprefix")) {
19174 }
else if (!strcasecmp(v->
name,
"privateprefix")) {
19175 ast_copy_string(confp->pri.pri.privateprefix, v->
value,
sizeof(confp->pri.pri.privateprefix));
19176 }
else if (!strcasecmp(v->
name,
"unknownprefix")) {
19177 ast_copy_string(confp->pri.pri.unknownprefix, v->
value,
sizeof(confp->pri.pri.unknownprefix));
19178 }
else if (!strcasecmp(v->
name,
"resetinterval")) {
19179 if (!strcasecmp(v->
value,
"never"))
19180 confp->pri.pri.resetinterval = -1;
19181 else if (atoi(v->
value) >= 60)
19182 confp->pri.pri.resetinterval = atoi(v->
value);
19184 ast_log(
LOG_WARNING,
"'%s' is not a valid reset interval, should be >= 60 seconds or 'never' at line %d.\n",
19186 }
else if (!strcasecmp(v->
name,
"force_restart_unavailable_chans")) {
19187 confp->pri.pri.force_restart_unavailable_chans =
ast_true(v->
value);
19188 }
else if (!strcasecmp(v->
name,
"minunused")) {
19189 confp->pri.pri.minunused = atoi(v->
value);
19190 }
else if (!strcasecmp(v->
name,
"minidle")) {
19191 confp->pri.pri.minidle = atoi(v->
value);
19192 }
else if (!strcasecmp(v->
name,
"idleext")) {
19194 }
else if (!strcasecmp(v->
name,
"idledial")) {
19196 }
else if (!strcasecmp(v->
name,
"overlapdial")) {
19199 }
else if (!strcasecmp(v->
value,
"incoming")) {
19201 }
else if (!strcasecmp(v->
value,
"outgoing")) {
19208#ifdef HAVE_PRI_PROG_W_CAUSE
19209 }
else if (!strcasecmp(v->
name,
"qsigchannelmapping")) {
19210 if (!strcasecmp(v->
value,
"logical")) {
19212 }
else if (!strcasecmp(v->
value,
"physical")) {
19218 }
else if (!strcasecmp(v->
name,
"discardremoteholdretrieval")) {
19219 confp->pri.pri.discardremoteholdretrieval =
ast_true(v->
value);
19220#if defined(HAVE_PRI_SERVICE_MESSAGES)
19221 }
else if (!strcasecmp(v->
name,
"service_message_support")) {
19223 if ((confp->pri.pri.switchtype == PRI_SWITCH_ATT4ESS
19224 || confp->pri.pri.switchtype == PRI_SWITCH_LUCENT5E
19225 || confp->pri.pri.switchtype == PRI_SWITCH_NI2) &&
ast_true(v->
value)) {
19226 confp->pri.pri.enable_service_message_support = 1;
19228 confp->pri.pri.enable_service_message_support = 0;
19231#ifdef HAVE_PRI_INBANDDISCONNECT
19232 }
else if (!strcasecmp(v->
name,
"inbanddisconnect")) {
19235 }
else if (!strcasecmp(v->
name,
"pritimer")) {
19236#ifdef PRI_GETSET_TIMERS
19247 timeridx = pri_timer2idx(timerc);
19249 if (timeridx < 0 || PRI_MAX_TIMERS <= timeridx) {
19251 "'%s' is not a valid ISDN timer at line %d.\n", timerc,
19253 }
else if (!
timer) {
19255 "'%s' is not a valid value for ISDN timer '%s' at line %d.\n",
19258 confp->pri.pri.pritimers[timeridx] =
timer;
19262 "'%s' is not a valid ISDN timer configuration string at line %d.\n",
19266 }
else if (!strcasecmp(v->
name,
"facilityenable")) {
19268#if defined(HAVE_PRI_AOC_EVENTS)
19269 }
else if (!strcasecmp(v->
name,
"aoc_enable")) {
19270 confp->pri.pri.aoc_passthrough_flag = 0;
19271 if (strchr(v->
value,
's') || strchr(v->
value,
'S')) {
19274 if (strchr(v->
value,
'd') || strchr(v->
value,
'D')) {
19277 if (strchr(v->
value,
'e') || strchr(v->
value,
'E')) {
19280 }
else if (!strcasecmp(v->
name,
"aoce_delayhangup")) {
19283#if defined(HAVE_PRI_CALL_HOLD)
19284 }
else if (!strcasecmp(v->
name,
"hold_disconnect_transfer")) {
19285 confp->pri.pri.hold_disconnect_transfer =
ast_true(v->
value);
19287 }
else if (!strcasecmp(v->
name,
"moh_signaling")
19288 || !strcasecmp(v->
name,
"moh_signalling")) {
19289 if (!strcasecmp(v->
value,
"moh")) {
19291 }
else if (!strcasecmp(v->
value,
"notify")) {
19293#if defined(HAVE_PRI_CALL_HOLD)
19294 }
else if (!strcasecmp(v->
value,
"hold")) {
19295 confp->pri.pri.moh_signaling = SIG_PRI_MOH_SIGNALING_HOLD;
19300#if defined(HAVE_PRI_CCSS)
19301 }
else if (!strcasecmp(v->
name,
"cc_ptmp_recall_mode")) {
19302 if (!strcasecmp(v->
value,
"global")) {
19303 confp->pri.pri.cc_ptmp_recall_mode = 0;
19304 }
else if (!strcasecmp(v->
value,
"specific")) {
19305 confp->pri.pri.cc_ptmp_recall_mode = 1;
19307 confp->pri.pri.cc_ptmp_recall_mode = 1;
19309 }
else if (!strcasecmp(v->
name,
"cc_qsig_signaling_link_req")) {
19310 if (!strcasecmp(v->
value,
"release")) {
19311 confp->pri.pri.cc_qsig_signaling_link_req = 0;
19312 }
else if (!strcasecmp(v->
value,
"retain")) {
19313 confp->pri.pri.cc_qsig_signaling_link_req = 1;
19314 }
else if (!strcasecmp(v->
value,
"do_not_care")) {
19315 confp->pri.pri.cc_qsig_signaling_link_req = 2;
19317 confp->pri.pri.cc_qsig_signaling_link_req = 1;
19319 }
else if (!strcasecmp(v->
name,
"cc_qsig_signaling_link_rsp")) {
19320 if (!strcasecmp(v->
value,
"release")) {
19321 confp->pri.pri.cc_qsig_signaling_link_rsp = 0;
19322 }
else if (!strcasecmp(v->
value,
"retain")) {
19323 confp->pri.pri.cc_qsig_signaling_link_rsp = 1;
19325 confp->pri.pri.cc_qsig_signaling_link_rsp = 1;
19328#if defined(HAVE_PRI_CALL_WAITING)
19329 }
else if (!strcasecmp(v->
name,
"max_call_waiting_calls")) {
19330 confp->pri.pri.max_call_waiting_calls = atoi(v->
value);
19331 if (confp->pri.pri.max_call_waiting_calls < 0) {
19333 confp->pri.pri.max_call_waiting_calls = 0;
19335 }
else if (!strcasecmp(v->
name,
"allow_call_waiting_calls")) {
19336 confp->pri.pri.allow_call_waiting_calls =
ast_true(v->
value);
19338#if defined(HAVE_PRI_MWI)
19339 }
else if (!strcasecmp(v->
name,
"mwi_mailboxes")) {
19341 sizeof(confp->pri.pri.mwi_mailboxes));
19342 }
else if (!strcasecmp(v->
name,
"mwi_vm_boxes")) {
19344 sizeof(confp->pri.pri.mwi_vm_boxes));
19345 }
else if (!strcasecmp(v->
name,
"mwi_vm_numbers")) {
19347 sizeof(confp->pri.pri.mwi_vm_numbers));
19349 }
else if (!strcasecmp(v->
name,
"append_msn_to_cid_tag")) {
19350 confp->pri.pri.append_msn_to_user_tag =
ast_true(v->
value);
19351 }
else if (!strcasecmp(v->
name,
"inband_on_setup_ack")) {
19353 }
else if (!strcasecmp(v->
name,
"inband_on_proceeding")) {
19355#if defined(HAVE_PRI_DISPLAY_TEXT)
19356 }
else if (!strcasecmp(v->
name,
"display_send")) {
19357 confp->pri.pri.display_flags_send = dahdi_display_text_option(v->
value);
19358 }
else if (!strcasecmp(v->
name,
"display_receive")) {
19359 confp->pri.pri.display_flags_receive = dahdi_display_text_option(v->
value);
19361#if defined(HAVE_PRI_MCID)
19362 }
else if (!strcasecmp(v->
name,
"mcid_send")) {
19365#if defined(HAVE_PRI_DATETIME_SEND)
19366 }
else if (!strcasecmp(v->
name,
"datetime_send")) {
19367 confp->pri.pri.datetime_send = dahdi_datetime_send_option(v->
value);
19369 }
else if (!strcasecmp(v->
name,
"layer1_presence")) {
19370 if (!strcasecmp(v->
value,
"required")) {
19371 confp->pri.pri.layer1_ignored = 0;
19372 }
else if (!strcasecmp(v->
value,
"ignore")) {
19373 confp->pri.pri.layer1_ignored = 1;
19376 confp->pri.pri.layer1_ignored = 0;
19378#if defined(HAVE_PRI_L2_PERSISTENCE)
19379 }
else if (!strcasecmp(v->
name,
"layer2_persistence")) {
19380 if (!strcasecmp(v->
value,
"keep_up")) {
19381 confp->pri.pri.l2_persistence = PRI_L2_PERSISTENCE_KEEP_UP;
19382 }
else if (!strcasecmp(v->
value,
"leave_down")) {
19383 confp->pri.pri.l2_persistence = PRI_L2_PERSISTENCE_LEAVE_DOWN;
19385 confp->pri.pri.l2_persistence = PRI_L2_PERSISTENCE_DEFAULT;
19388 }
else if (!strcasecmp(v->
name,
"colp_send")) {
19389 if (!strcasecmp(v->
value,
"block")) {
19391 }
else if (!strcasecmp(v->
value,
"connect")) {
19393 }
else if (!strcasecmp(v->
value,
"update")) {
19399#if defined(HAVE_SS7)
19400 }
else if (!strcasecmp(v->
name,
"ss7type")) {
19401 if (!strcasecmp(v->
value,
"itu")) {
19402 cur_ss7type = SS7_ITU;
19403 }
else if (!strcasecmp(v->
value,
"ansi")) {
19404 cur_ss7type = SS7_ANSI;
19408 }
else if (!strcasecmp(v->
name,
"slc")) {
19409 cur_slc = atoi(v->
value);
19410 }
else if (!strcasecmp(v->
name,
"linkset")) {
19411 cur_linkset = atoi(v->
value);
19412 }
else if (!strcasecmp(v->
name,
"pointcode")) {
19413 cur_pointcode = parse_pointcode(v->
value);
19414 }
else if (!strcasecmp(v->
name,
"adjpointcode")) {
19415 cur_adjpointcode = parse_pointcode(v->
value);
19416 }
else if (!strcasecmp(v->
name,
"defaultdpc")) {
19417 cur_defaultdpc = parse_pointcode(v->
value);
19418 }
else if (!strcasecmp(v->
name,
"cicbeginswith")) {
19419 cur_cicbeginswith = atoi(v->
value);
19420 }
else if (!strcasecmp(v->
name,
"networkindicator")) {
19421 if (!strcasecmp(v->
value,
"national")) {
19422 cur_networkindicator = SS7_NI_NAT;
19423 }
else if (!strcasecmp(v->
value,
"national_spare")) {
19424 cur_networkindicator = SS7_NI_NAT_SPARE;
19425 }
else if (!strcasecmp(v->
value,
"international")) {
19426 cur_networkindicator = SS7_NI_INT;
19427 }
else if (!strcasecmp(v->
value,
"international_spare")) {
19428 cur_networkindicator = SS7_NI_INT_SPARE;
19430 cur_networkindicator = -1;
19432 }
else if (!strcasecmp(v->
name,
"ss7_internationalprefix")) {
19433 ast_copy_string(confp->ss7.ss7.internationalprefix, v->
value,
sizeof(confp->ss7.ss7.internationalprefix));
19434 }
else if (!strcasecmp(v->
name,
"ss7_nationalprefix")) {
19435 ast_copy_string(confp->ss7.ss7.nationalprefix, v->
value,
sizeof(confp->ss7.ss7.nationalprefix));
19436 }
else if (!strcasecmp(v->
name,
"ss7_subscriberprefix")) {
19437 ast_copy_string(confp->ss7.ss7.subscriberprefix, v->
value,
sizeof(confp->ss7.ss7.subscriberprefix));
19438 }
else if (!strcasecmp(v->
name,
"ss7_unknownprefix")) {
19439 ast_copy_string(confp->ss7.ss7.unknownprefix, v->
value,
sizeof(confp->ss7.ss7.unknownprefix));
19440 }
else if (!strcasecmp(v->
name,
"ss7_networkroutedprefix")) {
19441 ast_copy_string(confp->ss7.ss7.networkroutedprefix, v->
value,
sizeof(confp->ss7.ss7.networkroutedprefix));
19442 }
else if (!strcasecmp(v->
name,
"ss7_called_nai")) {
19443 if (!strcasecmp(v->
value,
"national")) {
19444 confp->ss7.ss7.called_nai = SS7_NAI_NATIONAL;
19445 }
else if (!strcasecmp(v->
value,
"international")) {
19446 confp->ss7.ss7.called_nai = SS7_NAI_INTERNATIONAL;
19447 }
else if (!strcasecmp(v->
value,
"subscriber")) {
19448 confp->ss7.ss7.called_nai = SS7_NAI_SUBSCRIBER;
19449 }
else if (!strcasecmp(v->
value,
"unknown")) {
19450 confp->ss7.ss7.called_nai = SS7_NAI_UNKNOWN;
19451 }
else if (!strcasecmp(v->
value,
"dynamic")) {
19456 }
else if (!strcasecmp(v->
name,
"ss7_calling_nai")) {
19457 if (!strcasecmp(v->
value,
"national")) {
19458 confp->ss7.ss7.calling_nai = SS7_NAI_NATIONAL;
19459 }
else if (!strcasecmp(v->
value,
"international")) {
19460 confp->ss7.ss7.calling_nai = SS7_NAI_INTERNATIONAL;
19461 }
else if (!strcasecmp(v->
value,
"subscriber")) {
19462 confp->ss7.ss7.calling_nai = SS7_NAI_SUBSCRIBER;
19463 }
else if (!strcasecmp(v->
value,
"unknown")) {
19464 confp->ss7.ss7.calling_nai = SS7_NAI_UNKNOWN;
19465 }
else if (!strcasecmp(v->
value,
"dynamic")) {
19470 }
else if (!strcasecmp(v->
name,
"sigchan")) {
19472 sigchan = atoi(v->
value);
19473 res = linkset_addsigchan(sigchan);
19477 }
else if (!strcasecmp(v->
name,
"ss7_explicitacm")) {
19478 struct dahdi_ss7 *link;
19479 link = ss7_resolve_linkset(cur_linkset);
19487 link->ss7.flags &= ~LINKSET_FLAG_EXPLICITACM;
19489 }
else if (!strcasecmp(v->
name,
"ss7_autoacm")) {
19490 struct dahdi_ss7 *link;
19491 link = ss7_resolve_linkset(cur_linkset);
19499 link->ss7.flags &= ~LINKSET_FLAG_AUTOACM;
19501 }
else if (!strcasecmp(v->
name,
"ss7_initialhwblo")) {
19502 struct dahdi_ss7 *link;
19503 link = ss7_resolve_linkset(cur_linkset);
19511 link->ss7.flags &= ~LINKSET_FLAG_INITIALHWBLO;
19513 }
else if (!strcasecmp(v->
name,
"ss7_use_echocontrol")) {
19514 struct dahdi_ss7 *link;
19515 link = ss7_resolve_linkset(cur_linkset);
19523 link->ss7.flags &= ~LINKSET_FLAG_USEECHOCONTROL;
19525 }
else if (!strcasecmp(v->
name,
"ss7_default_echocontrol")) {
19526 struct dahdi_ss7 *link;
19527 link = ss7_resolve_linkset(cur_linkset);
19535 link->ss7.flags &= ~LINKSET_FLAG_DEFAULTECHOCONTROL;
19537 }
else if (!strncasecmp(v->
name,
"isup_timer.", 11)) {
19538 struct dahdi_ss7 *link;
19539 link = ss7_resolve_linkset(cur_linkset);
19544 if (!link->ss7.ss7) {
19546 }
else if (!ss7_set_isup_timer(link->ss7.ss7, strstr(v->
name,
".") + 1, atoi(v->
value))) {
19549 }
else if (!strncasecmp(v->
name,
"mtp3_timer.", 11)) {
19550 struct dahdi_ss7 *link;
19551 link = ss7_resolve_linkset(cur_linkset);
19556 if (!link->ss7.ss7) {
19558 }
else if (!ss7_set_mtp3_timer(link->ss7.ss7, strstr(v->
name,
".") + 1, atoi(v->
value))) {
19561 }
else if (!strcasecmp(v->
name,
"inr_if_no_calling")) {
19562 struct dahdi_ss7 *link;
19563 link = ss7_resolve_linkset(cur_linkset);
19568 if (!link->ss7.ss7) {
19571 ss7_set_flags(link->ss7.ss7, SS7_INR_IF_NO_CALLING);
19573 ss7_clear_flags(link->ss7.ss7, SS7_INR_IF_NO_CALLING);
19575 }
else if (!strcasecmp(v->
name,
"non_isdn_access")) {
19576 struct dahdi_ss7 *link;
19577 link = ss7_resolve_linkset(cur_linkset);
19582 if (!link->ss7.ss7) {
19585 ss7_clear_flags(link->ss7.ss7, SS7_ISDN_ACCESS_INDICATOR);
19587 ss7_set_flags(link->ss7.ss7, SS7_ISDN_ACCESS_INDICATOR);
19589 }
else if (!strcasecmp(v->
name,
"sls_shift")) {
19590 struct dahdi_ss7 *link;
19591 int sls_shift = atoi(v->
value);
19593 if (sls_shift < 0 || sls_shift > 7) {
19598 link = ss7_resolve_linkset(cur_linkset);
19603 if (!link->ss7.ss7) {
19606 ss7_set_sls_shift(link->ss7.ss7, sls_shift);
19608 }
else if (!strcasecmp(v->
name,
"cause_location")) {
19609 struct dahdi_ss7 *link;
19610 int cause_location = atoi(v->
value);
19612 if (cause_location < 0 || cause_location > 15) {
19613 ast_log(
LOG_ERROR,
"Invalid cause_location value. Must be between 0 and 15\n");
19616 link = ss7_resolve_linkset(cur_linkset);
19621 if (!link->ss7.ss7) {
19624 ss7_set_cause_location(link->ss7.ss7, cause_location);
19628 }
else if (!strcasecmp(v->
name,
"mfcr2_advanced_protocol_file")) {
19630 ast_log(
LOG_WARNING,
"MFC/R2 Protocol file '%s' will be used, you only should use this if you *REALLY KNOW WHAT YOU ARE DOING*.\n", confp->mfcr2.r2proto_file);
19631 }
else if (!strcasecmp(v->
name,
"mfcr2_logdir")) {
19633 }
else if (!strcasecmp(v->
name,
"mfcr2_variant")) {
19634 confp->mfcr2.variant = openr2_proto_get_variant(v->
value);
19635 if (OR2_VAR_UNKNOWN == confp->mfcr2.variant) {
19637 confp->mfcr2.variant = OR2_VAR_ITU;
19639 }
else if (!strcasecmp(v->
name,
"mfcr2_mfback_timeout")) {
19640 confp->mfcr2.mfback_timeout = atoi(v->
value);
19641 if (!confp->mfcr2.mfback_timeout) {
19642 ast_log(
LOG_WARNING,
"MF timeout of 0? hum, I will protect you from your ignorance. Setting default.\n");
19643 confp->mfcr2.mfback_timeout = -1;
19644 }
else if (confp->mfcr2.mfback_timeout > 0 && confp->mfcr2.mfback_timeout < 500) {
19645 ast_log(
LOG_WARNING,
"MF timeout less than 500ms is not recommended, you have been warned!\n");
19647 }
else if (!strcasecmp(v->
name,
"mfcr2_metering_pulse_timeout")) {
19648 confp->mfcr2.metering_pulse_timeout = atoi(v->
value);
19649 if (confp->mfcr2.metering_pulse_timeout > 500) {
19650 ast_log(
LOG_WARNING,
"Metering pulse timeout greater than 500ms is not recommended, you have been warned!\n");
19652#if defined(OR2_LIB_INTERFACE) && OR2_LIB_INTERFACE > 2
19653 }
else if (!strcasecmp(v->
name,
"mfcr2_dtmf_detection")) {
19655 }
else if (!strcasecmp(v->
name,
"mfcr2_dtmf_dialing")) {
19657 }
else if (!strcasecmp(v->
name,
"mfcr2_dtmf_time_on")) {
19658 confp->mfcr2.dtmf_time_on = atoi(v->
value);
19659 }
else if (!strcasecmp(v->
name,
"mfcr2_dtmf_time_off")) {
19660 confp->mfcr2.dtmf_time_off = atoi(v->
value);
19662#if defined(OR2_LIB_INTERFACE) && OR2_LIB_INTERFACE > 3
19663 }
else if (!strcasecmp(v->
name,
"mfcr2_dtmf_end_timeout")) {
19664 confp->mfcr2.dtmf_end_timeout = atoi(v->
value);
19666 }
else if (!strcasecmp(v->
name,
"mfcr2_get_ani_first")) {
19668 }
else if (!strcasecmp(v->
name,
"mfcr2_double_answer")) {
19670 }
else if (!strcasecmp(v->
name,
"mfcr2_charge_calls")) {
19672 }
else if (!strcasecmp(v->
name,
"mfcr2_accept_on_offer")) {
19674 }
else if (!strcasecmp(v->
name,
"mfcr2_allow_collect_calls")) {
19675 confp->mfcr2.allow_collect_calls =
ast_true(v->
value) ? 1 : 0;
19676 }
else if (!strcasecmp(v->
name,
"mfcr2_forced_release")) {
19678 }
else if (!strcasecmp(v->
name,
"mfcr2_immediate_accept")) {
19679 confp->mfcr2.immediate_accept =
ast_true(v->
value) ? 1 : 0;
19680#if defined(OR2_LIB_INTERFACE) && OR2_LIB_INTERFACE > 1
19681 }
else if (!strcasecmp(v->
name,
"mfcr2_skip_category")) {
19682 confp->mfcr2.skip_category_request =
ast_true(v->
value) ? 1 : 0;
19684 }
else if (!strcasecmp(v->
name,
"mfcr2_call_files")) {
19686 }
else if (!strcasecmp(v->
name,
"mfcr2_max_ani")) {
19687 confp->mfcr2.max_ani = atoi(v->
value);
19691 }
else if (!strcasecmp(v->
name,
"mfcr2_max_dnis")) {
19692 confp->mfcr2.max_dnis = atoi(v->
value);
19696 }
else if (!strcasecmp(v->
name,
"mfcr2_category")) {
19697 confp->mfcr2.category = openr2_proto_get_category(v->
value);
19698 if (OR2_CALLING_PARTY_CATEGORY_UNKNOWN == confp->mfcr2.category) {
19699 confp->mfcr2.category = OR2_CALLING_PARTY_CATEGORY_NATIONAL_SUBSCRIBER;
19700 ast_log(
LOG_WARNING,
"Invalid MFC/R2 caller category '%s' at line %d. Using national subscriber as default.\n",
19703 }
else if (!strcasecmp(v->
name,
"mfcr2_logging")) {
19704 openr2_log_level_t tmplevel;
19711 clevel =
strsep(&logval,
",");
19712 if (-1 == (tmplevel = openr2_log_get_level(clevel))) {
19716 confp->mfcr2.loglevel |= tmplevel;
19719 }
else if (!strcasecmp(v->
name,
"cadence")) {
19721 int element_count,
c[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
19723 struct dahdi_ring_cadence new_cadence;
19724 int cid_location = -1;
19725 int firstcadencepos = 0;
19726 char original_args[80];
19727 int cadence_is_ok = 1;
19731 element_count = sscanf(v->
value,
"%30d,%30d,%30d,%30d,%30d,%30d,%30d,%30d,%30d,%30d,%30d,%30d,%30d,%30d,%30d,%30d", &
c[0], &
c[1], &
c[2], &
c[3], &
c[4], &
c[5], &
c[6], &
c[7], &
c[8], &
c[9], &
c[10], &
c[11], &
c[12], &
c[13], &
c[14], &
c[15]);
19734 if (element_count % 2 == 1) {
19735 ast_log(
LOG_ERROR,
"Must be a silence duration for each ring duration: %s at line %d.\n", original_args, v->
lineno);
19745 for (i = 0; i < element_count; i++) {
19747 ast_log(
LOG_ERROR,
"Ring or silence duration cannot be zero: %s at line %d.\n", original_args, v->
lineno);
19750 }
else if (
c[i] < 0) {
19753 if (cid_location == -1) {
19762 if (firstcadencepos == 0) {
19763 firstcadencepos = i;
19766 ast_log(
LOG_ERROR,
"First cadence position specified twice: %s at line %d.\n", original_args, v->
lineno);
19775 for (i = 0; i < 16; i++) {
19776 new_cadence.ringcadence[i] =
c[i];
19779 if (cadence_is_ok) {
19781 if (element_count < 2) {
19784 if (cid_location == -1) {
19789 cid_location = (cid_location + 1) / 2;
19804 }
else if (!strcasecmp(v->
name,
"ringtimeout")) {
19806 }
else if (!strcasecmp(v->
name,
"prewink")) {
19808 }
else if (!strcasecmp(v->
name,
"preflash")) {
19810 }
else if (!strcasecmp(v->
name,
"wink")) {
19812 }
else if (!strcasecmp(v->
name,
"flash")) {
19814 }
else if (!strcasecmp(v->
name,
"start")) {
19816 }
else if (!strcasecmp(v->
name,
"rxwink")) {
19818 }
else if (!strcasecmp(v->
name,
"rxflash")) {
19820 }
else if (!strcasecmp(v->
name,
"debounce")) {
19822 }
else if (!strcasecmp(v->
name,
"toneduration")) {
19826 struct dahdi_dialparams dps;
19828 ctlfd = open(
"/dev/dahdi/ctl", O_RDWR);
19834 toneduration = atoi(v->
value);
19835 if (toneduration > -1) {
19836 memset(&dps, 0,
sizeof(dps));
19838 dps.dtmf_tonelen = dps.mfv1_tonelen = toneduration;
19839 res = ioctl(ctlfd, DAHDI_SET_DIALPARAMS, &dps);
19847 }
else if (!strcasecmp(v->
name,
"defaultcic")) {
19849 }
else if (!strcasecmp(v->
name,
"defaultozz")) {
19851 }
else if (!strcasecmp(v->
name,
"mwilevel")) {
19853 }
else if (!strcasecmp(v->
name,
"dtmfcidlevel")) {
19855 }
else if (!strcasecmp(v->
name,
"reportalarms")) {
19856 if (!strcasecmp(v->
value,
"all"))
19858 if (!strcasecmp(v->
value,
"none"))
19860 else if (!strcasecmp(v->
value,
"channels"))
19862 else if (!strcasecmp(v->
value,
"spans"))
19874 "Dahdichan '%s' failure ignored: ignore_failed_channels.\n",
19893 if (!
tmp->destroy &&
tmp->span != y) {
19894 tmp->manages_span_alarms = 1;
19897 tmp->manages_span_alarms = 0;
19910 if (
conf.chan.cc_params) {
19916 ast_verb(3,
"Automatically generated pseudo channel\n");
19980 static int had_cfg_before = 1;
19983 have_cfg_now = !!cfg;
19986 if (had_cfg_before) {
20015 have_cfg_now = !!cfg;
20017 if (had_cfg_before) {
20045 had_cfg_before = have_cfg_now;
20054 if (!strcasecmp(v->
name,
"trunkgroup")) {
20055 trunkgroup = atoi(v->
value);
20056 if (trunkgroup > 0) {
20057 if ((
c = strchr(v->
value,
','))) {
20059 memset(dchannels, 0,
sizeof(dchannels));
20061 dchannels[i] = atoi(
c + 1);
20062 if (dchannels[i] < 0) {
20063 ast_log(
LOG_WARNING,
"D-channel for trunk group %d must be a postiive number at line %d of chan_dahdi.conf\n", trunkgroup, v->
lineno);
20066 c = strchr(
c + 1,
',');
20069 if (pri_create_trunkgroup(trunkgroup, dchannels)) {
20070 ast_log(
LOG_WARNING,
"Unable to create trunk group %d with Primary D-channel %d at line %d of chan_dahdi.conf\n", trunkgroup, dchannels[0], v->
lineno);
20072 ast_verb(2,
"Created trunk group %d with Primary D-channel %d and %d backup%s\n", trunkgroup, dchannels[0], i - 1, (i == 1) ?
"" :
"s");
20074 ast_log(
LOG_WARNING,
"Trunk group %d lacks any valid D-channels at line %d of chan_dahdi.conf\n", trunkgroup, v->
lineno);
20076 ast_log(
LOG_WARNING,
"Trunk group %d lacks a primary D-channel at line %d of chan_dahdi.conf\n", trunkgroup, v->
lineno);
20078 ast_log(
LOG_WARNING,
"Trunk group identifier must be a positive integer at line %d of chan_dahdi.conf\n", v->
lineno);
20079 }
else if (!strcasecmp(v->
name,
"spanmap")) {
20080 spanno = atoi(v->
value);
20082 if ((
c = strchr(v->
value,
','))) {
20083 trunkgroup = atoi(
c + 1);
20084 if (trunkgroup > 0) {
20085 if ((
c = strchr(
c + 1,
',')))
20086 logicalspan = atoi(
c + 1);
20089 if (logicalspan >= 0) {
20090 if (pri_create_spanmap(spanno - 1, trunkgroup, logicalspan)) {
20091 ast_log(
LOG_WARNING,
"Failed to map span %d to trunk group %d (logical span %d)\n", spanno, trunkgroup, logicalspan);
20093 ast_verb(2,
"Mapped span %d to trunk group %d (logical span %d)\n", spanno, trunkgroup, logicalspan);
20095 ast_log(
LOG_WARNING,
"Logical span must be a postive number, or '0' (for unspecified) at line %d of chan_dahdi.conf\n", v->
lineno);
20132 if (!strcasecmp(cat,
"general") ||
20133 !strcasecmp(cat,
"trunkgroups") ||
20134 !strcasecmp(cat,
"globals") ||
20135 !strcasecmp(cat,
"channels")) {
20168 if (!strcasecmp(cat,
"general")) {
20195 if (pris[x].pri.
pvts[0] &&
20197 prepare_pri(pris + x);
20202 ast_verb(2,
"Starting D-Channel on span %d\n", x + 1);
20207#if defined(HAVE_SS7)
20211 if (linksets[x].ss7.
ss7) {
20216 ast_verb(2,
"Starting SS7 linkset on span %d\n", x + 1);
20223 struct r2link_entry *cur;
20227 struct dahdi_mfcr2 *r2 = &cur->mfcr2;
20230 ast_log(
LOG_ERROR,
"Unable to start R2 monitor on channel group %d\n", x + 1);
20233 ast_verb(2,
"Starting R2 monitor on channel group %d\n", x + 1);
20287#if defined(HAVE_PRI) || defined(HAVE_SS7)
20308 memset(pris, 0,
sizeof(pris));
20312 pri_set_error(dahdi_pri_error);
20313 pri_set_message(dahdi_pri_message);
20315#ifdef HAVE_PRI_PROG_W_CAUSE
20318#if defined(HAVE_PRI_CCSS)
20326#
if defined(HAVE_PRI_CCSS)
20336#if defined(HAVE_SS7)
20337 memset(linksets, 0,
sizeof(linksets));
20341 ss7_set_error(dahdi_ss7_error);
20342 ss7_set_message(dahdi_ss7_message);
20361#if defined(HAVE_SS7)
20381#if defined(HAVE_PRI)
20395#define END_SILENCE_LEN 400
20396#define HEADER_MS 50
20397#define TRAILER_MS 5
20398#define HEADER_LEN ((HEADER_MS + TRAILER_MS) * 8)
20399#define ASCII_BYTES_PER_CHAR 80
20401 unsigned char *
buf,*mybuf;
20403 struct pollfd fds[1];
20404 int size,res,fd,
len,x;
20426 if ((!p->
tdd) && (!p->
mate)) {
20427#if defined(HAVE_PRI)
20428#if defined(HAVE_PRI_DISPLAY_TEXT)
20453 for (x = 0;
text[x]; x++) {
20481 fds[0].events = POLLOUT | POLLPRI;
20482 fds[0].revents = 0;
20483 res = poll(fds, 1, -1);
20489 if (fds[0].revents & POLLPRI) {
20493 if (!(fds[0].revents & POLLOUT)) {
20497 res = write(fd,
buf, size);
20536 .
requires =
"ccss",
20537 .optional_modules =
"res_smdi",
Common implementation-independent jitterbuffer stuff.
void ast_jb_configure(struct ast_channel *chan, const struct ast_jb_conf *conf)
Configures a jitterbuffer on a channel.
int ast_jb_read_conf(struct ast_jb_conf *conf, const char *varname, const char *value)
Sets jitterbuffer configuration property.
ADSI Support (built upon Caller*ID)
A-Law to Signed linear conversion.
struct sla_ringing_trunk * last
static int copy(char *infile, char *outfile)
Utility function to copy a file.
Persistent data storage (akin to *doze registry)
int ast_db_put(const char *family, const char *key, const char *value)
Store value addressed by family/key.
int ast_db_get(const char *family, const char *key, char *value, int valuelen)
Get key value specified by family/key.
int ast_db_del(const char *family, const char *key)
Delete entry in astdb.
Asterisk main include file. File version handling, generic pbx functions.
static struct chans chans
#define ast_alloca(size)
call __builtin_alloca to ensure we get gcc builtin semantics
#define ast_strdup(str)
A wrapper for strdup()
#define ast_strdupa(s)
duplicate a string in memory from the stack
#define ast_asprintf(ret, fmt,...)
A wrapper for asprintf()
#define ast_calloc(num, len)
A wrapper for calloc()
#define ast_malloc(len)
A wrapper for malloc()
#define ao2_ref(o, delta)
Reference/unreference an object and return the old refcount.
@ AST_BRIDGE_TRANSFER_SUCCESS
enum ast_transfer_result ast_bridge_transfer_attended(struct ast_channel *to_transferee, struct ast_channel *to_transfer_target)
Attended transfer.
void dahdi_native_unload(void)
int dahdi_native_load(const struct ast_channel_tech *tech)
Native DAHDI bridging support.
CallerID (and other GR30) management and generation Includes code and algorithms from the Zapata libr...
int ast_callerid_callwaiting_full_generate(unsigned char *buf, const char *name, const char *number, const char *ddn, int redirecting, int pres, int qualifier, struct ast_format *codec)
Generate Caller-ID spill but in a format suitable for Call Waiting(tm)'s Caller*ID(tm)
#define CID_UNKNOWN_NUMBER
int ast_gen_cas(unsigned char *outbuf, int sas, int len, struct ast_format *codec)
Generate a CAS (CPE Alert Signal) tone for 'n' samples.
int ast_callerid_full_generate(unsigned char *buf, const char *name, const char *number, const char *ddn, int redirecting, int pres, int qualifier, int format, struct ast_format *codec)
Generate Caller-ID spill from the "callerid" field of asterisk (in e-mail address like format)
int callerid_feed_jp(struct callerid_state *cid, unsigned char *ubuf, int samples, struct ast_format *codec)
Read samples into the state machine.
#define AST_PRES_USER_NUMBER_UNSCREENED
#define AST_PRES_UNAVAILABLE
int ast_callerid_vmwi_generate(unsigned char *buf, int active, int type, struct ast_format *codec, const char *name, const char *number, int flags)
Generate message waiting indicator.
#define AST_PRES_RESTRICTED
void callerid_free(struct callerid_state *cid)
This function frees callerid_state cid.
void callerid_get_with_redirecting(struct callerid_state *cid, char **name, char **number, int *flags, int *redirecting)
Extract info out of callerID state machine. Flags are listed above.
#define MAX_CALLERID_SIZE
const char * ast_redirecting_reason_name(const struct ast_party_redirecting_reason *data)
Convert redirecting reason value to text code.
void ast_shrink_phone_number(char *n)
Shrink a phone number in place to just digits (more accurately it just removes ()'s,...
int ast_callerid_callwaiting_generate(unsigned char *buf, const char *name, const char *number, struct ast_format *codec)
Generate Caller-ID spill but in a format suitable for Call Waiting(tm)'s Caller*ID(tm)
#define CID_PRIVATE_NUMBER
struct callerid_state * callerid_new(int cid_signalling)
Create a callerID state machine.
int callerid_feed(struct callerid_state *cid, unsigned char *ubuf, int samples, struct ast_format *codec)
Read samples into the state machine.
#define CID_MWI_TYPE_MDMF_FULL
void callerid_get_dtmf(char *cidstring, char *number, int *flags)
Get and parse DTMF-based callerid.
#define CID_START_POLARITY
void callerid_get(struct callerid_state *cid, char **number, char **name, int *flags)
Extract info out of callerID state machine. Flags are listed above.
#define CID_START_POLARITY_IN
int ast_callerid_split(const char *src, char *name, int namelen, char *num, int numlen)
#define CID_START_DTMF_NOALERT
Internal Asterisk hangup causes.
#define AST_CAUSE_SWITCH_CONGESTION
#define AST_CAUSE_CONGESTION
#define AST_CAUSE_UNALLOCATED
#define AST_CAUSE_INTERWORKING
#define AST_CAUSE_PROTOCOL_ERROR
#define AST_CAUSE_DESTINATION_OUT_OF_ORDER
#define AST_CAUSE_NO_USER_RESPONSE
#define AST_CAUSE_NORMAL_CIRCUIT_CONGESTION
#define AST_CAUSE_NOTDEFINED
#define AST_CAUSE_CALL_REJECTED
#define AST_CAUSE_NETWORK_OUT_OF_ORDER
#define AST_CAUSE_UNREGISTERED
#define AST_CAUSE_NO_ANSWER
#define AST_CAUSE_NORMAL_CLEARING
#define AST_CAUSE_USER_BUSY
Call Completion Supplementary Services API.
#define ast_cc_config_params_init()
Allocate and initialize an ast_cc_config_params structure.
#define AST_CC_GENERIC_MONITOR_TYPE
int ast_cc_monitor_register(const struct ast_cc_monitor_callbacks *callbacks)
Register a set of monitor callbacks with the core.
void ast_cc_config_params_destroy(struct ast_cc_config_params *params)
Free memory from CCSS configuration params.
void(* ast_cc_callback_fn)(struct ast_channel *chan, struct ast_cc_config_params *cc_params, const char *monitor_type, const char *const device_name, const char *const dialstring, void *private_data)
Callback made from ast_cc_callback for certain channel types.
int ast_cc_agent_register(const struct ast_cc_agent_callbacks *callbacks)
Register a set of agent callbacks with the core.
void ast_cc_copy_config_params(struct ast_cc_config_params *dest, const struct ast_cc_config_params *src)
copy CCSS configuration parameters from one structure to another
void ast_cc_monitor_unregister(const struct ast_cc_monitor_callbacks *callbacks)
Unregister a set of monitor callbacks with the core.
enum ast_cc_monitor_policies ast_get_cc_monitor_policy(struct ast_cc_config_params *config)
Get the cc_monitor_policy.
void ast_cc_agent_unregister(const struct ast_cc_agent_callbacks *callbacks)
Unregister a set of agent callbacks with the core.
int ast_cc_is_config_param(const char *const name)
Is this a CCSS configuration parameter?
int ast_cc_set_param(struct ast_cc_config_params *params, const char *const name, const char *value)
set a CCSS configuration parameter, given its name
static struct ao2_container * pvts
#define CALLPROGRESS_FAX_INCOMING
static int dahdi_create_channel_range(int start, int end)
static int dahdi_confmute(struct dahdi_pvt *p, int muted)
static ast_mutex_t ss_thread_lock
static int calc_energy(const unsigned char *buf, int len, struct ast_format *law)
#define CALLWAITING_SUPPRESS_SAMPLES
static int isourconf(struct dahdi_pvt *p, struct dahdi_subchannel *c)
static void release_doomed_pris(void)
static struct dahdi_pvt * round_robin[64]
static void my_set_new_owner(void *pvt, struct ast_channel *new_owner)
static int restore_gains(struct dahdi_pvt *p)
static void publish_channel_alarm_clear(int channel)
static int conf_del(struct dahdi_pvt *p, struct dahdi_subchannel *c, int index)
static char * dahdi_show_channels(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static void my_set_confirmanswer(void *pvt, int flag)
#define CIDCW_EXPIRE_SAMPLES
static int my_dahdi_write(struct dahdi_pvt *p, unsigned char *buf, int len, int idx, int linear)
static int my_callwait(void *pvt)
static int restore_conference(struct dahdi_pvt *p)
static void publish_span_alarm_clear(int span)
static ast_mutex_t iflock
Protect the interface list (of dahdi_pvt's)
static int dahdi_indicate(struct ast_channel *chan, int condition, const void *data, size_t datalen)
static void notify_message(char *mailbox, int thereornot)
Send MWI state change.
static struct dahdi_pvt * mkintf(int channel, const struct dahdi_chan_conf *conf, int reloading)
static int conf_add(struct dahdi_pvt *p, struct dahdi_subchannel *c, int index, int slavechannel)
static int unalloc_sub(struct dahdi_pvt *p, int x)
static int my_check_confirmanswer(void *pvt)
static const char *const events[]
static int reset_conf(struct dahdi_pvt *p)
static int my_is_dialing(void *pvt, enum analog_sub sub)
static int my_dial_digits(void *pvt, enum analog_sub sub, struct analog_dialoperation *dop)
static struct ast_manager_event_blob * dahdichannel_to_ami(struct stasis_message *msg)
static void my_cancel_cidspill(void *pvt)
static int isslavenative(struct dahdi_pvt *p, struct dahdi_pvt **out)
static int my_set_echocanceller(void *pvt, int enable)
static int dahdi_wink(struct dahdi_pvt *p, int index)
static char mwimonitornotify[PATH_MAX]
static char * alarm2str(int alm)
static void my_hangup_polarityswitch(void *pvt)
static int is_group_or_channel_match(struct dahdi_pvt *p, int span, ast_group_t groupmatch, int *groupmatched, int channelmatch, int *channelmatched)
static int dahdi_ring_phone(struct dahdi_pvt *p)
static char * dahdi_show_status(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
#define CALLWAITING_REPEAT_SAMPLES
static void dahdi_lock_sub_owner(struct dahdi_pvt *pvt, int sub_idx)
#define CALLPROGRESS_FAX_OUTGOING
static int dahdi_call(struct ast_channel *ast, const char *rdest, int timeout)
static int my_stop_cid_detect(void *pvt)
static int my_get_sub_fd(void *pvt, enum analog_sub sub)
static void my_set_needringing(void *pvt, int value)
static char * dahdi_destroy_channels(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static struct ast_jb_conf default_jbconf
static int dahdi_cc_callback(struct ast_channel *inbound, const char *dest, ast_cc_callback_fn callback)
Callback made when dial failed to get a channel out of dahdi_request().
static struct dahdi_pvt * find_channel_from_str(const char *channel)
static int __unload_module(void)
static void dahdi_softhangup_all(void)
static void dahdi_train_ec(struct dahdi_pvt *p)
static int build_channels(struct dahdi_chan_conf *conf, const char *value, int reload, int lineno)
static int dahdi_write(struct ast_channel *ast, struct ast_frame *frame)
static enum analog_event dahdievent_to_analogevent(int event)
static int dahdi_digit_begin(struct ast_channel *ast, char digit)
static void my_unlock_private(void *pvt)
static int dahdi_fixup(struct ast_channel *oldchan, struct ast_channel *newchan)
static void my_set_dialing(void *pvt, int is_dialing)
static void my_handle_dtmf(void *pvt, struct ast_channel *ast, enum analog_sub analog_index, struct ast_frame **dest)
static struct dahdi_pvt * fxo_pvt(struct ast_channel *chan)
Return DAHDI pivot if channel is FXO signalled.
static void publish_dnd_state(int channel, const char *status)
static int my_on_hook(void *pvt)
static int attempt_transfer(struct dahdi_pvt *p)
static int cidrings[NUM_CADENCE_MAX]
cidrings says in which pause to transmit the cid information, where the first pause is 1,...
static void my_set_pulsedial(void *pvt, int flag)
static int dahdi_digit_end(struct ast_channel *ast, char digit, unsigned int duration)
static char * dahdi_set_hwgain(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static int dahdi_wait_event(int fd)
Avoid the silly dahdi_waitevent which ignores a bunch of events.
static void publish_channel_alarm(int channel, const char *alarm_txt)
static int canmatch_featurecode(const char *pickupexten, const char *exten)
static void dahdi_queue_frame(struct dahdi_pvt *p, struct ast_frame *f)
static int set_actual_gain(int fd, float rxgain, float txgain, float rxdrc, float txdrc, int law)
struct analog_callback analog_callbacks
static void dahdi_destroy_channel_range(int start, int end)
static char * dahdi_show_channel(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static int my_unallocate_sub(void *pvt, enum analog_sub analogsub)
static void my_set_alarm(void *pvt, int in_alarm)
static int num_restart_pending
static int my_dsp_set_digitmode(void *pvt, enum analog_dsp_digitmode mode)
static int my_get_event(void *pvt)
static int available(struct dahdi_pvt **pvt, int is_specific_channel)
static int dahdi_devicestate(const char *data)
static int user_has_defined_cadences
static int dahdi_callwait(struct ast_channel *ast)
static void wakeup_sub(struct dahdi_pvt *p, int a)
static void my_set_callwaiting(void *pvt, int callwaiting_enable)
static int distinctiveringaftercid
static int my_is_off_hook(void *pvt)
static int mwi_send_init(struct dahdi_pvt *pvt)
static int dahdi_open(char *fn)
static void publish_dahdichannel(struct ast_channel *chan, ast_group_t group, int span, const char *dahdi_channel)
Sends a DAHDIChannel channel blob used to produce DAHDIChannel AMI messages.
static int my_check_waitingfordt(void *pvt)
static int setup_dahdi_int(int reload, struct dahdi_chan_conf *default_conf, struct dahdi_chan_conf *base_conf, struct dahdi_chan_conf *conf)
static void publish_span_alarm(int span, const char *alarm_txt)
static void my_set_outgoing(void *pvt, int is_outgoing)
static int dahdi_fake_event(struct dahdi_pvt *p, int mode)
static void my_set_inthreeway(void *pvt, enum analog_sub sub, int inthreeway)
static void destroy_dahdi_pvt(struct dahdi_pvt *pvt)
static int dahdi_hangup(struct ast_channel *ast)
static void * analog_ss_thread(void *data)
static int dahdi_sendtext(struct ast_channel *c, const char *text)
static void dahdi_ami_channel_event(struct dahdi_pvt *p, struct ast_channel *chan)
static void my_swap_subchannels(void *pvt, enum analog_sub a, struct ast_channel *ast_a, enum analog_sub b, struct ast_channel *ast_b)
#define PROC_DAHDI_OPT_NOCHAN
static void parse_busy_pattern(struct ast_variable *v, struct ast_dsp_busy_pattern *busy_cadence)
static int analogsub_to_dahdisub(enum analog_sub analogsub)
static void my_get_and_handle_alarms(void *pvt)
static void my_lock_private(void *pvt)
static int dahdi_answer(struct ast_channel *ast)
static const char tdesc[]
static void fill_txgain(struct dahdi_gains *g, float gain, float drc, int law)
static int dahdi_restart(void)
static int action_transfer(struct mansession *s, const struct message *m)
static int bump_gains(struct dahdi_pvt *p)
static void * do_monitor(void *data)
static int save_conference(struct dahdi_pvt *p)
static char * dahdi_set_dnd(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static void handle_clear_alarms(struct dahdi_pvt *p)
static int dahdi_queryoption(struct ast_channel *chan, int option, void *data, int *datalen)
static char * dahdi_sig2str(int sig)
static int dahdi_set_hook(int fd, int hs)
static int my_stop_callwait(void *pvt)
static struct ast_channel * dahdi_new_callid_clean(struct dahdi_pvt *i, int state, int startpbx, int idx, int law, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, ast_callid callid, int callid_created)
static int check_for_conference(struct dahdi_pvt *p)
static struct dahdi_ring_cadence AS_RP_cadence
static int my_distinctive_ring(struct ast_channel *chan, void *pvt, int idx, int *ringdata)
void dahdi_ec_enable(struct dahdi_pvt *p)
static int dahdi_setlinear(int dfd, int linear)
static int restart_monitor(void)
static void my_handle_notify_message(struct ast_channel *chan, void *pvt, int cid_flags, int neon_mwievent)
static int my_confmute(void *pvt, int mute)
static void * mwi_thread(void *data)
static int my_send_callerid(void *pvt, int cwcid, struct ast_party_caller *caller)
static int sigtype_to_signalling(int sigtype)
static void my_decrease_ss_count(void)
static char * handle_dahdi_show_cadences(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static int has_voicemail(struct dahdi_pvt *p)
static void dahdi_iflist_extract(struct dahdi_pvt *pvt)
void dahdi_conf_update(struct dahdi_pvt *p)
static int alloc_sub(struct dahdi_pvt *p, int x)
static void my_start_polarityswitch(void *pvt)
static int digit_to_dtmfindex(char digit)
static int setup_dahdi(int reload)
STASIS_MESSAGE_TYPE_DEFN_LOCAL(dahdichannel_type,.to_ami=dahdichannel_to_ami,)
static char * dahdi_set_mwi(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static int action_dahdidndon(struct mansession *s, const struct message *m)
static struct dahdi_pvt * iflist
#define NEED_MFDETECT(p)
Signaling types that need to use MF detection should be placed in this macro.
static int dahdi_setoption(struct ast_channel *chan, int option, void *data, int datalen)
static int set_actual_txgain(int fd, float gain, float drc, int law)
static int dahdi_func_write(struct ast_channel *chan, const char *function, char *data, const char *value)
static int my_wait_event(void *pvt)
static int my_getsigstr(struct ast_channel *chan, char *str, const char *term, int ms)
static struct ast_channel * my_new_analog_ast_channel(void *pvt, int state, int startpbx, enum analog_sub sub, const struct ast_channel *requestor)
static int analog_tone_to_dahditone(enum analog_tone tone)
static struct ast_str * create_channel_name(struct dahdi_pvt *i)
static int my_get_callerid(void *pvt, char *namebuf, char *numbuf, enum analog_event *ev, size_t timeout)
static int set_actual_rxgain(int fd, float gain, float drc, int law)
static int my_start(void *pvt)
static ast_mutex_t restart_lock
static struct ast_frame * dahdi_handle_event(struct ast_channel *ast)
static char defaultcic[64]
static const char config[]
static int action_dahdishowchannels(struct mansession *s, const struct message *m)
void dahdi_dtmf_detect_enable(struct dahdi_pvt *p)
static struct dahdi_pvt * find_next_iface_in_span(struct dahdi_pvt *cur)
static ast_cond_t ss_thread_complete
static void process_echocancel(struct dahdi_chan_conf *confp, const char *data, unsigned int line)
static void dahdi_iflist_insert(struct dahdi_pvt *pvt)
static struct ast_frame * dahdi_exception(struct ast_channel *ast)
static void my_answer_polarityswitch(void *pvt)
static struct ast_channel * dahdi_request(const char *type, struct ast_format_cap *cap, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, const char *data, int *cause)
#define SMDI_MD_WAIT_TIMEOUT
static int my_have_progressdetect(void *pvt)
static char * dahdi_set_swgain(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static int dahdi_func_read(struct ast_channel *chan, const char *function, char *data, char *buf, size_t len)
#define CANPROGRESSDETECT(p)
static char * dahdi_create_channels(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static void fill_rxgain(struct dahdi_gains *g, float gain, float drc, int law)
static int my_train_echocanceller(void *pvt)
static const char * event2str(int event)
#define CALLPROGRESS_PROGRESS
static void dahdi_close_sub(struct dahdi_pvt *chan_pvt, int sub_num)
static void my_set_polarity(void *pvt, int value)
void dahdi_ec_disable(struct dahdi_pvt *p)
static struct ast_frame * __dahdi_exception(struct ast_channel *ast)
static void handle_alarms(struct dahdi_pvt *p, int alms)
static void dahdi_handle_dtmf(struct ast_channel *ast, int idx, struct ast_frame **dest)
static struct dahdi_chan_conf dahdi_chan_conf_default(void)
static struct dahdi_pvt * duplicate_pseudo(struct dahdi_pvt *src)
static void swap_subs(struct dahdi_pvt *p, int a, int b)
static int my_set_linear_mode(void *pvt, enum analog_sub sub, int linear_mode)
static int dahdi_dnd(struct dahdi_pvt *dahdichan, int flag)
enable or disable the chan_dahdi Do-Not-Disturb mode for a DAHDI channel
static struct ast_channel * dahdi_new(struct dahdi_pvt *i, int state, int startpbx, int idx, int law, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, ast_callid callid)
static int drc_sample(int sample, float drc)
static int dahdi_get_event(int fd)
Avoid the silly dahdi_getevent which ignores a bunch of events.
static int ringt_base
Configured ring timeout base.
void dahdi_master_slave_unlink(struct dahdi_pvt *slave, struct dahdi_pvt *master, int needlock)
static ast_mutex_t monlock
Protect the monitoring thread, so only one process can kill or start it, and not when it's doing some...
#define ASCII_BYTES_PER_CHAR
static void my_all_subchannels_hungup(void *pvt)
static int my_ring(void *pvt)
static int my_start_cid_detect(void *pvt, int cid_signalling)
static int parse_buffers_policy(const char *parse, int *num_buffers, int *policy)
static struct dahdi_pvt * ifend
static char * dahdi_show_version(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static int my_complete_conference_update(void *pvt, int needconference)
static struct @114 alarms[]
#define DEFAULT_DIALTONE_DETECT_TIMEOUT
static int mwi_send_process_buffer(struct dahdi_pvt *pvt, int num_read)
static void my_set_cadence(void *pvt, int *cid_rings, struct ast_channel *ast)
static void my_increase_ss_count(void)
#define REPORT_CHANNEL_ALARMS
static int my_play_tone(void *pvt, enum analog_sub sub, enum analog_tone tone)
static int my_wink(void *pvt, enum analog_sub sub)
static struct ast_channel_tech dahdi_tech
static struct ast_jb_conf global_jbconf
static int my_conf_add(void *pvt, enum analog_sub sub)
static int my_dsp_reset_and_flush_digits(void *pvt)
void dahdi_dtmf_detect_disable(struct dahdi_pvt *p)
#define PROC_DAHDI_OPT_NOWARN
#define MIN_MS_SINCE_FLASH
static int my_has_voicemail(void *pvt)
static int load_module(void)
Load the module.
static struct ast_frame * dahdi_read(struct ast_channel *ast)
static const char * my_get_orig_dialstring(void *pvt)
static int action_dahdirestart(struct mansession *s, const struct message *m)
static struct ast_custom_function polarity_function
static int get_alarms(struct dahdi_pvt *p)
static struct dahdi_pvt * determine_starting_point(const char *data, struct dahdi_starting_point *param)
#define gen_pvt_field_callback(type, field)
static int polarity_read(struct ast_channel *chan, const char *cmd, char *data, char *buffer, size_t buflen)
static int send_cwcidspill(struct dahdi_pvt *p)
static int my_conf_del(void *pvt, enum analog_sub sub)
static struct dahdi_ring_cadence cadences[NUM_CADENCE_MAX]
static int action_dahdidndoff(struct mansession *s, const struct message *m)
static int unload_module(void)
static int process_dahdi(struct dahdi_chan_conf *confp, const char *cat, struct ast_variable *v, int reload, int options)
static struct ast_cli_entry dahdi_cli[]
#define DEFAULT_CIDRINGS
Typically, how many rings before we should send Caller*ID.
static enum analog_sigtype dahdisig_to_analogsig(int sig)
static void dahdi_close(int fd)
static char defaultozz[64]
void dahdi_master_slave_link(struct dahdi_pvt *slave, struct dahdi_pvt *master)
static int my_off_hook(void *pvt)
const char *const subnames[]
static int my_allocate_sub(void *pvt, enum analog_sub analogsub)
static int usedistinctiveringdetection
static int polarity_write(struct ast_channel *chan, const char *cmd, char *data, const char *value)
static char * dahdi_restart_cmd(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static struct dahdi_pvt * find_channel(int channel)
static void * my_get_sigpvt_bridged_channel(struct ast_channel *chan)
static int send_callerid(struct dahdi_pvt *p)
static int set_hwgain(int fd, float gain, int tx_direction)
static void my_set_waitingfordt(void *pvt, struct ast_channel *ast)
static void build_alarm_info(char *restrict alarmstr, struct dahdi_spaninfo *spaninfo)
static int my_check_for_conference(void *pvt)
static int mwi_send_process_event(struct dahdi_pvt *pvt, int event)
static int my_flash(void *pvt)
static int ss_thread_count
static const char *const lbostr[]
int _dahdi_get_index(struct ast_channel *ast, struct dahdi_pvt *p, int nullok, const char *fname, unsigned long line)
#define REPORT_SPAN_ALARMS
static void deep_copy_dahdi_chan_conf(struct dahdi_chan_conf *dest, const struct dahdi_chan_conf *src)
static void my_deadlock_avoidance_private(void *pvt)
static struct dahdi_pvt * handle_init_event(struct dahdi_pvt *i, int event)
static void destroy_channel(struct dahdi_pvt *cur, int now)
static void my_set_ringtimeout(void *pvt, int ringt)
static void monitor_pfds_clean(void *arg)
static int action_dahdidialoffhook(struct mansession *s, const struct message *m)
static int dahdi_dial_str(struct dahdi_pvt *pvt, int operation, const char *dial_str)
static pthread_t monitor_thread
This is the thread for the monitor which checks for input on the channels which are not currently in ...
static int action_transferhangup(struct mansession *s, const struct message *m)
static int revert_fax_buffers(struct dahdi_pvt *p, struct ast_channel *ast)
static void destroy_all_channels(void)
static int action_dahdishowstatus(struct mansession *s, const struct message *m)
DAHDI internal API definitions.
static int dahdi_sig_pri_lib_handles(int signaling)
static int dahdi_analog_lib_handles(int signalling, int radio, int oprmode)
#define SIG_PRI_LIB_HANDLE_CASES
#define dahdi_get_index(ast, p, nullok)
static struct ast_timer * timer
General Asterisk PBX channel definitions.
void ast_channel_exten_set(struct ast_channel *chan, const char *value)
int ast_waitfordigit(struct ast_channel *c, int ms)
Waits for a digit.
const char * ast_channel_name(const struct ast_channel *chan)
static int ast_fdisset(struct pollfd *pfds, int fd, int maximum, int *start)
Helper function for migrating select to poll.
void ast_channel_rings_set(struct ast_channel *chan, int value)
void ast_channel_named_pickupgroups_set(struct ast_channel *chan, struct ast_namedgroups *value)
void ast_party_name_init(struct ast_party_name *init)
Initialize the given name structure.
void * ast_channel_tech_pvt(const struct ast_channel *chan)
struct ast_format * ast_channel_rawreadformat(struct ast_channel *chan)
void ast_party_number_init(struct ast_party_number *init)
Initialize the given number structure.
void ast_hangup(struct ast_channel *chan)
Hang up a channel.
#define ast_channel_alloc(needqueue, state, cid_num, cid_name, acctcode, exten, context, assignedids, requestor, amaflag,...)
Create a channel structure.
struct ast_channel * ast_channel_bridge_peer(struct ast_channel *chan)
Get the channel's bridge peer only if the bridge is two-party.
int ast_party_id_presentation(const struct ast_party_id *id)
Determine the overall presentation value for the given party.
#define CHECK_BLOCKING(c)
Set the blocking indication on the channel.
void ast_channel_nativeformats_set(struct ast_channel *chan, struct ast_format_cap *value)
#define ast_channel_lock(chan)
struct ast_party_redirecting * ast_channel_redirecting(struct ast_channel *chan)
void ast_channel_unregister(const struct ast_channel_tech *tech)
Unregister a channel technology.
unsigned short ast_channel_transfercapability(const struct ast_channel *chan)
struct ast_namedgroups * ast_ref_namedgroups(struct ast_namedgroups *groups)
int ast_waitfor(struct ast_channel *chan, int ms)
Wait for input on a channel.
int ast_channel_cc_params_init(struct ast_channel *chan, const struct ast_cc_config_params *base_params)
Set up datastore with CCSS parameters for a channel.
struct ast_flags * ast_channel_flags(struct ast_channel *chan)
unsigned long long ast_group_t
#define ast_channel_ref(c)
Increase channel reference count.
struct ast_party_connected_line * ast_channel_connected(struct ast_channel *chan)
int ast_queue_frame(struct ast_channel *chan, struct ast_frame *f)
Queue one or more frames to a channel's frame queue.
const char * ast_channel_uniqueid(const struct ast_channel *chan)
const char * ast_channel_accountcode(const struct ast_channel *chan)
const char * ast_channel_context(const struct ast_channel *chan)
void ast_party_caller_set(struct ast_party_caller *dest, const struct ast_party_caller *src, const struct ast_set_party_caller *update)
Set the caller information based on another caller source.
struct ast_frame * ast_read(struct ast_channel *chan)
Reads a frame.
#define ast_channel_trylock(chan)
int ast_queue_control_data(struct ast_channel *chan, enum ast_control_frame_type control, const void *data, size_t datalen)
Queue a control frame with payload.
void ast_party_caller_set_init(struct ast_party_caller *init, const struct ast_party_caller *guide)
Initialize the given caller structure using the given guide for a set update operation.
void ast_party_name_free(struct ast_party_name *doomed)
Destroy the party name contents.
void ast_set_callerid(struct ast_channel *chan, const char *cid_num, const char *cid_name, const char *cid_ani)
Set caller ID number, name and ANI and generate AMI event.
int ast_channel_fd(const struct ast_channel *chan, int which)
void ast_channel_internal_fd_set(struct ast_channel *chan, int which, int value)
int ast_queue_hangup_with_cause(struct ast_channel *chan, int cause)
Queue a hangup frame with hangupcause set.
void ast_channel_set_rawreadformat(struct ast_channel *chan, struct ast_format *format)
void ast_channel_tech_pvt_set(struct ast_channel *chan, void *value)
void ast_party_caller_free(struct ast_party_caller *doomed)
Destroy the caller party contents.
int ast_active_channels(void)
returns number of active/allocated channels
struct ast_namedgroups * ast_get_namedgroups(const char *s)
Create an ast_namedgroups set with group names from comma separated string.
void ast_channel_callgroup_set(struct ast_channel *chan, ast_group_t value)
int ast_check_hangup(struct ast_channel *chan)
Check to see if a channel is needing hang up.
int ast_channel_hangupcause(const struct ast_channel *chan)
void ast_channel_set_rawwriteformat(struct ast_channel *chan, struct ast_format *format)
struct ast_party_dialed * ast_channel_dialed(struct ast_channel *chan)
void ast_set_hangupsource(struct ast_channel *chan, const char *source, int force)
Set the source of the hangup in this channel and it's bridge.
int ast_softhangup(struct ast_channel *chan, int cause)
Softly hangup up a channel.
void ast_channel_named_callgroups_set(struct ast_channel *chan, struct ast_namedgroups *value)
void ast_channel_hangupcause_hash_set(struct ast_channel *chan, const struct ast_control_pvt_cause_code *cause_code, int datalen)
Sets the HANGUPCAUSE hash and optionally the SIP_CAUSE hash on the given channel.
int ast_queue_unhold(struct ast_channel *chan)
Queue an unhold frame.
int ast_queue_hold(struct ast_channel *chan, const char *musicclass)
Queue a hold frame.
void ast_channel_set_readformat(struct ast_channel *chan, struct ast_format *format)
int ast_channel_register(const struct ast_channel_tech *tech)
Register a channel technology (a new channel driver) Called by a channel module to register the kind ...
void ast_channel_softhangup_internal_flag_add(struct ast_channel *chan, int value)
#define ast_channel_unref(c)
Decrease channel reference count.
@ AST_SOFTHANGUP_EXPLICIT
@ AST_SOFTHANGUP_APPUNLOAD
void ast_party_number_free(struct ast_party_number *doomed)
Destroy the party number contents.
int ast_channel_get_up_time(struct ast_channel *chan)
Obtain how long it has been since the channel was answered.
void ast_channel_amaflags_set(struct ast_channel *chan, enum ama_flags value)
const char * ast_channel_language(const struct ast_channel *chan)
struct ast_bridge_channel * ast_channel_get_bridge_channel(struct ast_channel *chan)
Get a reference to the channel's bridge pointer.
void ast_channel_context_set(struct ast_channel *chan, const char *value)
void ast_channel_set_fd(struct ast_channel *chan, int which, int fd)
int ast_softhangup_nolock(struct ast_channel *chan, int cause)
Softly hangup up a channel (no channel lock)
enum ama_flags ast_channel_string2amaflag(const char *flag)
Convert a string to a detail record AMA flag.
@ AST_FLAG_DISABLE_DEVSTATE_CACHE
struct ast_pbx * ast_channel_pbx(const struct ast_channel *chan)
const struct ast_channel_tech * ast_channel_tech(const struct ast_channel *chan)
struct ast_namedgroups * ast_unref_namedgroups(struct ast_namedgroups *groups)
int ast_channel_setoption(struct ast_channel *channel, int option, void *data, int datalen, int block)
Sets an option on a channel.
struct ast_party_caller * ast_channel_caller(struct ast_channel *chan)
void ast_channel_callid_set(struct ast_channel *chan, ast_callid value)
void ast_channel_hangupcause_set(struct ast_channel *chan, int value)
#define ast_channel_cleanup(c)
Cleanup a channel reference.
void ast_channel_pickupgroup_set(struct ast_channel *chan, ast_group_t value)
void ast_channel_adsicpe_set(struct ast_channel *chan, enum ast_channel_adsicpe value)
ast_group_t ast_get_group(const char *s)
void ast_channel_tech_set(struct ast_channel *chan, const struct ast_channel_tech *value)
int ast_safe_sleep(struct ast_channel *chan, int ms)
Wait for a specified amount of time, looking for hangups.
const char * ast_channel_exten(const struct ast_channel *chan)
#define ast_channel_unlock(chan)
#define AST_MAX_EXTENSION
void ast_channel_set_writeformat(struct ast_channel *chan, struct ast_format *format)
ast_channel_state
ast_channel states
@ AST_STATE_DIALING_OFFHOOK
int ast_setstate(struct ast_channel *chan, enum ast_channel_state)
Change the state of a channel.
Standard Command Line Interface.
int ast_cli_unregister_multiple(struct ast_cli_entry *e, int len)
Unregister multiple commands.
#define AST_CLI_DEFINE(fn, txt,...)
void ast_cli(int fd, const char *fmt,...)
#define ast_cli_register_multiple(e, len)
Register multiple commands.
static struct channel_usage channels
#define container_of(ptr, type, member)
@ AST_DEVSTATE_NOT_CACHABLE
int ast_devstate_changed(enum ast_device_state state, enum ast_devstate_cache cachable, const char *fmt,...)
Tells Asterisk the State for Device is changed.
int ast_devstate_changed_literal(enum ast_device_state state, enum ast_devstate_cache cachable, const char *device)
Tells Asterisk the State for Device is changed.
ast_device_state
Device States.
Convenient Signal Processing routines.
void ast_dsp_free(struct ast_dsp *dsp)
int ast_dsp_get_tcount(struct ast_dsp *dsp)
Get tcount (Threshold counter)
#define DSP_FEATURE_WAITDIALTONE
#define DSP_FEATURE_BUSY_DETECT
#define DSP_TONE_STATE_DIALTONE
void ast_dsp_digitreset(struct ast_dsp *dsp)
Reset DTMF detector.
#define DSP_DIGITMODE_MUTEMAX
void ast_dsp_set_busy_pattern(struct ast_dsp *dsp, const struct ast_dsp_busy_pattern *cadence)
Set expected lengths of the busy tone.
struct ast_frame * ast_dsp_process(struct ast_channel *chan, struct ast_dsp *dsp, struct ast_frame *inf)
Return AST_FRAME_NULL frames when there is silence, AST_FRAME_BUSY on busies, and call progress,...
#define DSP_FEATURE_DIGIT_DETECT
#define DSP_FEATURE_FAX_DETECT
#define DSP_FEATURE_CALL_PROGRESS
int ast_dsp_set_digitmode(struct ast_dsp *dsp, int digitmode)
Set digit mode.
#define DSP_DIGITMODE_MUTECONF
int ast_dsp_get_tstate(struct ast_dsp *dsp)
Get tstate (Tone State)
int ast_dsp_was_muted(struct ast_dsp *dsp)
Returns true if DSP code was muting any fragment of the last processed frame. Muting (squelching) hap...
#define DSP_TONE_STATE_RINGING
void ast_dsp_set_busy_count(struct ast_dsp *dsp, int cadences)
Set number of required cadences for busy.
void ast_dsp_set_features(struct ast_dsp *dsp, int features)
Select feature set.
#define DSP_DIGITMODE_DTMF
struct ast_dsp * ast_dsp_new(void)
Allocates a new dsp, assumes 8khz for internal sample rate.
#define DSP_DIGITMODE_RELAXDTMF
int ast_dsp_set_call_progress_zone(struct ast_dsp *dsp, char *zone)
Set zone for doing progress detection.
void ast_verbose(const char *fmt,...)
Call Parking and Pickup API Includes code and algorithms from the Zapata library.
Generic File Format Support. Should be included by clients of the file handling routines....
int ast_streamfile(struct ast_channel *c, const char *filename, const char *preflang)
Streams a file.
int ast_waitstream(struct ast_channel *c, const char *breakon)
Waits for a stream to stop or digit to be pressed.
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
void astman_send_listack(struct mansession *s, const struct message *m, char *msg, char *listflag)
Send ack in manager transaction to begin a list.
void astman_send_error(struct mansession *s, const struct message *m, char *error)
Send error in manager transaction.
void ast_manager_publish_event(const char *type, int class_type, struct ast_json *obj)
Publish an event to AMI.
void astman_send_list_complete_start(struct mansession *s, const struct message *m, const char *event_name, int count)
Start the list complete event.
void astman_send_ack(struct mansession *s, const struct message *m, char *msg)
Send ack in manager transaction.
const char * astman_get_header(const struct message *m, char *var)
Get header from manager transaction.
void astman_send_list_complete_end(struct mansession *s)
End the list complete event.
void astman_append(struct mansession *s, const char *fmt,...)
int ast_manager_unregister(const char *action)
Unregister a registered manager command.
void ast_channel_stage_snapshot_done(struct ast_channel *chan)
Clear flag to indicate channel snapshot is being staged, and publish snapshot.
void ast_channel_publish_blob(struct ast_channel *chan, struct stasis_message_type *type, struct ast_json *blob)
Publish a channel blob message.
void ast_channel_stage_snapshot(struct ast_channel *chan)
Set flag to indicate channel snapshot is being staged.
#define AST_APP_ARG(name)
Define an application argument.
#define ast_app_separate_args(a, b, c, d)
int ast_app_has_voicemail(const char *mailboxes, const char *folder)
Determine if a given mailbox has any voicemail If folder is NULL, defaults to "INBOX"....
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application's arguments.
int ast_safe_system(const char *s)
Safely spawn an OS shell command while closing file descriptors.
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the 'standard' argument separation process for an application.
#define AST_NONSTANDARD_APP_ARGS(args, parse, sep)
Performs the 'nonstandard' argument separation process for an application.
char * strsep(char **str, const char *delims)
char * strcasestr(const char *, const char *)
Configuration File Parser.
#define ast_config_load(filename, flags)
Load a config file.
char * ast_category_browse(struct ast_config *config, const char *prev_name)
Browse categories.
struct ast_config * ast_config_new(void)
Create a new base configuration structure.
#define ast_variable_new(name, value, filename)
#define CONFIG_STATUS_FILEUNCHANGED
#define CONFIG_STATUS_FILEINVALID
void ast_config_destroy(struct ast_config *cfg)
Destroys a config.
int ast_variable_list_replace(struct ast_variable **head, struct ast_variable *replacement)
Replace a variable in the given list with a new value.
const char * ast_variable_retrieve(struct ast_config *config, const char *category, const char *variable)
void ast_variables_destroy(struct ast_variable *var)
Free variable list.
struct ast_variable * ast_variable_browse(const struct ast_config *config, const char *category_name)
@ CONFIG_FLAG_FILEUNCHANGED
struct ast_features_pickup_config * ast_get_chan_features_pickup_config(struct ast_channel *chan)
Get the pickup configuration options for a channel.
#define AST_OPTION_RELAXDTMF
#define AST_OPTION_TONE_VERIFY
#define AST_OPTION_RXGAIN
#define AST_OPTION_DIGIT_DETECT
#define AST_OPTION_OPRMODE
#define AST_OPTION_CC_AGENT_TYPE
#define AST_OPTION_FAX_DETECT
#define AST_OPTION_TXGAIN
#define AST_OPTION_ECHOCAN
#define AST_FRIENDLY_OFFSET
Offset into a frame's data buffer.
@ AST_CONTROL_RADIO_UNKEY
@ AST_CONTROL_PVT_CAUSE_CODE
#define AST_OPTION_AUDIO_MODE
struct ast_frame ast_null_frame
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...
#define DEBUG_ATLEAST(level)
#define ast_debug(level,...)
Log a DEBUG message.
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...
void ast_log_callid(int level, const char *file, int line, const char *function, ast_callid callid, const char *fmt,...)
Used for sending a log message with a known call_id This is a modified logger function which is funct...
#define ast_verb(level,...)
#define ast_verbose_callid(callid,...)
void ast_json_unref(struct ast_json *value)
Decrease refcount on value. If refcount reaches zero, value is freed.
struct ast_json * ast_json_pack(char const *format,...)
Helper for creating complex JSON values.
const char * ast_json_string_get(const struct ast_json *string)
Get the value of a JSON string.
struct ast_json * ast_json_object_get(struct ast_json *object, const char *key)
Get a field from a JSON object.
intmax_t ast_json_integer_get(const struct ast_json *integer)
Get the value from a JSON integer.
AST_JSON_INT_T ast_json_int_t
Primarily used to cast when packing to an "I" type.
#define AST_LIST_HEAD_STATIC(name, type)
Defines a structure to be used to hold a list of specified type, statically initialized.
#define AST_LIST_LAST(head)
Returns the last entry contained in a list.
#define AST_LIST_TRAVERSE(head, var, field)
Loops over (traverses) the entries in a list.
#define AST_LIST_HEAD_INIT_VALUE
Defines initial values for a declaration of AST_LIST_HEAD.
#define AST_LIST_EMPTY(head)
Checks whether the specified list contains any entries.
#define AST_LIST_INSERT_TAIL(head, elm, field)
Appends a list entry to the tail of a list.
#define AST_LIST_ENTRY(type)
Declare a forward link structure inside a list entry.
#define AST_LIST_TRAVERSE_SAFE_END
Closes a safe loop traversal block.
#define AST_LIST_MOVE_CURRENT(newhead, field)
Move the current list entry to another list.
#define AST_LIST_LOCK(head)
Locks a list.
#define AST_LIST_REMOVE(head, elm, field)
Removes a specific entry from a list.
#define AST_LIST_TRAVERSE_SAFE_BEGIN(head, var, field)
Loops safely over (traverses) the entries in a list.
#define AST_LIST_REMOVE_HEAD(head, field)
Removes and returns the head entry from a list.
#define AST_LIST_UNLOCK(head)
Attempts to unlock a list.
Asterisk locking-related definitions:
#define ast_cond_destroy(cond)
#define ast_cond_wait(cond, mutex)
#define AST_PTHREADT_NULL
#define ast_cond_init(cond, attr)
#define ast_mutex_init(pmutex)
#define CHANNEL_DEADLOCK_AVOIDANCE(chan)
#define DEADLOCK_AVOIDANCE(lock)
#define AST_PTHREADT_STOP
#define ast_mutex_unlock(a)
int ast_atomic_fetchadd_int(volatile int *p, int v)
Atomically add v to *p and return the previous value of *p.
#define ast_mutex_trylock(a)
pthread_cond_t ast_cond_t
#define ast_mutex_destroy(a)
#define ast_mutex_lock(a)
#define AST_MUTEX_DEFINE_STATIC(mutex)
#define ast_cond_signal(cond)
The AMI - Asterisk Manager Interface - is a TCP protocol created to manage Asterisk with third-party ...
struct ast_str * ast_manager_build_channel_state_string(const struct ast_channel_snapshot *snapshot)
Generate the AMI message body from a channel snapshot.
#define EVENT_FLAG_SYSTEM
#define ast_manager_register_xml(action, authority, func)
Register a manager callback using XML documentation to describe the manager.
struct ast_manager_event_blob * ast_manager_event_blob_create(int event_flags, const char *manager_event, const char *extra_fields_fmt,...)
Construct a ast_manager_event_blob.
Asterisk module definitions.
#define ast_module_unref(mod)
Release a reference to the module.
#define ast_module_ref(mod)
Hold a reference to the module.
#define AST_MODULE_INFO(keystr, flags_to_set, desc, fields...)
@ AST_MODPRI_CHANNEL_DRIVER
@ AST_MODULE_SUPPORT_CORE
#define ASTERISK_GPL_KEY
The text the key() function should return.
int ast_unregister_application(const char *app)
Unregister an application.
@ AST_MODULE_LOAD_DECLINE
Module has failed to load, may be in an inconsistent state.
#define ast_register_application_xml(app, execute)
Register an application using XML documentation.
int ast_moh_start(struct ast_channel *chan, const char *mclass, const char *interpclass)
Turn on music on hold on a given channel.
void ast_moh_stop(struct ast_channel *chan)
Turn off music on hold on a given channel.
struct stasis_message_type * ast_mwi_state_type(void)
Get the Stasis Message Bus API message type for MWI messages.
void * ast_mwi_unsubscribe(struct ast_mwi_subscriber *sub)
Unsubscribe from the stasis topic and MWI.
struct stasis_cache * ast_mwi_state_cache(void)
Backend cache for ast_mwi_topic_cached().
struct ast_mwi_subscriber * ast_mwi_subscribe_pool(const char *mailbox, stasis_subscription_cb callback, void *data)
Add an MWI state subscriber, and stasis subscription to the mailbox.
#define ast_publish_mwi_state(mailbox, context, new_msgs, old_msgs)
Publish a MWI state update via stasis.
int ast_parking_blind_transfer_park(struct ast_bridge_channel *parker, const char *context, const char *exten, transfer_channel_cb parked_channel_cb, struct transfer_channel_data *parked_channel_data)
Perform a blind transfer to a parking extension.
int ast_parking_is_exten_park(const char *context, const char *exten)
Determine if the context/exten is a "parking" extension.
int ast_parking_provider_registered(void)
Check whether a parking provider is registered.
Asterisk file paths, configured in asterisk.conf.
const char * ast_config_AST_LOG_DIR
Core PBX routines and definitions.
enum ast_pbx_result ast_pbx_run(struct ast_channel *c)
Execute the PBX in the current thread.
const char * pbx_builtin_getvar_helper(struct ast_channel *chan, const char *name)
Return a pointer to the value of the corresponding channel variable.
int ast_exists_extension(struct ast_channel *c, const char *context, const char *exten, int priority, const char *callerid)
Determine whether an extension exists.
int pbx_builtin_setvar_helper(struct ast_channel *chan, const char *name, const char *value)
Add a variable to the channel variable stack, removing the most recently set value for the same name.
#define ast_custom_function_register(acf)
Register a custom function.
int ast_canmatch_extension(struct ast_channel *c, const char *context, const char *exten, int priority, const char *callerid)
Looks for a valid matching extension.
int ast_custom_function_unregister(struct ast_custom_function *acf)
Unregister a custom function.
enum ast_pbx_result ast_pbx_start(struct ast_channel *c)
Create a new thread and start the PBX.
int ast_ignore_pattern(const char *context, const char *pattern)
Checks to see if a number should be ignored.
int ast_matchmore_extension(struct ast_channel *c, const char *context, const char *exten, int priority, const char *callerid)
Looks to see if adding anything to this extension might match something. (exists ^ canmatch)
int ast_async_goto(struct ast_channel *chan, const char *context, const char *exten, int priority)
Set the channel to next execute the specified dialplan location.
int ast_pickup_call(struct ast_channel *chan)
Pickup a call.
struct stasis_forward * sub
static void to_ami(struct ast_sip_subscription *sub, struct ast_str **buf)
static int debug
Global debug status.
Say numbers and dates (maybe words one day too)
int analog_hangup(struct analog_pvt *p, struct ast_channel *ast)
int analog_available(struct analog_pvt *p)
struct ast_frame * analog_exception(struct analog_pvt *p, struct ast_channel *ast)
int analog_dnd(struct analog_pvt *p, int flag)
int analog_config_complete(struct analog_pvt *p)
void analog_handle_dtmf(struct analog_pvt *p, struct ast_channel *ast, enum analog_sub idx, struct ast_frame **dest)
int analog_call(struct analog_pvt *p, struct ast_channel *ast, const char *rdest, int timeout)
void analog_delete(struct analog_pvt *doomed)
Delete the analog private structure.
struct analog_pvt * analog_new(enum analog_sigtype signallingtype, void *private_data)
int analog_fixup(struct ast_channel *oldchan, struct ast_channel *newchan, void *newp)
enum analog_sigtype sigtype
struct ast_channel * analog_request(struct analog_pvt *p, int *callwait, const struct ast_channel *requestor)
void * analog_handle_init_event(struct analog_pvt *i, int event)
int analog_answer(struct analog_pvt *p, struct ast_channel *ast)
int analog_ss_thread_start(struct analog_pvt *p, struct ast_channel *chan)
Interface header for analog signaling module.
#define ANALOG_INTER_DIGIT_TIMEOUT
Default time (ms) to detect following digits.
#define ANALOG_MATCH_DIGIT_TIMEOUT
Default time (ms) to wait, in case of ambiguous match.
@ ANALOG_EVENT_HOOKCOMPLETE
@ ANALOG_EVENT_PULSE_START
@ ANALOG_EVENT_TX_CED_DETECTED
@ ANALOG_EVENT_NEONMWI_ACTIVE
@ ANALOG_EVENT_EC_DISABLED
@ ANALOG_EVENT_PULSEDIGIT
@ ANALOG_EVENT_RX_CED_DETECTED
@ ANALOG_EVENT_DIALCOMPLETE
@ ANALOG_EVENT_EC_NLP_ENABLED
@ ANALOG_EVENT_NEONMWI_INACTIVE
@ ANALOG_EVENT_EC_NLP_DISABLED
@ ANALOG_EVENT_RINGOFFHOOK
#define ANALOG_FIRST_DIGIT_TIMEOUT
Default time (ms) to detect first digit.
@ ANALOG_CID_START_DTMF_NOALERT
@ ANALOG_CID_START_POLARITY
@ ANALOG_CID_START_POLARITY_IN
Interface header for PRI signaling module.
int sig_pri_is_chan_available(struct sig_pri_chan *pvt)
void sig_pri_unload(void)
#define SIG_PRI_DEBUG_NORMAL
int pri_send_callrerouting_facility_exec(struct sig_pri_chan *p, enum ast_channel_state chanstate, const char *destination, const char *original, const char *reason)
int sig_pri_ami_show_spans(struct mansession *s, const char *show_cmd, struct sig_pri_span *pri, const int *dchannels, const char *action_id)
int sig_pri_cc_agent_status_req(struct ast_cc_agent *agent)
struct sig_pri_callback sig_pri_callbacks
int sig_pri_indicate(struct sig_pri_chan *p, struct ast_channel *chan, int condition, const void *data, size_t datalen)
void sig_pri_extract_called_num_subaddr(struct sig_pri_chan *p, const char *rdest, char *called, size_t called_buff_size)
#define SIG_PRI_NUM_DCHANS
int sig_pri_cc_agent_start_offer_timer(struct ast_cc_agent *agent)
int sig_pri_hangup(struct sig_pri_chan *p, struct ast_channel *ast)
int sig_pri_cc_monitor_unsuspend(struct ast_cc_monitor *monitor)
int sig_pri_available(struct sig_pri_chan **pvt, int is_specific_channel)
int sig_pri_call(struct sig_pri_chan *p, struct ast_channel *ast, const char *rdest, int timeout, int layer1)
#define DAHDI_OVERLAPDIAL_OUTGOING
int sig_pri_is_alarm_ignored(struct sig_pri_span *pri)
int sig_pri_cc_monitor_req_cc(struct ast_cc_monitor *monitor, int *available_timer_id)
int sig_pri_start_pri(struct sig_pri_span *pri)
int sig_pri_cc_monitor_cancel_available_timer(struct ast_cc_monitor *monitor, int *sched_id)
void sig_pri_cli_show_channels(int fd, struct sig_pri_span *pri)
void sig_pri_cc_agent_req_rsp(struct ast_cc_agent *agent, enum ast_cc_agent_response_reason reason)
int sig_pri_cc_monitor_suspend(struct ast_cc_monitor *monitor)
@ SIG_PRI_RESET_IDLE
The channel is not being RESTARTed.
#define DAHDI_OVERLAPDIAL_BOTH
void sig_pri_stop_pri(struct sig_pri_span *pri)
void sig_pri_cc_agent_destructor(struct ast_cc_agent *agent)
void sig_pri_cli_show_spans(int fd, int span, struct sig_pri_span *pri)
void sig_pri_init_pri(struct sig_pri_span *pri)
#define SIG_PRI_AOC_GRANT_D
#define DAHDI_OVERLAPDIAL_NONE
int sig_pri_cc_agent_start_monitoring(struct ast_cc_agent *agent)
#define DAHDI_CHAN_MAPPING_LOGICAL
int sig_pri_cc_agent_init(struct ast_cc_agent *agent, struct sig_pri_chan *pvt_chan)
void sig_pri_chan_alarm_notify(struct sig_pri_chan *p, int noalarm)
int sig_pri_load(const char *cc_type_name)
@ SIG_PRI_CALL_LEVEL_PROCEEDING
@ SIG_PRI_MOH_SIGNALING_MOH
@ SIG_PRI_MOH_SIGNALING_NOTIFY
int sig_pri_cc_agent_callee_available(struct ast_cc_agent *agent)
#define DAHDI_OVERLAPDIAL_INCOMING
struct ast_channel * sig_pri_request(struct sig_pri_chan *p, enum sig_pri_law law, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, int transfercapability)
#define SIG_PRI_AOC_GRANT_E
void sig_pri_fixup(struct ast_channel *oldchan, struct ast_channel *newchan, struct sig_pri_chan *pchan)
void sig_pri_cc_monitor_destructor(void *monitor_pvt)
void sig_pri_dial_complete(struct sig_pri_chan *pvt, struct ast_channel *ast)
struct sig_pri_chan * sig_pri_chan_new(void *pvt_data, struct sig_pri_span *pri, int logicalspan, int channo, int trunkgroup)
void pri_event_noalarm(struct sig_pri_span *pri, int index, int before_start_pri)
void sig_pri_cli_show_span(int fd, int *dchannels, struct sig_pri_span *pri)
void sig_pri_chan_delete(struct sig_pri_chan *doomed)
int sig_pri_answer(struct sig_pri_chan *p, struct ast_channel *ast)
#define SIG_PRI_AOC_GRANT_S
@ SIG_PRI_TONE_CONGESTION
@ SIG_PRI_TONE_DIALRECALL
void pri_event_alarm(struct sig_pri_span *pri, int index, int before_start_pri)
int sig_pri_cc_agent_stop_offer_timer(struct ast_cc_agent *agent)
void sig_pri_cli_show_channels_header(int fd)
void sig_pri_set_alarm(struct sig_pri_chan *p, int in_alarm)
int sig_pri_cc_agent_party_b_free(struct ast_cc_agent *agent)
int sig_pri_cc_monitor_status_rsp(struct ast_cc_monitor *monitor, enum ast_device_state devstate)
#define DAHDI_CHAN_MAPPING_PHYSICAL
int sig_pri_cc_agent_stop_ringing(struct ast_cc_agent *agent)
int sig_pri_digit_begin(struct sig_pri_chan *pvt, struct ast_channel *ast, char digit)
int pri_send_keypad_facility_exec(struct sig_pri_chan *p, const char *digits)
Interface header for SS7 signaling module.
void sig_ss7_cb_call_null(struct ss7 *ss7, struct isup_call *c, int lock)
void sig_ss7_link_noalarm(struct sig_ss7_linkset *linkset, int which)
void sig_ss7_cli_show_channels_header(int fd)
struct ast_channel * sig_ss7_request(struct sig_ss7_chan *p, enum sig_ss7_law law, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, int transfercapability)
void sig_ss7_init_linkset(struct sig_ss7_linkset *ss7)
void sig_ss7_link_alarm(struct sig_ss7_linkset *linkset, int which)
#define LINKSET_FLAG_EXPLICITACM
#define LINKSET_FLAG_AUTOACM
int sig_ss7_reset_group(struct sig_ss7_linkset *linkset, int cic, unsigned int dpc, int range)
int sig_ss7_available(struct sig_ss7_chan *p)
void sig_ss7_cb_notinservice(struct ss7 *ss7, int cic, unsigned int dpc)
int sig_ss7_reset_cic(struct sig_ss7_linkset *linkset, int cic, unsigned int dpc)
int sig_ss7_call(struct sig_ss7_chan *p, struct ast_channel *ast, const char *rdest)
void * ss7_linkset(void *data)
int sig_ss7_indicate(struct sig_ss7_chan *p, struct ast_channel *chan, int condition, const void *data, size_t datalen)
#define SS7_BLOCKED_MAINTENANCE
int sig_ss7_group_blocking(struct sig_ss7_linkset *linkset, int do_block, int startcic, int endcic, unsigned char state[], int type)
int sig_ss7_find_cic(struct sig_ss7_linkset *linkset, int cic, unsigned int dpc)
struct sig_ss7_callback sig_ss7_callbacks
void sig_ss7_set_alarm(struct sig_ss7_chan *p, int in_alarm)
@ SIG_SS7_TONE_DIALRECALL
@ SIG_SS7_TONE_CONGESTION
struct sig_ss7_chan * sig_ss7_chan_new(void *pvt_data, struct sig_ss7_linkset *ss7)
void sig_ss7_cli_show_channels(int fd, struct sig_ss7_linkset *linkset)
int sig_ss7_cic_blocking(struct sig_ss7_linkset *linkset, int do_block, int cic)
#define LINKSET_FLAG_DEFAULTECHOCONTROL
#define LINKSET_FLAG_USEECHOCONTROL
void sig_ss7_chan_delete(struct sig_ss7_chan *doomed)
#define LINKSET_FLAG_INITIALHWBLO
int sig_ss7_cb_hangup(struct ss7 *ss7, int cic, unsigned int dpc, int cause, int do_hangup)
int sig_ss7_add_sigchan(struct sig_ss7_linkset *linkset, int which, int ss7type, int transport, int inalarm, int networkindicator, int pointcode, int adjpointcode, int cur_slc)
int sig_ss7_hangup(struct sig_ss7_chan *p, struct ast_channel *ast)
void sig_ss7_fixup(struct ast_channel *oldchan, struct ast_channel *newchan, struct sig_ss7_chan *pchan)
#define SS7_BLOCKED_HARDWARE
#define SIG_SS7_NUM_DCHANS
int sig_ss7_answer(struct sig_ss7_chan *p, struct ast_channel *ast)
int sig_ss7_find_cic_range(struct sig_ss7_linkset *linkset, int startcic, int endcic, unsigned int dpc)
SMDI support for Asterisk.
struct ast_smdi_interface * ast_smdi_interface_find(const char *iface_name)
Find an SMDI interface with the specified name.
struct ast_smdi_md_message * ast_smdi_md_message_wait(struct ast_smdi_interface *iface, int timeout)
Get the next SMDI message from the queue.
#define SMDI_MAX_FILENAME_LEN
#define STASIS_MESSAGE_TYPE_CLEANUP(name)
Boiler-plate messaging macro for cleaning up message types.
void stasis_subscription_cb_noop(void *data, struct stasis_subscription *sub, struct stasis_message *message)
Stasis subscription callback function that does nothing.
#define STASIS_MESSAGE_TYPE_INIT(name)
Boiler-plate messaging macro for initializing message types.
void * stasis_message_data(const struct stasis_message *msg)
Get the data contained in a message.
struct stasis_message * stasis_cache_get(struct stasis_cache *cache, struct stasis_message_type *type, const char *id)
Retrieve an item from the cache for the ast_eid_default entity.
char * ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
#define S_OR(a, b)
returns the equivalent of logic or for strings: first one if not empty, otherwise second one.
int attribute_pure ast_true(const char *val)
Make sure something is true. Determine if a string containing a boolean value is "true"....
#define S_COR(a, b, c)
returns the equivalent of logic or for strings, with an additional boolean check: second one if not e...
static force_inline int attribute_pure ast_strlen_zero(const char *s)
int attribute_pure ast_false(const char *val)
Make sure something is false. Determine if a string containing a boolean value is "false"....
#define ast_str_create(init_len)
Create a malloc'ed dynamic length string.
int ast_str_set(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Set a dynamic string using variable arguments.
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
char * ast_strip(char *s)
Strip leading/trailing whitespace from a string.
int(*const play_tone)(void *pvt, enum analog_sub sub, enum analog_tone tone)
unsigned int immediatering
unsigned int permcallwaiting
unsigned int dahditrcallerid
int polarityonanswerdelay
char cid_num[AST_MAX_EXTENSION]
unsigned int permhidecallerid
unsigned int callwaitingcallerid
unsigned int ani_wink_time
enum analog_sigtype outsigmod
unsigned int usedistinctiveringdetection
unsigned int answeronpolarityswitch
unsigned int threewaycalling
int msgstate
-1 = unknown, 0 = no messages, 1 = new messages available
unsigned int hanguponpolarityswitch
enum analog_cid_start cid_start
struct ast_channel * owner
unsigned int use_smdi
TRUE if SMDI (Simplified Message Desk Interface) is enabled.
unsigned int call_qualifier
unsigned int ani_info_digits
enum analog_dialmode dialmode
unsigned int cancallforward
struct analog_subchannel subs[3]
unsigned int transfertobusy
char cid_name[AST_MAX_EXTENSION]
unsigned int calledsubscriberheld
char mohsuggest[MAX_MUSICCLASS]
unsigned int use_callerid
struct ast_channel * ss_astchan
struct ast_smdi_interface * smdi_iface
The SMDI interface to get SMDI messages from.
struct ast_party_caller caller
struct ast_channel * owner
Structure to pass both assignedid values to channel drivers.
Structure that contains information regarding a channel in a bridge.
struct ast_channel * chan
const char * type
Type of agent the callbacks belong to.
Callbacks defined by CC monitors.
const char * type
Type of monitor the callbacks belong to.
Blob of data associated with a channel.
struct ast_channel_snapshot * snapshot
Structure to describe a channel "technology", ie a channel driver See for examples:
struct ast_format_cap * capabilities
Main Channel structure associated with a channel.
char exten[AST_MAX_EXTENSION]
struct ast_party_redirecting redirecting
Redirecting/Diversion information.
const ast_string_field name
descriptor for a cli entry.
char chan_name[AST_CHANNEL_NAME]
Data structure associated with a custom dialplan function.
Configuration relating to call pickup.
Structure used to handle boolean flags.
struct ast_format * format
Data structure associated with a single frame of data.
struct ast_frame_subclass subclass
union ast_frame::@226 data
enum ast_frame_type frametype
General jitterbuffer configuration.
unsigned int flags
Combination of the AST_JB_ENABLED, AST_JB_FORCED and AST_JB_LOG flags.
Abstract JSON element (object, array, string, int, ...).
Struct containing info for an AMI event to send out.
The structure that contains MWI state.
Caller Party information.
struct ast_party_id id
Caller party ID.
int ani2
Automatic Number Identification 2 (Info Digits)
struct ast_party_id ani
Automatic Number Identification (ANI)
struct ast_party_id id
Connected party ID.
struct ast_party_dialed::@208 number
Dialed/Called number.
char * str
Subscriber phone number (Malloced)
struct ast_party_subaddress subaddress
Subscriber subaddress.
char * tag
User-set "tag".
struct ast_party_name name
Subscriber name.
struct ast_party_number number
Subscriber phone number.
int presentation
Q.931 encoded presentation-indicator encoded field.
unsigned char valid
TRUE if the name information is valid/present.
char * str
Subscriber name (Malloced)
int presentation
Q.931 presentation-indicator and screening-indicator encoded fields.
unsigned char valid
TRUE if the number information is valid/present.
char * str
Subscriber phone number (Malloced)
int plan
Q.931 Type-Of-Number and Numbering-Plan encoded fields.
int code
enum AST_REDIRECTING_REASON value for redirection
struct ast_party_redirecting_reason reason
Reason for the redirection.
struct ast_party_id from
Who is redirecting the call (Sent to the party the call is redirected toward)
unsigned char valid
TRUE if the subaddress information is valid/present.
char * str
Malloced subaddress string.
An SMDI message desk message.
char calling_st[SMDI_MAX_STATION_NUM_LEN+1]
char fwd_st[SMDI_MAX_STATION_NUM_LEN+1]
Support for dynamic strings.
Structure for variables, used for configurations and for channel variables.
struct ast_variable * next
All configuration options for http media cache.
Channel configuration from chan_dahdi.conf . This struct is used for parsing the [channels] section o...
char smdi_port[SMDI_MAX_FILENAME_LEN]
The serial port to listen for SMDI data on.
int ignore_failed_channels
struct dahdi_params timing
int wanted_channels_end
Don't create channels above this number (infinity by default)
int wanted_channels_start
Don't create channels below this number.
struct ringContextData ringContext[3]
struct distRingData ringnum[3]
unsigned int echocanon
TRUE if echo cancellation is turned on.
char dialdest[256]
Delayed dialing for E911. Overlap digits for ISDN.
unsigned int immediate
TRUE if the channel should be answered immediately without attempting to gather any digits.
unsigned int immediatering
TRUE if audible ringback should be provided when immediate = yes.
unsigned int threewaysilenthold
TRUE if a three way dial tone should time out to silence.
enum DAHDI_IFLIST which_iflist
unsigned int permcallwaiting
TRUE if busy extensions will hear the call-waiting tone and can use hook-flash to switch between call...
float cid_rxgain
Amount of gain to increase during caller id.
struct dahdi_distRings drings
Distinctive Ring data.
struct ast_variable * vars
Channel variable list with associated values to set when a channel is created.
char cid_subaddr[AST_MAX_EXTENSION]
Caller ID subaddress from an incoming call.
unsigned int canpark
TRUE if support for call parking is enabled.
unsigned int bufferoverrideinuse
int law
Active PCM encoding format: DAHDI_LAW_ALAW or DAHDI_LAW_MULAW.
unsigned int hwtxgain_enabled
TRUE if hardware Tx gain set by Asterisk.
unsigned int dnd
TRUE if Do-Not-Disturb is enabled, present only for non sig_analog.
unsigned int ignoredtmf
TRUE if DTMF detection is disabled.
struct dahdi_dialoperation dop
DAHDI dial operation command struct for ioctl() call.
struct timeval dtmfcid_delay
unsigned int dahditrcallerid
TRUE if we should use the callerid from incoming call on dahdi transfer.
unsigned int doreoriginate
Internal flag for if we should actually process a reorigination.
unsigned char * cidspill
Analog caller ID waveform sample buffer.
int waitfordialtonetemp
Transient variable. Same as waitfordialtone, but temporarily set for a specific call,...
int cidlen
Length of the cidspill buffer containing samples.
int polarityonanswerdelay
Minimal time period (ms) between the answer polarity switch and hangup polarity switch.
int busycount
Number of times to see "busy" tone before hanging up.
char cid_num[AST_MAX_EXTENSION]
Caller ID number from an incoming call.
int ringt
Ring timeout timer??
struct ast_mwi_subscriber * mwi_event_sub
Opaque event subscription parameters for message waiting indication support.
ast_group_t group
Bitmapped groups this belongs to.
int sendcalleridafter
Send caller ID on FXS after this many rings. Set to 1 for US.
struct dahdi_pvt * oprpeer
unsigned int permhidecallerid
TRUE if the outgoing caller ID is blocked/restricted/hidden.
unsigned int mwisendactive
TRUE if a MWI message sending thread is active.
struct mwisend_info mwisend_data
int interdigit_timeout
Time (ms) to detect following digits (in an analog phone)
unsigned int mwimonitor_rpas
TRUE if the FXO port monitors for rpas precursor to fsk MWI indications from the other end.
struct dahdi_pvt * master
unsigned int confirmanswer
TRUE if to wait for a DTMF digit to confirm answer.
unsigned int restartpending
unsigned int mwimonitoractive
TRUE if an MWI monitor thread is currently active.
unsigned int outgoing
TRUE if we originated the call leg.
unsigned int faxdetect_timeout
The number of seconds into call to disable fax detection. (0 = disabled)
unsigned int callwaitingcallerid
TRUE if send caller ID for Call Waiting.
unsigned int manages_span_alarms
TRUE if the channel alarms will be managed also as Span ones.
unsigned int ani_wink_time
INTEGER, length of time to wait before sending ANI wink in ms.
int waitfordialtone
Number of milliseconds to wait for dialtone.
unsigned int locallyblocked
Bitmask for the channel being locally blocked.
unsigned int adsi
TRUE if ADSI (Analog Display Services Interface) available.
unsigned int usedistinctiveringdetection
TRUE if distinctive rings are to be detected.
unsigned int answeronpolarityswitch
TRUE if we can use a polarity reversal to mark when an outgoing call is answered by the remote party.
unsigned int threewaycalling
TRUE if three way calling is enabled.
struct dahdi_subchannel subs[3]
struct dahdi_confinfo saveconf
unsigned int use_callingpres
TRUE if we will use the calling presentation setting from the Asterisk channel for outgoing calls.
unsigned int pulse
TRUE if we will pulse dial.
int dialtone_scanning_time_elapsed
unsigned int priexclusive
TRUE if PRI B channels are always exclusively selected.
char mailbox[AST_MAX_MAILBOX_UNIQUEID]
Voice mailbox location.
float hwrxgain
Hardware Rx gain set by chan_dahdi.conf.
int echotraining
Echo training time. 0 = disabled.
char callwait_num[AST_MAX_EXTENSION]
Call waiting number.
float hwtxgain
Hardware Tx gain set by chan_dahdi.conf.
int waitfordialtoneduration
Transient variable. Stored off waitfordialtone duration at runtime.
int dsp_features
DSP feature flags: DSP_FEATURE_xxx.
unsigned int callwaiting
TRUE if busy extensions will hear the call-waiting tone and can use hook-flash to switch between call...
char exten[AST_MAX_EXTENSION]
Extension to use in the dialplan.
int callprogress
Bitmapped call progress detection flags. CALLPROGRESS_xxx values.
int callwaitcas
TRUE if Call Waiting (CW) CPE Alert Signal (CAS) is being sent.
struct timeval polaritydelaytv
Start delay time if polarityonanswerdelay is nonzero.
unsigned int hanguponpolarityswitch
TRUE if the call will be considered "hung up" on a polarity reversal.
char dnid[AST_MAX_EXTENSION]
Dialed Number Identifier.
char dialstring[AST_CHANNEL_NAME]
char call_forward[AST_MAX_EXTENSION]
Accumulated call forwarding number.
char description[32]
A description for the channel configuration.
unsigned int firstradio
TRUE if over a radio and dahdi_read() has been called.
unsigned int remotelyblocked
Bitmask for the channel being remotely blocked. 1 maintenance, 2 blocked in hardware.
struct dahdi_pvt::@115 echocancel
Echo cancel parameters.
unsigned int hidecallerid
TRUE if the outgoing caller ID is blocked/hidden.
unsigned int echobreak
XXX BOOLEAN Purpose???
struct dahdi_echocanparam params[DAHDI_MAX_ECHOCANPARAMS]
unsigned int callreturn
TRUE if call return is enabled. (*69, if your dialplan doesn't catch this first)
struct ast_namedgroups * named_pickupgroups
Named pickup groups this belongs to.
struct ast_channel * owner
char rdnis[AST_MAX_EXTENSION]
Redirecting Directory Number Information Service (RDNIS) number.
unsigned int faxhandled
TRUE if a fax tone has already been handled.
unsigned int use_smdi
TRUE if SMDI (Simplified Message Desk Interface) is enabled.
struct callerid_state * cs
int cid_ani2
Automatic Number Identification code from PRI.
struct ast_namedgroups * named_callgroups
Named call groups this belongs to.
int callwaitrings
Number of call waiting rings.
unsigned int mwimonitor_neon
TRUE if the FXO port monitors for neon type MWI indications from the other end.
unsigned int dialednone
TRUE if analog type line dialed no digits in Dial()
unsigned int hwrxgain_enabled
TRUE if hardware Rx gain set by Asterisk.
int law_default
Default call PCM encoding format: DAHDI_LAW_ALAW or DAHDI_LAW_MULAW.
int fake_event
Holding place for event injected from outside normal operation.
char echorest[20]
Filled with 'w'. XXX Purpose??
struct dahdi_pvt * slaves[MAX_SLAVES]
unsigned int ani_timeout
INTEGER, length of ANI failure timeout in ms.
int dtmfcid_holdoff_state
unsigned int mwioverride_active
TRUE if a manual MWI override is active for a channel.
unsigned int mwimonitor_fsk
TRUE if the FXO port monitors for fsk type MWI indications from the other end.
int ringt_base
Ring timeout base.
unsigned int destroy
TRUE if the channel is to be destroyed on hangup. (Used by pseudo channels.)
unsigned int restrictcid
TRUE if caller ID is restricted.
char defcontext[AST_MAX_CONTEXT]
Default distinctive ring context.
unsigned int priindication_oob
TRUE if PRI congestion/busy indications are sent out-of-band.
unsigned int ani_info_digits
INTEGER, number of ANI INFO digits on a CAMA trunk. older switches use 1 INFO digit,...
unsigned int busydetect
TRUE if busy detection is enabled. (Listens for the beep-beep busy pattern.)
unsigned int hidecalleridname
TRUE if hide just the name not the number for legacy PBX use.
struct timeval waitingfordt
struct ast_dsp * dsp
Opaque DSP configuration structure.
ast_group_t pickupgroup
Bitmapped pickup groups this belongs to.
unsigned int reoriginate
TRUE if FXS (FXO-signalled) channel should reoriginate for user to make a new call.
int cidpos
Position in the cidspill buffer to send out next.
char context[AST_MAX_CONTEXT]
The configured context for incoming calls.
unsigned int cancallforward
TRUE if support for call forwarding enabled. Dial *72 to enable call forwarding. Dial *73 to disable ...
int radio
Nonzero if the signaling type is sent over a radio.
char parkinglot[AST_MAX_EXTENSION]
unsigned int hardwaredtmf
TRUE if DTMF detection needs to be done by hardware.
char begindigit
DTMF digit in progress. 0 when no digit in progress.
struct ast_cc_config_params * cc_params
unsigned int mate
TRUE if TDD in MATE mode.
float txgain
Software Tx gain set by chan_dahdi.conf.
int firstdigit_timeout
Time (ms) to detect first digit (in an analog phone)
struct dahdi_echocanparams head
unsigned int echocanbridged
TRUE if echo cancellation enabled when bridged.
char finaldial[64]
Second part of SIG_FEATDMF_TA wink operation.
unsigned int transfer
TRUE if call transfer is enabled.
unsigned int transfertobusy
TRUE if allowed to flash-transfer to busy channels.
unsigned int inalarm
TRUE if in an alarm condition.
char cid_name[AST_MAX_EXTENSION]
Caller ID name from an incoming call.
unsigned int inservice
TRUE if channel is out of reset and ready.
char language[MAX_LANGUAGE]
Language configured for calls.
unsigned int digital
TRUE if the transfer capability of the call is digital.
char accountcode[AST_MAX_ACCOUNT_CODE]
unsigned int mwioverride_disposition
Manual MWI disposition (on/off)
struct ast_dsp_busy_pattern busy_cadence
Busy cadence pattern description.
int stripmsd
Number of most significant digits/characters to strip from the dialed number.
unsigned int pulsedial
TRUE if a pulsed digit was detected. (Pulse dial phone detected)
unsigned int calledsubscriberheld
TRUE if Called Subscriber held is enabled. This allows a single incoming call to hold a DAHDI channel...
int muting
TRUE if confrence is muted.
char cid_tag[AST_MAX_EXTENSION]
Caller ID tag from incoming call.
int matchdigit_timeout
Time (ms) to wait, in case of ambiguous match (in an analog phone)
char mohsuggest[MAX_MUSICCLASS]
Suggested music-on-hold class for peer channel to use for calls.
unsigned int use_callerid
TRUE if caller ID is used on this channel.
float rxgain
Software Rx gain set by chan_dahdi.conf.
int polarity
Current line interface polarity. POLARITY_IDLE, POLARITY_REV.
ast_group_t callgroup
Bitmapped call groups this belongs to.
unsigned int dialing
TRUE if in the process of dialing digits or sending something.
unsigned int usefaxbuffers
char callwait_name[AST_MAX_EXTENSION]
Call waiting name.
char mohinterpret[MAX_MUSICCLASS]
The configured music-on-hold class to use for calls.
int dialtone_detect
Number of frames to watch for dialtone in incoming calls.
struct ast_smdi_interface * smdi_iface
The SMDI interface to get SMDI messages from.
int cid_ton
Caller ID Q.931 TON/NPI field values. Set by PRI. Zero otherwise.
struct ast_channel * owner
struct dahdi_confinfo curconf
short buffer[AST_FRIENDLY_OFFSET/2+READ_SIZE]
unsigned int needcongestion
In case you didn't read that giant block of text above the mansession_session struct,...
unsigned char buf[READ_SIZE]
mwisend_states mwisend_current
struct ast_channel * peer
char contextData[AST_MAX_CONTEXT]
void(*const handle_dchan_exception)(struct sig_pri_span *pri, int index)
struct sig_pri_span * pri
enum sig_pri_reset_state resetting
Channel reset/restart state.
unsigned int allocated
TRUE when this channel is allocated.
unsigned int use_callingpres
unsigned int priexclusive
unsigned int hidecallerid
unsigned int priindication_oob
unsigned int hidecalleridname
char context[AST_MAX_CONTEXT]
unsigned int no_b_channel
TRUE if this interface has no B channel. (call hold and call waiting)
unsigned int use_callerid
char mohinterpret[MAX_MUSICCLASS]
struct sig_pri_chan * pvts[SIG_PRI_MAX_CHANNELS]
char idleext[AST_MAX_EXTENSION]
int fds[SIG_PRI_NUM_DCHANS]
int congestion_devstate
Congestion device state of the span.
char idledial[AST_MAX_EXTENSION]
void(*const lock_private)(void *pvt)
unsigned int locallyblocked
Bitmask for the channel being locally blocked.
unsigned int use_callingpres
TRUE if we will use the calling presentation setting from the Asterisk channel for outgoing calls.
struct isup_call * ss7call
Opaque libss7 call control structure.
unsigned int remotelyblocked
Bitmask for the channel being remotely blocked.
unsigned int hidecallerid
TRUE if the outgoing caller ID is blocked/hidden.
struct ast_channel * owner
char context[AST_MAX_CONTEXT]
unsigned int inalarm
TRUE if channel is associated with a link that is down.
unsigned int inservice
TRUE if channel is in service.
int stripmsd
Number of most significant digits/characters to strip from the dialed number.
unsigned int use_callerid
TRUE if caller ID is used on this channel.
char mohinterpret[MAX_MUSICCLASS]
int fds[SIG_SS7_NUM_DCHANS]
struct sig_ss7_chan * pvts[SIG_SS7_MAX_CHANNELS]
struct sla_ringing_trunk * next
TTY/TDD Generation support.
#define TDD_BYTES_PER_CHAR
int tdd_generate(struct tdd_state *tdd, unsigned char *buf, const char *string)
struct tdd_state * tdd_new(void)
void tdd_free(struct tdd_state *tdd)
int ast_tdd_gen_ecdisa(unsigned char *outbuf, int len)
int tdd_feed(struct tdd_state *tdd, unsigned char *ubuf, int samples)
Handy terminal functions for vt* terms.
char * term_color(char *outbuf, const char *inbuf, int fgcolor, int bgcolor, int maxout)
Colorize a specified string by adding terminal color codes.
int ast_remaining_ms(struct timeval start, int max_ms)
Calculate remaining milliseconds given a starting timestamp and upper bound.
int64_t ast_tvdiff_ms(struct timeval end, struct timeval start)
Computes the difference (in milliseconds) between two struct timeval instances.
struct timeval ast_tvnow(void)
Returns current timeval. Meant to replace calls to gettimeofday().
struct timeval ast_tv(ast_time_t sec, ast_suseconds_t usec)
Returns a timeval from sec, usec.
General Asterisk channel transcoding definitions.
#define AST_TRANS_CAP_DIGITAL
u-Law to Signed linear conversion
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
#define ast_pthread_create(a, b, c, d)
#define ast_pthread_create_background(a, b, c, d)
#define ast_clear_flag(p, flag)
long int ast_random(void)
#define ast_pthread_create_detached(a, b, c, d)
#define ast_set_flag(p, flag)