asterisk/apps
Matthew Jordan d42b116925 main/cdrs: Preserve context/extension when executing a Macro or GoSub
The context/extension in a CDR is generally considered the destination of a
call. When looking at a 2-party call CDR, users will typically be presented
with the following:

context    exten      channel     dest_channel app  data
default    1000       SIP/8675309 SIP/1000     Dial SIP/1000,,20

However, if the Dial actually takes place in a Macro, the current behaviour
in 12 will result in the following CDR:

context    exten      channel     dest_channel app  data
macro-dial s          SIP/8675309 SIP/1000     Dial SIP/1000,,20

The same is true of a GoSub:

context    exten      channel     dest_channel app  data
subs       dial_stuff SIP/8675309 SIP/1000     Dial SIP/1000,,20

This generally makes the context/exten fields less than useful.

It isn't hard to preserve these values in the CDR state machine; however, we
need to have something that informs us when a channel is executing a
subroutine. Prior to this patch, there isn't anything that does this.

This patch solves this problem by adding a new channel flag,
AST_FLAG_SUBROUTINE_EXEC. This flag is set on a channel when it executes a
Macro or a GoSub. The CDR engine looks for this value when updating a Party A
snapshot; if the flag is present, we don't override the context/exten on the
main CDR object. In a funny quirk, executing a hangup handler must *not* abide
by this logic, as the endbeforehexten logic assumes that the user wants to see
data that occurs in hangup logic, which includes those subroutines. Since
those execute outside of a typical Dial operation (and will typically have
their own dedicated CDR anyway), this is unlikely to cause any heartburn.

Review: https://reviewboard.asterisk.org/r/3962/

ASTERISK-24254 #close
Reported by: tm1000, Tony Lewis
Tested by: Tony Lewis
........

Merged revisions 422718 from http://svn.asterisk.org/svn/asterisk/branches/12
........

Merged revisions 422719 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@422720 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-09-05 22:04:33 +00:00
..
confbridge confbridge: Add 'Admin' param to join, leave, mute, unmute and talking events 2014-08-27 17:30:51 +00:00
Makefile Moved core logic from app_stasis to res_stasis 2013-04-15 16:43:47 +00:00
app_adsiprog.c Add module support level to ast_module_info structure. Print it in CLI "module show" . 2014-07-25 16:47:17 +00:00
app_agent_pool.c Add module support level to ast_module_info structure. Print it in CLI "module show" . 2014-07-25 16:47:17 +00:00
app_alarmreceiver.c Add module support level to ast_module_info structure. Print it in CLI "module show" . 2014-07-25 16:47:17 +00:00
app_amd.c Add module support level to ast_module_info structure. Print it in CLI "module show" . 2014-07-25 16:47:17 +00:00
app_authenticate.c Update Asterisk's CDRs for the new bridging framework 2013-06-17 03:00:38 +00:00
app_bridgewait.c app_bridgewait: Remove possibility of race condition between channels leaving/joining. 2014-07-25 10:54:49 +00:00
app_cdr.c CDRs: Synchronize dialplan applications that manipulate CDRs with the engine 2014-01-12 22:13:12 +00:00
app_celgenuserevent.c Add module support level to ast_module_info structure. Print it in CLI "module show" . 2014-07-25 16:47:17 +00:00
app_chanisavail.c Add module support level to ast_module_info structure. Print it in CLI "module show" . 2014-07-25 16:47:17 +00:00
app_channelredirect.c Merge in the bridge_construction branch to make the system use the Bridging API. 2013-05-21 18:00:22 +00:00
app_chanspy.c Bridges: Fix feature interruption/unintended kick caused by external actions 2014-08-13 16:24:37 +00:00
app_confbridge.c confbridge: Add Duration to ConfbridgeList event 2014-08-30 17:33:08 +00:00
app_controlplayback.c Add ControlPlayback manager action 2013-01-22 15:16:20 +00:00
app_dahdiras.c Add module support level to ast_module_info structure. Print it in CLI "module show" . 2014-07-25 16:47:17 +00:00
app_db.c Don't throw a spurious error when using DBdeltree 2013-02-14 03:49:52 +00:00
app_dial.c Improve call forwarding reporting, especially with regards to ARI. 2014-08-18 00:57:01 +00:00
app_dictate.c Add module support level to ast_module_info structure. Print it in CLI "module show" . 2014-07-25 16:47:17 +00:00
app_directed_pickup.c PickupChan: Add ability to specify channel uniqueids as well as channel names. 2013-11-22 16:43:21 +00:00
app_directory.c voicemail API callbacks: Extract the sayname API call to its own registerd callback. 2014-06-20 17:06:42 +00:00
app_disa.c app_cdr,app_forkcdr,func_cdr: Synchronize with engine when manipulating state 2013-12-19 00:50:01 +00:00
app_dumpchan.c media formats: re-architect handling of media for performance improvements 2014-07-20 22:06:33 +00:00
app_echo.c media formats: re-architect handling of media for performance improvements 2014-07-20 22:06:33 +00:00
app_exec.c Merged revisions 328247 via svnmerge from 2011-07-14 20:28:54 +00:00
app_externalivr.c Add module support level to ast_module_info structure. Print it in CLI "module show" . 2014-07-25 16:47:17 +00:00
app_fax.c Add module support level to ast_module_info structure. Print it in CLI "module show" . 2014-07-25 16:47:17 +00:00
app_festival.c Add module support level to ast_module_info structure. Print it in CLI "module show" . 2014-07-25 16:47:17 +00:00
app_flash.c Opaquify ast_channel typedefs, fd arrays, and softhangup flag 2012-03-01 22:09:18 +00:00
app_followme.c Add module support level to ast_module_info structure. Print it in CLI "module show" . 2014-07-25 16:47:17 +00:00
app_forkcdr.c Stasis: Allow message types to be blocked 2014-08-06 12:55:28 +00:00
app_getcpeid.c Add module support level to ast_module_info structure. Print it in CLI "module show" . 2014-07-25 16:47:17 +00:00
app_ices.c Add module support level to ast_module_info structure. Print it in CLI "module show" . 2014-07-25 16:47:17 +00:00
app_image.c Add module support level to ast_module_info structure. Print it in CLI "module show" . 2014-07-25 16:47:17 +00:00
app_ivrdemo.c Add module support level to ast_module_info structure. Print it in CLI "module show" . 2014-07-25 16:47:17 +00:00
app_jack.c Add module support level to ast_module_info structure. Print it in CLI "module show" . 2014-07-25 16:47:17 +00:00
app_macro.c main/cdrs: Preserve context/extension when executing a Macro or GoSub 2014-09-05 22:04:33 +00:00
app_meetme.c apps/app_meetme: Fix crash when publishing MeetMe messages with no channel 2014-08-17 23:29:34 +00:00
app_milliwatt.c media formats: re-architect handling of media for performance improvements 2014-07-20 22:06:33 +00:00
app_minivm.c Add module support level to ast_module_info structure. Print it in CLI "module show" . 2014-07-25 16:47:17 +00:00
app_mixmonitor.c Fix a locking inversion in MixMonitor. 2014-08-22 16:56:57 +00:00
app_morsecode.c Add module support level to ast_module_info structure. Print it in CLI "module show" . 2014-07-25 16:47:17 +00:00
app_mp3.c Add module support level to ast_module_info structure. Print it in CLI "module show" . 2014-07-25 16:47:17 +00:00
app_nbscat.c Add module support level to ast_module_info structure. Print it in CLI "module show" . 2014-07-25 16:47:17 +00:00
app_originate.c media formats: re-architect handling of media for performance improvements 2014-07-20 22:06:33 +00:00
app_osplookup.c Add module support level to ast_module_info structure. Print it in CLI "module show" . 2014-07-25 16:47:17 +00:00
app_page.c uniqueid: channel linkedid, ami, ari object creation with id's 2014-03-07 15:47:55 +00:00
app_playback.c Add module support level to ast_module_info structure. Print it in CLI "module show" . 2014-07-25 16:47:17 +00:00
app_playtones.c ast_channel opaquification of pointers and integral types 2012-02-20 23:43:27 +00:00
app_privacy.c Opaquify ast_channel structs and lists 2012-02-29 16:52:47 +00:00
app_queue.c app_queue: Add RealTime support for queue rules 2014-08-11 00:14:53 +00:00
app_read.c ast_channel opaquification of pointers and integral types 2012-02-20 23:43:27 +00:00
app_readexten.c Opaquify ast_channel structs and lists 2012-02-29 16:52:47 +00:00
app_record.c media formats: re-architect handling of media for performance improvements 2014-07-20 22:06:33 +00:00
app_saycounted.c Add module support level to ast_module_info structure. Print it in CLI "module show" . 2014-07-25 16:47:17 +00:00
app_sayunixtime.c Say: If SAY_DTMF_INTERRUPT is set to an ast_true value, jump on DTMF 2013-11-14 20:32:45 +00:00
app_senddtmf.c Add pause one second W dial modifier. 2012-09-28 18:27:02 +00:00
app_sendtext.c ast_channel opaquification of pointers and integral types 2012-02-20 23:43:27 +00:00
app_setcallerid.c Add module support level to ast_module_info structure. Print it in CLI "module show" . 2014-07-25 16:47:17 +00:00
app_skel.c Add module support level to ast_module_info structure. Print it in CLI "module show" . 2014-07-25 16:47:17 +00:00
app_sms.c Add module support level to ast_module_info structure. Print it in CLI "module show" . 2014-07-25 16:47:17 +00:00
app_softhangup.c ast_channel opaquification of pointers and integral types 2012-02-20 23:43:27 +00:00
app_speech_utils.c datastores: Audit ast_channel_datastore_remove usage. 2014-07-28 18:58:43 +00:00
app_stack.c main/cdrs: Preserve context/extension when executing a Macro or GoSub 2014-09-05 22:04:33 +00:00
app_stasis.c Add module support level to ast_module_info structure. Print it in CLI "module show" . 2014-07-25 16:47:17 +00:00
app_system.c Multiple revisions 369001-369002 2012-06-15 16:20:16 +00:00
app_talkdetect.c Add module support level to ast_module_info structure. Print it in CLI "module show" . 2014-07-25 16:47:17 +00:00
app_test.c Add module support level to ast_module_info structure. Print it in CLI "module show" . 2014-07-25 16:47:17 +00:00
app_transfer.c Documentation: doc fixes across various parts of the code for ASTERISK issues 23061,23028,23046,23027 2014-01-17 17:16:14 +00:00
app_url.c Add module support level to ast_module_info structure. Print it in CLI "module show" . 2014-07-25 16:47:17 +00:00
app_userevent.c ARI: Add ability to raise arbitrary User Events 2014-05-22 16:09:51 +00:00
app_verbose.c Allow Asterisk to compile under GCC 4.10 2014-05-09 22:49:26 +00:00
app_voicemail.c app_voicemail/app: Remove test events that were duplicated by r421059 2014-08-15 15:50:46 +00:00
app_voicemail.exports.in Remove some symbol exports that got missed in the removal of global symbols. 2012-06-15 15:33:41 +00:00
app_waitforring.c Add module support level to ast_module_info structure. Print it in CLI "module show" . 2014-07-25 16:47:17 +00:00
app_waitforsilence.c Add module support level to ast_module_info structure. Print it in CLI "module show" . 2014-07-25 16:47:17 +00:00
app_waituntil.c Merged revisions 328247 via svnmerge from 2011-07-14 20:28:54 +00:00
app_while.c Clean up and ensure proper usage of alloca() 2012-07-31 20:21:43 +00:00
app_zapateller.c Add module support level to ast_module_info structure. Print it in CLI "module show" . 2014-07-25 16:47:17 +00:00
enter.h remove extraneous svn:executable properties 2005-11-29 18:24:39 +00:00
leave.h remove extraneous svn:executable properties 2005-11-29 18:24:39 +00:00