diff options
author | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-01-25 23:44:01 +0000 |
---|---|---|
committer | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-01-25 23:44:01 +0000 |
commit | 131832a6c204d2303aa05547b3bb56a628f5a292 (patch) | |
tree | 0c4a842138fba56785561a741686f22271ccfc5c /channels | |
parent | ca894cb6c2c289befea187ad5dcce30246ca78bc (diff) |
Correctly track the hookstate
(closes issue #13686)
Reported by: itiliti
Patches:
20081013__bug13686.diff.txt uploaded by Corydon76 (license 14)
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@171187 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rw-r--r-- | channels/chan_oss.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/channels/chan_oss.c b/channels/chan_oss.c index ac62f2005..73297f4ef 100644 --- a/channels/chan_oss.c +++ b/channels/chan_oss.c @@ -336,9 +336,9 @@ struct chan_oss_pvt { int total_blocks; /* total blocks in the output device */ int sounddev; enum { M_UNSET, M_FULL, M_READ, M_WRITE } duplex; - int autoanswer; - int autohangup; - int hookstate; + int autoanswer; /*!< Boolean: whether to answer the immediately upon calling */ + int autohangup; /*!< Boolean: whether to hangup the call when the remote end hangs up */ + int hookstate; /*!< Boolean: 1 if offhook; 0 if onhook */ char *mixer_cmd; /* initial command to issue to the mixer */ unsigned int queuesize; /* max fragments in queue */ unsigned int frags; /* parameter for SETFRAGMENT */ @@ -367,8 +367,8 @@ struct chan_oss_pvt { char ext[AST_MAX_EXTENSION]; char ctx[AST_MAX_CONTEXT]; char language[MAX_LANGUAGE]; - char cid_name[256]; /*XXX */ - char cid_num[256]; /*XXX */ + char cid_name[256]; /*!< Initial CallerID name */ + char cid_num[256]; /*!< Initial CallerID number */ char mohinterpret[MAX_MUSICCLASS]; /* buffers used in oss_write */ @@ -401,8 +401,7 @@ static char *oss_active; /* the active device */ static int setformat(struct chan_oss_pvt *o, int mode); -static struct ast_channel *oss_request(const char *type, int format, void *data -, int *cause); +static struct ast_channel *oss_request(const char *type, int format, void *data, int *cause); static int oss_digit_begin(struct ast_channel *c, char digit); static int oss_digit_end(struct ast_channel *c, char digit, unsigned int duration); static int oss_text(struct ast_channel *c, const char *text); @@ -808,6 +807,7 @@ static int oss_call(struct ast_channel *c, char *dest, int timeout) f.frametype = AST_FRAME_CONTROL; f.subclass = AST_CONTROL_ANSWER; ast_queue_frame(c, &f); + o->hookstate = 1; } else { ast_verbose("<< Type 'answer' to answer, or use 'autoanswer' for future calls >> \n"); f.frametype = AST_FRAME_CONTROL; @@ -833,6 +833,7 @@ static int oss_answer(struct ast_channel *c) ast_setstate(c, AST_STATE_UP); o->cursound = -1; o->nosound = 0; + o->hookstate = 1; return 0; } @@ -1028,8 +1029,6 @@ static struct ast_channel *oss_new(struct chan_oss_pvt *o, char *ext, char *ctx, ast_log(LOG_WARNING, "Unable to start PBX on %s\n", c->name); ast_hangup(c); o->owner = c = NULL; - /* XXX what about the channel itself ? */ - /* XXX what about usecnt ? */ } } @@ -1296,7 +1295,7 @@ static int console_flash_deprecated(int fd, int argc, char *argv[]) return RESULT_FAILURE; } o->hookstate = 0; - if (o->owner) /* XXX must be true, right ? */ + if (o->owner) ast_queue_frame(o->owner, &f); return RESULT_SUCCESS; } @@ -1315,7 +1314,7 @@ static int console_flash(int fd, int argc, char *argv[]) return RESULT_FAILURE; } o->hookstate = 0; - if (o->owner) /* XXX must be true, right ? */ + if (o->owner) ast_queue_frame(o->owner, &f); return RESULT_SUCCESS; } @@ -1888,7 +1887,7 @@ static int unload_module(void) } if (o->owner) ast_softhangup(o->owner, AST_SOFTHANGUP_APPUNLOAD); - if (o->owner) /* XXX how ??? */ + if (o->owner) return -1; /* XXX what about the thread ? */ /* XXX what about the memory allocated ? */ |