[asterisk-dev] chan_zap: problem in PRI_EVENT_HANGUP_REQ

Tony Mountifield tony at softins.clara.co.uk
Tue Apr 24 07:27:41 MST 2007


I'm just debugging a customer problem in the UK with EuroISDN channels.

The problem manifests itself like this:
a) Caller is probably on a mobile, and is talking to a Meetme conference.
b) Caller's mobile loses signal and drops the call.
c) Asterisk logs "Channel 0/n, span x got hangup request", but doesn't
   hangup the call.
d) After about a second, the exchange sends a tri-tone followed by "Sorry,
   there is a fault - please try again" for about 40 seconds.
e) Asterisk logs "Channel 0/n, span x got hangup" and then process the hangup
   in the dial plan.

The fault message is of course very disruptive to the conference in progress.

Looking at a part of the code that handles PRI_EVENT_HANGUP_REQ (I'm using 1.2,
but it looks to be the same in trunk), I see this:

  pri->pvts[chanpos]->owner->hangupcause = e->hangup.cause;
  switch(e->hangup.cause) {
    case PRI_CAUSE_USER_BUSY:
      pri->pvts[chanpos]->subs[SUB_REAL].needbusy =1;
      break;
    case PRI_CAUSE_CALL_REJECTED:
    case PRI_CAUSE_NETWORK_OUT_OF_ORDER:
    case PRI_CAUSE_NORMAL_CIRCUIT_CONGESTION:
    case PRI_CAUSE_SWITCH_CONGESTION:
    case PRI_CAUSE_DESTINATION_OUT_OF_ORDER:
    case PRI_CAUSE_NORMAL_TEMPORARY_FAILURE:
      pri->pvts[chanpos]->subs[SUB_REAL].needcongestion =1;
      break;
    default:
      pri->pvts[chanpos]->owner->_softhangup |= AST_SOFTHANGUP_DEV;
  }
  if (option_verbose > 2) 
    ast_verbose(VERBOSE_PREFIX_3 "Channel %d/%d, span %d got hangup request\n", PRI_SPAN(e->hangup.channel), PRI_CHANNEL(e->hangup.channel), pri->span);

My suspicion (I now have pri debugging turned on to catch the next occasion)
is that when the call dropped, the cause code matched one of those listed
for congestion, and consequently, AST_SOFTHANGUP_DEV was not set.

The assumption was presumably that those listed cause codes would only
occur during call setup.

So I have two questions:

1) Would it cause a problem if AST_SOFTHANGUP_DEV were always to be set,
   regardless of the cause code?
2) Failing that, I think that the test for whether to set AST_SOFTHANGUP_DEV
   should be based not on the cause code, but on whether the channel is "Up",
   and if it is, always set AST_SOFTHANGUP_DEV. Does this sound correct?
   (If so, it probably also applies to PRI_EVENT_HANGUP).

I would be interested in whether anyone thinks my theory is correct or flawed.
Shall I go and report it as a bug in Mantis?

Cheers
Tony
-- 
Tony Mountifield
Work: tony at softins.co.uk - http://www.softins.co.uk
Play: tony at mountifield.org - http://tony.mountifield.org


More information about the asterisk-dev mailing list