*/
struct chan_call *call_first;
-struct chan_call *find_call_ref(unsigned int ref)
-{
- struct chan_call *call = call_first;
-
- while(call)
- {
- if (call->ref == ref)
- break;
- call = call->next;
- }
- return(call);
-}
-
-#if 0
-struct chan_call *find_call_ast(struct ast_channel *ast)
-{
- struct chan_call *call = call_first;
-
- while(call)
- {
- if (call->ast == ast)
- break;
- call = call->next;
- }
- return(call);
-}
+/*
+ * find call by ref
+ * special case: 0: find new ref, that has not been assigned a ref yet
+ */
-struct chan_call *find_call_handle(unsigned int handle)
+struct chan_call *find_call_ref(unsigned int ref)
{
struct chan_call *call = call_first;
-
+ int assigned = (ref > 0);
+
while(call)
{
- if (call->bchannel_handle == handle)
+ if (call->ref == ref && call->ref_was_assigned == assigned)
break;
call = call->next;
}
return(call);
}
-#endif
void free_call(struct chan_call *call)
{
return(*callp);
}
-
unsigned short new_bridge_id(void)
{
struct chan_call *call;
}
/*
- * incoming setup acknowledge from LCR
+ * incoming release from LCR
*/
static void lcr_in_release(struct chan_call *call, int message_type, union parameter *param)
{
call->state = CHAN_LCR_STATE_IN_PREPARE;
/* set ref */
call->ref = ref;
+ call->ref_was_assigned = 1;
/* wait for setup (or release from asterisk) */
} else
{
}
/* store new ref */
call->ref = ref;
+ call->ref_was_assigned = 1;
/* send pending setup info */
if (call->state == CHAN_LCR_STATE_OUT_PREPARE)
send_setup_to_lcr(call);