diff --git a/q931.c b/q931.c index cb89b16..4287c6b 100644 --- a/q931.c +++ b/q931.c @@ -3042,10 +3042,19 @@ static q931_call *q931_getcall(struct pri *ctrl, int cr) prev = NULL; while (cur) { if (cur->cr == cr) { - if (!ctrl->bri && ctrl->switchtype != PRI_SWITCH_GR303_EOC_PATH - && ctrl->switchtype != PRI_SWITCH_GR303_TMC_SWITCHING - && cur->pri != ctrl) { - cur->pri = ctrl; + /* Found existing call. */ + switch (ctrl->switchtype) { + case PRI_SWITCH_GR303_EOC: + case PRI_SWITCH_GR303_EOC_PATH: + case PRI_SWITCH_GR303_TMC: + case PRI_SWITCH_GR303_TMC_SWITCHING: + break; + default: + if (!ctrl->bri) { + /* PRI is set to whoever called us */ + cur->pri = ctrl; + } + break; } return cur; }