[asterisk-commits] murf: branch murf/bug8189 r48064 - in
/team/murf/bug8189: ./ apps/ channels/ ...
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Mon Nov 27 12:00:28 MST 2006
Author: murf
Date: Mon Nov 27 13:00:28 2006
New Revision: 48064
URL: http://svn.digium.com/view/asterisk?view=rev&rev=48064
Log:
Merged revisions 47995,47997,48001,48003-48004,48008-48014,48016,48018-48019,48032-48034,48039-48040,48048,48050,48056 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
................
r47995 | murf | 2006-11-24 10:40:49 -0700 (Fri, 24 Nov 2006) | 1 line
This fix inspired by a patch supplied in bug 8189, which points out problems with the PLC code
................
r47997 | murf | 2006-11-24 11:17:25 -0700 (Fri, 24 Nov 2006) | 1 line
removed the svnmerge-integrated property from trunk; it's confusing svnmerge in newly created branches
................
r48001 | rizzo | 2006-11-25 02:02:42 -0700 (Sat, 25 Nov 2006) | 5 lines
set pointers to NULL after freeing memory to avoid multiple free()
probably 1.4/1.2 issue as well if someone can look into that.
................
r48003 | oej | 2006-11-25 02:45:57 -0700 (Sat, 25 Nov 2006) | 9 lines
- Adding comment on suspicious memory allocation. Seems like it's never freed, but I don't
have a clear understanding of the frame allocation/deallocation, so I just mark this
for investigation. (Reported by Ed Guy). We're trying to see if a free() hurts...
- Doxygen comments on p2p rtp bridge stuff. I am a bit worried about shortcutting
rtcp this way, but will need feedback from rtcp gurus. This should work for
video calls too, and possibly UDPTL.
................
r48004 | oej | 2006-11-25 02:48:30 -0700 (Sat, 25 Nov 2006) | 2 lines
Changing ERROR to lesser level. Imported from 1.2/1.4
................
r48008 | rizzo | 2006-11-25 10:37:04 -0700 (Sat, 25 Nov 2006) | 7 lines
generalize a bit the functions used to create an tcp socket
and then run a service on it.
The code in manager.c does essentially the same things,
so we will be able to reuse the code in here (probably
moving it to netsock.c or another appropriate library file).
................
r48009 | mattf | 2006-11-25 13:30:04 -0700 (Sat, 25 Nov 2006) | 1 line
Updates to show linkset command
................
r48010 | mattf | 2006-11-25 13:54:38 -0700 (Sat, 25 Nov 2006) | 2 lines
Add ss7 show linkset command
................
r48011 | mattf | 2006-11-25 14:32:33 -0700 (Sat, 25 Nov 2006) | 1 line
Make sure we don't send a group reset on a group larger than 32 CICs
................
r48012 | mattf | 2006-11-25 14:35:23 -0700 (Sat, 25 Nov 2006) | 1 line
bug fix
................
r48013 | mattf | 2006-11-25 14:46:58 -0700 (Sat, 25 Nov 2006) | 1 line
Make compiler happier
................
r48014 | mattf | 2006-11-25 14:50:42 -0700 (Sat, 25 Nov 2006) | 1 line
Little fix so we use the right message
................
r48016 | murf | 2006-11-25 17:15:42 -0700 (Sat, 25 Nov 2006) | 9 lines
Merged revisions 48015 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r48015 | murf | 2006-11-25 17:01:34 -0700 (Sat, 25 Nov 2006) | 1 line
A little bit of func_cdr documentation upgrade-- no bug# involved, although 8221 may have inspired it.
........
................
r48018 | murf | 2006-11-25 17:31:13 -0700 (Sat, 25 Nov 2006) | 9 lines
Merged revisions 48017 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r48017 | murf | 2006-11-25 17:26:16 -0700 (Sat, 25 Nov 2006) | 1 line
might as well also document the raw values of the flag vars
........
................
r48019 | russell | 2006-11-25 23:55:33 -0700 (Sat, 25 Nov 2006) | 6 lines
- Add some comments on thread storage with a brief explanation of what it is
as well as what the motivation is for using it.
- Add a comment by the declaration of ast_inet_ntoa() noting that this function
is not reentrant, and the result of a previous call to the function is no
longer valid after calling it again.
................
r48032 | oej | 2006-11-26 23:44:40 -0700 (Sun, 26 Nov 2006) | 2 lines
Change error message (imported from 1.4)
................
r48033 | oej | 2006-11-26 23:59:20 -0700 (Sun, 26 Nov 2006) | 2 lines
Doxygen updates
................
r48034 | rizzo | 2006-11-27 07:47:15 -0700 (Mon, 27 Nov 2006) | 5 lines
remove an extra comma in an initializer
Detected by: AST_DEVMODE=yes
................
r48039 | file | 2006-11-27 08:33:56 -0700 (Mon, 27 Nov 2006) | 18 lines
Merged revisions 48038 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
................
r48038 | file | 2006-11-27 10:32:19 -0500 (Mon, 27 Nov 2006) | 10 lines
Merged revisions 48037 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2
........
r48037 | file | 2006-11-27 10:30:37 -0500 (Mon, 27 Nov 2006) | 2 lines
Do not reference the freed outgoing structure in the debug message. (issue #8425 reported by arkadia)
........
................
................
r48040 | file | 2006-11-27 08:48:57 -0700 (Mon, 27 Nov 2006) | 2 lines
More fixes for referencing a structure after it has been freed. (issue #8425 reported by arkadia)
................
r48048 | russell | 2006-11-27 10:19:47 -0700 (Mon, 27 Nov 2006) | 9 lines
Blocked revisions 48046 via svnmerge
........
r48046 | russell | 2006-11-27 12:17:40 -0500 (Mon, 27 Nov 2006) | 2 lines
Remove a couple of unused variables (issue #8380, casper)
........
................
r48050 | tilghman | 2006-11-27 10:31:56 -0700 (Mon, 27 Nov 2006) | 18 lines
Merged revisions 48049 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
................
r48049 | tilghman | 2006-11-27 11:20:37 -0600 (Mon, 27 Nov 2006) | 10 lines
Merged revisions 48045 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2
........
r48045 | tilghman | 2006-11-27 11:15:54 -0600 (Mon, 27 Nov 2006) | 2 lines
Random MOH wasn't really random (bug 8381)
........
................
................
r48056 | file | 2006-11-27 11:10:59 -0700 (Mon, 27 Nov 2006) | 18 lines
Merged revisions 48054 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
................
r48054 | file | 2006-11-27 13:06:50 -0500 (Mon, 27 Nov 2006) | 10 lines
Merged revisions 48053 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2
........
r48053 | file | 2006-11-27 13:03:57 -0500 (Mon, 27 Nov 2006) | 2 lines
Use the proper function to get the new message count instead of always using the filesystem. (issue #8421 reported by slimey)
........
................
................
Modified:
team/murf/bug8189/ (props changed)
team/murf/bug8189/apps/app_voicemail.c
team/murf/bug8189/channels/chan_sip.c
team/murf/bug8189/channels/chan_zap.c
team/murf/bug8189/funcs/func_cdr.c
team/murf/bug8189/include/asterisk/doxyref.h
team/murf/bug8189/include/asterisk/threadstorage.h
team/murf/bug8189/include/asterisk/utils.h
team/murf/bug8189/main/channel.c
team/murf/bug8189/main/http.c
team/murf/bug8189/main/rtp.c
team/murf/bug8189/pbx/pbx_spool.c
team/murf/bug8189/res/res_musiconhold.c
Propchange: team/murf/bug8189/
------------------------------------------------------------------------------
Binary property 'branch-1.4-blocked' - no diff available.
Propchange: team/murf/bug8189/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.
Propchange: team/murf/bug8189/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon Nov 27 13:00:28 2006
@@ -1,1 +1,1 @@
-/trunk:1-47987
+/trunk:1-48061
Modified: team/murf/bug8189/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug8189/apps/app_voicemail.c?view=diff&rev=48064&r1=48063&r2=48064
==============================================================================
--- team/murf/bug8189/apps/app_voicemail.c (original)
+++ team/murf/bug8189/apps/app_voicemail.c Mon Nov 27 13:00:28 2006
@@ -6970,22 +6970,13 @@
}
}
AST_LIST_TRAVERSE(&users, vmu, list) {
- char dirname[256];
- DIR *vmdir;
- struct dirent *vment;
- int vmcount = 0;
- char count[12];
+ int newmsgs = 0, oldmsgs = 0;
+ char count[12], tmp[256] = "";
if ((argc == 3) || ((argc == 5) && !strcmp(argv[4],vmu->context))) {
- make_dir(dirname, 255, vmu->context, vmu->mailbox, "INBOX");
- if ((vmdir = opendir(dirname))) {
- /* No matter what the format of VM, there will always be a .txt file for each message. */
- while ((vment = readdir(vmdir)))
- if (strlen(vment->d_name) > 7 && !strncmp(vment->d_name + 7,".txt",4))
- vmcount++;
- closedir(vmdir);
- }
- snprintf(count,sizeof(count),"%d",vmcount);
+ snprintf(tmp, sizeof(tmp), "%s@%s", vmu->mailbox, ast_strlen_zero(vmu->context) ? "default" : vmu->context);
+ inboxcount(tmp, &newmsgs, &oldmsgs);
+ snprintf(count,sizeof(count),"%d",newmsgs);
ast_cli(fd, output_format, vmu->context, vmu->mailbox, vmu->fullname, vmu->zonetag, count);
}
}
Modified: team/murf/bug8189/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug8189/channels/chan_sip.c?view=diff&rev=48064&r1=48063&r2=48064
==============================================================================
--- team/murf/bug8189/channels/chan_sip.c (original)
+++ team/murf/bug8189/channels/chan_sip.c Mon Nov 27 13:00:28 2006
@@ -12331,7 +12331,8 @@
if (sipmethod == SIP_INVITE) {
/* First we ACK */
transmit_request(p, SIP_ACK, seqno, XMIT_UNRELIABLE, FALSE);
- ast_log(LOG_WARNING, "INVITE with REPLACEs failed to '%s'\n", get_header(&p->initreq, "From"));
+ if (option_debug)
+ ast_log(LOG_DEBUG, "Got 481 on Invite. Assuming INVITE with REPLACEs failed to '%s'\n", get_header(&p->initreq, "From"));
if (owner)
ast_queue_control(p->owner, AST_CONTROL_CONGESTION);
sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT);
@@ -14456,7 +14457,7 @@
if ((firststate = ast_extension_state(NULL, p->context, p->exten)) < 0) {
- ast_log(LOG_ERROR, "Got SUBSCRIBE for extension %s@%s from %s, but there is no hint for that extension\n", p->exten, p->context, ast_inet_ntoa(p->sa.sin_addr));
+ ast_log(LOG_NOTICE, "Got SUBSCRIBE for extension %s@%s from %s, but there is no hint for that extension.\n", p->exten, p->context, ast_inet_ntoa(p->sa.sin_addr));
transmit_response(p, "404 Not found", req);
ast_set_flag(&p->flags[0], SIP_NEEDDESTROY);
return 0;
Modified: team/murf/bug8189/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug8189/channels/chan_zap.c?view=diff&rev=48064&r1=48063&r2=48064
==============================================================================
--- team/murf/bug8189/channels/chan_zap.c (original)
+++ team/murf/bug8189/channels/chan_zap.c Mon Nov 27 13:00:28 2006
@@ -8380,7 +8380,7 @@
startcic = linkset->pvts[0]->cic;
for (i = 0; i < linkset->numchans; i++) {
- if (linkset->pvts[i+1] && (linkset->pvts[i+1]->cic - linkset->pvts[i]->cic) == 1) {
+ if (linkset->pvts[i+1] && ((linkset->pvts[i+1]->cic - linkset->pvts[i]->cic) == 1) && (linkset->pvts[i]->cic - startcic < 31)) {
continue;
} else {
endcic = linkset->pvts[i]->cic;
@@ -10568,23 +10568,23 @@
return RESULT_SUCCESS;
}
-static const char pri_debug_help[] =
+static char pri_debug_help[] =
"Usage: pri debug span <span>\n"
" Enables debugging on a given PRI span\n";
-static const char pri_no_debug_help[] =
+static char pri_no_debug_help[] =
"Usage: pri no debug span <span>\n"
" Disables debugging on a given PRI span\n";
-static const char pri_really_debug_help[] =
+static char pri_really_debug_help[] =
"Usage: pri intensive debug span <span>\n"
" Enables debugging down to the Q.921 level\n";
-static const char pri_show_span_help[] =
+static char pri_show_span_help[] =
"Usage: pri show span <span>\n"
" Displays PRI Information on a given PRI span\n";
-static const char pri_show_spans_help[] =
+static char pri_show_spans_help[] =
"Usage: pri show spans\n"
" Displays PRI Information\n";
@@ -11556,7 +11556,6 @@
return RESULT_SUCCESS;
}
-#if 0
static int handle_ss7_show_linkset(int fd, int argc, char *argv[])
{
int linkset;
@@ -11573,49 +11572,44 @@
return RESULT_SUCCESS;
}
if (linksets[linkset-1].ss7)
- ss7 = linksets[linkset-1];
-
- if (
+ ss7 = &linksets[linkset-1];
+
+ ast_cli(fd, "SS7 linkset %d status: %s\n", linkset, (ss7->state == LINKSET_STATE_UP) ? "Up" : "Down");
return RESULT_SUCCESS;
}
-#endif
-
-static const char ss7_debug_help[] =
+
+static char ss7_debug_help[] =
"Usage: ss7 debug linkset <linkset>\n"
" Enables debugging on a given SS7 linkset\n";
-static const char ss7_no_debug_help[] =
+static char ss7_no_debug_help[] =
"Usage: ss7 no debug linkset <span>\n"
" Disables debugging on a given SS7 linkset\n";
-static const char ss7_block_cic_help[] =
+static char ss7_block_cic_help[] =
"Usage: ss7 block cic <linkset> <CIC>\n"
" Sends a remote blocking request for the given CIC on the specified linkset\n";
-static const char ss7_unblock_cic_help[] =
+static char ss7_unblock_cic_help[] =
"Usage: ss7 unblock cic <linkset> <CIC>\n"
" Sends a remote unblocking request for the given CIC on the specified linkset\n";
-#if 0
-static const char ss7_show_linkset_help[] =
+static char ss7_show_linkset_help[] =
"Usage: ss7 show linkset <span>\n"
- " Disables debugging on a given SS7 linkset\n";
-#endif
+ " Shows the status of an SS7 linkset.\n";
static struct ast_cli_entry zap_ss7_cli[] = {
{ { "ss7", "debug", "linkset", NULL }, handle_ss7_debug,
"Enables SS7 debugging on a linkset", ss7_debug_help, NULL },
{ { "ss7", "no", "debug", "linkset", NULL }, handle_ss7_no_debug,
- "Disables SS7 debugging on a linkset", ss7_debug_help, NULL },
+ "Disables SS7 debugging on a linkset", ss7_no_debug_help, NULL },
{ { "ss7", "block", "cic", NULL }, handle_ss7_block_cic,
"Disables SS7 debugging on a linkset", ss7_block_cic_help, NULL },
{ { "ss7", "unblock", "cic", NULL }, handle_ss7_unblock_cic,
"Disables SS7 debugging on a linkset", ss7_unblock_cic_help, NULL },
-#if 0
{ { "ss7", "show", "linkset", NULL }, handle_ss7_show_linkset,
- "Disables SS7 debugging on a linkset", ss7_show_linkset_help, NULL },
-#endif
+ "Shows the status of a linkset", ss7_show_linkset_help, NULL },
};
#endif /* HAVE_SS7 */
Modified: team/murf/bug8189/funcs/func_cdr.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug8189/funcs/func_cdr.c?view=diff&rev=48064&r1=48063&r2=48064
==============================================================================
--- team/murf/bug8189/funcs/func_cdr.c (original)
+++ team/murf/bug8189/funcs/func_cdr.c Mon Nov 27 13:00:28 2006
@@ -129,7 +129,28 @@
" For example, 'start', 'answer', and 'end' will be retrieved as epoch\n"
" values, when the 'u' option is passed, but formatted as YYYY-MM-DD HH:MM:SS\n"
" otherwise. Similarly, disposition and amaflags will return their raw\n"
-" integral values.\n",
+" integral values.\n"
+" Here is a list of all the available cdr field names:\n"
+" clid lastdata disposition\n"
+" src start amaflags\n"
+" dst answer accountcode\n"
+" dcontext end uniqueid\n"
+" dstchannel duration userfield\n"
+" lastapp billsec channel\n"
+" All of the above variables are read-only, except for accountcode,\n"
+" userfield, and amaflags. You may, however, supply\n"
+" a name not on the above list, and create your own\n"
+" variable, whose value can be changed with this function,\n"
+" and this variable will be stored on the cdr.\n"
+" raw values for disposition:\n"
+" 1 = NO ANSWER\n"
+" 2 = BUSY\n"
+" 3 = FAILED\n"
+" 4 = ANSWERED\n"
+" raw values for amaflags:\n"
+" 1 = OMIT\n"
+" 2 = BILLING\n"
+" 3 = DOCUMENTATION\n",
};
static int unload_module(void)
Modified: team/murf/bug8189/include/asterisk/doxyref.h
URL: http://svn.digium.com/view/asterisk/team/murf/bug8189/include/asterisk/doxyref.h?view=diff&rev=48064&r1=48063&r2=48064
==============================================================================
--- team/murf/bug8189/include/asterisk/doxyref.h (original)
+++ team/murf/bug8189/include/asterisk/doxyref.h Mon Nov 27 13:00:28 2006
@@ -40,7 +40,6 @@
* \arg \ref AstENUM : The IETF way to redirect from phone numbers to VoIP calls
* \arg \ref AstHTTP
* \arg \ref AstSpeech
- * \arg \ref DataStores
* \arg \ref ConfigFiles
* \arg \ref SoundFiles included in the Asterisk distribution
* \arg \ref AstCREDITS : A Thank You to contributors
@@ -65,6 +64,10 @@
/*! \page AstAPI Asterisk API
* \section Asteriskapi Asterisk API
* Some generic documents on the Asterisk architecture
+ *
+ * \arg \ref AstThreadStorage
+ * \arg \ref DataStores
+ *
* \subsection model_txt Generic Model
* \verbinclude model.txt
* \subsection channel_txt Channels
Modified: team/murf/bug8189/include/asterisk/threadstorage.h
URL: http://svn.digium.com/view/asterisk/team/murf/bug8189/include/asterisk/threadstorage.h?view=diff&rev=48064&r1=48063&r2=48064
==============================================================================
--- team/murf/bug8189/include/asterisk/threadstorage.h (original)
+++ team/murf/bug8189/include/asterisk/threadstorage.h Mon Nov 27 13:00:28 2006
@@ -19,9 +19,28 @@
/*!
* \file threadstorage.h
* \author Russell Bryant <russell at digium.com>
- *
* \brief Definitions to aid in the use of thread local storage
-*/
+ */
+
+/*!
+ * \page AstThreadStorage The Asterisk Thread Storage API
+ *
+ *
+ * The POSIX threads (pthreads) API provides the ability to define thread
+ * specific data. The functions and structures defined here are intended
+ * to centralize the code that is commonly used when using thread local
+ * storage.
+ *
+ * The motivation for using this code in Asterisk is for situations where
+ * storing data on a thread-specific basis can provide some amount of
+ * performance benefit. For example, there are some call types in Asterisk
+ * where ast_frame structures must be allocated very rapidly (easily 50, 100,
+ * 200 times a second). Instead of doing the equivalent of that many calls
+ * to malloc() and free() per second, thread local storage is used to keep a
+ * list of unused frame structures so that they can be continuously reused.
+ *
+ * - \ref threadstorage.h
+ */
#ifndef ASTERISK_THREADSTORAGE_H
#define ASTERISK_THREADSTORAGE_H
@@ -73,7 +92,7 @@
*
* Example usage:
* \code
- * AST_THREADSTORAGE(my_buf, my_init, my_cleanup);
+ * AST_THREADSTORAGE_CUSTOM(my_buf, my_init, my_cleanup);
* \endcode
*/
#define AST_THREADSTORAGE_CUSTOM(name, c_init, c_cleanup) \
Modified: team/murf/bug8189/include/asterisk/utils.h
URL: http://svn.digium.com/view/asterisk/team/murf/bug8189/include/asterisk/utils.h?view=diff&rev=48064&r1=48063&r2=48064
==============================================================================
--- team/murf/bug8189/include/asterisk/utils.h (original)
+++ team/murf/bug8189/include/asterisk/utils.h Mon Nov 27 13:00:28 2006
@@ -218,6 +218,16 @@
int test_for_thread_safety(void);
+/*!
+ * \brief thread-safe replacement for inet_ntoa().
+ *
+ * \note It is very important to note that even though this is a thread-safe
+ * replacement for inet_ntoa(), it is *not* reentrant. In a single
+ * thread, the result from a previous call to this function is no longer
+ * valid once it is called again. If the result from multiple calls to
+ * this function need to be kept or used at once, then the result must be
+ * copied to a local buffer before calling this function again.
+ */
const char *ast_inet_ntoa(struct in_addr ia);
#ifdef inet_ntoa
Modified: team/murf/bug8189/main/channel.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug8189/main/channel.c?view=diff&rev=48064&r1=48063&r2=48064
==============================================================================
--- team/murf/bug8189/main/channel.c (original)
+++ team/murf/bug8189/main/channel.c Mon Nov 27 13:00:28 2006
@@ -1027,6 +1027,7 @@
free(cid->cid_ani);
if (cid->cid_rdnis)
free(cid->cid_rdnis);
+ cid->cid_dnid = cid->cid_num = cid->cid_name = cid->cid_ani = cid->cid_rdnis = NULL;
}
/*! \brief Free a channel structure */
Modified: team/murf/bug8189/main/http.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug8189/main/http.c?view=diff&rev=48064&r1=48063&r2=48064
==============================================================================
--- team/murf/bug8189/main/http.c (original)
+++ team/murf/bug8189/main/http.c Mon Nov 27 13:00:28 2006
@@ -63,6 +63,7 @@
* in or out the DO_SSL macro.
* We declare most of ssl support variables unconditionally,
* because their number is small and this simplifies the code.
+ * XXX this eventually goes into a generic header file.
*/
#if defined(HAVE_OPENSSL) && (defined(HAVE_FUNOPEN) || defined(HAVE_FOPENCOOKIE))
#define DO_SSL /* comment in/out if you want to support ssl */
@@ -103,7 +104,13 @@
int is_ssl; /* is this an SSL accept ? */
int accept_fd;
pthread_t master;
+ void *(*accept_fn)(void *); /* the function in charge of doing the accept */
+ void *(*worker_fn)(void *); /* the function in charge of doing the actual work */
+ const char *name;
};
+
+static void *http_root(void *arg);
+static void *httpd_helper_thread(void *arg);
/*!
* we have up to two accepting threads, one for http, one for https
@@ -112,12 +119,18 @@
.accept_fd = -1,
.master = AST_PTHREADT_NULL,
.is_ssl = 0,
+ .name = "http server",
+ .accept_fn = http_root,
+ .worker_fn = httpd_helper_thread,
};
static struct server_args https_desc = {
.accept_fd = -1,
.master = AST_PTHREADT_NULL,
.is_ssl = 1,
+ .name = "https server",
+ .accept_fn = http_root,
+ .worker_fn = httpd_helper_thread,
};
static struct ast_http_uri *uris; /*!< list of supported handlers */
@@ -471,7 +484,7 @@
}
#endif /* DO_SSL */
-static void *ast_httpd_helper_thread(void *data)
+static void *httpd_helper_thread(void *data)
{
char buf[4096];
char cookie[4096];
@@ -667,7 +680,7 @@
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
- if (ast_pthread_create_background(&launched, &attr, ast_httpd_helper_thread, ser)) {
+ if (ast_pthread_create_background(&launched, &attr, desc->worker_fn, ser)) {
ast_log(LOG_WARNING, "Unable to launch helper thread: %s\n", strerror(errno));
close(ser->fd);
free(ser);
@@ -721,7 +734,12 @@
#endif
}
-static void http_server_start(struct server_args *desc)
+/*!
+ * This is a generic (re)start routine for a TCP server,
+ * which does the socket/bind/listen and starts a thread for handling
+ * accept().
+ */
+static void server_start(struct server_args *desc)
{
int flags;
int x = 1;
@@ -729,7 +747,7 @@
/* Do nothing if nothing has changed */
if (!memcmp(&desc->oldsin, &desc->sin, sizeof(desc->oldsin))) {
if (option_debug)
- ast_log(LOG_DEBUG, "Nothing changed in http\n");
+ ast_log(LOG_DEBUG, "Nothing changed in %s\n", desc->name);
return;
}
@@ -748,33 +766,33 @@
/* If there's no new server, stop here */
if (desc->sin.sin_family == 0)
return;
-
-
+
desc->accept_fd = socket(AF_INET, SOCK_STREAM, 0);
if (desc->accept_fd < 0) {
- ast_log(LOG_WARNING, "Unable to allocate socket: %s\n", strerror(errno));
+ ast_log(LOG_WARNING, "Unable to allocate socket for %s: %s\n",
+ desc->name, strerror(errno));
return;
}
setsockopt(desc->accept_fd, SOL_SOCKET, SO_REUSEADDR, &x, sizeof(x));
if (bind(desc->accept_fd, (struct sockaddr *)&desc->sin, sizeof(desc->sin))) {
- ast_log(LOG_NOTICE, "Unable to bind http server to %s:%d: %s\n",
+ ast_log(LOG_NOTICE, "Unable to bind %s to %s:%d: %s\n",
+ desc->name,
ast_inet_ntoa(desc->sin.sin_addr), ntohs(desc->sin.sin_port),
strerror(errno));
goto error;
}
if (listen(desc->accept_fd, 10)) {
- ast_log(LOG_NOTICE, "Unable to listen!\n");
- close(desc->accept_fd);
- desc->accept_fd = -1;
- return;
+ ast_log(LOG_NOTICE, "Unable to listen for %s!\n", desc->name);
+ goto error;
}
flags = fcntl(desc->accept_fd, F_GETFL);
fcntl(desc->accept_fd, F_SETFL, flags | O_NONBLOCK);
- if (ast_pthread_create_background(&desc->master, NULL, http_root, desc)) {
- ast_log(LOG_NOTICE, "Unable to launch http server on %s:%d: %s\n",
- ast_inet_ntoa(desc->sin.sin_addr), ntohs(desc->sin.sin_port),
- strerror(errno));
+ if (ast_pthread_create_background(&desc->master, NULL, desc->accept_fn, desc)) {
+ ast_log(LOG_NOTICE, "Unable to launch %s on %s:%d: %s\n",
+ desc->name,
+ ast_inet_ntoa(desc->sin.sin_addr), ntohs(desc->sin.sin_port),
+ strerror(errno));
goto error;
}
return;
@@ -794,8 +812,10 @@
struct ast_hostent ahp;
char newprefix[MAX_PREFIX];
+ /* default values */
memset(&http_desc.sin, 0, sizeof(http_desc.sin));
http_desc.sin.sin_port = htons(8088);
+
memset(&https_desc.sin, 0, sizeof(https_desc.sin));
https_desc.sin.sin_port = htons(8089);
strcpy(newprefix, DEFAULT_PREFIX);
@@ -854,9 +874,9 @@
if (strcmp(prefix, newprefix))
ast_copy_string(prefix, newprefix, sizeof(prefix));
enablestatic = newenablestatic;
- http_server_start(&http_desc);
+ server_start(&http_desc);
if (ssl_setup())
- http_server_start(&https_desc);
+ server_start(&https_desc);
return 0;
}
Modified: team/murf/bug8189/main/rtp.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug8189/main/rtp.c?view=diff&rev=48064&r1=48063&r2=48064
==============================================================================
--- team/murf/bug8189/main/rtp.c (original)
+++ team/murf/bug8189/main/rtp.c Mon Nov 27 13:00:28 2006
@@ -2474,6 +2474,7 @@
return 0;
}
+/*! \brief Write RTP packet with audio or video media frames into UDP packet */
static int ast_rtp_raw_write(struct ast_rtp *rtp, struct ast_frame *f, int codec)
{
unsigned char *rtpheader;
@@ -2659,11 +2660,10 @@
ast_rtp_raw_write(rtp, f, codec);
} else {
/* Don't buffer outgoing frames; send them one-per-packet: */
- if (_f->offset < hdrlen) {
- f = ast_frdup(_f);
- } else {
+ if (_f->offset < hdrlen)
+ f = ast_frdup(_f); /*! \bug XXX this might never be free'd. Why do we do this? */
+ else
f = _f;
- }
ast_rtp_raw_write(rtp, f, codec);
}
@@ -2850,7 +2850,7 @@
return AST_BRIDGE_FAILED;
}
-/*! \brief P2P RTP/RTCP Callback */
+/*! \brief peer 2 peer RTP mode RTP/RTCP Callback */
static int p2p_rtp_callback(int *id, int fd, short events, void *cbdata)
{
int res = 0, hdrlen = 12;
@@ -2951,7 +2951,12 @@
return 0;
}
-/*! \brief Bridge loop for partial native bridge (packet2packet) */
+/*! \brief Bridge loop for partial native bridge (packet2packet)
+
+ In p2p mode, Asterisk is a very basic RTP proxy, just forwarding whatever
+ rtp/rtcp we get in to the channel.
+ \note this currently only works for Audio
+*/
static enum ast_bridge_result bridge_p2p_loop(struct ast_channel *c0, struct ast_channel *c1, struct ast_rtp *p0, struct ast_rtp *p1, int timeoutms, int flags, struct ast_frame **fo, struct ast_channel **rc, void *pvt0, void *pvt1)
{
struct ast_frame *fr = NULL;
Modified: team/murf/bug8189/pbx/pbx_spool.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug8189/pbx/pbx_spool.c?view=diff&rev=48064&r1=48063&r2=48064
==============================================================================
--- team/murf/bug8189/pbx/pbx_spool.c (original)
+++ team/murf/bug8189/pbx/pbx_spool.c Mon Nov 27 13:00:28 2006
@@ -387,8 +387,8 @@
now += o->retrytime;
if (o->callingpid && (o->callingpid == ast_mainpid)) {
safe_append(o, time(NULL), "DelayedRetry");
+ ast_log(LOG_DEBUG, "Delaying retry since we're currently running '%s'\n", o->fn);
free_outgoing(o);
- ast_log(LOG_DEBUG, "Delaying retry since we're currently running '%s'\n", o->fn);
} else {
/* Increment retries */
o->retries++;
@@ -403,20 +403,20 @@
return now;
} else {
ast_log(LOG_EVENT, "Queued call to %s/%s expired without completion after %d attempt%s\n", o->tech, o->dest, o->retries - 1, ((o->retries - 1) != 1) ? "s" : "");
+ remove_from_queue(o, "Expired");
free_outgoing(o);
- remove_from_queue(o, "Expired");
return 0;
}
} else {
+ remove_from_queue(o, "Failed");
free_outgoing(o);
ast_log(LOG_WARNING, "Invalid file contents in %s, deleting\n", fn);
fclose(f);
- remove_from_queue(o, "Failed");
}
} else {
+ remove_from_queue(o, "Failed");
free_outgoing(o);
ast_log(LOG_WARNING, "Unable to open %s: %s, deleting\n", fn, strerror(errno));
- remove_from_queue(o, "Failed");
}
} else
ast_log(LOG_WARNING, "Out of memory :(\n");
Modified: team/murf/bug8189/res/res_musiconhold.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug8189/res/res_musiconhold.c?view=diff&rev=48064&r1=48063&r2=48064
==============================================================================
--- team/murf/bug8189/res/res_musiconhold.c (original)
+++ team/murf/bug8189/res/res_musiconhold.c Mon Nov 27 13:00:28 2006
@@ -205,7 +205,7 @@
if (state->origwfmt && ast_set_write_format(chan, state->origwfmt)) {
ast_log(LOG_WARNING, "Unable to restore channel '%s' to format '%d'\n", chan->name, state->origwfmt);
}
- state->save_pos = state->pos + 1;
+ state->save_pos = state->pos;
}
}
@@ -216,32 +216,29 @@
int tries;
if (state->save_pos) {
- state->pos = state->save_pos - 1;
+ state->pos = state->save_pos;
state->save_pos = 0;
- } else {
+ }
+
+ state->samples = 0;
+ if (chan->stream) {
+ ast_closestream(chan->stream);
+ chan->stream = NULL;
+ state->pos++;
+ state->pos %= state->class->total_files;
+ }
+
+ if (ast_test_flag(state->class, MOH_RANDOMIZE)) {
/* Try 20 times to find something good */
- for (tries=0;tries < 20;tries++) {
- state->samples = 0;
- if (chan->stream) {
- ast_closestream(chan->stream);
- chan->stream = NULL;
- state->pos++;
- }
-
- if (ast_test_flag(state->class, MOH_RANDOMIZE))
- state->pos = ast_random();
-
- state->pos %= state->class->total_files;
+ for (tries = 0; tries < 20; tries++) {
+ state->pos = rand() % state->class->total_files;
/* check to see if this file's format can be opened */
if (ast_fileexists(state->class->filearray[state->pos], NULL, NULL) > 0)
break;
-
- }
- }
-
- state->pos = state->pos % state->class->total_files;
-
+ }
+ }
+
if (!ast_openstream_full(chan, state->class->filearray[state->pos], chan->language, 1)) {
ast_log(LOG_WARNING, "Unable to open file '%s': %s\n", state->class->filearray[state->pos], strerror(errno));
state->pos++;
More information about the asterisk-commits
mailing list