Add HANGUPCAUSE information to callee channels

This adds HANGUPCAUSE information to called channels so that hangup
handlers can, in conjunction with predial dialplan execution, access
the hangupcause information when the dialed channel hangs up on a
one-to-one basis instead of a many-to-one basis as with HANGUPCAUSE
usage on the caller channel.

Review: https://reviewboard.asterisk.org/r/2069/
(closes issue ASTERISK-20198)


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@371258 65c4cc65-6c06-0410-ace0-fbb531ad65f3
certified/11.2
Kinsey Moore 13 years ago
parent 121495f7a9
commit d7fbceb55b

@ -4248,6 +4248,7 @@ static void dahdi_r2_on_call_disconnect(openr2_chan_t *r2chan, openr2_call_disco
ast_copy_string(cause_code->chan_name, ast_channel_name(p->owner), AST_CHANNEL_NAME);
ast_copy_string(cause_code->code, cause_str, datalen + 1 - sizeof(*cause_code));
ast_queue_control_data(p->owner, AST_CONTROL_PVT_CAUSE_CODE, cause_code, datalen);
ast_channel_hangupcause_hash_set(p->owner, cause_code, datalen);
/* when we have an owner we don't call dahdi_r2_disconnect_call here, that will
be done in dahdi_hangup */

@ -10237,7 +10237,12 @@ static int socket_process_helper(struct iax2_thread *thread)
cause_code->ast_cause = ies.causecode;
snprintf(cause_code->code, data_size - sizeof(*cause_code) + 1, "IAX2 %s(%d)", subclass, ies.causecode);
iax2_queue_control_data(fr->callno, AST_CONTROL_PVT_CAUSE_CODE, cause_code, data_size);
iax2_lock_owner(fr->callno);
if (iaxs[fr->callno] && iaxs[fr->callno]->owner) {
ast_queue_control_data(iaxs[fr->callno]->owner, AST_CONTROL_PVT_CAUSE_CODE, cause_code, data_size);
ast_channel_hangupcause_hash_set(iaxs[fr->callno]->owner, cause_code, data_size);
ast_channel_unlock(iaxs[fr->callno]->owner);
}
if (!iaxs[fr->callno]) {
ast_variables_destroy(ies.vars);
ast_mutex_unlock(&iaxsl[fr->callno]);

@ -27207,6 +27207,7 @@ static int handle_incoming(struct sip_pvt *p, struct sip_request *req, struct as
}
ast_queue_control_data(p->owner, AST_CONTROL_PVT_CAUSE_CODE, cause_code, data_size);
ast_channel_hangupcause_hash_set(p->owner, cause_code, data_size);
}
handle_response(p, respid, e + len, req, seqno);

@ -2819,6 +2819,7 @@ static struct ast_frame *__analog_handle_event(struct analog_pvt *p, struct ast_
cause_code->ast_cause = AST_CAUSE_NETWORK_OUT_OF_ORDER;
case ANALOG_EVENT_ONHOOK:
ast_queue_control_data(ast, AST_CONTROL_PVT_CAUSE_CODE, cause_code, data_size);
ast_channel_hangupcause_hash_set(ast, cause_code, data_size);
switch (p->sig) {
case ANALOG_SIG_FXOLS:
case ANALOG_SIG_FXOGS:
@ -3498,6 +3499,7 @@ winkflashdone:
if (p->hanguponpolarityswitch) {
ast_debug(1, "HangingUp on polarity switch! channel %d\n", p->channel);
ast_queue_control_data(ast, AST_CONTROL_PVT_CAUSE_CODE, cause_code, data_size);
ast_channel_hangupcause_hash_set(ast, cause_code, data_size);
ast_softhangup(p->owner, AST_SOFTHANGUP_EXPLICIT);
p->polarity = POLARITY_IDLE;
} else {

@ -1300,6 +1300,7 @@ static void pri_queue_pvt_cause_data(struct sig_pri_span *pri, int chanpos, cons
ast_copy_string(cause_code->chan_name, ast_channel_name(chan), AST_CHANNEL_NAME);
ast_copy_string(cause_code->code, cause, datalen + 1 - sizeof(*cause_code));
ast_queue_control_data(chan, AST_CONTROL_PVT_CAUSE_CODE, cause_code, datalen);
ast_channel_hangupcause_hash_set(chan, cause_code, datalen);
ast_channel_unlock(chan);
}
}

@ -397,6 +397,7 @@ static void ss7_queue_pvt_cause_data(struct ast_channel *owner, const char *caus
ast_copy_string(cause_code->chan_name, ast_channel_name(owner), AST_CHANNEL_NAME);
ast_copy_string(cause_code->code, cause, datalen + 1 - sizeof(*cause_code));
ast_queue_control_data(owner, AST_CONTROL_PVT_CAUSE_CODE, cause_code, datalen);
ast_channel_hangupcause_hash_set(owner, cause_code, datalen);
}

Loading…
Cancel
Save