Skip to content

Commit

Permalink
qualify: fix qualify with multiple incoming calls (#35)
Browse files Browse the repository at this point in the history
SEGVs were possible when there were multiple incoming calls to the same
account.
  • Loading branch information
maximilianfridrich authored Nov 20, 2023
1 parent 6b0afe4 commit 5e0420b
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions modules/qualify/qualify.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ static int call_start_qualify(struct call *call,
qualle->call = call;
tmr_init(&qualle->to_tmr);
tmr_init(&qualle->int_tmr);
hash_append(q.qual_map, hash_fast_str(account_aor(acc)),
hash_append(q.qual_map, hash_fast_str(call_id(call)),
&qualle->he, qualle);
}

Expand Down Expand Up @@ -220,11 +220,15 @@ static bool qualle_get_applyh(struct le *le, void *arg)
}


static void call_stop_qualify(struct account *acc)
static void call_stop_qualify(struct call *call)
{
struct qualle *qualle;

if (!call)
return;

struct le *le = hash_lookup(q.qual_map,
hash_fast_str(account_aor(acc)),
hash_fast_str(call_id(call)),
qualle_get_applyh, NULL);

if (!le || !le->data)
Expand Down Expand Up @@ -252,10 +256,10 @@ static void ua_event_handler(struct ua *ua, enum ua_event ev,
if (call_is_outgoing(call))
break;

call_stop_qualify(acc);
call_stop_qualify(call);
break;
case UA_EVENT_CALL_CLOSED:
call_stop_qualify(acc);
call_stop_qualify(call);
break;
default:
break;
Expand Down

0 comments on commit 5e0420b

Please sign in to comment.