Multiple revisions 375519-375524

........
  r375519 | rmudgett | 2012-10-30 16:06:15 -0500 (Tue, 30 Oct 2012) | 11 lines

  chan_misdn: Timer primitives must be handled first.

  The frm->addr is a different "address space" than the stack/instance
  address of other Lx primitives.  The test for B channel instance address
  could fail.

  Patches:
	patch01_timers.diff (license #6372) patch uploaded by Guenther Kelleter

  JIRA ABE-2888

  ........
  r375520 | rmudgett | 2012-10-30 16:14:58 -0500 (Tue, 30 Oct 2012) | 10 lines

  chan_misdn: Free memory in error paths and other memory leaks.

  The one line commented with BUG is not easily fixable because there is no
  de-init function one can call.

  Patches:
	patch02_memory.diff (license #6372) patch uploaded by Guenther Kelleter

  JIRA ABE-2888

  ........
  r375521 | rmudgett | 2012-10-30 16:38:41 -0500 (Tue, 30 Oct 2012) | 14 lines

  chan_misdn: ISDN NT L2 de-establish/establish

  * An NT-PTMP cannot de/establish L2 since it doesn't know the TEIs.
  * On NT-PTP L2 is started when L1 is finally active in handle_l1.
  * L2 deactivation logging cleanup.
  * L2 aggregate link status is unknown for NT-PTMP, show as "UNKN".
  * Removed unused functions and code for L2 handling.

  Patches:
	patch03_L2estab.diff (license #6372) patch uploaded by Guenther Kelleter
	Modified

  JIRA ABE-2888

  ........
  r375522 | rmudgett | 2012-10-30 16:56:14 -0500 (Tue, 30 Oct 2012) | 22 lines

  chan_misdn: Fix broken upper_id/lower_id usage.

  Sending PH prim via lower_id layer (3 or 1) simply does not work.  For TE
  (3) it returns an error (len=-6) which is not evaluated by handle_l1(), so
  the L1 layer status ends up wrong.  Instead PH must be sent via L4, only
  then does it reach L1 without an error message.

  And NT PH prims only reach L1 when they are sent to layer 2 id.
  --> use upper_id to send PH primitives.

  * Check for errors in PH_(DE)ACTIVATE | CONFIRM.
  * Debug messages are improved.

  * The lower_id is now not used for anything, except: Why is lower_id layer
  deleted when it wasn't created?  I removed this code since it looks very
  wrong.

  Patches:
	patch04_l1activation.diff (license #6372) patch uploaded by Guenther Kelleter

  JIRA ABE-2888

  ........
  r375523 | rmudgett | 2012-10-30 17:29:15 -0500 (Tue, 30 Oct 2012) | 31 lines

  chan_misdn: Fix loss of B channels if L1 is down.

  If you make 2 calls out an NT PTMP port which is not connected to any
  phone, the B channel associated with that call becomes unusable until
  Asterisk is restarted.

  The problem is the EVENT_SETUP is queued when L1 is not up in
  misdn_lib_send_event().  If L1 cannot be activated the event won't be
  dequeued.  It gets even worse when the call is hung up.  The queued
  EVENT_SETUP will be overwritten by an EVENT_DISCONNECT.  The reserved B
  channel then will never be freed.  If later someone connects a phone to
  the port, L1 will eventually activate and the queued EVENT_DISCONNECT is
  sent down the stack.  However, it is ignored because it is the wrong call
  state.

  The real fix would be that activation and queueing for a new SETUP is done
  by the NT stack.  But since it doesn't, the workaround must be removed
  because it doesn't always work.

  Fix: The event is no longer queued but immediately sent to the stack.  If
  L1 cannot be activated, the L3 state machine that was started by the
  EVENT_SETUP will do its work, i.e.  a timeout will release the B channel
  properly.  The SETUP possibly cannot be sent the first time but is resent
  by T303 in case L1 could be activated.

  Patches:
	patch05_bchan-loss.diff (license #6372) patch uploaded by Guenther Kelleter
	Modified

  JIRA ABE-2888

........
  r375524 | rmudgett | 2012-10-30 18:26:05 -0500 (Tue, 30 Oct 2012) | 13 lines

  chan_misdn: Remove some calls to exit().

  Try proper cleanup when something goes wrong in misdn_lib_init().
  Especially do not call exit()!

  * Fix memory leak because stack_destroy() does not free the stack struct.

  Patches:
	patch06_cleanup-init.diff (license #6372) patch uploaded by Guenther Kelleter
	Modified

  JIRA ABE-2888
........

Merged revisions 375519-375524 from https://origsvn.digium.com/svn/asterisk/be/branches/C.3-bier


git-svn-id: http://svn.asterisk.org/svn/asterisk/branches/1.8@375625 f38db490-d61c-443f-a65b-d21fe96a405b