Fix a bug in 1.4 branch with iax2 channels not being removed when a call was rejected (from the calling box, not the box that denied the

registration). Related to revisions 132466 in trunk, and 132467 in 1.6.0. Earlier I had accidently tested 1.4 with a backport from those revisions, 
so I didn't see this problem (oops).


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@132506 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.4
Brett Bryant 18 years ago
parent 00228e42d0
commit 2172cc71b1

@ -3406,17 +3406,15 @@ static int iax2_call(struct ast_channel *c, char *dest, int timeout)
static int iax2_hangup(struct ast_channel *c)
{
unsigned short callno = PTR_TO_CALLNO(c->tech_pvt);
int alreadygone;
struct iax_ie_data ied;
memset(&ied, 0, sizeof(ied));
ast_mutex_lock(&iaxsl[callno]);
if (callno && iaxs[callno]) {
if (option_debug)
ast_log(LOG_DEBUG, "We're hanging up %s now...\n", c->name);
alreadygone = ast_test_flag(iaxs[callno], IAX_ALREADYGONE);
/* Send the hangup unless we have had a transmission error or are already gone */
iax_ie_append_byte(&ied, IAX_IE_CAUSECODE, (unsigned char)c->hangupcause);
if (!iaxs[callno]->error && !alreadygone) {
if (!iaxs[callno]->error && !ast_test_flag(iaxs[callno], IAX_ALREADYGONE)) {
send_command_final(iaxs[callno], AST_FRAME_IAX, IAX_COMMAND_HANGUP, 0, ied.buf, ied.pos, -1);
if (!iaxs[callno]) {
ast_mutex_unlock(&iaxsl[callno]);
@ -3426,7 +3424,7 @@ static int iax2_hangup(struct ast_channel *c)
/* Explicitly predestroy it */
iax2_predestroy(callno);
/* If we were already gone to begin with, destroy us now */
if (alreadygone && iaxs[callno]) {
if (iaxs[callno]) {
if (option_debug)
ast_log(LOG_DEBUG, "Really destroying %s now...\n", c->name);
iax2_destroy(callno);

Loading…
Cancel
Save