Another test patch.
[lcr.git] / chan_lcr.c
index a091fdb..b710888 100644 (file)
@@ -623,7 +623,7 @@ static void send_setup_to_lcr(struct chan_call *call)
 {
        union parameter newparam;
        struct ast_channel *ast = call->ast;
-       const char *tmp;
+//     const char *tmp;
 
        if (!call->ast || !call->ref)
                return;
@@ -676,9 +676,10 @@ static void send_setup_to_lcr(struct chan_call *call)
                default:
                newparam.setup.callerinfo.ntype = INFO_NTYPE_UNKNOWN;
        }
-       tmp = pbx_builtin_getvar_helper(ast, "LCR_TRANSFERCAPABILITY");
-       if (tmp && *tmp)
-               ast->transfercapability = atoi(tmp);
+#warning DISABLED DUE TO DOUBLE LOCKING PROBLEM
+//     tmp = pbx_builtin_getvar_helper(ast, "LCR_TRANSFERCAPABILITY");
+//     if (tmp && *tmp)
+//             ast->transfercapability = atoi(tmp);
        newparam.setup.capainfo.bearer_capa = ast->transfercapability;
        newparam.setup.capainfo.bearer_mode = INFO_BMODE_CIRCUIT;
        if (call->hdlc)
@@ -1687,13 +1688,22 @@ static void handle_queue()
        struct ast_frame fr;
        char *p;
 
+again:
        call = call_first;
        while(call) {
                p = call->queue_string;
                ast = call->ast;
                if (*p && ast) {
                        lock_debug("A1+");
-//                     ast_channel_lock(ast);
+                       if (ast_channel_trylock(ast)) {
+                               lock_debug("<trylock failed>");
+                               ast_mutex_unlock(&chan_lock);
+                               usleep(1000);
+                               lock_debug("A1++");
+                               ast_mutex_lock(&chan_lock);
+                               lock_debug("A1+-");
+                               goto again;
+                       }
                        lock_debug("A1-");
                        while(*p) {
                                switch (*p) {
@@ -1750,7 +1760,7 @@ static void handle_queue()
                                p++;
                        }
                        call->queue_string[0] = '\0';
-//                     ast_channel_unlock(ast);
+                       ast_channel_unlock(ast);
                        lock_debug("a1");
                }
                call = call->next;