diff options
author | Kinsey Moore <kmoore@digium.com> | 2012-07-20 15:48:55 +0000 |
---|---|---|
committer | Kinsey Moore <kmoore@digium.com> | 2012-07-20 15:48:55 +0000 |
commit | cb9756daa2042d6e5b91290def004b0f0c9eb168 (patch) | |
tree | 9ea585c25213ade435c83c95a055082f1e291f2a /main/channel.c | |
parent | 499a445af213b1cbce99db9219f041ef053fbc18 (diff) |
Add hangupcause translation support
The HANGUPCAUSE hash (trunk only) meant to replace SIP_CAUSE has now
been replaced with the HANGUPCAUSE and HANGUPCAUSE_KEYS dialplan
functions to better facilitate access to the AST_CAUSE translations
for technology-specific cause codes. The HangupCauseClear application
has also been added to remove this data from the channel.
(closes issue SWP-4738)
Review: https://reviewboard.asterisk.org/r/2025/
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@370316 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/channel.c')
-rw-r--r-- | main/channel.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/main/channel.c b/main/channel.c index 6b4f8b721..f2660e1fd 100644 --- a/main/channel.c +++ b/main/channel.c @@ -4298,12 +4298,14 @@ static int attribute_const is_visible_indication(enum ast_control_frame_type con return 0; } -void ast_channel_hangupcause_hash_set(struct ast_channel *chan, const struct ast_control_pvt_cause_code *cause_code) +void ast_channel_hangupcause_hash_set(struct ast_channel *chan, const struct ast_control_pvt_cause_code *cause_code, int datalen) { char causevar[256]; - snprintf(causevar, sizeof(causevar), "HASH(HANGUPCAUSE,%s)", cause_code->chan_name); - ast_func_write(chan, causevar, cause_code->code); + if (ast_channel_dialed_causes_add(chan, cause_code, datalen)) { + ast_log(LOG_WARNING, "Unable to store hangup cause for %s on %s\n", cause_code->chan_name, ast_channel_name(chan)); + } + if (cause_code->emulate_sip_cause) { snprintf(causevar, sizeof(causevar), "HASH(SIP_CAUSE,%s)", cause_code->chan_name); ast_func_write(chan, causevar, cause_code->code); @@ -4455,7 +4457,7 @@ int ast_indicate_data(struct ast_channel *chan, int _condition, ts = ast_get_indication_tone(ast_channel_zone(chan), "congestion"); break; case AST_CONTROL_PVT_CAUSE_CODE: - ast_channel_hangupcause_hash_set(chan, data); + ast_channel_hangupcause_hash_set(chan, data, datalen); res = 0; break; case AST_CONTROL_PROGRESS: @@ -5602,7 +5604,7 @@ struct ast_channel *__ast_request_and_dial(const char *type, struct ast_format_c break; case AST_CONTROL_PVT_CAUSE_CODE: - ast_channel_hangupcause_hash_set(chan, f->data.ptr); + ast_channel_hangupcause_hash_set(chan, f->data.ptr, f->datalen); break; /* Ignore these */ |