diff options
-rw-r--r-- | apps/app_dahdibarge.c | 2 | ||||
-rw-r--r-- | apps/app_dahdiras.c | 2 | ||||
-rw-r--r-- | apps/app_dahdiscan.c | 2 | ||||
-rw-r--r-- | apps/app_meetme.c | 2 | ||||
-rw-r--r-- | apps/app_rpt.c | 271 | ||||
-rw-r--r-- | channels/chan_dahdi.c | 107 |
6 files changed, 309 insertions, 77 deletions
diff --git a/apps/app_dahdibarge.c b/apps/app_dahdibarge.c index 04c6af045..0e57f6285 100644 --- a/apps/app_dahdibarge.c +++ b/apps/app_dahdibarge.c @@ -100,7 +100,7 @@ static int conf_run(struct ast_channel *chan, int confno, int confflags) int origfd; int ret = -1; - DAHDI_BUFFERINFO bi; + struct dahdi_bufferinfo bi; char __buf[CONF_SIZE + AST_FRIENDLY_OFFSET]; char *buf = __buf + AST_FRIENDLY_OFFSET; diff --git a/apps/app_dahdiras.c b/apps/app_dahdiras.c index 6038c524f..9c7c7b717 100644 --- a/apps/app_dahdiras.c +++ b/apps/app_dahdiras.c @@ -191,7 +191,7 @@ static int dahdiras_exec(struct ast_channel *chan, void *data) { int res=-1; char *args; - DAHDI_PARAMS dahdip; + struct dahdi_params dahdip; if (!data) data = ""; diff --git a/apps/app_dahdiscan.c b/apps/app_dahdiscan.c index 83032d358..d092f348e 100644 --- a/apps/app_dahdiscan.c +++ b/apps/app_dahdiscan.c @@ -107,7 +107,7 @@ static int conf_run(struct ast_channel *chan, int confno, int confflags) char input[4]; int ic=0; - DAHDI_BUFFERINFO bi; + struct dahdi_bufferinfo bi; char __buf[CONF_SIZE + AST_FRIENDLY_OFFSET]; char *buf = __buf + AST_FRIENDLY_OFFSET; diff --git a/apps/app_meetme.c b/apps/app_meetme.c index a38194967..13f61df00 100644 --- a/apps/app_meetme.c +++ b/apps/app_meetme.c @@ -1517,7 +1517,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c char members[10] = ""; int dtmf, opt_waitmarked_timeout = 0; time_t timeout = 0; - DAHDI_BUFFERINFO bi; + struct dahdi_bufferinfo bi; char __buf[CONF_SIZE + AST_FRIENDLY_OFFSET]; char *buf = __buf + AST_FRIENDLY_OFFSET; char *exitkeys = NULL; diff --git a/apps/app_rpt.c b/apps/app_rpt.c index 40ce3492f..fbba16b20 100644 --- a/apps/app_rpt.c +++ b/apps/app_rpt.c @@ -1892,7 +1892,7 @@ static void wait_interval(struct rpt *myrpt, int type, struct ast_channel *chan) static void *rpt_tele_thread(void *this) { - DAHDI_CONFINFO ci; /* conference info */ + struct dahdi_confinfo ci; /* conference info */ int res = 0, haslink, hastx, hasremote, imdone = 0, unkeys_queued, x; struct rpt_tele *mytele = (struct rpt_tele *)this; struct rpt_tele *tlist; @@ -2525,12 +2525,20 @@ static void rpt_telemetry(struct rpt *myrpt, int mode, void *data) static void *rpt_call(void *this) { +<<<<<<< .working DAHDI_CONFINFO ci; /* conference info */ struct rpt *myrpt = (struct rpt *)this; int res; struct ast_frame wf; int stopped, congstarted, dialtimer, lastcidx, aborted; struct ast_channel *mychannel, *genchannel; +======= +struct dahdi_confinfo ci; /* conference info */ +struct rpt *myrpt = (struct rpt *)this; +int res; +int stopped,congstarted,dialtimer,lastcidx,aborted; +struct ast_channel *mychannel,*genchannel; +>>>>>>> .merge-right.r134260 myrpt->mydtmf = 0; /* allocate a pseudo-channel thru asterisk */ @@ -2793,6 +2801,250 @@ static void send_link_dtmf(struct rpt *myrpt, char c) return; } +<<<<<<< .working +======= +static void send_link_keyquery(struct rpt *myrpt) +{ +char str[300]; +struct ast_frame wf; +struct rpt_link *l; + + rpt_mutex_lock(&myrpt->lock); + memset(myrpt->topkey,0,sizeof(myrpt->topkey)); + myrpt->topkeystate = 1; + time(&myrpt->topkeytime); + rpt_mutex_unlock(&myrpt->lock); + snprintf(str, sizeof(str), "K? * %s 0 0", myrpt->name); + wf.frametype = AST_FRAME_TEXT; + wf.subclass = 0; + wf.offset = 0; + wf.mallocd = 0; + wf.datalen = strlen(str) + 1; + wf.samples = 0; + l = myrpt->links.next; + /* give it to everyone */ + while(l != &myrpt->links) + { + wf.data.ptr = str; + if (l->chan) ast_write(l->chan,&wf); + l = l->next; + } + return; +} + +/* send newkey request */ + +static void send_newkey(struct ast_channel *chan) +{ + + /* ast_safe_sleep(chan,10); */ + ast_sendtext(chan,newkeystr); + return; +} + + +/* + * Connect a link + * + * Return values: + * -2: Attempt to connect to self + * -1: No such node + * 0: Success + * 1: No match yet + * 2: Already connected to this node + */ + +static int connect_link(struct rpt *myrpt, char* node, int mode, int perma) +{ + char *val, *s, *s1, *s2, *tele; + char lstr[MAXLINKLIST],*strs[MAXLINKLIST]; + char tmp[300], deststr[300] = "",modechange = 0; + char sx[320],*sy; + struct rpt_link *l; + int reconnects = 0; + int i,n; + struct dahdi_confinfo ci; /* conference info */ + + val = node_lookup(myrpt,node); + if (!val){ + if(strlen(node) >= myrpt->longestnode) + return -1; /* No such node */ + return 1; /* No match yet */ + } + + if(!strcmp(myrpt->name,node)) /* Do not allow connections to self */ + return -2; + + if(debug > 3){ + ast_log(LOG_NOTICE,"Connect attempt to node %s\n", node); + ast_log(LOG_NOTICE,"Mode: %s\n",(mode)?"Transceive":"Monitor"); + ast_log(LOG_NOTICE,"Connection type: %s\n",(perma)?"Permalink":"Normal"); + } + + strncpy(tmp,val,sizeof(tmp) - 1); + s = tmp; + s1 = strsep(&s,","); + if (!strchr(s1,':') && strchr(s1,'/') && strncasecmp(s1, "local/", 6)) + { + sy = strchr(s1,'/'); + *sy = 0; + sprintf(sx,"%s:4569/%s",s1,sy + 1); + s1 = sx; + } + s2 = strsep(&s,","); + rpt_mutex_lock(&myrpt->lock); + l = myrpt->links.next; + /* try to find this one in queue */ + while(l != &myrpt->links){ + if (l->name[0] == '0') + { + l = l->next; + continue; + } + /* if found matching string */ + if (!strcmp(l->name, node)) + break; + l = l->next; + } + /* if found */ + if (l != &myrpt->links){ + /* if already in this mode, just ignore */ + if ((l->mode) || (!l->chan)) { + rpt_mutex_unlock(&myrpt->lock); + return 2; /* Already linked */ + } + reconnects = l->reconnects; + rpt_mutex_unlock(&myrpt->lock); + if (l->chan) ast_softhangup(l->chan, AST_SOFTHANGUP_DEV); + l->retries = l->max_retries + 1; + l->disced = 2; + modechange = 1; + } else + { + __mklinklist(myrpt,NULL,lstr); + rpt_mutex_unlock(&myrpt->lock); + n = finddelim(lstr,strs,MAXLINKLIST); + for(i = 0; i < n; i++) + { + if ((*strs[i] < '0') || + (*strs[i] > '9')) strs[i]++; + if (!strcmp(strs[i],node)) + { + return 2; /* Already linked */ + } + } + } + strncpy(myrpt->lastlinknode,node,MAXNODESTR - 1); + /* establish call */ + l = ast_malloc(sizeof(struct rpt_link)); + if (!l) + { + ast_log(LOG_WARNING, "Unable to malloc\n"); + return -1; + } + /* zero the silly thing */ + memset((char *)l,0,sizeof(struct rpt_link)); + l->mode = mode; + l->outbound = 1; + l->thisconnected = 0; + voxinit_link(l,1); + strncpy(l->name, node, MAXNODESTR - 1); + l->isremote = (s && ast_true(s)); + if (modechange) l->connected = 1; + l->hasconnected = l->perma = perma; +#ifdef ALLOW_LOCAL_CHANNELS + if ((strncasecmp(s1,"iax2/", 5) == 0) || (strncasecmp(s1, "local/", 6) == 0)) + strncpy(deststr, s1, sizeof(deststr)); + else + snprintf(deststr, sizeof(deststr), "IAX2/%s", s1); +#else + snprintf(deststr, sizeof(deststr), "IAX2/%s", s1); +#endif + tele = strchr(deststr, '/'); + if (!tele){ + ast_log(LOG_WARNING,"link3:Dial number (%s) must be in format tech/number\n",deststr); + ast_free(l); + return -1; + } + *tele++ = 0; + l->chan = ast_request(deststr, AST_FORMAT_SLINEAR, tele,NULL); + if (l->chan){ + ast_set_read_format(l->chan, AST_FORMAT_SLINEAR); + ast_set_write_format(l->chan, AST_FORMAT_SLINEAR); +#ifdef AST_CDR_FLAG_POST_DISABLED + if (l->chan->cdr) + ast_set_flag(l->chan->cdr,AST_CDR_FLAG_POST_DISABLED); +#endif +#ifndef NEW_ASTERISK + l->chan->whentohangup = 0; +#endif + l->chan->appl = "Apprpt"; + l->chan->data = "(Remote Rx)"; + if (debug > 3) + ast_log(LOG_NOTICE, "rpt (remote) initiating call to %s/%s on %s\n", + deststr, tele, l->chan->name); + if(l->chan->cid.cid_num) + ast_free(l->chan->cid.cid_num); + l->chan->cid.cid_num = ast_strdup(myrpt->name); + ast_call(l->chan,tele,999); + } + else { + if(debug > 3) + ast_log(LOG_NOTICE, "Unable to place call to %s/%s on %s\n", + deststr,tele,l->chan->name); + if (myrpt->p.archivedir) + { + char str[100]; + sprintf(str,"LINKFAIL,%s",l->name); + donodelog(myrpt,str); + } + ast_free(l); + return -1; + } + /* allocate a pseudo-channel thru asterisk */ + l->pchan = ast_request("DAHDI",AST_FORMAT_SLINEAR,"pseudo",NULL); + if (!l->pchan){ + ast_log(LOG_WARNING,"rpt connect: Sorry unable to obtain pseudo channel\n"); + ast_hangup(l->chan); + ast_free(l); + return -1; + } + ast_set_read_format(l->pchan, AST_FORMAT_SLINEAR); + ast_set_write_format(l->pchan, AST_FORMAT_SLINEAR); +#ifdef AST_CDR_FLAG_POST_DISABLED + if (l->pchan->cdr) + ast_set_flag(l->pchan->cdr,AST_CDR_FLAG_POST_DISABLED); +#endif + /* make a conference for the tx */ + ci.chan = 0; + ci.confno = myrpt->conf; + ci.confmode = DAHDI_CONF_CONF | DAHDI_CONF_LISTENER | DAHDI_CONF_TALKER; + /* first put the channel on the conference in proper mode */ + if (ioctl(l->pchan->fds[0], DAHDI_SETCONF, &ci) == -1) + { + ast_log(LOG_WARNING, "Unable to set conference mode to Announce\n"); + ast_hangup(l->chan); + ast_hangup(l->pchan); + ast_free(l); + return -1; + } + rpt_mutex_lock(&myrpt->lock); + l->reconnects = reconnects; + /* insert at end of queue */ + l->max_retries = MAX_RETRIES; + if (perma) + l->max_retries = MAX_RETRIES_PERM; + if (l->isremote) l->retries = l->max_retries + 1; + insque((struct qelem *)l,(struct qelem *)myrpt->links.next); + __kickshort(myrpt); + rpt_mutex_unlock(&myrpt->lock); + if (!l->phonemode) send_newkey(l->chan); + return 0; +} + + + +>>>>>>> .merge-right.r134260 /* * Internet linking function */ @@ -5652,6 +5904,7 @@ static void do_scheduler(struct rpt *myrpt) /* single thread with one file (request) to dial */ static void *rpt(void *this) { +<<<<<<< .working struct rpt *myrpt = (struct rpt *)this; char *tele, c; const char *idtalkover; @@ -5662,6 +5915,18 @@ static void *rpt(void *this) struct rpt_link *l, *m; struct rpt_tele *telem; char tmpstr[300]; +======= +struct rpt *myrpt = (struct rpt *)this; +char *tele,*idtalkover,c,myfirst,*p; +int ms = MSWAIT,i,lasttx=0,val,remrx=0,identqueued,othertelemqueued; +int tailmessagequeued,ctqueued,dtmfed,lastmyrx,localmsgqueued; +struct ast_channel *who; +struct dahdi_confinfo ci; /* conference info */ +time_t t; +struct rpt_link *l,*m; +struct rpt_tele *telem; +char tmpstr[300],lstr[MAXLINKLIST]; +>>>>>>> .merge-right.r134260 rpt_mutex_lock(&myrpt->lock); @@ -6816,8 +7081,8 @@ static int rpt_exec(struct ast_channel *chan, void *data) struct ast_channel *who; struct ast_channel *cs[20]; struct rpt_link *l; - DAHDI_CONFINFO ci; /* conference info */ - DAHDI_PARAMS par; + struct dahdi_confinfo ci; /* conference info */ + struct dahdi_params par; int ms, elap; AST_DECLARE_APP_ARGS(args, AST_APP_ARG(node); diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c index 30a91a12f..31ca09ca2 100644 --- a/channels/chan_dahdi.c +++ b/channels/chan_dahdi.c @@ -103,7 +103,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #define SMDI_MD_WAIT_TIMEOUT 1500 /* 1.5 seconds */ -#ifdef DAHDI_SPANINFO_HAS_LINECONFIG static const char *lbostr[] = { "0 db (CSU)/0-133 feet (DSX-1)", "133-266 feet (DSX-1)", @@ -114,7 +113,6 @@ static const char *lbostr[] = { "-15db (CSU)", "-22.5db (CSU)" }; -#endif /*! Global jitterbuffer configuration - by default, jb is disabled */ static struct ast_jb_conf default_jbconf = @@ -486,7 +484,7 @@ struct dahdi_subchannel { unsigned int needunhold:1; unsigned int linear:1; unsigned int inthreeway:1; - DAHDI_CONFINFO curconf; + struct dahdi_confinfo curconf; }; #define CONF_USER_REAL (1 << 0) @@ -646,7 +644,7 @@ static struct dahdi_pvt { struct timeval flashtime; /*!< Last flash-hook time */ struct ast_dsp *dsp; int cref; /*!< Call reference number */ - DAHDI_DIAL_OPERATION dop; + struct dahdi_dialoperation dop; int whichwink; /*!< SIG_FEATDMF_TA Which wink are we on? */ char finaldial[64]; char accountcode[AST_MAX_ACCOUNT_CODE]; /*!< Account code */ @@ -725,7 +723,7 @@ struct dahdi_chan_conf { #ifdef HAVE_SS7 struct dahdi_ss7 ss7; #endif - DAHDI_PARAMS timing; + struct dahdi_params timing; int is_sig_auto; /*!< Use channel signalling from DAHDI? */ char smdi_port[SMDI_MAX_FILENAME_LEN]; @@ -1136,7 +1134,7 @@ static int dahdi_setlinear(int zfd, int linear) static int alloc_sub(struct dahdi_pvt *p, int x) { - DAHDI_BUFFERINFO bi; + struct dahdi_bufferinfo bi; int res; if (p->subs[x].zfd >= 0) { ast_log(LOG_WARNING, "%s subchannel of %d already in use\n", subnames[x], p->channel); @@ -1246,7 +1244,7 @@ static int dahdi_digit_begin(struct ast_channel *chan, char digit) if (pvt->pulse || ioctl(pvt->subs[SUB_REAL].zfd, DAHDI_SENDTONE, &dtmf)) { int res; - DAHDI_DIAL_OPERATION zo = { + struct dahdi_dialoperation zo = { .op = DAHDI_DIAL_OP_APPEND, }; @@ -1442,7 +1440,7 @@ static int conf_add(struct dahdi_pvt *p, struct dahdi_subchannel *c, int index, { /* If the conference already exists, and we're already in it don't bother doing anything */ - DAHDI_CONFINFO zi; + struct dahdi_confinfo zi; memset(&zi, 0, sizeof(zi)); zi.chan = 0; @@ -1489,7 +1487,7 @@ static int isourconf(struct dahdi_pvt *p, struct dahdi_subchannel *c) static int conf_del(struct dahdi_pvt *p, struct dahdi_subchannel *c, int index) { - DAHDI_CONFINFO zi; + struct dahdi_confinfo zi; if (/* Can't delete if there's no zfd */ (c->zfd < 0) || /* Don't delete from the conference if it's not our conference */ @@ -1555,7 +1553,7 @@ static int isslavenative(struct dahdi_pvt *p, struct dahdi_pvt **out) static int reset_conf(struct dahdi_pvt *p) { - DAHDI_CONFINFO zi; + struct dahdi_confinfo zi; memset(&zi, 0, sizeof(zi)); p->confno = -1; memset(&p->subs[SUB_REAL].curconf, 0, sizeof(p->subs[SUB_REAL].curconf)); @@ -2960,7 +2958,7 @@ static int dahdi_hangup(struct ast_channel *ast) struct dahdi_pvt *p = ast->tech_pvt; struct dahdi_pvt *tmp = NULL; struct dahdi_pvt *prev = NULL; - DAHDI_PARAMS par; + struct dahdi_params par; ast_debug(1, "dahdi_hangup(%s)\n", ast->name); if (!ast->tech_pvt) { @@ -3681,16 +3679,13 @@ static void dahdi_link(struct dahdi_pvt *slave, struct dahdi_pvt *master) { static void disable_dtmf_detect(struct dahdi_pvt *p) { -#ifdef DAHDI_TONEDETECT int val; -#endif p->ignoredtmf = 1; -#ifdef DAHDI_TONEDETECT val = 0; ioctl(p->subs[SUB_REAL].zfd, DAHDI_TONEDETECT, &val); -#endif + if (!p->hardwaredtmf && p->dsp) { p->dsp_features &= ~DSP_FEATURE_DTMF_DETECT; ast_dsp_set_features(p->dsp, p->dsp_features); @@ -3699,19 +3694,16 @@ static void disable_dtmf_detect(struct dahdi_pvt *p) static void enable_dtmf_detect(struct dahdi_pvt *p) { -#ifdef DAHDI_TONEDETECT int val; -#endif if (p->channel == CHAN_PSEUDO) return; p->ignoredtmf = 0; -#ifdef DAHDI_TONEDETECT val = DAHDI_TONEDETECT_ON | DAHDI_TONEDETECT_MUTE; ioctl(p->subs[SUB_REAL].zfd, DAHDI_TONEDETECT, &val); -#endif + if (!p->hardwaredtmf && p->dsp) { p->dsp_features |= DSP_FEATURE_DTMF_DETECT; ast_dsp_set_features(p->dsp, p->dsp_features); @@ -4124,7 +4116,7 @@ static int attempt_transfer(struct dahdi_pvt *p) static int check_for_conference(struct dahdi_pvt *p) { - DAHDI_CONFINFO ci; + struct dahdi_confinfo ci; /* Fine if we already have a master, etc */ if (p->master || (p->confno > -1)) return 0; @@ -4151,7 +4143,7 @@ static int check_for_conference(struct dahdi_pvt *p) static int get_alarms(struct dahdi_pvt *p) { int res; - DAHDI_SPANINFO zi; + struct dahdi_spaninfo zi; struct dahdi_params params; memset(&zi, 0, sizeof(zi)); @@ -4313,12 +4305,10 @@ static struct ast_frame *dahdi_handle_event(struct ast_channel *ast) } switch (res) { -#ifdef DAHDI_EVENT_EC_DISABLED case DAHDI_EVENT_EC_DISABLED: ast_verb(3, "Channel %d echo canceler disabled due to CED detection\n", p->channel); p->echocanon = 0; break; -#endif case DAHDI_EVENT_BITSCHANGED: ast_log(LOG_WARNING, "Recieved bits changed on %s signalling?\n", sig2str(p->sig)); case DAHDI_EVENT_PULSE_START: @@ -4707,7 +4697,6 @@ static struct ast_frame *dahdi_handle_event(struct ast_channel *ast) ast_log(LOG_WARNING, "Don't know how to handle ring/off hook for signalling %d\n", p->sig); } break; -#ifdef DAHDI_EVENT_RINGBEGIN case DAHDI_EVENT_RINGBEGIN: switch (p->sig) { case SIG_FXSLS: @@ -4719,7 +4708,6 @@ static struct ast_frame *dahdi_handle_event(struct ast_channel *ast) break; } break; -#endif case DAHDI_EVENT_RINGEROFF: if (p->inalarm) break; if ((p->radio || (p->oprmode < 0))) break; @@ -5243,7 +5231,7 @@ static struct ast_frame *dahdi_read(struct ast_channel *ast) /* make sure it sends initial key state as first frame */ if ((p->radio || (p->oprmode < 0)) && (!p->firstradio)) { - DAHDI_PARAMS ps; + struct dahdi_params ps; ps.channo = p->channel; if (ioctl(p->subs[SUB_REAL].zfd, DAHDI_GET_PARAMS, &ps) < 0) { @@ -5835,7 +5823,7 @@ static struct ast_channel *dahdi_new(struct dahdi_pvt *i, int state, int startpb int features; struct ast_str *chan_name; struct ast_variable *v; - DAHDI_PARAMS ps; + struct dahdi_params ps; if (i->subs[index].owner) { ast_log(LOG_WARNING, "Channel %d already has a %s call\n", i->channel,subnames[index]); return NULL; @@ -5897,18 +5885,14 @@ static struct ast_channel *dahdi_new(struct dahdi_pvt *i, int state, int startpb (i->outgoing && (i->callprogress & CALLPROGRESS_FAX_OUTGOING))) { features |= DSP_FEATURE_FAX_DETECT; } -#ifdef DAHDI_TONEDETECT x = DAHDI_TONEDETECT_ON | DAHDI_TONEDETECT_MUTE; if (ioctl(i->subs[index].zfd, DAHDI_TONEDETECT, &x)) { -#endif i->hardwaredtmf = 0; features |= DSP_FEATURE_DTMF_DETECT; -#ifdef DAHDI_TONEDETECT } else if (NEED_MFDETECT(i)) { i->hardwaredtmf = 1; features |= DSP_FEATURE_DTMF_DETECT; } -#endif } if (features) { if (i->dsp) { @@ -6826,12 +6810,10 @@ static void *ss_thread(void *data) ast_log(LOG_NOTICE, "Got event %d (%s)...\n", res, event2str(res)); if (p->cid_signalling == CID_SIG_V23_JP) { -#ifdef DAHDI_EVENT_RINGBEGIN if (res == DAHDI_EVENT_RINGBEGIN) { res = dahdi_set_hook(p->subs[SUB_REAL].zfd, DAHDI_OFFHOOK); usleep(1); } -#endif } else { res = 0; break; @@ -7321,10 +7303,8 @@ static void *mwi_thread(void *data) res = dahdi_get_event(mtd->pvt->subs[SUB_REAL].zfd); switch (res) { -#ifdef HAVE_DAHDI_NEONMWI case DAHDI_EVENT_NEONMWI_ACTIVE: case DAHDI_EVENT_NEONMWI_INACTIVE: -#endif case DAHDI_EVENT_NONE: case DAHDI_EVENT_BITSCHANGED: break; @@ -7641,7 +7621,6 @@ static int handle_init_event(struct dahdi_pvt *i, int event) i->channel); dahdi_destroy_channel_bynum(i->channel); break; -#ifdef HAVE_DAHDI_NEONMWI case DAHDI_EVENT_NEONMWI_ACTIVE: if (i->mwimonitor_neon) { notify_message(i->mailbox, 1); @@ -7654,7 +7633,6 @@ static int handle_init_event(struct dahdi_pvt *i, int event) ast_log(LOG_NOTICE, "NEON MWI cleared for channel %d, mailbox %s\n", i->channel, i->mailbox); } break; -#endif } return 0; } @@ -7747,11 +7725,9 @@ static void *do_monitor(void *data) if (last->msgstate != res) { int x; ast_debug(1, "Message status for %s changed from %d to %d on %d\n", last->mailbox, last->msgstate, res, last->channel); -#ifdef DAHDI_VMWI res2 = ioctl(last->subs[SUB_REAL].zfd, DAHDI_VMWI, res); if (res2) ast_log(LOG_DEBUG, "Unable to control message waiting led on channel %d: %s\n", last->channel, strerror(errno)); -#endif x = DAHDI_FLUSH_BOTH; res2 = ioctl(last->subs[SUB_REAL].zfd, DAHDI_FLUSH, &x); if (res2) @@ -7949,7 +7925,7 @@ static int pri_resolve_span(int *span, int channel, int offset, struct dahdi_spa static int pri_create_trunkgroup(int trunkgroup, int *channels) { struct dahdi_spaninfo si; - DAHDI_PARAMS p; + struct dahdi_params p; int fd; int span; int ospan=0; @@ -8069,7 +8045,7 @@ static struct dahdi_pvt *mkintf(int channel, const struct dahdi_chan_conf *conf, int x; struct dahdi_pvt **wlist; struct dahdi_pvt **wend; - DAHDI_PARAMS p; + struct dahdi_params p; wlist = &iflist; wend = &ifend; @@ -8611,7 +8587,7 @@ static struct dahdi_pvt *mkintf(int channel, const struct dahdi_chan_conf *conf, static inline int available(struct dahdi_pvt *p, int channelmatch, ast_group_t groupmatch, int *busy, int *channelmatched, int *groupmatched) { int res; - DAHDI_PARAMS par; + struct dahdi_params par; /* First, check group matching */ if (groupmatch) { @@ -8683,11 +8659,7 @@ static inline int available(struct dahdi_pvt *p, int channelmatch, ast_group_t g if (par.rxisoffhook) return 1; else -#ifdef DAHDI_CHECK_HOOKSTATE return 0; -#else - return 1; -#endif } else if (par.rxisoffhook) { ast_debug(1, "Channel %d off hook, can't use\n", p->channel); /* Not available when the other end is off hook */ @@ -8727,7 +8699,7 @@ static inline int available(struct dahdi_pvt *p, int channelmatch, ast_group_t g static struct dahdi_pvt *chandup(struct dahdi_pvt *src) { struct dahdi_pvt *p; - DAHDI_BUFFERINFO bi; + struct dahdi_bufferinfo bi; int res; if ((p = ast_malloc(sizeof(*p)))) { @@ -9854,7 +9826,7 @@ static int pri_find_principle(struct dahdi_pri *pri, int channel) int x; int span = PRI_SPAN(channel); int spanfd; - DAHDI_PARAMS param; + struct dahdi_params param; int principle = -1; int explicit = PRI_EXPLICIT(channel); channel = PRI_CHANNEL(channel); @@ -11262,8 +11234,8 @@ static void *pri_dchannel(void *vpri) static int start_pri(struct dahdi_pri *pri) { int res, x; - DAHDI_PARAMS p; - DAHDI_BUFFERINFO bi; + struct dahdi_params p; + struct dahdi_bufferinfo bi; struct dahdi_spaninfo si; int i; @@ -11908,8 +11880,8 @@ static char *dahdi_show_channel(struct ast_cli_entry *e, int cmd, struct ast_cli { int channel; struct dahdi_pvt *tmp = NULL; - DAHDI_CONFINFO ci; - DAHDI_PARAMS ps; + struct dahdi_confinfo ci; + struct dahdi_params ps; int x; ast_mutex_t *lock; struct dahdi_pvt *start; @@ -12058,11 +12030,9 @@ static char *dahdi_show_channel(struct ast_cli_entry *e, int cmd, struct ast_cli if (!ioctl(tmp->subs[SUB_REAL].zfd, DAHDI_GETCONF, &ci)) { ast_cli(a->fd, "Actual Confinfo: Num/%d, Mode/0x%04x\n", ci.confno, ci.confmode); } -#ifdef DAHDI_GETCONFMUTE if (!ioctl(tmp->subs[SUB_REAL].zfd, DAHDI_GETCONFMUTE, &x)) { ast_cli(a->fd, "Actual Confmute: %s\n", x ? "Yes" : "No"); } -#endif if (ioctl(tmp->subs[SUB_REAL].zfd, DAHDI_GET_PARAMS, &ps) < 0) { ast_log(LOG_WARNING, "Failed to get parameters on channel %d: %s\n", tmp->channel, strerror(errno)); } else { @@ -12119,19 +12089,14 @@ static char *handle_dahdi_show_cadences(struct ast_cli_entry *e, int cmd, struct /* Based on irqmiss.c */ static char *dahdi_show_status(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { -#ifdef DAHDI_SPANINFO_HAS_LINECONFIG #define FORMAT "%-40.40s %-7.7s %-6d %-6d %-6d %-3.3s %-4.4s %-8.8s %s\n" #define FORMAT2 "%-40.40s %-7.7s %-6.6s %-6.6s %-6.6s %-3.3s %-4.4s %-8.8s %s\n" -#else - #define FORMAT "%-40.40s %-10.10s %-10d %-10d %-10d\n" - #define FORMAT2 "%-40.40s %-10.10s %-10.10s %-10.10s %-10.10s\n" -#endif int span; int res; char alarms[50]; int ctl; - DAHDI_SPANINFO s; + struct dahdi_spaninfo s; switch (cmd) { case CLI_INIT: @@ -12148,11 +12113,7 @@ static char *dahdi_show_status(struct ast_cli_entry *e, int cmd, struct ast_cli_ ast_cli(a->fd, "No DAHDI found. Unable to open /dev/dahdi/ctl: %s\n", strerror(errno)); return CLI_FAILURE; } - ast_cli(a->fd, FORMAT2, "Description", "Alarms", "IRQ", "bpviol", "CRC4" -#ifdef DAHDI_SPANINFO_HAS_LINECONFIG - , "Framing", "Coding", "Options", "LBO" -#endif - ); + ast_cli(a->fd, FORMAT2, "Description", "Alarms", "IRQ", "bpviol", "CRC4", "Framing", "Coding", "Options", "LBO"); for (span = 1; span < DAHDI_MAX_SPANS; ++span) { s.spanno = span; @@ -12188,7 +12149,6 @@ static char *dahdi_show_status(struct ast_cli_entry *e, int cmd, struct ast_cli_ } ast_cli(a->fd, FORMAT, s.desc, alarms, s.irqmisses, s.bpvcount, s.crc4count -#ifdef DAHDI_SPANINFO_HAS_LINECONFIG , s.lineconfig & DAHDI_CONFIG_D4 ? "D4" : s.lineconfig & DAHDI_CONFIG_ESF ? "ESF" : s.lineconfig & DAHDI_CONFIG_CCS ? "CCS" : @@ -12200,7 +12160,6 @@ static char *dahdi_show_status(struct ast_cli_entry *e, int cmd, struct ast_cli_ , s.lineconfig & DAHDI_CONFIG_CRC4 ? s.lineconfig & DAHDI_CONFIG_NOTOPEN ? "CRC4/YEL" : "CRC4" : "YEL" , lbostr[s.lbo] -#endif ); } close(ctl); @@ -12771,8 +12730,8 @@ static int linkset_addsigchan(int sigchan) struct dahdi_ss7 *link; int res; int curfd; - DAHDI_PARAMS p; - DAHDI_BUFFERINFO bi; + struct dahdi_params p; + struct dahdi_bufferinfo bi; struct dahdi_spaninfo si; @@ -14512,11 +14471,19 @@ static int reload(void) * AST_MODULE_INFO(, , "DAHDI Telephony" */ -#ifdef DAHDI_PRI +#ifdef HAVE_PRI +#ifdef HAVE_SS7 +#define tdesc "DAHDI Telephony w/PRI & SS7" +#else #define tdesc "DAHDI Telephony w/PRI" +#endif +#else +#ifdef HAVE_SS7 +#define tdesc "DAHDI Telephony w/SS7" #else #define tdesc "DAHDI Telephony" #endif +#endif AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, tdesc, .load = load_module, |