summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorKinsey Moore <kmoore@digium.com>2012-05-14 19:44:27 +0000
committerKinsey Moore <kmoore@digium.com>2012-05-14 19:44:27 +0000
commitb5a6de76fc71e3f604761885dd844975a11893ee (patch)
tree5a8f74f510374ec3768b4e778a797b529133cb8a /main
parentfef9a32fb410b47da4cb195f0af2f63f8cac0f03 (diff)
Commit framework for HANGUPCAUSE (replacement for SIP_CAUSE)
This is the starting point for the Asterisk 11: Who Hung Up work and provides a framework which will allow channel drivers to report the types of hangup cause information available in SIP_CAUSE without incurring the overhead of the MASTER_CHANNEL dialplan function. The initial implementation only includes cause generation for chan_sip and does not include cause code translation utilities. This change deprecates SIP_CAUSE and replaces its method of reporting cause codes with the new framework. This change also deprecates the 'storesipcause' option in sip.conf. Review: https://reviewboard.asterisk.org/r/1822/ (Closes issue SWP-4221) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@366408 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main')
-rw-r--r--main/channel.c19
-rw-r--r--main/dial.c3
-rw-r--r--main/features.c5
-rw-r--r--main/file.c1
-rw-r--r--main/rtp_engine.c6
5 files changed, 34 insertions, 0 deletions
diff --git a/main/channel.c b/main/channel.c
index dfb31e1f3..e46aa3a79 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -3444,6 +3444,7 @@ int ast_waitfordigit_full(struct ast_channel *c, int ms, int audiofd, int cmdfd)
ast_frfree(f);
ast_clear_flag(ast_channel_flags(c), AST_FLAG_END_DTMF_ONLY);
return -1;
+ case AST_CONTROL_PVT_CAUSE_CODE:
case AST_CONTROL_RINGING:
case AST_CONTROL_ANSWER:
case AST_CONTROL_SRCUPDATE:
@@ -4171,6 +4172,7 @@ static int attribute_const is_visible_indication(enum ast_control_frame_type con
case AST_CONTROL_END_OF_Q:
case AST_CONTROL_MCID:
case AST_CONTROL_UPDATE_RTP_PEER:
+ case AST_CONTROL_PVT_CAUSE_CODE:
break;
case AST_CONTROL_INCOMPLETE:
@@ -4334,6 +4336,21 @@ int ast_indicate_data(struct ast_channel *chan, int _condition,
case AST_CONTROL_CONGESTION:
ts = ast_get_indication_tone(ast_channel_zone(chan), "congestion");
break;
+ case AST_CONTROL_PVT_CAUSE_CODE:
+ {
+ char causevar[256];
+ const struct ast_control_pvt_cause_code *cause_code = data;
+
+ snprintf(causevar, sizeof(causevar), "HASH(HANGUPCAUSE,%s)", cause_code->chan_name);
+ ast_func_write(chan, causevar, cause_code->code);
+ 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);
+ }
+
+ res = 0;
+ break;
+ }
case AST_CONTROL_PROGRESS:
case AST_CONTROL_PROCEEDING:
case AST_CONTROL_VIDUPDATE:
@@ -5481,6 +5498,7 @@ struct ast_channel *__ast_request_and_dial(const char *type, struct ast_format_c
break;
/* Ignore these */
+ case AST_CONTROL_PVT_CAUSE_CODE:
case AST_CONTROL_PROGRESS:
case AST_CONTROL_PROCEEDING:
case AST_CONTROL_HOLD:
@@ -7172,6 +7190,7 @@ static enum ast_bridge_result ast_generic_bridge(struct ast_channel *c0, struct
int bridge_exit = 0;
switch (f->subclass.integer) {
+ case AST_CONTROL_PVT_CAUSE_CODE:
case AST_CONTROL_AOC:
case AST_CONTROL_MCID:
ast_indicate_data(other, f->subclass.integer, f->data.ptr, f->datalen);
diff --git a/main/dial.c b/main/dial.c
index 251eab9ba..39b837b2a 100644
--- a/main/dial.c
+++ b/main/dial.c
@@ -467,6 +467,9 @@ static void handle_frame(struct ast_dial *dial, struct ast_dial_channel *channel
case AST_CONTROL_OFFHOOK:
case AST_CONTROL_FLASH:
break;
+ case AST_CONTROL_PVT_CAUSE_CODE:
+ ast_indicate_data(chan, AST_CONTROL_PVT_CAUSE_CODE, fr->data.ptr, fr->datalen);
+ break;
case -1:
/* Prod the channel */
ast_indicate(chan, -1);
diff --git a/main/features.c b/main/features.c
index cbf7c1f42..433c1a647 100644
--- a/main/features.c
+++ b/main/features.c
@@ -3943,6 +3943,10 @@ static struct ast_channel *feature_request_and_dial(struct ast_channel *caller,
ast_frfree(f);
ready=1;
break;
+ } else if (f->subclass.integer == AST_CONTROL_PVT_CAUSE_CODE) {
+ ast_indicate_data(caller, AST_CONTROL_PVT_CAUSE_CODE, f->data.ptr, f->datalen);
+ ast_frfree(f);
+ break;
} else if (f->subclass.integer == AST_CONTROL_CONNECTED_LINE) {
if (caller_hungup) {
struct ast_party_connected_line connected;
@@ -4463,6 +4467,7 @@ int ast_bridge_call(struct ast_channel *chan, struct ast_channel *peer, struct a
ast_indicate_data(other, f->subclass.integer, f->data.ptr, f->datalen);
}
break;
+ case AST_CONTROL_PVT_CAUSE_CODE:
case AST_CONTROL_AOC:
case AST_CONTROL_HOLD:
case AST_CONTROL_UNHOLD:
diff --git a/main/file.c b/main/file.c
index c4db7b639..52f5af58d 100644
--- a/main/file.c
+++ b/main/file.c
@@ -1356,6 +1356,7 @@ static int waitstream_core(struct ast_channel *c, const char *breakon,
case AST_CONTROL_REDIRECTING:
case AST_CONTROL_AOC:
case AST_CONTROL_UPDATE_RTP_PEER:
+ case AST_CONTROL_PVT_CAUSE_CODE:
case -1:
/* Unimportant */
break;
diff --git a/main/rtp_engine.c b/main/rtp_engine.c
index 681029ffb..522ed0db1 100644
--- a/main/rtp_engine.c
+++ b/main/rtp_engine.c
@@ -928,6 +928,9 @@ static enum ast_bridge_result local_bridge_loop(struct ast_channel *c0, struct a
ast_indicate_data(other, fr->subclass.integer, fr->data.ptr, fr->datalen);
}
ast_frfree(fr);
+ } else if (fr->subclass.integer == AST_CONTROL_PVT_CAUSE_CODE) {
+ ast_indicate_data(other, fr->subclass.integer, fr->data.ptr, fr->datalen);
+ ast_frfree(fr);
} else {
*fo = fr;
*rc = who;
@@ -1219,6 +1222,9 @@ static enum ast_bridge_result remote_bridge_loop(struct ast_channel *c0,
ast_indicate_data(other, fr->subclass.integer, fr->data.ptr, fr->datalen);
}
ast_frfree(fr);
+ } else if (fr->subclass.integer == AST_CONTROL_PVT_CAUSE_CODE) {
+ ast_indicate_data(other, fr->subclass.integer, fr->data.ptr, fr->datalen);
+ ast_frfree(fr);
} else {
*fo = fr;
*rc = who;