diff options
author | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-01-15 02:28:32 +0000 |
---|---|---|
committer | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-01-15 02:28:32 +0000 |
commit | 563eae459df34e16f9e32ae16a5bb75989c2b6d2 (patch) | |
tree | 39e94ebfc4bfed90099e7560ed15cabfce45767d /channels/chan_oss.c | |
parent | bc7d45f56c370ceedacc6320d9103dbcfc0eb413 (diff) |
Feature: allow soundcard to be used in both modes (autoanswer and not),
selectable by how it is called in the dialplan. This allows a speaker
system hooked up to the soundcard to be used for both ring notification,
as well as paging.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@50847 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_oss.c')
-rw-r--r-- | channels/chan_oss.c | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/channels/chan_oss.c b/channels/chan_oss.c index 8e33e357e..c76278293 100644 --- a/channels/chan_oss.c +++ b/channels/chan_oss.c @@ -75,6 +75,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "asterisk/stringfields.h" #include "asterisk/abstract_jb.h" #include "asterisk/musiconhold.h" +#include "asterisk/app.h" /* ringtones we use */ #include "busy.h" @@ -803,9 +804,25 @@ static int oss_call(struct ast_channel *c, char *dest, int timeout) { struct chan_oss_pvt *o = c->tech_pvt; struct ast_frame f = { 0, }; + AST_DECLARE_APP_ARGS(args, + AST_APP_ARG(name); + AST_APP_ARG(flags); + ); + char *parse = ast_strdupa(dest); + + AST_NONSTANDARD_APP_ARGS(args, parse, '/'); ast_verbose(" << Call to device '%s' dnid '%s' rdnis '%s' on console from '%s' <%s> >>\n", dest, c->cid.cid_dnid, c->cid.cid_rdnis, c->cid.cid_name, c->cid.cid_num); - if (o->autoanswer) { + if (!ast_strlen_zero(args.flags) && strcasecmp(args.flags, "answer") == 0) { + f.frametype = AST_FRAME_CONTROL; + f.subclass = AST_CONTROL_ANSWER; + ast_queue_frame(c, &f); + } else if (!ast_strlen_zero(args.flags) && strcasecmp(args.flags, "noanswer") == 0) { + f.frametype = AST_FRAME_CONTROL; + f.subclass = AST_CONTROL_RINGING; + ast_queue_frame(c, &f); + ring(o, AST_CONTROL_RING); + } else if (o->autoanswer) { ast_verbose(" << Auto-answered >> \n"); f.frametype = AST_FRAME_CONTROL; f.subclass = AST_CONTROL_ANSWER; @@ -1045,11 +1062,19 @@ static struct ast_channel *oss_new(struct chan_oss_pvt *o, char *ext, char *ctx, static struct ast_channel *oss_request(const char *type, int format, void *data, int *cause) { struct ast_channel *c; - struct chan_oss_pvt *o = find_desc(data); + struct chan_oss_pvt *o; + AST_DECLARE_APP_ARGS(args, + AST_APP_ARG(name); + AST_APP_ARG(flags); + ); + char *parse = ast_strdupa(data); + + AST_NONSTANDARD_APP_ARGS(args, parse, '/'); + o = find_desc(args.name); ast_log(LOG_WARNING, "oss_request ty <%s> data 0x%p <%s>\n", type, data, (char *) data); if (o == NULL) { - ast_log(LOG_NOTICE, "Device %s not found\n", (char *) data); + ast_log(LOG_NOTICE, "Device %s not found\n", args.name); /* XXX we could default to 'dsp' perhaps ? */ return NULL; } |