Another test patch.
[lcr.git] / chan_lcr.c
index 5968733..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,16 +1688,21 @@ 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+");
-                       while (ast_channel_trylock(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) {