Fix: chan_lcr will suppress audio traffic until ref is received
[lcr.git] / chan_lcr.c
index ee221b7..332cc7f 100644 (file)
@@ -919,8 +919,12 @@ CDEBUG(call, ast, "Got 'sending complete', but extension '%s' will not match at
 static void lcr_in_setup(struct chan_call *call, int message_type, union parameter *param)
 {
        struct ast_channel *ast;
+#ifdef AST_1_8_OR_HIGHER
        struct ast_party_redirecting *ast_redir;
        struct ast_party_caller *ast_caller;
+#else
+       struct ast_callerid *ast_caller;
+#endif
 #if ASTERISK_VERSION_NUM >= 110000
        struct ast_party_redirecting s_ast_redir;
        struct ast_party_caller s_ast_caller;
@@ -944,9 +948,13 @@ static void lcr_in_setup(struct chan_call *call, int message_type, union paramet
        #endif
 
 #if ASTERISK_VERSION_NUM < 110000
+#ifdef AST_1_8_OR_HIGHER
        ast_redir = &ast->redirecting;
        ast_caller = &ast->caller;
 #else
+       ast_caller = &ast->cid;
+#endif
+#else
        ast_redir = &s_ast_redir;
        ast_caller = &s_ast_caller;
 #endif
@@ -1996,8 +2004,10 @@ struct ast_channel *lcr_request(const char *type, int format, void *data, int *c
        char exten[256], *dial, *interface, *opt;
        struct ast_channel *ast;
        struct chan_call *call;
+#ifdef AST_1_8_OR_HIGHER
        const struct ast_party_redirecting *req_redir;
        const struct ast_party_caller *req_caller;
+#endif
 
        ast_mutex_lock(&chan_lock);
        CDEBUG(NULL, NULL, "Received request from Asterisk. (data=%s)\n", (char *)data);
@@ -2041,8 +2051,10 @@ struct ast_channel *lcr_request(const char *type, int format, void *data, int *c
 #if ASTERISK_VERSION_NUM < 110000
        ast->tech = &lcr_tech;
        ast->tech_pvt = (void *)1L; // set pointer or asterisk will not call
+#ifdef AST_1_8_OR_HIGHER
        req_redir = &requestor->redirecting;
        req_caller = &requestor->caller;
+#endif
 #else
        ast_channel_tech_set(ast, &lcr_tech);
        ast_channel_tech_pvt_set(ast, (void *)1L); // set pointer or asterisk will not call
@@ -2738,7 +2750,7 @@ static int lcr_write(struct ast_channel *ast, struct ast_frame *fr)
 #else
        call = ast_channel_tech_pvt(ast);
 #endif
-       if (!call) {
+       if (!call || !call->ref) {
                ast_mutex_unlock(&chan_lock);
                if (f != fr) {
                        ast_frfree(f);
@@ -3095,6 +3107,9 @@ enum ast_bridge_result lcr_bridge(struct ast_channel *ast1,
        struct ast_frame        *f;
        int                     bridge_id;
 
+/* bridge is disabled, because there is currerntly no concept to bridge mISDN channels */
+return AST_BRIDGE_FAILED;
+
        CDEBUG(NULL, NULL, "Received bridging request from Asterisk.\n");
 
        carr[0] = ast1;
@@ -3123,18 +3138,11 @@ enum ast_bridge_result lcr_bridge(struct ast_channel *ast1,
        /* get bridge id and join */
        bridge_id = new_bridge_id();
 
-#if 0
        call1->bridge_id = bridge_id;
-       if (call1->bchannel)
-               bchannel_join(call1->bchannel, bridge_id);
-
        call2->bridge_id = bridge_id;
-       if (call2->bchannel)
-               bchannel_join(call2->bchannel, bridge_id);
-#else
-       printf("FIXME");
-       exit(0);
-#endif
+       // FIXME: do bridiging
+       // bchannel_join(call1->bchannel, bridge_id);
+       // bchannel_join(call2->bchannel, bridge_id);
 
        call1->bridge_call = call2;
        call2->bridge_call = call1;