diff options
author | Automerge script <automerge@asterisk.org> | 2012-12-09 02:20:13 +0000 |
---|---|---|
committer | Automerge script <automerge@asterisk.org> | 2012-12-09 02:20:13 +0000 |
commit | 75559a4c429db8e41d59a4ac6bd4a4757a530b2f (patch) | |
tree | e9aa9f4822ed87a02a4dc7d885570b7e161c4666 | |
parent | 0f7943c48ab5d93bf8cce73b54fc0852ab4404ba (diff) |
Merged revisions 377463 via svnmerge from
file:///srv/subversion/repos/asterisk/trunk
................
r377463 | file | 2012-12-08 19:23:44 -0600 (Sat, 08 Dec 2012) | 9 lines
Add missing support for "who hung up" to chan_motif.
(closes issue ASTERISK-20671)
Reported by: Matt Jordan
Review: https://reviewboard.asterisk.org/r/2208/
........
Merged revisions 377462 from http://svn.asterisk.org/svn/asterisk/branches/11
................
git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@377468 65c4cc65-6c06-0410-ace0-fbb531ad65f3
-rw-r--r-- | channels/chan_motif.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/channels/chan_motif.c b/channels/chan_motif.c index 0b07ed158..cc1e370fd 100644 --- a/channels/chan_motif.c +++ b/channels/chan_motif.c @@ -2360,6 +2360,8 @@ static void jingle_action_session_terminate(struct jingle_endpoint *endpoint, st struct ast_channel *chan; iks *reason, *text; int cause = AST_CAUSE_NORMAL; + struct ast_control_pvt_cause_code *cause_code; + int data_size = sizeof(*cause_code); if (!session) { jingle_send_error_response(endpoint->connection, pak, "cancel", "item-not-found xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'", @@ -2377,6 +2379,10 @@ static void jingle_action_session_terminate(struct jingle_endpoint *endpoint, st if ((reason = iks_find(pak->query, "reason")) && (text = iks_child(reason))) { int i; + /* Size of the string making up the cause code is "Motif " + text */ + data_size += 6 + strlen(iks_name(text)); + cause_code = ast_malloc(data_size); + /* Get the appropriate cause code mapping for this reason */ for (i = 0; i < ARRAY_LEN(jingle_reason_mappings); i++) { if (!strcasecmp(jingle_reason_mappings[i].reason, iks_name(text))) { @@ -2384,8 +2390,21 @@ static void jingle_action_session_terminate(struct jingle_endpoint *endpoint, st break; } } + + /* Store the technology specific information */ + snprintf(cause_code->code, data_size - sizeof(*cause_code) + 1, "Motif %s", iks_name(text)); + } else { + /* No technology specific information is available */ + cause_code = ast_malloc(data_size); } + ast_copy_string(cause_code->chan_name, ast_channel_name(chan), AST_CHANNEL_NAME); + cause_code->ast_cause = cause; + ast_queue_control_data(chan, AST_CONTROL_PVT_CAUSE_CODE, cause_code, data_size); + ast_channel_hangupcause_hash_set(chan, cause_code, data_size); + + ast_free(cause_code); + ast_debug(3, "Hanging up channel '%s' due to session terminate message with cause '%d'\n", ast_channel_name(chan), cause); ast_queue_hangup_with_cause(chan, cause); session->gone = 1; |