Merge branch 'master' of ssh://git.freeswitch.org:222/freeswitch

This commit is contained in:
Nathan Neulinger 2013-09-26 12:53:50 -05:00
commit 5b92970f55
9 changed files with 120 additions and 34 deletions

View File

@ -1041,7 +1041,9 @@ typedef enum {
SWITCH_STATUS_FOUND,
SWITCH_STATUS_CONTINUE,
SWITCH_STATUS_TERM,
SWITCH_STATUS_NOT_INITALIZED
SWITCH_STATUS_NOT_INITALIZED,
SWITCH_STATUS_XBREAK = 35,
SWITCH_STATUS_WINBREAK = 730035
} switch_status_t;

View File

@ -1329,6 +1329,8 @@ SWITCH_STANDARD_API(stun_function)
switch_port_t port = 0;
switch_memory_pool_t *pool = NULL;
char *error = "";
char *argv[3] = { 0 };
char *mycmd = NULL;
ip = ip_buf;
@ -1337,9 +1339,15 @@ SWITCH_STANDARD_API(stun_function)
return SWITCH_STATUS_SUCCESS;
}
stun_ip = strdup(cmd);
mycmd = strdup(cmd);
switch_split(mycmd, ' ', argv);
stun_ip = argv[0];
switch_assert(stun_ip);
port = argv[1] ? atoi(argv[1]) : 0;
if ((p = strchr(stun_ip, ':'))) {
int iport;
*p++ = '\0';
@ -1374,7 +1382,7 @@ SWITCH_STANDARD_API(stun_function)
}
switch_core_destroy_memory_pool(&pool);
free(stun_ip);
switch_safe_free(mycmd);
return SWITCH_STATUS_SUCCESS;
}

View File

@ -435,7 +435,7 @@ static const char usage[] =
"\t-version -- print the version and exit\n"
"\t-rp -- enable high(realtime) priority settings\n"
"\t-lp -- enable low priority settings\n"
"\t-np -- enable normal priority settings (system defaults)\n"
"\t-np -- enable normal priority settings\n"
"\t-vg -- run under valgrind\n"
"\t-nosql -- disable internal sql scoreboard\n"
"\t-heavy-timer -- Heavy Timer, possibly more accurate but at a cost\n"

View File

@ -717,7 +717,7 @@ SWITCH_DECLARE(switch_status_t) switch_socket_connect(switch_socket_t *sock, swi
SWITCH_DECLARE(switch_status_t) switch_socket_send(switch_socket_t *sock, const char *buf, switch_size_t *len)
{
switch_status_t status = SWITCH_STATUS_SUCCESS;
int status = SWITCH_STATUS_SUCCESS;
switch_size_t req = *len, wrote = 0, need = *len;
int to_count = 0;
@ -737,7 +737,7 @@ SWITCH_DECLARE(switch_status_t) switch_socket_send(switch_socket_t *sock, const
}
*len = wrote;
return status;
return (switch_status_t)status;
}
SWITCH_DECLARE(switch_status_t) switch_socket_send_nonblock(switch_socket_t *sock, const char *buf, switch_size_t *len)
@ -760,7 +760,7 @@ SWITCH_DECLARE(switch_status_t) switch_socket_sendto(switch_socket_t *sock, swit
SWITCH_DECLARE(switch_status_t) switch_socket_recv(switch_socket_t *sock, char *buf, switch_size_t *len)
{
switch_status_t r;
int r;
r = apr_socket_recv(sock, buf, len);
@ -768,7 +768,7 @@ SWITCH_DECLARE(switch_status_t) switch_socket_recv(switch_socket_t *sock, char *
r = SWITCH_STATUS_BREAK;
}
return r;
return (switch_status_t)r;
}
SWITCH_DECLARE(switch_status_t) switch_sockaddr_create(switch_sockaddr_t **sa, switch_memory_pool_t *pool)
@ -866,7 +866,7 @@ SWITCH_DECLARE(switch_status_t) switch_socket_atmark(switch_socket_t *sock, int
SWITCH_DECLARE(switch_status_t) switch_socket_recvfrom(switch_sockaddr_t *from, switch_socket_t *sock, int32_t flags, char *buf, size_t *len)
{
apr_status_t r = SWITCH_STATUS_GENERR;
int r = SWITCH_STATUS_GENERR;
if (from && sock && (r = apr_socket_recvfrom(from, sock, flags, buf, len)) == APR_SUCCESS) {
from->port = ntohs(from->sa.sin.sin_port);
@ -879,7 +879,7 @@ SWITCH_DECLARE(switch_status_t) switch_socket_recvfrom(switch_sockaddr_t *from,
r = SWITCH_STATUS_BREAK;
}
return r;
return (switch_status_t)r;
}
/* poll stubs */

View File

@ -773,7 +773,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
switch_buffer_create_dynamic(&session->raw_read_buffer, bytes * SWITCH_BUFFER_BLOCK_FRAMES, bytes * SWITCH_BUFFER_START_FRAMES, 0);
}
if (!switch_buffer_write(session->raw_read_buffer, read_frame->data, read_frame->datalen)) {
if (read_frame->datalen && (!switch_buffer_write(session->raw_read_buffer, read_frame->data, read_frame->datalen))) {
status = SWITCH_STATUS_MEMERR;
goto done;
}

View File

@ -1394,7 +1394,7 @@ SWITCH_DECLARE(void) switch_core_session_perform_destroy(switch_core_session_t *
switch_channel_get_name((*session)->channel), switch_channel_state_name(switch_channel_get_state((*session)->channel)));
switch_core_session_reset(*session, TRUE, SWITCH_TRUE);
switch_core_session_reset(*session, SWITCH_TRUE, SWITCH_TRUE);
switch_core_media_bug_remove_all(*session);
switch_ivr_deactivate_unicast(*session);

View File

@ -644,31 +644,11 @@ SWITCH_DECLARE(switch_status_t) switch_event_init(switch_memory_pool_t *pool)
switch_find_local_ip(guess_ip_v6, sizeof(guess_ip_v6), NULL, AF_INET6);
//switch_queue_create(&EVENT_QUEUE[0], POOL_COUNT_MAX + 10, THRUNTIME_POOL);
//switch_queue_create(&EVENT_QUEUE[1], POOL_COUNT_MAX + 10, THRUNTIME_POOL);
//switch_queue_create(&EVENT_QUEUE[2], POOL_COUNT_MAX + 10, THRUNTIME_POOL);
#ifdef SWITCH_EVENT_RECYCLE
switch_queue_create(&EVENT_RECYCLE_QUEUE, 250000, THRUNTIME_POOL);
switch_queue_create(&EVENT_HEADER_RECYCLE_QUEUE, 250000, THRUNTIME_POOL);
#endif
//switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
if (runtime.events_use_dispatch) {
switch_queue_create(&EVENT_DISPATCH_QUEUE, DISPATCH_QUEUE_LEN * MAX_DISPATCH, pool);
switch_event_launch_dispatch_threads(1);
}
//switch_thread_create(&EVENT_QUEUE_THREADS[0], thd_attr, switch_event_thread, EVENT_QUEUE[0], RUNTIME_POOL);
//switch_thread_create(&EVENT_QUEUE_THREADS[1], thd_attr, switch_event_thread, EVENT_QUEUE[1], RUNTIME_POOL);
//switch_thread_create(&EVENT_QUEUE_THREADS[2], thd_attr, switch_event_thread, EVENT_QUEUE[2], RUNTIME_POOL);
if (runtime.events_use_dispatch) {
while (!THREAD_COUNT) {
switch_cond_next();
}
}
switch_mutex_lock(EVENT_QUEUE_MUTEX);
SYSTEM_RUNNING = 1;
switch_mutex_unlock(EVENT_QUEUE_MUTEX);
@ -1921,6 +1901,20 @@ SWITCH_DECLARE(switch_status_t) switch_event_fire_detailed(const char *file, con
if (runtime.events_use_dispatch) {
if (!EVENT_DISPATCH_QUEUE) {
switch_mutex_lock(BLOCK);
if (!EVENT_DISPATCH_QUEUE) {
switch_queue_create(&EVENT_DISPATCH_QUEUE, DISPATCH_QUEUE_LEN * MAX_DISPATCH, THRUNTIME_POOL);
switch_event_launch_dispatch_threads(1);
while (!THREAD_COUNT) {
switch_cond_next();
}
}
switch_mutex_unlock(BLOCK);
}
if (switch_event_queue_dispatch_event(event) != SWITCH_STATUS_SUCCESS) {
switch_event_destroy(event);
return SWITCH_STATUS_FALSE;

View File

@ -927,7 +927,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_wait_for_answer(switch_core_session_t
switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Codec Error!\n");
if (caller_channel) {
switch_channel_hangup(caller_channel, SWITCH_CAUSE_NORMAL_TEMPORARY_FAILURE);
switch_channel_hangup(caller_channel, SWITCH_CAUSE_BEARERCAPABILITY_NOTIMPL);
}
read_codec = NULL;
goto done;
@ -1254,7 +1254,7 @@ static switch_status_t setup_ringback(originate_global_t *oglobals, originate_st
switch_core_session_set_read_codec(oglobals->session, write_codec);
} else {
switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(caller_channel), SWITCH_LOG_ERROR, "Codec Error!\n");
switch_channel_hangup(caller_channel, SWITCH_CAUSE_NORMAL_TEMPORARY_FAILURE);
switch_channel_hangup(caller_channel, SWITCH_CAUSE_BEARERCAPABILITY_NOTIMPL);
read_codec = NULL;
switch_goto_status(SWITCH_STATUS_BREAK, end);
}

82
support-d/gl Executable file
View File

@ -0,0 +1,82 @@
#!/usr/bin/perl
my $pager = `which less` || `which more`;
my $tmpdir = "/tmp/FSJIRA";
system("mkdir -p $tmpdir");
my $cmd = "git log " . join(" ", @ARGV);
open(CMD, "$cmd |");
open(PAGER, "|$pager");
select PAGER;
while(my $line = <CMD>) {
print $line;
if ($line =~ /([A-Z]+\-[0-9]+)/) {
my $bug = $1;
my $txt = bugtxt($bug);
if ($txt) {
print "=" x 80 . "\n";
print $txt;
print "=" x 80 . "\n";
}
}
}
close(CMD);
close(PAGER);
sub catfile($) {
my $file = shift;
open(I, $file) or return;
$/ = undef;
my $txt = <I>;
$/ = "\n";
close(I);
return $txt;
}
sub bugtxt($)
{
my $bug = shift or return "";
my $now = time;
my $tmp;
$bug =~ s/\.\.//g;
$bug =~ s/^\///g;
$bug =~ s/~//g;
$bug =~ s/[^a-zA-Z0-9\-]//g;
$tmp = "$tmpdir/$bug.txt";
if(-f $tmp) {
return catfile($tmp);
}
my $cmd = "wget -q http://jira.freeswitch.org/si/jira.issueviews:issue-xml/$bug/$bug.xml -O $tmp";
system($cmd);
my $txt = catfile($tmp);
my ($a,$title) = $txt =~ /\<title\>(.*?)\<\/title\>/smg;
my ($status) = $txt =~ /\<status.*?\>(.*?)\<\/status\>/smg;
my ($a,$des) = $txt =~ /\<description\>(.*?)\<\/description\>/smg;
my ($alogin, $aname) = $txt =~ /\<assignee username=\"([^\"]+)\"\>(.*?)\<\/assignee\>/smg;
my ($rlogin, $rname) = $txt =~ /\<reporter username=\"([^\"]+)\"\>(.*?)\<\/reporter\>/smg;
if ($rname && $aname) {
my $data = "$title\nReporter: $rname [$rlogin]\nAssignee: $aname [$alogin]\nStatus: $status\nhttp://jira.freeswitch.org/browse/$bug\n";
open(O, ">$tmp");
print O $data;
close(O);
return $data;
} else {
unlink($tmp);
}
}