aboutsummaryrefslogtreecommitdiffstats
path: root/channels/chan_phone.c
diff options
context:
space:
mode:
authormattf <mattf@f38db490-d61c-443f-a65b-d21fe96a405b>2006-01-10 21:34:04 +0000
committermattf <mattf@f38db490-d61c-443f-a65b-d21fe96a405b>2006-01-10 21:34:04 +0000
commit26887439297279dec0edd3d4f238ccebe8253ade (patch)
tree2ed6596e846a6c0cbeb8b0ad56384599174fe638 /channels/chan_phone.c
parent40c02477e7f4c0b2be5c0a23a58913e09a5e93c3 (diff)
Update chan_phone to indicate FLASH properley (#4935)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@7947 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_phone.c')
-rw-r--r--channels/chan_phone.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/channels/chan_phone.c b/channels/chan_phone.c
index abea80c92..8f732e9ae 100644
--- a/channels/chan_phone.c
+++ b/channels/chan_phone.c
@@ -160,6 +160,7 @@ static int phone_write(struct ast_channel *ast, struct ast_frame *frame);
static struct ast_frame *phone_exception(struct ast_channel *ast);
static int phone_send_text(struct ast_channel *ast, const char *text);
static int phone_fixup(struct ast_channel *old, struct ast_channel *new);
+static int phone_indicate(struct ast_channel *chan, int condition);
static const struct ast_channel_tech phone_tech = {
.type = type,
@@ -173,6 +174,7 @@ static const struct ast_channel_tech phone_tech = {
.read = phone_read,
.write = phone_write,
.exception = phone_exception,
+ .indicate = phone_indicate,
.fixup = phone_fixup
};
@@ -189,11 +191,31 @@ static struct ast_channel_tech phone_tech_fxs = {
.exception = phone_exception,
.write_video = phone_write,
.send_text = phone_send_text,
+ .indicate = phone_indicate,
.fixup = phone_fixup
};
static struct ast_channel_tech *cur_tech;
+static int phone_indicate(struct ast_channel *chan, int condition)
+{
+ struct phone_pvt *p = chan->tech_pvt;
+ int res=-1;
+ ast_log(LOG_DEBUG, "Requested indication %d on channel %s\n", condition, chan->name);
+ switch(condition) {
+ case AST_CONTROL_FLASH:
+ ioctl(p->fd, IXJCTL_PSTN_SET_STATE, PSTN_ON_HOOK);
+ usleep(320000);
+ ioctl(p->fd, IXJCTL_PSTN_SET_STATE, PSTN_OFF_HOOK);
+ p->lastformat = -1;
+ res = 0;
+ break;
+ default:
+ ast_log(LOG_WARNING, "Condition %d is not supported on channel %s\n", condition, chan->name);
+ }
+ return res;
+}
+
static int phone_fixup(struct ast_channel *old, struct ast_channel *new)
{
struct phone_pvt *pvt = old->tech_pvt;