Allow do not disturb to be set on analog channels via the CLI and AMI.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@217954 65c4cc65-6c06-0410-ace0-fbb531ad65f3
certified/1.8.6
Jeff Peeler 16 years ago
parent a393b47316
commit 3a718192c6

@ -784,7 +784,7 @@ struct dahdi_pvt {
unsigned int dialing:1;
/*! \brief TRUE if the transfer capability of the call is digital. */
unsigned int digital:1;
/*! \brief TRUE if Do-Not-Disturb is enabled. */
/*! \brief TRUE if Do-Not-Disturb is enabled, present only for non sig_analog */
unsigned int dnd:1;
/*! \brief XXX BOOLEAN Purpose??? */
unsigned int echobreak:1;
@ -8399,24 +8399,34 @@ static int dahdi_wink(struct dahdi_pvt *p, int idx)
/*! \brief enable or disable the chan_dahdi Do-Not-Disturb mode for a DAHDI channel
* \param dahdichan "Physical" DAHDI channel (e.g: DAHDI/5)
* \param on 1 to enable, 0 to disable
* \param on 1 to enable, 0 to disable, -1 return dnd value
*
* chan_dahdi has a DND (Do Not Disturb) mode for each dahdichan (physical
* DAHDI channel). Use this to enable or disable it.
*
* \bug the use of the word "channel" for those dahdichans is really confusing.
*/
static void dahdi_dnd(struct dahdi_pvt *dahdichan, int on)
static int dahdi_dnd(struct dahdi_pvt *dahdichan, int flag)
{
if (analog_lib_handles(dahdichan->sig, dahdichan->radio, dahdichan->oprmode)) {
return analog_dnd(dahdichan->sig_pvt, flag);
}
if (flag == -1) {
return dahdichan->dnd;
}
/* Do not disturb */
dahdichan->dnd = on;
dahdichan->dnd = flag;
ast_verb(3, "%s DND on channel %d\n",
on? "Enabled" : "Disabled",
flag? "Enabled" : "Disabled",
dahdichan->channel);
manager_event(EVENT_FLAG_SYSTEM, "DNDState",
"Channel: DAHDI/%d\r\n"
"Status: %s\r\n", dahdichan->channel,
on? "enabled" : "disabled");
flag? "enabled" : "disabled");
return 0;
}
static void *analog_ss_thread(void *data)
@ -13864,7 +13874,7 @@ static char *dahdi_show_channel(struct ast_cli_entry *e, int cmd, struct ast_cli
ast_cli(a->fd, "Default law: %s\n", tmp->law == DAHDI_LAW_MULAW ? "ulaw" : tmp->law == DAHDI_LAW_ALAW ? "alaw" : "unknown");
ast_cli(a->fd, "Fax Handled: %s\n", tmp->faxhandled ? "yes" : "no");
ast_cli(a->fd, "Pulse phone: %s\n", tmp->pulsedial ? "yes" : "no");
ast_cli(a->fd, "DND: %s\n", tmp->dnd ? "yes" : "no");
ast_cli(a->fd, "DND: %s\n", dahdi_dnd(tmp, -1) ? "yes" : "no");
ast_cli(a->fd, "Echo Cancellation:\n");
if (tmp->echocancel.head.tap_length) {
@ -14370,7 +14380,7 @@ static int action_dahdidndon(struct mansession *s, const struct message *m)
astman_send_error(s, m, "No such channel");
return 0;
}
p->dnd = 1;
dahdi_dnd(p, 1);
astman_send_ack(s, m, "DND Enabled");
return 0;
}
@ -14389,7 +14399,7 @@ static int action_dahdidndoff(struct mansession *s, const struct message *m)
astman_send_error(s, m, "No such channel");
return 0;
}
p->dnd = 0;
dahdi_dnd(p, 0);
astman_send_ack(s, m, "DND Disabled");
return 0;
}
@ -14514,7 +14524,7 @@ static int action_dahdishowchannels(struct mansession *s, const struct message *
sig2str(tmp->sig),
tmp->sig,
tmp->context,
tmp->dnd ? "Enabled" : "Disabled",
dahdi_dnd(tmp, -1) ? "Enabled" : "Disabled",
alarm2str(alm), idText);
} else {
astman_append(s,
@ -14529,7 +14539,7 @@ static int action_dahdishowchannels(struct mansession *s, const struct message *
"\r\n",
tmp->channel, sig2str(tmp->sig), tmp->sig,
tmp->context,
tmp->dnd ? "Enabled" : "Disabled",
dahdi_dnd(tmp, -1) ? "Enabled" : "Disabled",
alarm2str(alm), idText);
}
}

@ -3477,3 +3477,22 @@ int analog_fixup(struct ast_channel *oldchan, struct ast_channel *newchan, void
analog_update_conf(new_pvt);
return 0;
}
int analog_dnd(struct analog_pvt *p, int flag)
{
if (flag == -1) {
return p->dnd;
}
p->dnd = flag;
ast_verb(3, "%s DND on channel %d\n",
flag? "Enabled" : "Disabled",
p->channel);
manager_event(EVENT_FLAG_SYSTEM, "DNDState",
"Channel: DAHDI/%d\r\n"
"Status: %s\r\n", p->channel,
flag? "enabled" : "disabled");
return 0;
}

@ -274,7 +274,7 @@ struct analog_pvt {
unsigned int callwaiting:1;
unsigned int dialednone:1;
unsigned int dialing:1; /*!< TRUE if in the process of dialing digits or sending something */
unsigned int dnd:1;
unsigned int dnd:1; /*!< TRUE if Do-Not-Disturb is enabled. */
unsigned int echobreak:1;
unsigned int hidecallerid:1;
unsigned int outgoing:1;
@ -350,4 +350,6 @@ int analog_ss_thread_start(struct analog_pvt *p, struct ast_channel *ast);
int analog_fixup(struct ast_channel *oldchan, struct ast_channel *newchan, void *newp);
int analog_dnd(struct analog_pvt *p, int flag);
#endif /* _SIG_ANSLOG_H */

Loading…
Cancel
Save