[asterisk-commits] rmudgett: branch rmudgett/bridge_phase r393381 - in /team/rmudgett/bridge_pha...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Jul 1 17:48:57 CDT 2013
Author: rmudgett
Date: Mon Jul 1 17:48:54 2013
New Revision: 393381
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=393381
Log:
Add automatic recording of agent calls by triggering automixmon at the start of the call.
Modified:
team/rmudgett/bridge_phase/apps/app_agent_pool.c
team/rmudgett/bridge_phase/configs/agents.conf.sample
team/rmudgett/bridge_phase/include/asterisk/bridging_features.h
team/rmudgett/bridge_phase/main/bridging.c
Modified: team/rmudgett/bridge_phase/apps/app_agent_pool.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/bridge_phase/apps/app_agent_pool.c?view=diff&rev=393381&r1=393380&r2=393381
==============================================================================
--- team/rmudgett/bridge_phase/apps/app_agent_pool.c (original)
+++ team/rmudgett/bridge_phase/apps/app_agent_pool.c Mon Jul 1 17:48:54 2013
@@ -212,10 +212,6 @@
AST_STRING_FIELD(beep_sound);
/*! MOH class to use while agent waiting for call. */
AST_STRING_FIELD(moh);
- /*! Absolute recording filename directory. (Made to start and end with '/') */
- AST_STRING_FIELD(save_calls_in);
- /*! Recording format filename extension. */
- AST_STRING_FIELD(record_format);
);
/*!
* \brief Number of seconds for agent to ack a call before being logged off.
@@ -236,7 +232,7 @@
* \note The channel variable AGENTACKCALL overrides on login.
*/
int ack_call;
- /*! TRUE if agent calls are recorded. */
+ /*! TRUE if agent calls are automatically recorded. */
int record_agent_calls;
};
@@ -390,39 +386,6 @@
.post_apply_config = agents_post_apply_config,
);
-/*!
- * \internal
- * \brief Handle the agent savecallsin option.
- * \since 12.0.0
- *
- * \param opt The option being configured
- * \param var The config variable to use to configure \a obj
- * \param obj The object to be configured
- *
- * \retval 0 on success.
- * \retval -1 on error.
- */
-static int agent_savecallsin_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
-{
- struct agent_cfg *cfg = obj;
- size_t len;
- int need_leading;
- int need_trailing;
-
- if (ast_strlen_zero(var->value)) {
- ast_string_field_set(cfg, save_calls_in, "");
- return 0;
- }
-
- /* Add a leading and/or trailing '/' if needed. */
- len = strlen(var->value);
- need_leading = var->value[0] != '/';
- need_trailing = var->value[len - 1] != '/';
- ast_string_field_build(cfg, save_calls_in, "%s%s%s",
- need_leading ? "/" : "", var->value, need_trailing ? "/" : "");
- return 0;
-}
-
static void destroy_config(void)
{
ao2_global_obj_release(cfg_handle);
@@ -442,8 +405,6 @@
aco_option_register(&cfg_info, "wrapuptime", ACO_EXACT, agent_types, "0", OPT_UINT_T, 0, FLDSET(struct agent_cfg, wrapup_time));
aco_option_register(&cfg_info, "musiconhold", ACO_EXACT, agent_types, "default", OPT_STRINGFIELD_T, 0, STRFLDSET(struct agent_cfg, moh));
aco_option_register(&cfg_info, "recordagentcalls", ACO_EXACT, agent_types, "no", OPT_BOOL_T, 1, FLDSET(struct agent_cfg, record_agent_calls));
- aco_option_register(&cfg_info, "recordformat", ACO_EXACT, agent_types, "wav", OPT_STRINGFIELD_T, 1, STRFLDSET(struct agent_cfg, record_format));
- aco_option_register_custom(&cfg_info, "savecallsin", ACO_EXACT, agent_types, "", agent_savecallsin_handler, 0);
aco_option_register(&cfg_info, "custom_beep", ACO_EXACT, agent_types, "beep", OPT_STRINGFIELD_T, 1, STRFLDSET(struct agent_cfg, beep_sound));
aco_option_register(&cfg_info, "fullname", ACO_EXACT, agent_types, NULL, OPT_STRINGFIELD_T, 0, STRFLDSET(struct agent_cfg, full_name));
@@ -905,8 +866,10 @@
static void agent_connect_caller(struct ast_bridge_channel *bridge_channel, struct agent_pvt *agent)
{
struct ast_bridge *caller_bridge;
+ int record_agent_calls;
int res;
+ record_agent_calls = agent->cfg->record_agent_calls;
caller_bridge = agent->caller_bridge;
agent->caller_bridge = NULL;
agent->state = AGENT_STATE_ON_CALL;
@@ -927,6 +890,12 @@
return;
}
ast_bridge_channel_write_control_data(bridge_channel, AST_CONTROL_ANSWER, NULL, 0);
+
+ if (record_agent_calls) {
+ /* The agent is in the new bridge so we can invoke the mixmonitor hook. */
+ ast_bridge_features_do(AST_BRIDGE_BUILTIN_AUTOMIXMON, caller_bridge,
+ bridge_channel, NULL);
+ }
}
static int bridge_agent_hold_ack(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, void *hook_pvt)
@@ -2188,7 +2157,6 @@
ast_str_append(&out, 0, "Beep: %s\n", agent->cfg->beep_sound);
ast_str_append(&out, 0, "MOH: %s\n", agent->cfg->moh);
ast_str_append(&out, 0, "RecordCalls: %s\n", AST_CLI_YESNO(agent->cfg->record_agent_calls));
- ast_str_append(&out, 0, "SaveCallsIn: %s\n", agent->cfg->save_calls_in);
ast_str_append(&out, 0, "State: %s\n", ast_devstate_str(agent->devstate));
if (logged) {
const char *talking_with;
@@ -2423,8 +2391,6 @@
res |= ast_register_application_xml(app_agent_login, agent_login_exec);
res |= ast_register_application_xml(app_agent_request, agent_request_exec);
-/* BUGBUG agent call recording not written. */
-
if (res) {
unload_module();
return AST_MODULE_LOAD_FAILURE;
Modified: team/rmudgett/bridge_phase/configs/agents.conf.sample
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/bridge_phase/configs/agents.conf.sample?view=diff&rev=393381&r1=393380&r2=393381
==============================================================================
--- team/rmudgett/bridge_phase/configs/agents.conf.sample (original)
+++ team/rmudgett/bridge_phase/configs/agents.conf.sample Mon Jul 1 17:48:54 2013
@@ -23,7 +23,7 @@
; Set what DTMF key sequence the agent should use to acknowledge a call.
; The channel variable AGENTACCEPTDTMF overrides on login.
; Default is "#".
-;acceptdtmf=#
+;acceptdtmf=##
;
; Set the minimum amount of time after disconnecting a call before
; the agent can receive a new call in milliseconds.
@@ -35,19 +35,11 @@
; Default is "default".
;musiconhold=default
;
-; Enable recording calls the agent takes.
+; Enable recording calls the agent takes automatically by invoking the
+; DTMF automixmon feature when the agent connects to a caller.
+; See features.conf.sample for information about the automixmon feature.
; Default is "no".
;recordagentcalls=yes
-;
-; The format used to record the calls: wav, gsm, wav49.
-; Default is "wav".
-;recordformat=gsm
-;
-; Set the absolute directory to save the agent's conversations in.
-; Default is "".
-; An empty string becomes asterisk.conf's astspooldir/monitor
-; which resolves to /var/spool/asterisk/monitor by default.
-;savecallsin=/var/calls
;
; A custom beep sound file to play to the agent.
; Default is "beep".
Modified: team/rmudgett/bridge_phase/include/asterisk/bridging_features.h
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/bridge_phase/include/asterisk/bridging_features.h?view=diff&rev=393381&r1=393380&r2=393381
==============================================================================
--- team/rmudgett/bridge_phase/include/asterisk/bridging_features.h (original)
+++ team/rmudgett/bridge_phase/include/asterisk/bridging_features.h Mon Jul 1 17:48:54 2013
@@ -330,6 +330,26 @@
int ast_bridge_features_unregister(enum ast_bridge_builtin_feature feature);
/*!
+ * \brief Invoke a built in feature hook now.
+ *
+ * \param feature The feature to invoke
+ *
+ * \note This API call is only meant to be used by bridge
+ * subclasses and hook callbacks to request a builtin feature
+ * hook to be executed.
+ *
+ * \retval 0 on success
+ * \retval -1 on failure
+ *
+ * Example usage:
+ *
+ * \code
+ * ast_bridge_features_do(AST_BRIDGE_BUILTIN_ATTENDED_TRANSFER, bridge, bridge_channel, hook_pvt);
+ * \endcode
+ */
+int ast_bridge_features_do(enum ast_bridge_builtin_feature feature, struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, void *hook_pvt);
+
+/*!
* \brief Attach interval hooks to a bridge features structure
*
* \param features Bridge features structure
Modified: team/rmudgett/bridge_phase/main/bridging.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/bridge_phase/main/bridging.c?view=diff&rev=393381&r1=393380&r2=393381
==============================================================================
--- team/rmudgett/bridge_phase/main/bridging.c (original)
+++ team/rmudgett/bridge_phase/main/bridging.c Mon Jul 1 17:48:54 2013
@@ -5107,6 +5107,23 @@
return 0;
}
+int ast_bridge_features_do(enum ast_bridge_builtin_feature feature, struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, void *hook_pvt)
+{
+ ast_bridge_hook_callback callback;
+
+ if (ARRAY_LEN(builtin_features_handlers) <= feature) {
+ return -1;
+ }
+
+ callback = builtin_features_handlers[feature];
+ if (!callback) {
+ return -1;
+ }
+ callback(bridge, bridge_channel, hook_pvt);
+
+ return 0;
+}
+
int ast_bridge_interval_register(enum ast_bridge_builtin_interval interval, ast_bridge_builtin_set_limits_fn callback)
{
if (ARRAY_LEN(builtin_interval_handlers) <= interval
More information about the asterisk-commits
mailing list