[asterisk-commits] branch bweschke/polycom_acd_functions - r7726 in
/team/bweschke/polycom_acd_f...
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Mon Jan 2 21:51:23 CST 2006
Author: bweschke
Date: Mon Jan 2 21:51:21 2006
New Revision: 7726
URL: http://svn.digium.com/view/asterisk?rev=7726&view=rev
Log:
Fixes. Fixes. Fixes. Polycom SoundPoint phones now pass unit test on ACD login/logout. Ya!
Modified:
team/bweschke/polycom_acd_functions/channel.c
team/bweschke/polycom_acd_functions/channels/chan_agent.c
team/bweschke/polycom_acd_functions/channels/chan_sip.c
team/bweschke/polycom_acd_functions/include/asterisk/agents.h
Modified: team/bweschke/polycom_acd_functions/channel.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/polycom_acd_functions/channel.c?rev=7726&r1=7725&r2=7726&view=diff
==============================================================================
--- team/bweschke/polycom_acd_functions/channel.c (original)
+++ team/bweschke/polycom_acd_functions/channel.c Mon Jan 2 21:51:21 2006
@@ -54,6 +54,7 @@
#include "asterisk/options.h"
#include "asterisk/channel.h"
#include "asterisk/chanspy.h"
+#include "asterisk/agents.h"
#include "asterisk/musiconhold.h"
#include "asterisk/logger.h"
#include "asterisk/say.h"
@@ -3718,10 +3719,18 @@
return group;
}
+static int (*ast_agent_callback_login_ptr)(char *, char *, char *, char *, char *) = NULL;
+static void (*ast_agent_callback_logout_ptr)(char *) = NULL;
+
static int (*ast_moh_start_ptr)(struct ast_channel *, char *) = NULL;
static void (*ast_moh_stop_ptr)(struct ast_channel *) = NULL;
static void (*ast_moh_cleanup_ptr)(struct ast_channel *) = NULL;
+void ast_install_agent_functions(int (*login_ptr)(char *, char *, char *, char *, char*), void (*logout_ptr)(char *))
+{
+ ast_agent_callback_login_ptr = login_ptr;
+ ast_agent_callback_logout_ptr = logout_ptr;
+}
void ast_install_music_functions(int (*start_ptr)(struct ast_channel *, char *),
void (*stop_ptr)(struct ast_channel *),
@@ -3738,6 +3747,27 @@
ast_moh_start_ptr = NULL;
ast_moh_stop_ptr = NULL;
ast_moh_cleanup_ptr = NULL;
+}
+
+/*! \brief Login an agent for later callback */
+int ast_agent_callback_login(char *agent, char *exten, char *context, char *wrapuptime, char *ackcall)
+{
+ if (ast_agent_callback_login_ptr)
+ return ast_agent_callback_login_ptr(agent, exten, context, wrapuptime, ackcall);
+
+ if (option_verbose > 2)
+ ast_verbose(VERBOSE_PREFIX_3 "Agent callback login requested but not callback function registered.\n");
+
+ return 0;
+}
+
+/*! \brief Logout an agent */
+void ast_agent_callback_logout(char *agent)
+{
+
+ if (ast_agent_callback_logout_ptr)
+ return ast_agent_callback_logout_ptr(agent);
+
}
/*! \brief Turn on music on hold on a given channel */
Modified: team/bweschke/polycom_acd_functions/channels/chan_agent.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/polycom_acd_functions/channels/chan_agent.c?rev=7726&r1=7725&r2=7726&view=diff
==============================================================================
--- team/bweschke/polycom_acd_functions/channels/chan_agent.c (original)
+++ team/bweschke/polycom_acd_functions/channels/chan_agent.c Mon Jan 2 21:51:21 2006
@@ -63,6 +63,7 @@
#include "asterisk/file.h"
#include "asterisk/cli.h"
#include "asterisk/app.h"
+#include "asterisk/agents.h"
#include "asterisk/musiconhold.h"
#include "asterisk/manager.h"
#include "asterisk/features.h"
@@ -1500,6 +1501,13 @@
}
return ret;
+}
+
+void callback_agent_logoff(char *agent)
+{
+
+ agent_logoff(agent, 0);
+
}
static int agent_logoff_cmd(int fd, int argc, char **argv)
@@ -2148,7 +2156,7 @@
* @returns
* @sa action_agent_callback_login(), load_module()
*/
-static int agent_callback_login(char *agent, char *exten, char *context, char *wrapuptime, char *ackcall)
+int agent_callback_login(char *agent, char *exten, char *context, char *wrapuptime, char *ackcall)
{
struct agent_pvt *p = NULL;
int login_state = 0;
@@ -2551,6 +2559,7 @@
read_agent_config();
if (persistent_agents)
reload_agents();
+ ast_install_agent_functions(agent_callback_login, callback_agent_logoff);
return 0;
}
Modified: team/bweschke/polycom_acd_functions/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/polycom_acd_functions/channels/chan_sip.c?rev=7726&r1=7725&r2=7726&view=diff
==============================================================================
--- team/bweschke/polycom_acd_functions/channels/chan_sip.c (original)
+++ team/bweschke/polycom_acd_functions/channels/chan_sip.c Mon Jan 2 21:51:21 2006
@@ -57,6 +57,7 @@
ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+#include "asterisk/agents.h"
#include "asterisk/lock.h"
#include "asterisk/channel.h"
#include "asterisk/config.h"
@@ -86,7 +87,6 @@
#include "asterisk/dnsmgr.h"
#include "asterisk/devicestate.h"
#include "asterisk/linkedlists.h"
-#include "asterisk/agents.h"
#ifdef OSP_SUPPORT
#include "asterisk/astosp.h"
@@ -10907,7 +10907,7 @@
p->expiry = atoi(get_header(req, "Expires"));
if (p->expiry) {
- agent_callback_login(agentid, p->username, user->agentcbcontext, NULL, NULL);
+ ast_agent_callback_login(agentid, p->username, user->agentcbcontext, NULL, NULL);
if (debug)
ast_log(LOG_DEBUG, "Adding agent login for agent '%s' for peer %s\n", agentid, p->username);
}
@@ -10922,6 +10922,7 @@
ast_set_flag(p, SIP_NEEDDESTROY);
if (debug)
ast_log(LOG_DEBUG, "Removing agent login for agent '%s' for peer %s\n", agentid, p->username);
+ ast_agent_callback_logout(agentid);
}
}
Modified: team/bweschke/polycom_acd_functions/include/asterisk/agents.h
URL: http://svn.digium.com/view/asterisk/team/bweschke/polycom_acd_functions/include/asterisk/agents.h?rev=7726&r1=7725&r2=7726&view=diff
==============================================================================
--- team/bweschke/polycom_acd_functions/include/asterisk/agents.h (original)
+++ team/bweschke/polycom_acd_functions/include/asterisk/agents.h Mon Jan 2 21:51:21 2006
@@ -23,6 +23,10 @@
#ifndef _AST_AGENTS_H
#define _AST_AGENTS_H
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
/*! \brief Login an agent and params for Asterisk to callback the agent
* \param agent
\param exten
@@ -30,6 +34,18 @@
\param wrapuptime
\param ackcall
*/
-int agent_callback_login(char *agent, char *exten, char *context, char *wrapuptime, char *ackcall);
+extern int agent_callback_login(char *agent, char *exten, char *context, char *wrapuptime, char *ackcall);
+
+/*! Turn on music on hold on a given channel */
+extern int ast_agent_callback_login(char *agent, char *exten, char *context, char *wrapuptime, char *ackcall);
+
+/*! Turn off music on hold on a given channel */
+extern void ast_agent_callback_logout(char *agent);
+
+extern void ast_install_agent_functions(int (*login_ptr)(char *, char *, char *, char *, char*), void (*logout_ptr)(char *));
+
+#if defined(__cplusplus) || defined(c_plusplus)
+}
+#endif
#endif /* _AST_AGENTS_H */
More information about the asterisk-commits
mailing list