chan_lcr: fixed lcr_fixup (compare with chan_misdn for reference)
authorPeter Schlaile <root@asterisk.schlaile.de>
Sat, 23 Aug 2008 07:56:19 +0000 (09:56 +0200)
committerroot <root@asterisk.schlaile.de>
Sat, 23 Aug 2008 07:56:19 +0000 (09:56 +0200)
- oldast is totally unimportant
- we didn't unlock correctly

=> works now :)
Test case: open two lcr channels using a sip phone. Do a transfer between
them.

chan_lcr.c

index 906e6a3..4ab8591 100644 (file)
@@ -2096,21 +2096,25 @@ static int lcr_indicate(struct ast_channel *ast, int cond, const void *data, siz
 /*
  * fixup asterisk
  */
-static int lcr_fixup(struct ast_channel *oldast, struct ast_channel *newast)
+static int lcr_fixup(struct ast_channel *oldast, struct ast_channel *ast)
 {
         struct chan_call *call;
 
+       if (!ast) {
+               return -1;
+       }
+
        ast_mutex_lock(&chan_lock);
-       call = oldast->tech_pvt;
+       call = ast->tech_pvt;
        if (!call) {
-               CERROR(NULL, oldast, "Received fixup from Asterisk, but no call instance exists.\n");
+               CERROR(NULL, ast, "Received fixup from Asterisk, but no call instance exists.\n");
                ast_mutex_unlock(&chan_lock);
                return -1;
        }
 
-       CDEBUG(call, oldast, "Received fixup from Asterisk.\n");
-       call->ast = newast;
-       ast_mutex_lock(&chan_lock);
+       CDEBUG(call, ast, "Received fixup from Asterisk.\n");
+       call->ast = ast;
+       ast_mutex_unlock(&chan_lock);
        return 0;
 }