Merge branch 'v1.2.stable' of ssh://git.freeswitch.org:222/freeswitch into v1.2.stable

This commit is contained in:
Michael S Collins 2013-07-10 08:28:29 -07:00
commit 2c00f4c570
5 changed files with 105 additions and 39 deletions

View File

@ -764,8 +764,8 @@ static void *msg_thread_run(esl_thread_t *me, void *obj)
SetConsoleTextAttribute(hStdout, colors[level]);
}
if (global_profile->log_uuid && !esl_strlen_zero(userdata)) {
WriteFile(hStdout, userdata, strlen(userdata), &outbytes, NULL);
WriteFile(hStdout, " ", strlen(" "), &outbytes, NULL);
WriteFile(hStdout, userdata, (DWORD)strlen(userdata), &outbytes, NULL);
WriteFile(hStdout, " ", (DWORD)strlen(" "), &outbytes, NULL);
}
WriteFile(hStdout, handle->last_event->body, len, &outbytes, NULL);
if(!(global_profile->batch_mode)) {

View File

@ -4390,7 +4390,11 @@ static int show_as_json_callback(void *pArg, int argc, char **argv, char **colum
}
if (holder->justcount) {
holder->count++;
if (zstr(argv[0])) {
holder->count = 0;
} else {
holder->count = (uint32_t) atoi(argv[0]);
}
return 0;
}
@ -4430,7 +4434,11 @@ static int show_as_xml_callback(void *pArg, int argc, char **argv, char **column
}
if (holder->justcount) {
holder->count++;
if (zstr(argv[0])) {
holder->count = 0;
} else {
holder->count = (uint32_t) atoi(argv[0]);
}
return 0;
}
@ -4468,7 +4476,11 @@ static int show_callback(void *pArg, int argc, char **argv, char **columnNames)
int x;
if (holder->justcount) {
holder->count++;
if (zstr(argv[0])) {
holder->count = 0;
} else {
holder->count = (uint32_t) atoi(argv[0]);
}
return 0;
}
@ -4704,6 +4716,7 @@ SWITCH_STANDARD_API(show_function)
if (!strcasecmp(command, "calls")) {
sprintf(sql, "select * from basic_calls where hostname='%s' order by call_created_epoch", hostname);
if (argv[1] && !strcasecmp(argv[1], "count")) {
sprintf(sql, "select count(*) from basic_calls where hostname='%s'", hostname);
holder.justcount = 1;
if (argv[3] && !strcasecmp(argv[2], "as")) {
as = argv[3];
@ -4712,6 +4725,7 @@ SWITCH_STANDARD_API(show_function)
} else if (!strcasecmp(command, "registrations")) {
sprintf(sql, "select * from registrations where hostname='%s'", hostname);
if (argv[1] && !strcasecmp(argv[1], "count")) {
sprintf(sql, "select count(*) from registrations where hostname='%s'", hostname);
holder.justcount = 1;
if (argv[3] && !strcasecmp(argv[2], "as")) {
as = argv[3];
@ -4743,6 +4757,7 @@ SWITCH_STANDARD_API(show_function)
} else if (!strcasecmp(command, "channels")) {
sprintf(sql, "select * from channels where hostname='%s' order by created_epoch", hostname);
if (argv[1] && !strcasecmp(argv[1], "count")) {
sprintf(sql, "select count(*) from channels where hostname='%s'", hostname);
holder.justcount = 1;
if (argv[3] && !strcasecmp(argv[2], "as")) {
as = argv[3];

View File

@ -1591,7 +1591,35 @@ switch_status_t FSH323Connection::receive_message(switch_core_session_message_t
}
break;
}
case SWITCH_MESSAGE_INDICATE_DEBUG_MEDIA:{
if (switch_rtp_ready(tech_pvt->rtp_session) && !zstr(msg->string_array_arg[0]) && !zstr(msg->string_array_arg[1])) {
switch_rtp_flag_t flags = 0;
int x = 0;
if (!strcasecmp(msg->string_array_arg[0], "read")) {
x++; flags |= SWITCH_RTP_FLAG_DEBUG_RTP_READ;
} else if (!strcasecmp(msg->string_array_arg[0], "write")) {
x++; flags |= SWITCH_RTP_FLAG_DEBUG_RTP_WRITE;
} else if (!strcasecmp(msg->string_array_arg[0], "both")) {
x++;
x++; flags |= SWITCH_RTP_FLAG_DEBUG_RTP_READ | SWITCH_RTP_FLAG_DEBUG_RTP_WRITE;
} else if (*msg->string_array_arg[0] == 'v') {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(m_fsSession), SWITCH_LOG_ERROR, "Video is not supported yet\n");
break;
}
if (x) {
if (switch_true(msg->string_array_arg[1])) {
switch_rtp_set_flag(tech_pvt->rtp_session, flags);
} else {
switch_rtp_clear_flag(tech_pvt->rtp_session, flags);
}
} else {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(m_fsSession), SWITCH_LOG_ERROR, "Invalid Options\n");
}
}
break;
}
default:{
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"Received message id = %d [%p]\n", msg->message_id,this);
}

View File

@ -91,7 +91,7 @@ static switch_status_t play_group(switch_say_method_t method, switch_say_gender_
} else {
say_file("digits/%d.wav", a);
}
say_file("digits/hundred.wav");
say_file("digits/hundred.wav");
}
if (b) {
@ -106,13 +106,25 @@ static switch_status_t play_group(switch_say_method_t method, switch_say_gender_
say_file("currency/and.wav");
}
if (method == SSM_COUNTED) {
say_file("digits/h-%d0.wav", b);
if ( gender == SSG_MASCULINE ) {
say_file("digits/h-%d0_m.wav", b);
} else if ( gender == SSG_NEUTER ) {
say_file("digits/h-%d0_n.wav", b);
} else {
say_file("digits/h-%d0.wav", b);
}
} else {
say_file("digits/%d0.wav", b);
}
} else {
if (method == SSM_COUNTED) {
say_file("digits/h-%d%d.wav", b, c);
if ( gender == SSG_MASCULINE ) {
say_file("digits/h-%d%d_m.wav", b,c);
} else if ( gender == SSG_NEUTER ) {
say_file("digits/h-%d%d_n.wav", b,c);
} else {
say_file("digits/h-%d%d.wav", b,c);
}
} else {
say_file("digits/%d%d.wav", b, c);
}
@ -122,12 +134,18 @@ static switch_status_t play_group(switch_say_method_t method, switch_say_gender_
if (c) {
if (method == SSM_COUNTED) {
say_file("digits/h-%d.wav", c);
if ( gender == SSG_MASCULINE ) {
say_file("digits/h-%d_m.wav", c);
} else if ( gender == SSG_NEUTER ) {
say_file("digits/h-%d_n.wav", c);
} else {
say_file("digits/h-%d.wav", c);
}
} else {
/*"one" used as an article is feminine or masculine in german, e.g. voicemail-message is feminine
only applies to the likes of 1, 101, 1001 etc.*/
if ( b == 0 && c == 1 && gender == SSG_FEMININE ) {
say_file("digits/%d_f.wav", c);
say_file("digits/1_f.wav");
} else if ( b == 0 && c == 1 && what ) {
say_file("digits/s-1.wav");
} else {
@ -251,10 +269,11 @@ static switch_status_t de_say_time(switch_core_session_t *session, char *tosay,
}
if (hours) {
say_num(hours, SSM_PRONOUNCED);
if (hours == 1) {
say_file("digits/1_f.wav");
say_file("time/hour.wav");
} else {
say_num(hours, SSM_PRONOUNCED);
say_file("time/hours.wav");
}
} else {
@ -263,10 +282,11 @@ static switch_status_t de_say_time(switch_core_session_t *session, char *tosay,
}
if (minutes) {
say_num(minutes, SSM_PRONOUNCED);
if (minutes == 1) {
say_file("digits/1_f.wav");
say_file("time/minute.wav");
} else {
say_num(minutes, SSM_PRONOUNCED);
say_file("time/minutes.wav");
}
} else {
@ -274,11 +294,13 @@ static switch_status_t de_say_time(switch_core_session_t *session, char *tosay,
say_file("time/minutes.wav");
}
say_file("currency/and.wav");
if (seconds) {
say_num(seconds, SSM_PRONOUNCED);
if (seconds == 1) {
say_file("digits/1_f.wav");
say_file("time/second.wav");
} else {
say_num(seconds, SSM_PRONOUNCED);
say_file("time/seconds.wav");
}
} else {
@ -311,6 +333,7 @@ static switch_status_t de_say_time(switch_core_session_t *session, char *tosay,
}
if (say_date) {
say_args->gender = SSG_MASCULINE;
say_file("time/day-%d.wav", tm.tm_wday);
say_num(tm.tm_mday, SSM_COUNTED);
say_file("time/mon-%d.wav", tm.tm_mon);
@ -318,29 +341,27 @@ static switch_status_t de_say_time(switch_core_session_t *session, char *tosay,
}
if (say_time) {
int32_t hour = tm.tm_hour, pm = 0;
if (hour > 12) {
hour -= 12;
pm = 1;
} else if (hour == 12) {
pm = 1;
} else if (hour == 0) {
hour = 12;
pm = 0;
if (say_date) {
say_file("time/at.wav");
}
say_num(hour, SSM_PRONOUNCED);
say_file("time/oclock.wav");
if (tm.tm_min > 9) {
say_num(tm.tm_min, SSM_PRONOUNCED);
} else if (tm.tm_min) {
say_file("time/oh.wav");
say_num(tm.tm_min, SSM_PRONOUNCED);
if (tm.tm_hour == 1) {
say_file("digits/s-1.wav");
} else {
say_num(tm.tm_hour, SSM_PRONOUNCED);
}
say_file("time/oclock.wav");
if (tm.tm_min > 0) {
say_file("currency/and.wav");
if (tm.tm_min == 1) {
say_file("digits/1_f.wav")
say_file("time/minute.wav");
} else {
say_num(tm.tm_min, SSM_PRONOUNCED);
say_file("time/minutes.wav");
}
}
say_file("time/%s.wav", pm ? "p-m" : "a-m");
}
return SWITCH_STATUS_SUCCESS;
@ -378,23 +399,25 @@ static switch_status_t de_say_money(switch_core_session_t *session, char *tosay,
dollars++;
}
/* Say dollar amount */
de_say_general_count(session, dollars, say_args, args);
if (atoi(dollars) == 1) {
say_file("digits/s-1.wav");
say_file("currency/dollar.wav");
} else {
de_say_general_count(session, dollars, say_args, args);
say_file("currency/dollars.wav");
}
/* Say "and" */
say_file("currency/and.wav");
/* Say cents */
if (cents) {
de_say_general_count(session, cents, say_args, args);
/* Say "and" */
say_file("currency/and.wav");
if (atoi(cents) == 1) {
say_file("digits/s-1.wav");
say_file("currency/cent.wav");
} else {
de_say_general_count(session, cents, say_args, args);
say_file("currency/cents.wav");
}
} else {

View File

@ -1704,7 +1704,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess
if (read_impl.samples_per_second) {
switch_channel_set_variable_printf(channel, "playback_seconds", "%d", fh->samples_in / fh->native_rate);
switch_channel_set_variable_printf(channel, "playback_ms", "%d", fh->samples_in / fh->native_rate);
switch_channel_set_variable_printf(channel, "playback_ms", "%d", fh->samples_in / (fh->native_rate / 1000));
}
switch_channel_set_variable_printf(channel, "playback_samples", "%d", fh->samples_in);