[asterisk-commits] kpfleming: branch group/new_loader_completion
r38231 - in /team/group/new_loa...
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Wed Jul 26 06:09:47 MST 2006
Author: kpfleming
Date: Wed Jul 26 08:09:46 2006
New Revision: 38231
URL: http://svn.digium.com/view/asterisk?rev=38231&view=rev
Log:
partial update to trunk
Modified:
team/group/new_loader_completion/ (props changed)
team/group/new_loader_completion/Makefile
team/group/new_loader_completion/UPGRADE.txt
team/group/new_loader_completion/acl.c
team/group/new_loader_completion/apps/app_dial.c
team/group/new_loader_completion/apps/app_directed_pickup.c
team/group/new_loader_completion/apps/app_followme.c
team/group/new_loader_completion/apps/app_meetme.c
team/group/new_loader_completion/apps/app_queue.c
team/group/new_loader_completion/apps/app_rpt.c
team/group/new_loader_completion/ast_expr2f.c
team/group/new_loader_completion/autoservice.c
team/group/new_loader_completion/channel.c
team/group/new_loader_completion/channels/chan_agent.c
team/group/new_loader_completion/channels/chan_alsa.c
team/group/new_loader_completion/channels/chan_h323.c
team/group/new_loader_completion/channels/chan_iax2.c
team/group/new_loader_completion/channels/chan_jingle.c
team/group/new_loader_completion/channels/chan_mgcp.c
team/group/new_loader_completion/channels/chan_misdn.c
team/group/new_loader_completion/channels/chan_oss.c
team/group/new_loader_completion/channels/chan_phone.c
team/group/new_loader_completion/channels/chan_sip.c
team/group/new_loader_completion/channels/chan_skinny.c
team/group/new_loader_completion/channels/chan_vpb.cc
team/group/new_loader_completion/channels/chan_zap.c
team/group/new_loader_completion/channels/iax2-parser.c
team/group/new_loader_completion/channels/iax2-provision.c
team/group/new_loader_completion/cli.c
team/group/new_loader_completion/configs/alsa.conf.sample
team/group/new_loader_completion/configs/features.conf.sample
team/group/new_loader_completion/configs/iax.conf.sample
team/group/new_loader_completion/configs/queues.conf.sample
team/group/new_loader_completion/configs/sip.conf.sample
team/group/new_loader_completion/configs/skinny.conf.sample
team/group/new_loader_completion/configs/zapata.conf.sample
team/group/new_loader_completion/dnsmgr.c
team/group/new_loader_completion/doc/CODING-GUIDELINES
team/group/new_loader_completion/formats/format_ogg_vorbis.c
team/group/new_loader_completion/http.c
team/group/new_loader_completion/include/asterisk/abstract_jb.h
team/group/new_loader_completion/include/asterisk/channel.h
team/group/new_loader_completion/include/asterisk/musiconhold.h
team/group/new_loader_completion/include/asterisk/utils.h
team/group/new_loader_completion/logger.c
team/group/new_loader_completion/manager.c
team/group/new_loader_completion/netsock.c
team/group/new_loader_completion/pbx.c
team/group/new_loader_completion/pbx/dundi-parser.c
team/group/new_loader_completion/pbx/pbx_dundi.c
team/group/new_loader_completion/res/res_agi.c
team/group/new_loader_completion/res/res_config_odbc.c
team/group/new_loader_completion/res/res_config_pgsql.c
team/group/new_loader_completion/res/res_features.c
team/group/new_loader_completion/res/res_musiconhold.c
team/group/new_loader_completion/rtp.c
team/group/new_loader_completion/udptl.c
team/group/new_loader_completion/utils.c
Propchange: team/group/new_loader_completion/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed Jul 26 08:09:46 2006
@@ -1,1 +1,1 @@
-/trunk:1-37975
+/trunk:1-38126
Modified: team/group/new_loader_completion/Makefile
URL: http://svn.digium.com/view/asterisk/team/group/new_loader_completion/Makefile?rev=38231&r1=38230&r2=38231&view=diff
==============================================================================
--- team/group/new_loader_completion/Makefile (original)
+++ team/group/new_loader_completion/Makefile Wed Jul 26 08:09:46 2006
@@ -935,7 +935,7 @@
menuselect: menuselect/menuselect makeopts.xml
- at menuselect/menuselect $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS) menuselect.makeopts && echo "menuselect changes saved!" || echo "menuselect changes NOT saved!"
-menuselect/menuselect: menuselect/menuselect.c menuselect/menuselect_curses.c menuselect/menuselect.h menuselect/linkedlists.h config.status mxml/libmxml.a
+menuselect/menuselect: menuselect/menuselect.c menuselect/menuselect_curses.c menuselect/menuselect_stub.c menuselect/menuselect.h menuselect/linkedlists.h config.status mxml/libmxml.a
@CFLAGS="-include $(ASTTOPDIR)/include/asterisk/autoconfig.h -I$(ASTTOPDIR)/include" PARENTSRC="$(ASTTOPDIR)" $(MAKE) -C menuselect menuselect
mxml/libmxml.a:
Modified: team/group/new_loader_completion/UPGRADE.txt
URL: http://svn.digium.com/view/asterisk/team/group/new_loader_completion/UPGRADE.txt?rev=38231&r1=38230&r2=38231&view=diff
==============================================================================
--- team/group/new_loader_completion/UPGRADE.txt (original)
+++ team/group/new_loader_completion/UPGRADE.txt Wed Jul 26 08:09:46 2006
@@ -315,3 +315,42 @@
ASTETCDIR /usr/local/etc/asterisk
ASTBINDIR /usr/local/bin/asterisk
ASTSBINDIR /usr/local/sbin/asterisk
+
+Music on Hold:
+
+* The music on hold handling has been changed in some significant ways in hopes
+ to make it work in a way that is much less confusing to users. Behavior will
+ not change if the same configuration is used from older versions of Asterisk.
+ However, there are some new configuration options that will make things work
+ in a way that makes more sense.
+
+ Previously, many of the channel drivers had an option called "musicclass" or
+ something similar. This option set what music on hold class this channel
+ would *hear* when put on hold. Some people expected (with good reason) that
+ this option was to configure what music on hold class to play when putting
+ the bridged channel on hold. This option has now been deprecated.
+
+ Two new music on hold related configuration options for channel drivers have
+ been introduced. Some channel drivers support both options, some just one,
+ and some support neither of them. Check the sample configuration files to see
+ which options apply to which channel driver.
+
+ The "mohsuggest" option specifies which music on hold class to suggest to the
+ bridged channel when putting them on hold. The only way that this class can
+ be overridden is if the bridged channel has a specific music class set that
+ was done in the dialplan using Set(CHANNEL(musicclass)=something).
+
+ The "mohinterpret" option is similar to the old "musicclass" option. It
+ specifies which music on hold class this channel would like to listen to when
+ put on hold. This music class is only effective if this channel has no music
+ class set on it from the dialplan and the bridged channel putting this one on
+ hold had no "mohsuggest" setting.
+
+ The IAX2 and Zap channel drivers have an additional feature for the
+ "mohinterpret" option. If this option is set to "passthrough", then these
+ channel drivers will pass through the HOLD message in signalling instead of
+ starting music on hold on the channel. An example for how this would be
+ useful is in an enterprise network of Asterisk servers. When one phone on one
+ server puts a phone on a different server on hold, the remote server will be
+ responsibile for playing the hold music to its local phone that was put on
+ hold instead of the far end server across the network playing the music.
Modified: team/group/new_loader_completion/acl.c
URL: http://svn.digium.com/view/asterisk/team/group/new_loader_completion/acl.c?rev=38231&r1=38230&r2=38231&view=diff
==============================================================================
--- team/group/new_loader_completion/acl.c (original)
+++ team/group/new_loader_completion/acl.c Wed Jul 26 08:09:46 2006
@@ -208,10 +208,9 @@
char iabuf[INET_ADDRSTRLEN];
char iabuf2[INET_ADDRSTRLEN];
/* DEBUG */
- ast_log(LOG_DEBUG,
- "##### Testing %s with %s\n",
- ast_inet_ntoa(iabuf, sizeof(iabuf), sin->sin_addr),
- ast_inet_ntoa(iabuf2, sizeof(iabuf2), ha->netaddr));
+ ast_copy_string(iabuf, ast_inet_ntoa(sin->sin_addr), sizeof(iabuf));
+ ast_copy_string(iabuf2, ast_inet_ntoa(ha->netaddr), sizeof(iabuf2));
+ ast_log(LOG_DEBUG, "##### Testing %s with %s\n", iabuf, iabuf2);
/* For each rule, if this address and the netmask = the net address
apply the current rule */
if ((sin->sin_addr.s_addr & ha->netmask.s_addr) == ha->netaddr.s_addr)
Modified: team/group/new_loader_completion/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/group/new_loader_completion/apps/app_dial.c?rev=38231&r1=38230&r2=38231&view=diff
==============================================================================
--- team/group/new_loader_completion/apps/app_dial.c (original)
+++ team/group/new_loader_completion/apps/app_dial.c Wed Jul 26 08:09:46 2006
@@ -1213,8 +1213,8 @@
/* Our status will at least be NOANSWER */
strcpy(status, "NOANSWER");
if (ast_test_flag(outgoing, OPT_MUSICBACK)) {
- moh=1;
- ast_moh_start(chan, opt_args[OPT_ARG_MUSICBACK]);
+ moh = 1;
+ ast_moh_start(chan, opt_args[OPT_ARG_MUSICBACK], NULL);
} else if (ast_test_flag(outgoing, OPT_RINGBACK)) {
ast_indicate(chan, AST_CONTROL_RINGING);
sentringing++;
@@ -1272,7 +1272,7 @@
if (ast_test_flag(&opts, OPT_MUSICBACK) && !ast_strlen_zero(opt_args[OPT_ARG_MUSICBACK])) {
ast_indicate(chan, -1);
- ast_moh_start(chan, opt_args[OPT_ARG_MUSICBACK]);
+ ast_moh_start(chan, opt_args[OPT_ARG_MUSICBACK], NULL);
} else if (ast_test_flag(&opts, OPT_RINGBACK)) {
ast_indicate(chan, AST_CONTROL_RINGING);
sentringing++;
@@ -1700,7 +1700,7 @@
res = ast_waitstream(chan, AST_DIGIT_ANY);
if (!res && sleep) {
if (!ast_test_flag(chan, AST_FLAG_MOH))
- ast_moh_start(chan, NULL);
+ ast_moh_start(chan, NULL, NULL);
res = ast_waitfordigit(chan, sleep);
}
} else {
@@ -1708,7 +1708,7 @@
res = ast_waitstream(chan, "");
if (sleep) {
if (!ast_test_flag(chan, AST_FLAG_MOH))
- ast_moh_start(chan, NULL);
+ ast_moh_start(chan, NULL, NULL);
if (!res)
res = ast_waitfordigit(chan, sleep);
}
Modified: team/group/new_loader_completion/apps/app_directed_pickup.c
URL: http://svn.digium.com/view/asterisk/team/group/new_loader_completion/apps/app_directed_pickup.c?rev=38231&r1=38230&r2=38231&view=diff
==============================================================================
--- team/group/new_loader_completion/apps/app_directed_pickup.c (original)
+++ team/group/new_loader_completion/apps/app_directed_pickup.c Wed Jul 26 08:09:46 2006
@@ -82,7 +82,7 @@
*context++ = '\0';
/* If the context is the pickup mark, iterate through all channels finding the right origin one */
- if (!strcmp(context, PICKUPMARK)) {
+ if (context && !strcmp(context, PICKUPMARK)) {
while ((origin = ast_channel_walk_locked(origin))) {
if (origin) {
tmp2 = pbx_builtin_getvar_helper(origin, PICKUPMARK);
Modified: team/group/new_loader_completion/apps/app_followme.c
URL: http://svn.digium.com/view/asterisk/team/group/new_loader_completion/apps/app_followme.c?rev=38231&r1=38230&r2=38231&view=diff
==============================================================================
--- team/group/new_loader_completion/apps/app_followme.c (original)
+++ team/group/new_loader_completion/apps/app_followme.c Wed Jul 26 08:09:46 2006
@@ -1007,10 +1007,7 @@
goto outrun;
if (ast_waitstream(chan, "") < 0)
goto outrun;
- if (!strcmp(targs.mohclass, ""))
- ast_moh_start(chan, NULL);
- else
- ast_moh_start(chan, targs.mohclass);
+ ast_moh_start(chan, S_OR(targs.mohclass, NULL), NULL);
targs.status = 0;
Modified: team/group/new_loader_completion/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/team/group/new_loader_completion/apps/app_meetme.c?rev=38231&r1=38230&r2=38231&view=diff
==============================================================================
--- team/group/new_loader_completion/apps/app_meetme.c (original)
+++ team/group/new_loader_completion/apps/app_meetme.c Wed Jul 26 08:09:46 2006
@@ -1403,7 +1403,7 @@
}
}
if (musiconhold == 0 && (confflags & CONFFLAG_MOH)) {
- ast_moh_start(chan, NULL);
+ ast_moh_start(chan, NULL, NULL);
musiconhold = 1;
} else {
ztc.confmode = ZT_CONF_CONF;
@@ -1441,7 +1441,7 @@
if ((confflags & CONFFLAG_MOH) && !(confflags & CONFFLAG_WAITMARKED)) {
if (conf->users == 1) {
if (musiconhold == 0) {
- ast_moh_start(chan, NULL);
+ ast_moh_start(chan, NULL, NULL);
musiconhold = 1;
}
} else {
@@ -1745,7 +1745,7 @@
}
}
if (musiconhold)
- ast_moh_start(chan, NULL);
+ ast_moh_start(chan, NULL, NULL);
if (ioctl(fd, ZT_SETCONF, &ztc)) {
ast_log(LOG_WARNING, "Error setting conference\n");
Modified: team/group/new_loader_completion/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/group/new_loader_completion/apps/app_queue.c?rev=38231&r1=38230&r2=38231&view=diff
==============================================================================
--- team/group/new_loader_completion/apps/app_queue.c (original)
+++ team/group/new_loader_completion/apps/app_queue.c Wed Jul 26 08:09:46 2006
@@ -758,7 +758,8 @@
char *c, *lastc;
char buff[80];
- if (!strcasecmp(param, "music") || !strcasecmp(param, "musiconhold")) {
+ if (!strcasecmp(param, "musicclass") ||
+ !strcasecmp(param, "music") || !strcasecmp(param, "musiconhold")) {
ast_copy_string(q->moh, val, sizeof(q->moh));
} else if (!strcasecmp(param, "announce")) {
ast_copy_string(q->announce, val, sizeof(q->announce));
@@ -1340,7 +1341,7 @@
/* Don't restart music on hold if we're about to exit the caller from the queue */
if (!res)
- ast_moh_start(qe->chan, qe->moh);
+ ast_moh_start(qe->chan, qe->moh, NULL);
return res;
}
@@ -1779,7 +1780,7 @@
/* Resume Music on Hold if the caller is going to stay in the queue */
if (!res)
- ast_moh_start(qe->chan, qe->moh);
+ ast_moh_start(qe->chan, qe->moh, NULL);
/* update last_periodic_announce_time */
qe->last_periodic_announce_time = now;
@@ -3308,7 +3309,7 @@
if (ringing) {
ast_indicate(chan, AST_CONTROL_RINGING);
} else {
- ast_moh_start(chan, qe.moh);
+ ast_moh_start(chan, qe.moh, NULL);
}
for (;;) {
/* This is the wait loop for callers 2 through maxlen */
Modified: team/group/new_loader_completion/apps/app_rpt.c
URL: http://svn.digium.com/view/asterisk/team/group/new_loader_completion/apps/app_rpt.c?rev=38231&r1=38230&r2=38231&view=diff
==============================================================================
--- team/group/new_loader_completion/apps/app_rpt.c (original)
+++ team/group/new_loader_completion/apps/app_rpt.c Wed Jul 26 08:09:46 2006
@@ -7498,7 +7498,7 @@
return -1;
}
memcpy(&ia,hp->h_addr,sizeof(in_addr_t));
- ast_inet_ntoa(nodeip,sizeof(nodeip) - 1,ia);
+ ast_copy_string(nodeip, ast_inet_ntoa(ia), sizeof(nodeip));
if (strcmp(hisip,nodeip))
{
char *s3 = strchr(s1,'@');
@@ -7512,7 +7512,7 @@
return -1;
}
memcpy(&ia,hp->h_addr,sizeof(in_addr_t));
- ast_inet_ntoa(nodeip,sizeof(nodeip) - 1,ia);
+ ast_copy_string(nodeip, ast_inet_ntoa(ia), sizeof(nodeip));
if (strcmp(hisip,nodeip))
{
ast_log(LOG_WARNING, "Node %s IP %s does not match link IP %s!!\n",b1,nodeip,hisip);
Modified: team/group/new_loader_completion/ast_expr2f.c
URL: http://svn.digium.com/view/asterisk/team/group/new_loader_completion/ast_expr2f.c?rev=38231&r1=38230&r2=38231&view=diff
==============================================================================
--- team/group/new_loader_completion/ast_expr2f.c (original)
+++ team/group/new_loader_completion/ast_expr2f.c Wed Jul 26 08:09:46 2006
@@ -2722,8 +2722,8 @@
/** Setup the input buffer state to scan the given bytes. The next call to ast_yylex() will
* scan from a @e copy of @a bytes.
- * @param bytes the byte buffer to scan
- * @param len the number of bytes in the buffer pointed to by @a bytes.
+ * @param yybytes the byte buffer to scan
+ * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
* @param yyscanner The scanner object.
* @return the newly allocated buffer state object.
*/
@@ -2884,7 +2884,7 @@
}
/** Set the current column.
- * @param line_number
+ * @param column_no
* @param yyscanner The scanner object.
*/
void ast_yyset_column (int column_no , yyscan_t yyscanner)
Modified: team/group/new_loader_completion/autoservice.c
URL: http://svn.digium.com/view/asterisk/team/group/new_loader_completion/autoservice.c?rev=38231&r1=38230&r2=38231&view=diff
==============================================================================
--- team/group/new_loader_completion/autoservice.c (original)
+++ team/group/new_loader_completion/autoservice.c Wed Jul 26 08:09:46 2006
@@ -104,7 +104,6 @@
if (as->chan == chan)
break;
}
- /* XXX if found, we return -1, why ??? */
/* If not, start autoservice on channel */
if (!as && (as = ast_calloc(1, sizeof(*as)))) {
Modified: team/group/new_loader_completion/channel.c
URL: http://svn.digium.com/view/asterisk/team/group/new_loader_completion/channel.c?rev=38231&r1=38230&r2=38231&view=diff
==============================================================================
--- team/group/new_loader_completion/channel.c (original)
+++ team/group/new_loader_completion/channel.c Wed Jul 26 08:09:46 2006
@@ -92,7 +92,9 @@
unsigned long global_fin = 0, global_fout = 0;
-/* XXX Lock appropriately in more functions XXX */
+static pthread_key_t state2str_buf_key;
+static pthread_once_t state2str_buf_once = PTHREAD_ONCE_INIT;
+#define STATE2STR_BUFSIZE 32
struct chanlist {
const struct ast_channel_tech *tech;
@@ -482,12 +484,17 @@
return -1;
}
-
+
+static void state2str_buf_key_create(void)
+{
+ pthread_key_create(&state2str_buf_key, free);
+}
+
/*! \brief Gives the string form of a given channel state */
char *ast_state2str(int state)
{
- /* XXX Not reentrant XXX */
- static char localtmp[256];
+ char *buf;
+
switch(state) {
case AST_STATE_DOWN:
return "Down";
@@ -506,8 +513,14 @@
case AST_STATE_BUSY:
return "Busy";
default:
- snprintf(localtmp, sizeof(localtmp), "Unknown (%d)\n", state);
- return localtmp;
+ pthread_once(&state2str_buf_once, state2str_buf_key_create);
+ if (!(buf = pthread_getspecific(state2str_buf_key))) {
+ if (!(buf = ast_calloc(1, STATE2STR_BUFSIZE)))
+ return NULL;
+ pthread_setspecific(state2str_buf_key, buf);
+ }
+ snprintf(buf, STATE2STR_BUFSIZE, "Unknown (%d)\n", state);
+ return buf;
}
}
@@ -2347,8 +2360,8 @@
CHECK_BLOCKING(chan);
switch(fr->frametype) {
case AST_FRAME_CONTROL:
- /* XXX Interpret control frames XXX */
- ast_log(LOG_WARNING, "Don't know how to handle control frames yet\n");
+ res = (chan->tech->indicate == NULL) ? 0 :
+ chan->tech->indicate(chan, fr->subclass, fr->data, fr->datalen);
break;
case AST_FRAME_DTMF_BEGIN:
res = (chan->tech->send_digit_begin == NULL) ? 0 :
@@ -3881,11 +3894,11 @@
return group;
}
-static int (*ast_moh_start_ptr)(struct ast_channel *, const char *) = NULL;
+static int (*ast_moh_start_ptr)(struct ast_channel *, const char *, const 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_music_functions(int (*start_ptr)(struct ast_channel *, const char *),
+void ast_install_music_functions(int (*start_ptr)(struct ast_channel *, const char *, const char *),
void (*stop_ptr)(struct ast_channel *),
void (*cleanup_ptr)(struct ast_channel *))
{
@@ -3902,14 +3915,16 @@
}
/*! \brief Turn on music on hold on a given channel */
-int ast_moh_start(struct ast_channel *chan, const char *mclass)
+int ast_moh_start(struct ast_channel *chan, const char *mclass, const char *interpclass)
{
if (ast_moh_start_ptr)
- return ast_moh_start_ptr(chan, mclass);
-
- if (option_verbose > 2)
- ast_verbose(VERBOSE_PREFIX_3 "Music class %s requested but no musiconhold loaded.\n", mclass ? mclass : "default");
-
+ return ast_moh_start_ptr(chan, mclass, interpclass);
+
+ if (option_verbose > 2) {
+ ast_verbose(VERBOSE_PREFIX_3 "Music class %s requested but no musiconhold loaded.\n",
+ mclass ? mclass : (interpclass ? interpclass : "default"));
+ }
+
return 0;
}
Modified: team/group/new_loader_completion/channels/chan_agent.c
URL: http://svn.digium.com/view/asterisk/team/group/new_loader_completion/channels/chan_agent.c?rev=38231&r1=38230&r2=38231&view=diff
==============================================================================
--- team/group/new_loader_completion/channels/chan_agent.c (original)
+++ team/group/new_loader_completion/channels/chan_agent.c Wed Jul 26 08:09:46 2006
@@ -596,7 +596,7 @@
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 @@
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);
}
}
@@ -968,7 +970,7 @@
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;
}
@@ -1967,12 +1969,9 @@
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",
Modified: team/group/new_loader_completion/channels/chan_alsa.c
URL: http://svn.digium.com/view/asterisk/team/group/new_loader_completion/channels/chan_alsa.c?rev=38231&r1=38230&r2=38231&view=diff
==============================================================================
--- team/group/new_loader_completion/channels/chan_alsa.c (original)
+++ team/group/new_loader_completion/channels/chan_alsa.c Wed Jul 26 08:09:46 2006
@@ -61,6 +61,7 @@
#include "asterisk/endian.h"
#include "asterisk/stringfields.h"
#include "asterisk/abstract_jb.h"
+#include "asterisk/musiconhold.h"
#include "busy.h"
#include "ringtone.h"
@@ -126,6 +127,7 @@
static char context[AST_MAX_CONTEXT] = "default";
static char language[MAX_LANGUAGE] = "";
static char exten[AST_MAX_EXTENSION] = "s";
+static char mohinterpret[MAX_MUSICCLASS];
static int hookstate=0;
@@ -763,7 +765,9 @@
static int alsa_indicate(struct ast_channel *chan, int cond, const void *data, size_t datalen)
{
int res = 0;
- ast_mutex_lock(&alsalock);
+
+ ast_mutex_lock(&alsalock);
+
switch(cond) {
case AST_CONTROL_BUSY:
res = 1;
@@ -772,7 +776,6 @@
res = 2;
break;
case AST_CONTROL_RINGING:
- res = 0;
break;
case -1:
res = -1;
@@ -780,14 +783,24 @@
case AST_CONTROL_VIDUPDATE:
res = -1;
break;
+ case AST_CONTROL_HOLD:
+ ast_verbose( " << Console Has Been Placed on Hold >> \n");
+ ast_moh_start(chan, data, mohinterpret);
+ break;
+ case AST_CONTROL_UNHOLD:
+ ast_verbose( " << Console Has Been Retrieved from Hold >> \n");
+ ast_moh_stop(chan);
+ break;
default:
ast_log(LOG_WARNING, "Don't know how to display condition %d on %s\n", cond, chan->name);
res = -1;
}
- if (res > -1) {
+
+ if (res > -1)
write(sndcmd[1], &res, sizeof(res));
- }
- ast_mutex_unlock(&alsalock);
+
+ ast_mutex_unlock(&alsalock);
+
return res;
}
@@ -1067,14 +1080,15 @@
/* Copy the default jb config over global_jbconf */
memcpy(&global_jbconf, &default_jbconf, sizeof(struct ast_jb_conf));
+ strcpy(mohinterpret, "default");
+
if ((cfg = ast_config_load(config))) {
v = ast_variable_browse(cfg, "general");
- while(v) {
+ for (; v; v = v->next) {
/* handle jb conf */
- if (!ast_jb_read_conf(&global_jbconf, v->name, v->value)) {
- v = v->next;
+ if (!ast_jb_read_conf(&global_jbconf, v->name, v->value))
continue;
- }
+
if (!strcasecmp(v->name, "autoanswer"))
autoanswer = ast_true(v->value);
else if (!strcasecmp(v->name, "silencesuppression"))
@@ -1082,16 +1096,17 @@
else if (!strcasecmp(v->name, "silencethreshold"))
silencethreshold = atoi(v->value);
else if (!strcasecmp(v->name, "context"))
- strncpy(context, v->value, sizeof(context)-1);
+ ast_copy_string(context, v->value, sizeof(context));
else if (!strcasecmp(v->name, "language"))
- strncpy(language, v->value, sizeof(language)-1);
+ ast_copy_string(language, v->value, sizeof(language));
else if (!strcasecmp(v->name, "extension"))
- strncpy(exten, v->value, sizeof(exten)-1);
+ ast_copy_string(exten, v->value, sizeof(exten));
else if (!strcasecmp(v->name, "input_device"))
- strncpy(indevname, v->value, sizeof(indevname)-1);
+ ast_copy_string(indevname, v->value, sizeof(indevname));
else if (!strcasecmp(v->name, "output_device"))
- strncpy(outdevname, v->value, sizeof(outdevname)-1);
- v=v->next;
+ ast_copy_string(outdevname, v->value, sizeof(outdevname));
+ else if (!strcasecmp(v->name, "mohinterpret"))
+ ast_copy_string(mohinterpret, v->value, sizeof(mohinterpret));
}
ast_config_destroy(cfg);
}
Modified: team/group/new_loader_completion/channels/chan_h323.c
URL: http://svn.digium.com/view/asterisk/team/group/new_loader_completion/channels/chan_h323.c?rev=38231&r1=38230&r2=38231&view=diff
==============================================================================
--- team/group/new_loader_completion/channels/chan_h323.c (original)
+++ team/group/new_loader_completion/channels/chan_h323.c Wed Jul 26 08:09:46 2006
@@ -701,6 +701,16 @@
if (token)
free(token);
return -1;
+ case AST_CONTROL_HOLD:
+ ast_moh_start(c, data, NULL);
+ if (token)
+ free(token);
+ return 0;
+ case AST_CONTROL_UNHOLD:
+ ast_moh_stop(c);
+ if (token)
+ free(token);
+ return 0;
case AST_CONTROL_PROCEEDING:
case -1:
if (token)
Modified: team/group/new_loader_completion/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/group/new_loader_completion/channels/chan_iax2.c?rev=38231&r1=38230&r2=38231&view=diff
==============================================================================
--- team/group/new_loader_completion/channels/chan_iax2.c (original)
+++ team/group/new_loader_completion/channels/chan_iax2.c Wed Jul 26 08:09:46 2006
@@ -173,8 +173,7 @@
static struct ast_netsock_list *netsock;
static int defaultsockfd = -1;
-static int usecnt;
-AST_MUTEX_DEFINE_STATIC(usecnt_lock);
+static int usecnt = 0;
int (*iax2_regfunk)(char *username, int onoff) = NULL;
@@ -217,6 +216,8 @@
#endif /* IAXTESTS */
static char accountcode[AST_MAX_ACCOUNT_CODE];
+static char mohinterpret[MAX_MUSICCLASS];
+static char mohsuggest[MAX_MUSICCLASS];
static int amaflags = 0;
static int adsi = 0;
static int delayreject = 0;
@@ -283,6 +284,8 @@
int authmethods;
int encmethods;
char accountcode[AST_MAX_ACCOUNT_CODE];
+ char mohinterpret[MAX_MUSICCLASS];
+ char mohsuggest[MAX_MUSICCLASS];
char inkeys[80]; /*!< Key(s) this user can use to authenticate to us */
char language[MAX_LANGUAGE];
int amaflags;
@@ -310,6 +313,8 @@
char regexten[AST_MAX_EXTENSION]; /*!< Extension to register (if regcontext is used) */
char peercontext[AST_MAX_EXTENSION]; /*!< Context to pass to peer */
char mailbox[AST_MAX_EXTENSION]; /*!< Mailbox */
+ char mohinterpret[MAX_MUSICCLASS];
+ char mohsuggest[MAX_MUSICCLASS];
struct ast_codec_pref prefs;
struct ast_dnsmgr_entry *dnsmgr; /*!< DNS refresh manager */
struct sockaddr_in addr;
@@ -590,6 +595,8 @@
int calling_pres;
char dproot[AST_MAX_EXTENSION];
char accountcode[AST_MAX_ACCOUNT_CODE];
+ char mohinterpret[MAX_MUSICCLASS];
+ char mohsuggest[MAX_MUSICCLASS];
int amaflags;
struct iax2_dpcache *dpentries;
struct ast_variable *vars;
@@ -1168,7 +1175,6 @@
int res = 0;
int x;
struct timeval now;
- char iabuf[INET_ADDRSTRLEN];
char host[80];
if (new <= NEW_ALLOW) {
/* Look for an existing connection first */
@@ -1195,7 +1201,7 @@
}
if ((res < 1) && (new >= NEW_ALLOW)) {
if (!iax2_getpeername(*sin, host, sizeof(host), lockpeer))
- snprintf(host, sizeof(host), "%s:%d", ast_inet_ntoa(iabuf, sizeof(iabuf), sin->sin_addr), ntohs(sin->sin_port));
+ snprintf(host, sizeof(host), "%s:%d", ast_inet_ntoa(sin->sin_addr), ntohs(sin->sin_port));
gettimeofday(&now, NULL);
for (x=1;x<TRUNK_CALL_START;x++) {
/* Find first unused call number that hasn't been used in a while */
@@ -1226,6 +1232,8 @@
iaxs[x]->amaflags = amaflags;
ast_copy_flags(iaxs[x], (&globalflags), IAX_NOTRANSFER | IAX_TRANSFERMEDIA | IAX_USEJITTERBUF | IAX_FORCEJITTERBUF);
ast_copy_string(iaxs[x]->accountcode, accountcode, sizeof(iaxs[x]->accountcode));
+ ast_copy_string(iaxs[x]->mohinterpret, mohinterpret, sizeof(iaxs[x]->mohinterpret));
+ ast_copy_string(iaxs[x]->mohsuggest, mohsuggest, sizeof(iaxs[x]->mohsuggest));
} else {
ast_log(LOG_WARNING, "Out of resources\n");
ast_mutex_unlock(&iaxsl[x]);
@@ -1565,7 +1573,7 @@
if (m.msg_controllen) {
sin = (struct sockaddr_in *)SO_EE_OFFENDER(&e);
if (sin)
- ast_log(LOG_WARNING, "Receive error from %s\n", ast_inet_ntoa(iabuf, sizeof(iabuf), sin->sin_addr));
+ ast_log(LOG_WARNING, "Receive error from %s\n", ast_inet_ntoa(sin->sin_addr));
else
ast_log(LOG_WARNING, "No address detected??\n");
} else {
@@ -1593,7 +1601,6 @@
static int send_packet(struct iax_frame *f)
{
int res;
- char iabuf[INET_ADDRSTRLEN];
int callno = f->callno;
/* Don't send if there was an error, but return error instead */
@@ -1602,7 +1609,7 @@
/* Called with iaxsl held */
if (option_debug > 2 && iaxdebug)
- ast_log(LOG_DEBUG, "Sending %d on %d/%d to %s:%d\n", f->ts, callno, iaxs[callno]->peercallno, ast_inet_ntoa(iabuf, sizeof(iabuf), iaxs[callno]->addr.sin_addr), ntohs(iaxs[callno]->addr.sin_port));
+ ast_log(LOG_DEBUG, "Sending %d on %d/%d to %s:%d\n", f->ts, callno, iaxs[callno]->peercallno, ast_inet_ntoa(iaxs[callno]->addr.sin_addr), ntohs(iaxs[callno]->addr.sin_port));
if (f->transfer) {
if (iaxdebug)
iax_showframe(f, NULL, 0, &iaxs[callno]->transfer, f->datalen - sizeof(struct ast_iax2_full_hdr));
@@ -1680,14 +1687,10 @@
c->tech_pvt = NULL;
ast_queue_hangup(c);
pvt->owner = NULL;
- ast_mutex_lock(&usecnt_lock);
- usecnt--;
- if (usecnt < 0)
- ast_log(LOG_WARNING, "Usecnt < 0???\n");
- ast_mutex_unlock(&usecnt_lock);
+ ast_atomic_fetchadd_int(&usecnt, -1);
+ ast_update_use_count();
}
ast_mutex_unlock(&iaxsl[callno]);
- ast_update_use_count();
return 0;
}
@@ -1792,7 +1795,6 @@
struct iax_frame *f = data;
int freeme=0;
int callno = f->callno;
- char iabuf[INET_ADDRSTRLEN];
/* Make sure this call is still active */
if (callno)
ast_mutex_lock(&iaxsl[callno]);
@@ -1809,7 +1811,7 @@
iax2_destroy_nolock(callno);
} else {
if (iaxs[callno]->owner)
- ast_log(LOG_WARNING, "Max retries exceeded to host %s on %s (type = %d, subclass = %d, ts=%d, seqno=%d)\n", ast_inet_ntoa(iabuf, sizeof(iabuf), iaxs[f->callno]->addr.sin_addr),iaxs[f->callno]->owner->name , f->af.frametype, f->af.subclass, f->ts, f->oseqno);
+ ast_log(LOG_WARNING, "Max retries exceeded to host %s on %s (type = %d, subclass = %d, ts=%d, seqno=%d)\n", ast_inet_ntoa(iaxs[f->callno]->addr.sin_addr),iaxs[f->callno]->owner->name , f->af.frametype, f->af.subclass, f->ts, f->oseqno);
iaxs[callno]->error = ETIMEDOUT;
if (iaxs[callno]->owner) {
struct ast_frame fr = { 0, };
@@ -1980,7 +1982,6 @@
{
char status[30];
char cbuf[256];
- char iabuf[INET_ADDRSTRLEN];
struct iax2_peer *peer;
char codec_buf[512];
int x = 0, codec = 0, load_realtime = 0;
@@ -2001,8 +2002,8 @@
ast_cli(fd, " Callerid : %s\n", ast_callerid_merge(cbuf, sizeof(cbuf), peer->cid_name, peer->cid_num, "<unspecified>"));
ast_cli(fd, " Expire : %d\n", peer->expire);
ast_cli(fd, " ACL : %s\n", (peer->ha?"Yes":"No"));
- ast_cli(fd, " Addr->IP : %s Port %d\n", peer->addr.sin_addr.s_addr ? ast_inet_ntoa(iabuf, sizeof(iabuf), peer->addr.sin_addr) : "(Unspecified)", ntohs(peer->addr.sin_port));
- ast_cli(fd, " Defaddr->IP : %s Port %d\n", ast_inet_ntoa(iabuf, sizeof(iabuf), peer->defaddr.sin_addr), ntohs(peer->defaddr.sin_port));
+ ast_cli(fd, " Addr->IP : %s Port %d\n", peer->addr.sin_addr.s_addr ? ast_inet_ntoa(peer->addr.sin_addr) : "(Unspecified)", ntohs(peer->addr.sin_port));
+ ast_cli(fd, " Defaddr->IP : %s Port %d\n", ast_inet_ntoa(peer->defaddr.sin_addr), ntohs(peer->defaddr.sin_port));
ast_cli(fd, " Username : %s\n", peer->username);
ast_cli(fd, " Codecs : ");
ast_getformatname_multiple(codec_buf, sizeof(codec_buf) -1, peer->capability);
@@ -2423,18 +2424,14 @@
if (peername)
var = ast_load_realtime("iaxpeers", "name", peername, NULL);
else {
- char iabuf[INET_ADDRSTRLEN];
char porta[25];
- ast_inet_ntoa(iabuf, sizeof(iabuf), sin->sin_addr);
sprintf(porta, "%d", ntohs(sin->sin_port));
- var = ast_load_realtime("iaxpeers", "ipaddr", iabuf, "port", porta, NULL);
+ var = ast_load_realtime("iaxpeers", "ipaddr", ast_inet_ntoa(sin->sin_addr), "port", porta, NULL);
if (var) {
/* We'll need the peer name in order to build the structure! */
- tmp = var;
- while(tmp) {
+ for (tmp = var; tmp; tmp = tmp->next) {
if (!strcasecmp(tmp->name, "name"))
peername = tmp->value;
- tmp = tmp->next;
}
}
}
@@ -2446,8 +2443,7 @@
if (!peer)
return NULL;
- tmp = var;
- while(tmp) {
+ for (tmp = var; tmp; tmp = tmp->next) {
/* Make sure it's not a user only... */
if (!strcasecmp(tmp->name, "type")) {
if (strcasecmp(tmp->value, "friend") &&
@@ -2467,7 +2463,6 @@
if (!strcasecmp(tmp->value, "dynamic"))
dynamic = 1;
}
- tmp = tmp->next;
}
if (!peer)
return NULL;
@@ -2551,15 +2546,15 @@
static void realtime_update_peer(const char *peername, struct sockaddr_in *sin)
{
char port[10];
- char ipaddr[20];
char regseconds[20];
time_t nowtime;
time(&nowtime);
snprintf(regseconds, sizeof(regseconds), "%d", (int)nowtime);
- ast_inet_ntoa(ipaddr, sizeof(ipaddr), sin->sin_addr);
snprintf(port, sizeof(port), "%d", ntohs(sin->sin_port));
- ast_update_realtime("iaxpeers", "name", peername, "ipaddr", ipaddr, "port", port, "regseconds", regseconds, NULL);
+ ast_update_realtime("iaxpeers", "name", peername,
+ "ipaddr", ast_inet_ntoa(sin->sin_addr), "port", port,
+ "regseconds", regseconds, NULL);
}
struct create_addr_info {
@@ -2577,6 +2572,8 @@
char prefs[32];
char context[AST_MAX_CONTEXT];
char peercontext[AST_MAX_CONTEXT];
+ char mohinterpret[MAX_MUSICCLASS];
+ char mohsuggest[MAX_MUSICCLASS];
};
static int create_addr(const char *peername, struct sockaddr_in *sin, struct create_addr_info *cai)
@@ -2634,6 +2631,8 @@
ast_copy_string(cai->username, peer->username, sizeof(cai->username));
ast_copy_string(cai->timezone, peer->zonetag, sizeof(cai->timezone));
ast_copy_string(cai->outkey, peer->outkey, sizeof(cai->outkey));
+ ast_copy_string(cai->mohinterpret, peer->mohinterpret, sizeof(cai->mohinterpret));
+ ast_copy_string(cai->mohsuggest, peer->mohsuggest, sizeof(cai->mohsuggest));
if (ast_strlen_zero(peer->dbsecret)) {
ast_copy_string(cai->secret, peer->secret, sizeof(cai->secret));
} else {
@@ -2881,6 +2880,9 @@
iaxs[callno]->encmethods = cai.encmethods;
iaxs[callno]->adsi = cai.adsi;
+
+ ast_copy_string(iaxs[callno]->mohinterpret, cai.mohinterpret, sizeof(iaxs[callno]->mohinterpret));
+ ast_copy_string(iaxs[callno]->mohsuggest, cai.mohsuggest, sizeof(iaxs[callno]->mohsuggest));
if (pds.key)
ast_copy_string(iaxs[callno]->outkey, pds.key, sizeof(iaxs[callno]->outkey));
@@ -3168,9 +3170,23 @@
static int iax2_indicate(struct ast_channel *c, int condition, const void *data, size_t datalen)
{
unsigned short callno = PTR_TO_CALLNO(c->tech_pvt);
+
if (option_debug && iaxdebug)
ast_log(LOG_DEBUG, "Indicating condition %d\n", condition);
- return send_command_locked(callno, AST_FRAME_CONTROL, condition, 0, data, datalen, -1);
+
+ if (!strcasecmp(iaxs[callno]->mohinterpret, "passthrough"))
+ return send_command_locked(callno, AST_FRAME_CONTROL, condition, 0, data, datalen, -1);
+
+ switch (condition) {
+ case AST_CONTROL_HOLD:
+ ast_moh_start(c, data, iaxs[callno]->mohinterpret);
+ return 0;
+ case AST_CONTROL_UNHOLD:
+ ast_moh_stop(c);
+ return 0;
+ default:
+ return send_command_locked(callno, AST_FRAME_CONTROL, condition, 0, data, datalen, -1);
+ }
}
static int iax2_transfer(struct ast_channel *c, const char *dest)
@@ -3272,9 +3288,7 @@
for (v = i->vars ; v ; v = v->next)
pbx_builtin_setvar_helper(tmp, v->name, v->value);
- ast_mutex_lock(&usecnt_lock);
- usecnt++;
- ast_mutex_unlock(&usecnt_lock);
+ ast_atomic_fetchadd_int(&usecnt, 1);
ast_update_use_count();
return tmp;
@@ -3485,17 +3499,15 @@
static struct iax2_trunk_peer *find_tpeer(struct sockaddr_in *sin, int fd)
{
struct iax2_trunk_peer *tpeer;
- char iabuf[INET_ADDRSTRLEN];
+
/* Finds and locks trunk peer */
ast_mutex_lock(&tpeerlock);
- tpeer = tpeers;
- while(tpeer) {
+ for (tpeer = tpeers; tpeer; tpeer = tpeer->next) {
/* We don't lock here because tpeer->addr *never* changes */
if (!inaddrcmp(&tpeer->addr, sin)) {
ast_mutex_lock(&tpeer->lock);
break;
}
- tpeer = tpeer->next;
}
if (!tpeer) {
if ((tpeer = ast_calloc(1, sizeof(*tpeer)))) {
@@ -3510,7 +3522,7 @@
#ifdef SO_NO_CHECK
setsockopt(tpeer->sockfd, SOL_SOCKET, SO_NO_CHECK, &nochecksums, sizeof(nochecksums));
#endif
- ast_log(LOG_DEBUG, "Created trunk peer for '%s:%d'\n", ast_inet_ntoa(iabuf, sizeof(iabuf), tpeer->addr.sin_addr), ntohs(tpeer->addr.sin_port));
+ ast_log(LOG_DEBUG, "Created trunk peer for '%s:%d'\n", ast_inet_ntoa(tpeer->addr.sin_addr), ntohs(tpeer->addr.sin_port));
}
}
ast_mutex_unlock(&tpeerlock);
@@ -3524,7 +3536,6 @@
void *tmp, *ptr;
struct ast_iax2_meta_trunk_entry *met;
struct ast_iax2_meta_trunk_mini *mtm;
- char iabuf[INET_ADDRSTRLEN];
f = &fr->af;
tpeer = find_tpeer(&pvt->addr, pvt->sockfd);
@@ -3539,9 +3550,9 @@
tpeer->trunkdataalloc += DEFAULT_TRUNKDATA;
tpeer->trunkdata = tmp;
- ast_log(LOG_DEBUG, "Expanded trunk '%s:%d' to %d bytes\n", ast_inet_ntoa(iabuf, sizeof(iabuf), tpeer->addr.sin_addr), ntohs(tpeer->addr.sin_port), tpeer->trunkdataalloc);
+ ast_log(LOG_DEBUG, "Expanded trunk '%s:%d' to %d bytes\n", ast_inet_ntoa(tpeer->addr.sin_addr), ntohs(tpeer->addr.sin_port), tpeer->trunkdataalloc);
} else {
- ast_log(LOG_WARNING, "Maximum trunk data space exceeded to %s:%d\n", ast_inet_ntoa(iabuf, sizeof(iabuf), tpeer->addr.sin_addr), ntohs(tpeer->addr.sin_port));
+ ast_log(LOG_WARNING, "Maximum trunk data space exceeded to %s:%d\n", ast_inet_ntoa(tpeer->addr.sin_addr), ntohs(tpeer->addr.sin_port));
[... 5741 lines stripped ...]
More information about the asterisk-commits
mailing list