diff options
Diffstat (limited to 'channels/chan_console.c')
-rw-r--r-- | channels/chan_console.c | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/channels/chan_console.c b/channels/chan_console.c index ead0b1231..9141c3d1d 100644 --- a/channels/chan_console.c +++ b/channels/chan_console.c @@ -182,7 +182,7 @@ static struct ast_jb_conf default_jbconf = { static struct ast_jb_conf global_jbconf; /*! Channel Technology Callbacks @{ */ -static struct ast_channel *console_request(const char *type, int format, +static struct ast_channel *console_request(const char *type, format_t format, const struct ast_channel *requestor, void *data, int *cause); static int console_digit_begin(struct ast_channel *c, char digit); static int console_digit_end(struct ast_channel *c, char digit, unsigned int duration); @@ -264,7 +264,7 @@ static void *stream_monitor(void *data) PaError res; struct ast_frame f = { .frametype = AST_FRAME_VOICE, - .subclass = AST_FORMAT_SLINEAR16, + .subclass.codec = AST_FORMAT_SLINEAR16, .src = "console_stream_monitor", .data.ptr = buf, .datalen = sizeof(buf), @@ -440,11 +440,12 @@ static struct ast_channel *console_new(struct console_pvt *pvt, const char *ext, return chan; } -static struct ast_channel *console_request(const char *type, int format, const struct ast_channel *requestor, void *data, int *cause) +static struct ast_channel *console_request(const char *type, format_t format, const struct ast_channel *requestor, void *data, int *cause) { - int oldformat = format; + format_t oldformat = format; struct ast_channel *chan = NULL; struct console_pvt *pvt; + char buf[512]; if (!(pvt = find_pvt(data))) { ast_log(LOG_ERROR, "Console device '%s' not found\n", (char *) data); @@ -453,7 +454,7 @@ static struct ast_channel *console_request(const char *type, int format, const s format &= SUPPORTED_FORMATS; if (!format) { - ast_log(LOG_NOTICE, "Channel requested with unsupported format(s): '%d'\n", oldformat); + ast_log(LOG_NOTICE, "Channel requested with unsupported format(s): '%s'\n", ast_getformatname_multiple(buf, sizeof(buf), oldformat)); goto return_unref; } @@ -553,8 +554,8 @@ static struct ast_frame *console_read(struct ast_channel *chan) static int console_call(struct ast_channel *c, char *dest, int timeout) { - struct ast_frame f = { 0, }; struct console_pvt *pvt = c->tech_pvt; + enum ast_control_frame_type ctrl; ast_verb(1, V_BEGIN "Call to device '%s' on console from '%s' <%s>" V_END, dest, c->cid.cid_name, c->cid.cid_num); @@ -565,18 +566,16 @@ static int console_call(struct ast_channel *c, char *dest, int timeout) pvt->hookstate = 1; console_pvt_unlock(pvt); ast_verb(1, V_BEGIN "Auto-answered" V_END); - f.frametype = AST_FRAME_CONTROL; - f.subclass = AST_CONTROL_ANSWER; + ctrl = AST_CONTROL_ANSWER; } else { console_pvt_unlock(pvt); ast_verb(1, V_BEGIN "Type 'console answer' to answer, or use the 'autoanswer' option " "for future calls" V_END); - f.frametype = AST_FRAME_CONTROL; - f.subclass = AST_CONTROL_RINGING; + ctrl = AST_CONTROL_RINGING; ast_indicate(c, AST_CONTROL_RINGING); } - ast_queue_frame(c, &f); + ast_queue_control(c, ctrl); return start_stream(pvt); } @@ -729,7 +728,6 @@ static char *cli_console_autoanswer(struct ast_cli_entry *e, int cmd, static char *cli_console_flash(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { - struct ast_frame f = { AST_FRAME_CONTROL, AST_CONTROL_FLASH }; struct console_pvt *pvt = get_active_pvt(); if (cmd == CLI_INIT) { @@ -757,7 +755,7 @@ static char *cli_console_flash(struct ast_cli_entry *e, int cmd, struct ast_cli_ pvt->hookstate = 0; - ast_queue_frame(pvt->owner, &f); + ast_queue_control(pvt->owner, AST_CONTROL_FLASH); unref_pvt(pvt); @@ -789,7 +787,7 @@ static char *cli_console_dial(struct ast_cli_entry *e, int cmd, struct ast_cli_a if (pvt->owner) { /* already in a call */ int i; - struct ast_frame f = { AST_FRAME_DTMF, 0 }; + struct ast_frame f = { AST_FRAME_DTMF }; const char *s; if (a->argc == e->args) { /* argument is mandatory here */ @@ -800,7 +798,7 @@ static char *cli_console_dial(struct ast_cli_entry *e, int cmd, struct ast_cli_a s = a->argv[e->args]; /* send the string one char at a time */ for (i = 0; i < strlen(s); i++) { - f.subclass = s[i]; + f.subclass.integer = s[i]; ast_queue_frame(pvt->owner, &f); } unref_pvt(pvt); @@ -1024,7 +1022,6 @@ static char *cli_list_devices(struct ast_cli_entry *e, int cmd, struct ast_cli_a */ static char *cli_console_answer(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { - struct ast_frame f = { AST_FRAME_CONTROL, AST_CONTROL_ANSWER }; struct console_pvt *pvt = get_active_pvt(); switch (cmd) { @@ -1059,7 +1056,7 @@ static char *cli_console_answer(struct ast_cli_entry *e, int cmd, struct ast_cli ast_indicate(pvt->owner, -1); - ast_queue_frame(pvt->owner, &f); + ast_queue_control(pvt->owner, AST_CONTROL_ANSWER); unref_pvt(pvt); |