From 0c80e2361f699ba067a5d89a3638b44adee47057 Mon Sep 17 00:00:00 2001 From: MelwareDE Date: Sat, 28 Apr 2007 10:09:58 +0000 Subject: [PATCH] answer call before entering chat --- chan_capi.c | 4 ++-- chan_capi.h | 2 ++ chan_capi_chat.c | 8 ++++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/chan_capi.c b/chan_capi.c index 66b0391..8271e50 100644 --- a/chan_capi.c +++ b/chan_capi.c @@ -275,7 +275,7 @@ static const char * capi_command_to_string(unsigned short wCmd) /* * wait for B3 up */ -static void capi_wait_for_b3_up(struct capi_pvt *i) +void capi_wait_for_b3_up(struct capi_pvt *i) { struct timespec abstime; @@ -300,7 +300,7 @@ static void capi_wait_for_b3_up(struct capi_pvt *i) /* * wait for finishing answering state */ -static void capi_wait_for_answered(struct capi_pvt *i) +void capi_wait_for_answered(struct capi_pvt *i) { struct timespec abstime; diff --git a/chan_capi.h b/chan_capi.h index 1c450a0..e38b5ac 100644 --- a/chan_capi.h +++ b/chan_capi.h @@ -569,5 +569,7 @@ extern void cc_start_b3(struct capi_pvt *i); extern void queue_cause_control(struct capi_pvt *i, int control); extern void capidev_handle_connection_conf(struct capi_pvt **i, unsigned int PLCI, unsigned short wInfo, unsigned short wMsgNum); +extern void capi_wait_for_answered(struct capi_pvt *i); +extern void capi_wait_for_b3_up(struct capi_pvt *i); #endif diff --git a/chan_capi_chat.c b/chan_capi_chat.c index a1ed0c9..7d860a8 100644 --- a/chan_capi_chat.c +++ b/chan_capi_chat.c @@ -207,6 +207,14 @@ int pbx_capi_chat(struct ast_channel *c, char *param) cc_verbose(3, 1, VERBOSE_PREFIX_3 "capi chat: %s: roomname=%s options=%s\n", c->name, roomname, options); + if (c->_state != AST_STATE_UP) + ast_answer(c); + + if (i) { + capi_wait_for_answered(i); + capi_wait_for_b3_up(i); + } + room = add_chat_member(roomname, c, i); if (!room) { cc_log(LOG_WARNING, "Unable to open capi chat room.\n");