fixed trace bug
[lcr.git] / chan_lcr.c
index dc7ebed..7eabe0e 100644 (file)
@@ -690,6 +690,7 @@ static void lcr_start_pbx(struct chan_call *call, struct ast_channel *ast, int c
 
                /* change state */
                call->state = CHAN_LCR_STATE_IN_PROCEEDING;
+               ast_setstate(ast, AST_STATE_OFFHOOK);
 
                goto start;
        }
@@ -704,6 +705,7 @@ static void lcr_start_pbx(struct chan_call *call, struct ast_channel *ast, int c
 
                /* change state */
                call->state = CHAN_LCR_STATE_IN_DIALING;
+               ast_setstate(ast, AST_STATE_OFFHOOK);
 
                /* if match, start pbx */
                if (ast_exists_extension(ast, ast->context, ast->exten, 1, call->oad)) {
@@ -1943,7 +1945,11 @@ static struct ast_frame *lcr_read(struct ast_channel *ast)
                return NULL;
        }
        if (call->pipe[0] > -1) {
-               len = read(call->pipe[0], call->read_buff, sizeof(call->read_buff));
+               if (call->rebuffer) {
+                       len = read(call->pipe[0], call->read_buff, 160);
+               } else {
+                       len = read(call->pipe[0], call->read_buff, sizeof(call->read_buff));
+               }
                if (len <= 0) {
                        close(call->pipe[0]);
                        call->pipe[0] = -1;