diff options
author | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-07-19 20:44:39 +0000 |
---|---|---|
committer | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-07-19 20:44:39 +0000 |
commit | 6049bb6539153c2f400f1f2dbc763c74d796204b (patch) | |
tree | 3c36781db3a5a7a08967cbe8d83acb5d82e581cb /channels/chan_agent.c | |
parent | 28df168d0f9fd12f5914263015dc26898e834146 (diff) |
merge Russell's 'hold_handling' branch, finally implementing music-on-hold handling the way it was decided at AstriDevCon Europe 2006 (and the way people really want it to be)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@37988 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_agent.c')
-rw-r--r-- | channels/chan_agent.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/channels/chan_agent.c b/channels/chan_agent.c index 1c440f3b8..1c3f8d8df 100644 --- a/channels/chan_agent.c +++ b/channels/chan_agent.c @@ -595,7 +595,7 @@ static int agent_indicate(struct ast_channel *ast, int condition, const void *da int res = -1; ast_mutex_lock(&p->lock); if (p->chan) - res = ast_indicate(p->chan, condition); + res = ast_indicate_data(p->chan, condition, data, datalen); else res = 0; ast_mutex_unlock(&p->lock); @@ -773,7 +773,9 @@ static int agent_hangup(struct ast_channel *ast) ast_channel_unlock(p->chan); } else if (p->loginstart) { ast_channel_lock(p->chan); - ast_moh_start(p->chan, p->moh); + ast_indicate_data(p->chan, AST_CONTROL_HOLD, + S_OR(p->moh, NULL), + !ast_strlen_zero(p->moh) ? strlen(p->moh) + 1 : 0); ast_channel_unlock(p->chan); } } @@ -965,7 +967,7 @@ static struct ast_channel *agent_new(struct agent_pvt *p, int state) ast_log( LOG_ERROR, "A blocker exists after agent channel ownership acquired\n" ); CRASH; } - ast_moh_stop(p->chan); + ast_indicate(p->chan, AST_CONTROL_UNHOLD); } return tmp; } @@ -1964,12 +1966,9 @@ static int __login_exec(struct ast_channel *chan, void *data, int callbackmode) res = ast_safe_sleep(chan, 500); ast_mutex_unlock(&p->lock); } else if (!res) { -#ifdef HONOR_MUSIC_CLASS - /* check if the moh class was changed with setmusiconhold */ - if (*(chan->musicclass)) - ast_copy_string(p->moh, chan->musicclass, sizeof(p->moh)); -#endif - ast_moh_start(chan, p->moh); + ast_indicate_data(chan, AST_CONTROL_HOLD, + S_OR(p->moh, NULL), + !ast_strlen_zero(p->moh) ? strlen(p->moh) + 1 : 0); if (p->loginstart == 0) time(&p->loginstart); manager_event(EVENT_FLAG_AGENT, "Agentlogin", |