stasis: Fix dial masquerade datastore lifetime
authorJoshua Colp <jcolp@digium.com>
Mon, 4 May 2015 17:16:24 +0000 (14:16 -0300)
committerJoshua Colp <jcolp@digium.com>
Tue, 5 May 2015 10:38:38 +0000 (05:38 -0500)
commit11f650c6ac3a1ead92e0030170f5851532c2c073
tree6465413a3e3fdbcc44483d5908bae378302a1284
parentce21776aae2866f3c611f172c4d38fb53e806dcf
stasis: Fix dial masquerade datastore lifetime

A recent change went into Asterisk which added reference counts to the
channels stored in a dial masquerade datastore. Unfortunately this
included a reference to the caller in a dialing operation. While all
of the dialed targets have the datastore removed from them upon dialing
completion this did not occur for the caller, causing it to have a
reference to itself that could go never go away (as it depended on
the destruction of the datastore which only happened when the channel
was destroyed). This resulted in the caller channel remaining on the
system despite it having hung up.

This change does the following to fix this issue:

1. The dial masquerade datastore is now removed from the caller upon
dialing completion, just like the dialed targets.
2. Upon destruction of the caller all the dialed targets are also
removed from the dial masquerade datastore (just in case).
3. The reference to the caller has been removed as it should not be
possible for the datastore to now be valid/useful after the lifetime
of the caller has ended.

ASTERISK-25025 #close

Change-Id: I1ef4ca5ca04980028604cc2af5d2992ac3431b3f
main/stasis_channels.c