[asterisk-commits] oej: branch oej/moremanager r99551 - in /team/oej/moremanager: ./ channels/ i...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Jan 22 11:55:26 CST 2008
Author: oej
Date: Tue Jan 22 11:13:34 2008
New Revision: 99551
URL: http://svn.digium.com/view/asterisk?view=rev&rev=99551
Log:
Reset
Modified:
team/oej/moremanager/ (props changed)
team/oej/moremanager/Makefile
team/oej/moremanager/channels/chan_sip.c
team/oej/moremanager/include/asterisk/translate.h
team/oej/moremanager/main/autoservice.c
team/oej/moremanager/main/channel.c
team/oej/moremanager/main/manager.c
team/oej/moremanager/main/pbx.c
team/oej/moremanager/main/translate.c
team/oej/moremanager/res/res_features.c
Change Statistics:
0 files changed
Propchange: team/oej/moremanager/
------------------------------------------------------------------------------
automerge = http://www.codename-pineapple.org/
Propchange: team/oej/moremanager/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Tue Jan 22 11:13:34 2008
@@ -1,1 +1,1 @@
-/branches/1.4:1-94694
+/branches/1.4:1-94878
Modified: team/oej/moremanager/Makefile
URL: http://svn.digium.com/view/asterisk/team/oej/moremanager/Makefile?view=diff&rev=99551&r1=99550&r2=99551
==============================================================================
--- team/oej/moremanager/Makefile (original)
+++ team/oej/moremanager/Makefile Tue Jan 22 11:13:34 2008
@@ -759,4 +759,4 @@
@cat sounds/sounds.xml >> $@
@echo "</menu>" >> $@
-.PHONY: menuselect main sounds clean dist-clean distclean all prereqs cleantest uninstall _uninstall uninstall-all dont-optimize $(SUBDIRS_INSTALL) $(SUBDIRS_DIST_CLEAN) $(SUBDIRS_CLEAN) $(SUBDIRS_UNINSTALL) $(SUBDIRS) $(MOD_SUBDIRS_EMBED_LDSCRIPT) $(MOD_SUBDIRS_EMBED_LDFLAGS) $(MOD_SUBDIRS_EMBED_LIBS) menuselect.makeopts
+.PHONY: menuselect main sounds clean dist-clean distclean all prereqs cleantest uninstall _uninstall uninstall-all dont-optimize $(SUBDIRS_INSTALL) $(SUBDIRS_DIST_CLEAN) $(SUBDIRS_CLEAN) $(SUBDIRS_UNINSTALL) $(SUBDIRS) $(MOD_SUBDIRS_EMBED_LDSCRIPT) $(MOD_SUBDIRS_EMBED_LDFLAGS) $(MOD_SUBDIRS_EMBED_LIBS) menuselect.makeopts include/asterisk/version.h
Modified: team/oej/moremanager/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/oej/moremanager/channels/chan_sip.c?view=diff&rev=99551&r1=99550&r2=99551
==============================================================================
--- team/oej/moremanager/channels/chan_sip.c (original)
+++ team/oej/moremanager/channels/chan_sip.c Tue Jan 22 11:13:34 2008
@@ -2487,7 +2487,7 @@
static struct sip_peer *realtime_peer(const char *newpeername, struct sockaddr_in *sin)
{
struct sip_peer *peer=NULL;
- struct ast_variable *var;
+ struct ast_variable *var = NULL;
struct ast_config *peerlist = NULL;
struct ast_variable *tmp;
struct ast_flags flags = {0};
@@ -2565,8 +2565,7 @@
}
}
}
- } else
- return NULL;
+ }
if (!var) {
if(peerlist)
@@ -15528,7 +15527,14 @@
get back to this point every millisecond or less)
*/
for (sip = iflist; !fastrestart && sip; sip = sip->next) {
- ast_mutex_lock(&sip->lock);
+ /*! \note If we can't get a lock on an interface, skip it and come
+ * back later. Note that there is the possibility of a deadlock with
+ * sip_hangup otherwise, because sip_hangup is called with the channel
+ * locked first, and the iface lock is attempted second.
+ */
+ if (ast_mutex_trylock(&sip->lock))
+ continue;
+
/* Check RTP timeouts and kill calls if we have a timeout set and do not get RTP */
if (sip->rtp && sip->owner &&
(sip->owner->_state == AST_STATE_UP) &&
Modified: team/oej/moremanager/include/asterisk/translate.h
URL: http://svn.digium.com/view/asterisk/team/oej/moremanager/include/asterisk/translate.h?view=diff&rev=99551&r1=99550&r2=99551
==============================================================================
--- team/oej/moremanager/include/asterisk/translate.h (original)
+++ team/oej/moremanager/include/asterisk/translate.h Tue Jan 22 11:13:34 2008
@@ -23,7 +23,7 @@
#ifndef _ASTERISK_TRANSLATE_H
#define _ASTERISK_TRANSLATE_H
-//#define MAX_FORMAT 15 /* Do not include video here */
+#define MAX_AUDIO_FORMAT 15 /* Do not include video here */
#define MAX_FORMAT 32 /* Do include video here */
#if defined(__cplusplus) || defined(c_plusplus)
Modified: team/oej/moremanager/main/autoservice.c
URL: http://svn.digium.com/view/asterisk/team/oej/moremanager/main/autoservice.c?view=diff&rev=99551&r1=99550&r2=99551
==============================================================================
--- team/oej/moremanager/main/autoservice.c (original)
+++ team/oej/moremanager/main/autoservice.c Tue Jan 22 11:13:34 2008
@@ -58,6 +58,7 @@
* channel. It will ensure that it doesn't actually get stopped until
* it gets stopped for the last time. */
unsigned int use_count;
+ unsigned int orig_end_dtmf_flag:1;
AST_LIST_HEAD_NOLOCK(, ast_frame) dtmf_frames;
AST_LIST_ENTRY(asent) list;
};
@@ -125,7 +126,6 @@
* be queued up or not. */
switch (f->frametype) {
/* Save these frames */
- case AST_FRAME_DTMF_BEGIN:
case AST_FRAME_DTMF_END:
case AST_FRAME_CONTROL:
case AST_FRAME_TEXT:
@@ -135,6 +135,7 @@
break;
/* Throw these frames away */
+ case AST_FRAME_DTMF_BEGIN:
case AST_FRAME_VOICE:
case AST_FRAME_VIDEO:
case AST_FRAME_NULL:
@@ -157,41 +158,51 @@
int res = 0;
struct asent *as;
- AST_LIST_LOCK(&aslist);
-
/* Check if the channel already has autoservice */
+ AST_LIST_LOCK(&aslist);
AST_LIST_TRAVERSE(&aslist, as, list) {
if (as->chan == chan) {
as->use_count++;
break;
}
}
-
- /* If not, start autoservice on channel */
+ AST_LIST_UNLOCK(&aslist);
+
if (as) {
- /* Entry extist, autoservice is already handling this channel */
- } else if ((as = ast_calloc(1, sizeof(*as))) == NULL) {
- /* Memory allocation failed */
- res = -1;
- } else {
- /* New entry created */
- as->chan = chan;
- as->use_count = 1;
- AST_LIST_INSERT_HEAD(&aslist, as, list);
- if (asthread == AST_PTHREADT_NULL) { /* need start the thread */
- if (ast_pthread_create_background(&asthread, NULL, autoservice_run, NULL)) {
- ast_log(LOG_WARNING, "Unable to create autoservice thread :(\n");
- /* There will only be a single member in the list at this point,
- the one we just added. */
- AST_LIST_REMOVE(&aslist, as, list);
- free(as);
- res = -1;
- } else
- pthread_kill(asthread, SIGURG);
- }
- }
-
- AST_LIST_UNLOCK(&aslist);
+ /* Entry exists, autoservice is already handling this channel */
+ return 0;
+ }
+
+ if (!(as = ast_calloc(1, sizeof(*as))))
+ return -1;
+
+ /* New entry created */
+ as->chan = chan;
+ as->use_count = 1;
+
+ ast_channel_lock(chan);
+ as->orig_end_dtmf_flag = ast_test_flag(chan, AST_FLAG_END_DTMF_ONLY) ? 1 : 0;
+ if (!as->orig_end_dtmf_flag)
+ ast_set_flag(chan, AST_FLAG_END_DTMF_ONLY);
+ ast_channel_unlock(chan);
+
+ AST_LIST_LOCK(&aslist);
+ AST_LIST_INSERT_HEAD(&aslist, as, list);
+ AST_LIST_UNLOCK(&aslist);
+
+ if (asthread == AST_PTHREADT_NULL) { /* need start the thread */
+ if (ast_pthread_create_background(&asthread, NULL, autoservice_run, NULL)) {
+ ast_log(LOG_WARNING, "Unable to create autoservice thread :(\n");
+ /* There will only be a single member in the list at this point,
+ the one we just added. */
+ AST_LIST_LOCK(&aslist);
+ AST_LIST_REMOVE(&aslist, as, list);
+ AST_LIST_UNLOCK(&aslist);
+ free(as);
+ res = -1;
+ } else
+ pthread_kill(asthread, SIGURG);
+ }
return res;
}
@@ -203,6 +214,7 @@
AST_LIST_HEAD_NOLOCK(, ast_frame) dtmf_frames;
struct ast_frame *f;
int removed = 0;
+ int orig_end_dtmf_flag = 0;
AST_LIST_HEAD_INIT_NOLOCK(&dtmf_frames);
@@ -214,6 +226,7 @@
break;
AST_LIST_REMOVE_CURRENT(&aslist, list);
AST_LIST_APPEND_LIST(&dtmf_frames, &as->dtmf_frames, frame_list);
+ orig_end_dtmf_flag = as->orig_end_dtmf_flag;
free(as);
removed = 1;
if (!chan->_softhangup)
@@ -231,6 +244,9 @@
if (!removed)
return 0;
+ if (!orig_end_dtmf_flag)
+ ast_clear_flag(chan, AST_FLAG_END_DTMF_ONLY);
+
/* Wait for it to un-block */
while (ast_test_flag(chan, AST_FLAG_BLOCKING))
usleep(1000);
Modified: team/oej/moremanager/main/channel.c
URL: http://svn.digium.com/view/asterisk/team/oej/moremanager/main/channel.c?view=diff&rev=99551&r1=99550&r2=99551
==============================================================================
--- team/oej/moremanager/main/channel.c (original)
+++ team/oej/moremanager/main/channel.c Tue Jan 22 11:13:34 2008
@@ -897,6 +897,25 @@
AST_LIST_LOCK(&channels);
AST_LIST_INSERT_HEAD(&channels, tmp, chan_list);
AST_LIST_UNLOCK(&channels);
+
+ /*\!note
+ * and now, since the channel structure is built, and has its name, let's
+ * call the manager event generator with this Newchannel event. This is the
+ * proper and correct place to make this call, but you sure do have to pass
+ * a lot of data into this func to do it here!
+ */
+ if (!ast_strlen_zero(name_fmt)) {
+ manager_event(EVENT_FLAG_CALL, "Newchannel",
+ "Channel: %s\r\n"
+ "State: %s\r\n"
+ "CallerIDNum: %s\r\n"
+ "CallerIDName: %s\r\n"
+ "Uniqueid: %s\r\n",
+ tmp->name, ast_state2str(state),
+ S_OR(cid_num, "<unknown>"),
+ S_OR(cid_name, "<unknown>"),
+ tmp->uniqueid);
+ }
return tmp;
}
Modified: team/oej/moremanager/main/manager.c
URL: http://svn.digium.com/view/asterisk/team/oej/moremanager/main/manager.c?view=diff&rev=99551&r1=99550&r2=99551
==============================================================================
--- team/oej/moremanager/main/manager.c (original)
+++ team/oej/moremanager/main/manager.c Tue Jan 22 11:13:34 2008
@@ -2373,6 +2373,20 @@
}
ast_log(LOG_EVENT, "Failed attempt from %s\n", ast_inet_ntoa(s->sin.sin_addr));
}
+
+ /* It is possible under certain circumstances for this session thread
+ to complete its work and exit *before* the thread that created it
+ has finished executing the ast_pthread_create_background() function.
+ If this occurs, some versions of glibc appear to act in a buggy
+ fashion and attempt to write data into memory that it thinks belongs
+ to the thread but is in fact not owned by the thread (or may have
+ been freed completely).
+
+ Causing this thread to yield to other threads at least one time
+ appears to work around this bug.
+ */
+ usleep(1);
+
destroy_session(s);
return NULL;
}
Modified: team/oej/moremanager/main/pbx.c
URL: http://svn.digium.com/view/asterisk/team/oej/moremanager/main/pbx.c?view=diff&rev=99551&r1=99550&r2=99551
==============================================================================
--- team/oej/moremanager/main/pbx.c (original)
+++ team/oej/moremanager/main/pbx.c Tue Jan 22 11:13:34 2008
@@ -2015,7 +2015,6 @@
{
struct ast_hint *hint;
- ast_rdlock_contexts();
AST_LIST_LOCK(&hints);
AST_LIST_TRAVERSE(&hints, hint, list) {
@@ -2053,7 +2052,6 @@
}
AST_LIST_UNLOCK(&hints);
- ast_unlock_contexts();
}
/*! \brief ast_extension_state_add: Add watcher for extension states */
Modified: team/oej/moremanager/main/translate.c
URL: http://svn.digium.com/view/asterisk/team/oej/moremanager/main/translate.c?view=diff&rev=99551&r1=99550&r2=99551
==============================================================================
--- team/oej/moremanager/main/translate.c (original)
+++ team/oej/moremanager/main/translate.c Tue Jan 22 11:13:34 2008
@@ -796,10 +796,10 @@
int cur, cursrc;
int besttime = INT_MAX;
int beststeps = INT_MAX;
- int common = (*dst) & (*srcs); /* are there common formats ? */
+ int common = ((*dst) & (*srcs)) & AST_FORMAT_AUDIO_MASK; /* are there common formats ? */
if (common) { /* yes, pick one and return */
- for (cur = 1, y = 0; y < MAX_FORMAT; cur <<= 1, y++) {
+ for (cur = 1, y = 0; y <= MAX_AUDIO_FORMAT; cur <<= 1, y++) {
if (cur & common) /* guaranteed to find one */
break;
}
@@ -808,10 +808,10 @@
return 0;
} else { /* No, we will need to translate */
AST_LIST_LOCK(&translators);
- for (cur = 1, y = 0; y < MAX_FORMAT; cur <<= 1, y++) {
+ for (cur = 1, y = 0; y <= MAX_AUDIO_FORMAT; cur <<= 1, y++) {
if (! (cur & *dst))
continue;
- for (cursrc = 1, x = 0; x < MAX_FORMAT; cursrc <<= 1, x++) {
+ for (cursrc = 1, x = 0; x <= MAX_AUDIO_FORMAT; cursrc <<= 1, x++) {
if (!(*srcs & cursrc) || !tr_matrix[x][y].step ||
tr_matrix[x][y].cost > besttime)
continue; /* not existing or no better */
Modified: team/oej/moremanager/res/res_features.c
URL: http://svn.digium.com/view/asterisk/team/oej/moremanager/res/res_features.c?view=diff&rev=99551&r1=99550&r2=99551
==============================================================================
--- team/oej/moremanager/res/res_features.c (original)
+++ team/oej/moremanager/res/res_features.c Tue Jan 22 11:13:34 2008
@@ -372,9 +372,8 @@
pu->parkingtime = (timeout > 0) ? timeout : parkingtime;
if (extout)
*extout = x;
- if (!ast_strlen_zero(orig_chan_name))
- ast_copy_string(pu->peername, orig_chan_name, sizeof(pu->peername));
- else if (peer)
+
+ if (peer)
ast_copy_string(pu->peername, peer->name, sizeof(pu->peername));
/* Remember what had been dialed, so that if the parking
@@ -420,7 +419,7 @@
if (!con) /* Still no context? Bad */
ast_log(LOG_ERROR, "Parking context '%s' does not exist and unable to create\n", parking_con);
/* Tell the peer channel the number of the parking space */
- if (peer && ((pu->parkingnum != -1 && ast_strlen_zero(orig_chan_name)) || (strlen(orig_chan_name) == strlen(peer->name) && !strncasecmp(peer->name, orig_chan_name, strlen(peer->name))))) { /* Only say number if it's a number and the channel hasn't been masqueraded away */
+ if (peer && ((pu->parkingnum != -1 && ast_strlen_zero(orig_chan_name)) || !strcasecmp(peer->name, orig_chan_name))) { /* Only say number if it's a number and the channel hasn't been masqueraded away */
/* Make sure we don't start saying digits to the channel being parked */
ast_set_flag(peer, AST_FLAG_MASQ_NOSTREAM);
ast_say_digits(peer, pu->parkingnum, "", peer->language);
@@ -1832,7 +1831,7 @@
res = ast_safe_sleep(chan, 1000);
/* Park the call */
if (!res)
- res = park_call_full(chan, chan, 0, NULL, orig_chan_name);
+ res = park_call_full(chan, NULL, 0, NULL, orig_chan_name);
ast_module_user_remove(u);
More information about the asterisk-commits
mailing list