From 18db50c46a3839897b7a61c54e09b5c118ee79e3 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 25 Apr 2016 17:29:50 -0500 Subject: [PATCH 01/32] FS-9099 #resolve [Websocket raw frame read timeout is too short] --- libs/sofia-sip/.update | 2 +- .../libsofia-sip-ua/tport/tport_type_ws.c | 47 +++--- .../libsofia-sip-ua/tport/tport_ws.h | 3 +- libs/sofia-sip/libsofia-sip-ua/tport/ws.c | 156 +++++++++++------- libs/sofia-sip/libsofia-sip-ua/tport/ws.h | 19 ++- src/mod/endpoints/mod_verto/ws.c | 12 +- 6 files changed, 139 insertions(+), 100 deletions(-) diff --git a/libs/sofia-sip/.update b/libs/sofia-sip/.update index 971a2e93f3..768af17e16 100644 --- a/libs/sofia-sip/.update +++ b/libs/sofia-sip/.update @@ -1 +1 @@ -Mon Apr 18 10:41:03 CEST 2016 +Mon Apr 25 17:16:25 CDT 2016 diff --git a/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_ws.c b/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_ws.c index 2866899fd3..8857515cb3 100644 --- a/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_ws.c +++ b/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_ws.c @@ -267,26 +267,15 @@ ssize_t tport_send_stream_ws(tport_t const *self, msg_t *msg, msg_iovec_t iov[], size_t iovlen) { - size_t i, j, n, m, size = 0; + size_t i, j, m, size = 0; ssize_t nerror; tport_ws_t *wstp = (tport_ws_t *)self; - enum { WSBUFSIZE = 2048 }; + wstp->wstp_buflen = 0; for (i = 0; i < iovlen; i = j) { - char *buf = wstp->wstp_buffer; - unsigned wsbufsize = WSBUFSIZE; - - if (i + 1 == iovlen) { - buf = NULL; /* Don't bother copying single chunk */ - } - - if (buf && - (char *)iov[i].siv_base - buf < WSBUFSIZE && - (char *)iov[i].siv_base - buf >= 0) { - wsbufsize = buf + WSBUFSIZE - (char *)iov[i].siv_base; - assert(wsbufsize <= WSBUFSIZE); - } + char *buf = NULL; + unsigned wsbufsize = sizeof(wstp->wstp_buffer); for (j = i, m = 0; buf && j < iovlen; j++) { if (m + iov[j].siv_len > wsbufsize) { @@ -304,8 +293,20 @@ ssize_t tport_send_stream_ws(tport_t const *self, msg_t *msg, iov[j].siv_base = buf, iov[j].siv_len = m; } - nerror = ws_feed_buf(&wstp->ws, buf, m); + nerror = 0; + if (m + wstp->wstp_buflen >= wsbufsize) { + nerror = -1; + errno = ENOMEM; + } else { + if (memcpy(wstp->wstp_buffer + wstp->wstp_buflen, buf, m)) { + wstp->wstp_buflen += m; + } else { + nerror = -1; + errno = ENOMEM; + } + } + SU_DEBUG_9(("tport_ws_writevec: vec %p %p %lu ("MOD_ZD")\n", (void *)&wstp->ws, (void *)iov[i].siv_base, (LU)iov[i].siv_len, nerror)); @@ -317,17 +318,13 @@ ssize_t tport_send_stream_ws(tport_t const *self, msg_t *msg, SU_DEBUG_3(("ws_write: %s\n", strerror(err))); return -1; } - - n = (size_t)nerror; - size += n; - - /* Return if the write buffer is full for now */ - if (n != m) - break; } - ws_send_buf(&wstp->ws, WSOC_TEXT); - + if (wstp->wstp_buflen) { + *(wstp->wstp_buffer + wstp->wstp_buflen) = '\0'; + ws_write_frame(&wstp->ws, WSOC_TEXT, wstp->wstp_buffer, wstp->wstp_buflen); + size = wstp->wstp_buflen; + } return size; } diff --git a/libs/sofia-sip/libsofia-sip-ua/tport/tport_ws.h b/libs/sofia-sip/libsofia-sip-ua/tport/tport_ws.h index b4a5d42b5a..d48101e5cb 100644 --- a/libs/sofia-sip/libsofia-sip-ua/tport/tport_ws.h +++ b/libs/sofia-sip/libsofia-sip-ua/tport/tport_ws.h @@ -56,7 +56,8 @@ typedef enum { typedef struct tport_ws_s { tport_t wstp_tp[1]; wsh_t ws; - char *wstp_buffer; + char wstp_buffer[65536]; + size_t wstp_buflen; SU_S8_T ws_initialized; unsigned ws_secure:1; unsigned:0; diff --git a/libs/sofia-sip/libsofia-sip-ua/tport/ws.c b/libs/sofia-sip/libsofia-sip-ua/tport/ws.c index 6e9a69d025..7fe9f182bf 100644 --- a/libs/sofia-sip/libsofia-sip-ua/tport/ws.c +++ b/libs/sofia-sip/libsofia-sip-ua/tport/ws.c @@ -1,3 +1,4 @@ +#include #include "ws.h" #include @@ -146,7 +147,7 @@ static int cheezy_get_var(char *data, char *name, char *buf, size_t buflen) } while((p = (strstr(p,"\n")+1))!=(char *)1); - if (p != (char *)1 && *p!='\0') { + if (p && p != (char *)1 && *p!='\0') { char *v, *e = 0; v = strchr(p, ':'); @@ -264,7 +265,7 @@ int ws_handshake(wsh_t *wsh) } } - if (bytes > sizeof(wsh->buffer) -1) { + if (bytes > wsh->buflen -1) { goto err; } @@ -362,7 +363,7 @@ ssize_t ws_raw_read(wsh_t *wsh, void *data, size_t bytes, int block) } } - } while (r == -1 && err == SSL_ERROR_WANT_READ && wsh->x < 100); + } while (r == -1 && err == SSL_ERROR_WANT_READ && wsh->x < 1000); goto end; } @@ -382,9 +383,9 @@ ssize_t ws_raw_read(wsh_t *wsh, void *data, size_t bytes, int block) ms_sleep(10); } } - } while (r == -1 && xp_is_blocking(xp_errno()) && wsh->x < 100); + } while (r == -1 && xp_is_blocking(xp_errno()) && wsh->x < 1000); - if (wsh->x >= 1000 || (block && wsh->x >= 100)) { + if (wsh->x >= 10000 || (block && wsh->x >= 1000)) { r = -1; } @@ -596,7 +597,15 @@ int ws_init(wsh_t *wsh, ws_socket_t sock, SSL_CTX *ssl_ctx, int close_sock, int wsh->close_sock = 1; } - wsh->buflen = sizeof(wsh->buffer); + wsh->buflen = 1024 * 64; + wsh->bbuflen = wsh->buflen; + + wsh->buffer = malloc(wsh->buflen); + wsh->bbuffer = malloc(wsh->bbuflen); + //printf("init %p %ld\n", (void *) wsh->bbuffer, wsh->bbuflen); + //memset(wsh->buffer, 0, wsh->buflen); + //memset(wsh->bbuffer, 0, wsh->bbuflen); + wsh->secure = ssl_ctx ? 1 : 0; setup_socket(sock); @@ -644,6 +653,12 @@ void ws_destroy(wsh_t *wsh) SSL_free(wsh->ssl); wsh->ssl = NULL; } + + if (wsh->buffer) free(wsh->buffer); + if (wsh->bbuffer) free(wsh->bbuffer); + + wsh->buffer = wsh->bbuffer = NULL; + } ssize_t ws_close(wsh_t *wsh, int16_t reason) @@ -685,6 +700,20 @@ ssize_t ws_close(wsh_t *wsh, int16_t reason) } + +uint64_t hton64(uint64_t val) +{ + if (__BYTE_ORDER == __BIG_ENDIAN) return (val); + else return __bswap_64(val); +} + +uint64_t ntoh64(uint64_t val) +{ + if (__BYTE_ORDER == __BIG_ENDIAN) return (val); + else return __bswap_64(val); +} + + ssize_t ws_read_frame(wsh_t *wsh, ws_opcode_t *oc, uint8_t **data) { @@ -692,6 +721,10 @@ ssize_t ws_read_frame(wsh_t *wsh, ws_opcode_t *oc, uint8_t **data) char *maskp; int ll = 0; int frag = 0; + int blen; + + wsh->body = wsh->bbuffer; + wsh->packetlen = 0; again: need = 2; @@ -745,12 +778,11 @@ ssize_t ws_read_frame(wsh_t *wsh, ws_opcode_t *oc, uint8_t **data) int fin = (wsh->buffer[0] >> 7) & 1; int mask = (wsh->buffer[1] >> 7) & 1; - if (fin) { - if (*oc == WSOC_CONTINUATION) { - frag = 1; - } else { - frag = 0; - } + + if (!fin && *oc != WSOC_CONTINUATION) { + frag = 1; + } else if (fin && *oc == WSOC_CONTINUATION) { + frag = 0; } if (mask) { @@ -765,23 +797,33 @@ ssize_t ws_read_frame(wsh_t *wsh, ws_opcode_t *oc, uint8_t **data) wsh->plen = wsh->buffer[1] & 0x7f; wsh->payload = &wsh->buffer[2]; - + if (wsh->plen == 127) { uint64_t *u64; + int more = 0; need += 8; if (need > wsh->datalen) { /* too small - protocol err */ - *oc = WSOC_CLOSE; - return ws_close(wsh, WS_PROTO_ERR); - } + //*oc = WSOC_CLOSE; + //return ws_close(wsh, WS_PROTO_ERR); + more = ws_raw_read(wsh, wsh->buffer + wsh->datalen, need - wsh->datalen, WS_BLOCK); + + if (more < need - wsh->datalen) { + *oc = WSOC_CLOSE; + return ws_close(wsh, WS_PROTO_ERR); + } else { + wsh->datalen += more; + } + + + } + u64 = (uint64_t *) wsh->payload; wsh->payload += 8; - - wsh->plen = ntohl((u_long)*u64); - + wsh->plen = ntoh64(*u64); } else if (wsh->plen == 126) { uint16_t *u16; @@ -811,16 +853,30 @@ ssize_t ws_read_frame(wsh_t *wsh, ws_opcode_t *oc, uint8_t **data) return ws_close(wsh, WS_PROTO_ERR); } - if ((need + wsh->datalen) > (ssize_t)wsh->buflen) { - /* too big - Ain't nobody got time fo' dat */ - *oc = WSOC_CLOSE; - return ws_close(wsh, WS_DATA_TOO_BIG); + blen = wsh->body - wsh->bbuffer; + + if (need + blen > (ssize_t)wsh->bbuflen) { + void *tmp; + + wsh->bbuflen = need + blen + wsh->rplen; + + if ((tmp = realloc(wsh->bbuffer, wsh->bbuflen))) { + wsh->bbuffer = tmp; + } else { + abort(); + } + + wsh->body = wsh->bbuffer + blen; } wsh->rplen = wsh->plen - need; - + + if (wsh->rplen) { + memcpy(wsh->body, wsh->payload, wsh->rplen); + } + while(need) { - ssize_t r = ws_raw_read(wsh, wsh->payload + wsh->rplen, need, WS_BLOCK); + ssize_t r = ws_raw_read(wsh, wsh->body + wsh->rplen, need, WS_BLOCK); if (r < 1) { /* invalid read - protocol err .. */ @@ -837,28 +893,30 @@ ssize_t ws_read_frame(wsh_t *wsh, ws_opcode_t *oc, uint8_t **data) ssize_t i; for (i = 0; i < wsh->datalen; i++) { - wsh->payload[i] ^= maskp[i % 4]; + wsh->body[i] ^= maskp[i % 4]; } } if (*oc == WSOC_PING) { - ws_write_frame(wsh, WSOC_PONG, wsh->payload, wsh->rplen); + ws_write_frame(wsh, WSOC_PONG, wsh->body, wsh->rplen); goto again; } + *(wsh->body+wsh->rplen) = '\0'; + wsh->packetlen += wsh->rplen; + wsh->body += wsh->rplen; + if (frag) { goto again; } + + *data = (uint8_t *)wsh->bbuffer; - - *(wsh->payload+wsh->rplen) = '\0'; - *data = (uint8_t *)wsh->payload; - - //printf("READ[%ld][%d]-----------------------------:\n[%s]\n-------------------------------\n", wsh->rplen, *oc, (char *)*data); + //printf("READ[%ld][%d]-----------------------------:\n[%s]\n-------------------------------\n", wsh->packetlen, *oc, (char *)*data); - return wsh->rplen; + return wsh->packetlen; } break; default: @@ -871,36 +929,6 @@ ssize_t ws_read_frame(wsh_t *wsh, ws_opcode_t *oc, uint8_t **data) } } -ssize_t ws_feed_buf(wsh_t *wsh, void *data, size_t bytes) -{ - - if (bytes + wsh->wdatalen > wsh->buflen) { - return -1; - } - - memcpy(wsh->wbuffer + wsh->wdatalen, data, bytes); - - wsh->wdatalen += bytes; - - return bytes; -} - -ssize_t ws_send_buf(wsh_t *wsh, ws_opcode_t oc) -{ - ssize_t r = 0; - - if (!wsh->wdatalen) { - return -1; - } - - r = ws_write_frame(wsh, oc, wsh->wbuffer, wsh->wdatalen); - - wsh->wdatalen = 0; - - return r; -} - - ssize_t ws_write_frame(wsh_t *wsh, ws_opcode_t oc, void *data, size_t bytes) { uint8_t hdr[14] = { 0 }; @@ -934,7 +962,7 @@ ssize_t ws_write_frame(wsh_t *wsh, ws_opcode_t oc, void *data, size_t bytes) hlen += 8; u64 = (uint64_t *) &hdr[2]; - *u64 = htonl(bytes); + *u64 = hton64(bytes); } if (wsh->write_buffer_len < (hlen + bytes + 1)) { diff --git a/libs/sofia-sip/libsofia-sip-ua/tport/ws.h b/libs/sofia-sip/libsofia-sip-ua/tport/ws.h index 1751a96655..045ff32acc 100644 --- a/libs/sofia-sip/libsofia-sip-ua/tport/ws.h +++ b/libs/sofia-sip/libsofia-sip-ua/tport/ws.h @@ -25,6 +25,17 @@ //#include "sha1.h" #include +#if defined(_MSC_VER) || defined(__APPLE__) || defined(__FreeBSD__) || (defined(__SVR4) && defined(__sun)) +#define __bswap_64(x) \ + x = (x>>56) | \ + ((x<<40) & 0x00FF000000000000) | \ + ((x<<24) & 0x0000FF0000000000) | \ + ((x<<8) & 0x000000FF00000000) | \ + ((x>>8) & 0x00000000FF000000) | \ + ((x>>24) & 0x0000000000FF0000) | \ + ((x>>40) & 0x000000000000FF00) | \ + (x<<56) +#endif #ifdef _MSC_VER #ifndef strncasecmp #define strncasecmp _strnicmp @@ -78,15 +89,17 @@ typedef enum { typedef struct wsh_s { ws_socket_t sock; - char buffer[65536]; - char wbuffer[65536]; + char *buffer; + char *bbuffer; + char *body; char *uri; size_t buflen; + size_t bbuflen; ssize_t datalen; - ssize_t wdatalen; char *payload; ssize_t plen; ssize_t rplen; + ssize_t packetlen; SSL *ssl; int handshake; uint8_t down; diff --git a/src/mod/endpoints/mod_verto/ws.c b/src/mod/endpoints/mod_verto/ws.c index 0731ac6915..265dd10d8e 100644 --- a/src/mod/endpoints/mod_verto/ws.c +++ b/src/mod/endpoints/mod_verto/ws.c @@ -385,7 +385,7 @@ ssize_t ws_raw_read(wsh_t *wsh, void *data, size_t bytes, int block) } } while (r == -1 && xp_is_blocking(xp_errno()) && wsh->x < 1000); - if (wsh->x >= 1000 || (block && wsh->x >= 100)) { + if (wsh->x >= 10000 || (block && wsh->x >= 1000)) { r = -1; } @@ -929,7 +929,7 @@ ssize_t ws_read_frame(wsh_t *wsh, ws_opcode_t *oc, uint8_t **data) } } -#if 0 + ssize_t ws_feed_buf(wsh_t *wsh, void *data, size_t bytes) { @@ -937,9 +937,9 @@ ssize_t ws_feed_buf(wsh_t *wsh, void *data, size_t bytes) return -1; } - memcpy(wsh->wbuffer + wsh->wdatalen, data, bytes); + memcpy((unsigned char *)wsh->write_buffer + wsh->write_buffer_len, data, bytes); - wsh->wdatalen += bytes; + wsh->write_buffer_len += bytes; return bytes; } @@ -953,13 +953,13 @@ ssize_t ws_send_buf(wsh_t *wsh, ws_opcode_t oc) return -1; } - r = ws_write_frame(wsh, oc, wsh->wbuffer, wsh->wdatalen); + r = ws_write_frame(wsh, oc, wsh->write_buffer, wsh->write_buffer_len); wsh->wdatalen = 0; return r; } -#endif + ssize_t ws_write_frame(wsh_t *wsh, ws_opcode_t oc, void *data, size_t bytes) { From 2477740700d43b6370842b5cbdfd812abf33357b Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 25 Apr 2016 13:48:33 -0500 Subject: [PATCH 02/32] FS-9062 #resolve [OPUS - Mid Call change from 20ms to 40 ms causes jittery voice ] --- src/switch_core_media.c | 146 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 132 insertions(+), 14 deletions(-) diff --git a/src/switch_core_media.c b/src/switch_core_media.c index 777c664d88..fede877b46 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -1870,7 +1870,81 @@ SWITCH_DECLARE(void) switch_core_media_prepare_codecs(switch_core_session_t *ses } +static void adjust_jb(switch_core_session_t *session, int new_ptime_ms) +{ + const char *val; + switch_media_handle_t *smh; + switch_rtp_engine_t *a_engine = NULL; + int maxlen = 0; + int32_t jb_msec = 0 ; + int qlen, maxqlen = 50; + switch_assert(session); + + if (!(smh = session->media_handle)) { + return; + } + + a_engine = &smh->engines[SWITCH_MEDIA_TYPE_AUDIO]; + + if ((val = switch_channel_get_variable(session->channel, "jitterbuffer_msec")) || (val = smh->mparams->jb_msec)) { + char *p; + + if (!jb_msec) { + jb_msec = atoi(val); + + if (strchr(val, 'p') && jb_msec > 0) { + jb_msec *= -1; + } else { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG3, "Will not adjust JB size, token 'p' not specified\n"); + return; + } + + if ((p = strchr(val, ':'))) { + p++; + maxlen = atoi(p); + + if (strchr(p, 'p') && maxlen > 0) { + maxlen *= -1; + } + } + } + + if (jb_msec < 0 && jb_msec > -1000) { + jb_msec = new_ptime_ms * abs(jb_msec); + } + + if (maxlen < 0 && maxlen > -1000) { + maxlen = new_ptime_ms * abs(maxlen); + } + + if (jb_msec < 10 || jb_msec > 10000) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, + "Invalid Jitterbuffer spec [%d] must be between 10 and 10000\n", jb_msec); + } else { + qlen = jb_msec / new_ptime_ms; + if (maxlen) { + maxqlen = maxlen / new_ptime_ms; + } + if (maxqlen < qlen) { + maxqlen = qlen * 5; + } + if (switch_rtp_activate_jitter_buffer(a_engine->rtp_session, qlen, maxqlen, + a_engine->read_impl.samples_per_packet, a_engine->read_impl.samples_per_second) == SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), + SWITCH_LOG_DEBUG, "Adjusting Jitterbuffer to %dms (%d frames) (%d max frames)\n", + jb_msec, qlen, maxqlen); + switch_channel_set_flag(session->channel, CF_JITTERBUFFER); + if (!switch_false(switch_channel_get_variable(session->channel, "rtp_jitter_buffer_plc"))) { + switch_channel_set_flag(session->channel, CF_JITTERBUFFER_PLC); + } + } else { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), + SWITCH_LOG_DEBUG, "Error adjusting Jitterbuffer to %dms (%d frames)\n", jb_msec, qlen); + } + } + } +} static void check_jb(switch_core_session_t *session, const char *input, int32_t jb_msec, int32_t maxlen, switch_bool_t silent) { @@ -2391,25 +2465,22 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_read_frame(switch_core_session } /* check for timing issues */ - if (smh->media_flags[SCMF_AUTOFIX_TIMING] && engine->check_frames < MAX_CODEC_CHECK_FRAMES) { - + if (smh->media_flags[SCMF_AUTOFIX_TIMING]) { + char is_vbr; + is_vbr = engine->read_impl.encoded_bytes_per_packet?0:1; engine->check_frames++; - - if (!engine->read_impl.encoded_bytes_per_packet) { - engine->check_frames = MAX_CODEC_CHECK_FRAMES; - goto skip; - } - - if (smh->media_flags[SCMF_AUTOFIX_TIMING] && (engine->read_frame.datalen % 10) == 0) { + /* CBR */ + if ((smh->media_flags[SCMF_AUTOFIX_TIMING] && (engine->read_frame.datalen % 10) == 0) + && (engine->check_frames < MAX_CODEC_CHECK_FRAMES) && !is_vbr) { + engine->check_frames++; if (engine->last_ts && engine->read_frame.datalen != engine->read_impl.encoded_bytes_per_packet) { uint32_t codec_ms = (int) (engine->read_frame.timestamp - engine->last_ts) / (engine->read_impl.samples_per_second / 1000); - if (engine->last_seq && (int) (engine->read_frame.seq - engine->last_seq) > 1) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Correcting calculated ptime value from %d to %d to compensate for %d lost packet(s)\n", codec_ms, codec_ms / (int) (engine->read_frame.seq - engine->last_seq), (int) (engine->read_frame.seq - engine->last_seq - 1)); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "[%s]: Correcting calculated ptime value from [%d] to [%d] to compensate for [%d] lost packet(s). \n", is_vbr?"VBR":"CBR", codec_ms, codec_ms / (int) (engine->read_frame.seq - engine->last_seq), (int) (engine->read_frame.seq - engine->last_seq - 1)); codec_ms = codec_ms / (int) (engine->read_frame.seq - engine->last_seq); } @@ -2419,7 +2490,6 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_read_frame(switch_core_session goto skip; } - if (engine->last_codec_ms && engine->last_codec_ms == codec_ms) { engine->mismatch_count++; } @@ -2431,8 +2501,9 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_read_frame(switch_core_session if (codec_ms > 120) { /* yeah right */ switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, - "Your phone is trying to send timestamps that suggest an increment of %dms per packet\n" + "[%s]: Your phone is trying to send timestamps that suggest an increment of %dms per packet\n" "That seems hard to believe so I am going to go on ahead and um ignore that, mmkay?\n", + is_vbr?"VBR":"CBR", (int) codec_ms); engine->check_frames = MAX_CODEC_CHECK_FRAMES; goto skip; @@ -2442,7 +2513,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_read_frame(switch_core_session if (codec_ms != engine->cur_payload_map->codec_ms) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, - "Asynchronous PTIME not supported, changing our end from %d to %d\n", + "[%s]: Asynchronous PTIME not supported, changing our end from %d to %d\n", + is_vbr?"VBR":"CBR", (int) engine->cur_payload_map->codec_ms, (int) codec_ms ); @@ -2465,6 +2537,52 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_read_frame(switch_core_session engine->last_ts = engine->read_frame.timestamp; engine->last_seq = engine->read_frame.seq; + } else if (smh->media_flags[SCMF_AUTOFIX_TIMING] && is_vbr && switch_rtp_get_jitter_buffer(engine->rtp_session) + && engine->read_frame.timestamp && engine->read_frame.seq) { + + uint32_t codec_ms = (int) (engine->read_frame.timestamp - + engine->last_ts) / (engine->read_impl.samples_per_second / 1000); + + if (engine->last_seq && (int) (engine->read_frame.seq - engine->last_seq) > 1) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "[%s]: Correcting calculated ptime value from [%d] to [%d] to compensate for [%d] lost packet(s)\n", is_vbr?"VBR":"CBR", codec_ms, codec_ms / (int) (engine->read_frame.seq - engine->last_seq), (int) (engine->read_frame.seq - engine->last_seq - 1)); + codec_ms = codec_ms / (int) (engine->read_frame.seq - engine->last_seq); + } + + engine->last_codec_ms = codec_ms; + + if (codec_ms != engine->cur_payload_map->codec_ms && codec_ms) { + + if (codec_ms > 120) { + /*will show too many times with packet loss*/ + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG3, + "[%s]: Remote party is trying to send timestamps that suggest an increment of [%d] ms per packet, which is too high. Ignoring.\n", + is_vbr?"VBR":"CBR", + (int) codec_ms); + engine->last_ts = engine->read_frame.timestamp; + engine->last_seq = engine->read_frame.seq; + goto skip; + } + + if (codec_ms != engine->cur_payload_map->codec_ms) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, + "[%s]: Asynchronous PTIME supported, adjusting JB size. Remote PTIME changed from [%d] to [%d]\n", + is_vbr?"VBR":"CBR", + (int) engine->cur_payload_map->codec_ms, + (int) codec_ms + ); + engine->cur_payload_map->codec_ms = codec_ms; + /* adjust audio JB size, but do not substitute the codec */ + adjust_jb(session,codec_ms); + engine->reset_codec = 2; + + if (switch_channel_test_flag(session->channel, CF_CONFERENCE)) { + switch_channel_set_flag(session->channel, CF_CONFERENCE_RESET_MEDIA); + } + } + } + + engine->last_ts = engine->read_frame.timestamp; + engine->last_seq = engine->read_frame.seq; } else { engine->mismatch_count = 0; From be8440b0b0dcead84bc5815579bba659ae265e7d Mon Sep 17 00:00:00 2001 From: Brian West Date: Tue, 26 Apr 2016 09:51:39 -0500 Subject: [PATCH 03/32] FS-9076 #resolve --- src/mod/applications/mod_conference/conference_api.c | 5 +++++ src/mod/applications/mod_conference/conference_record.c | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/src/mod/applications/mod_conference/conference_api.c b/src/mod/applications/mod_conference/conference_api.c index cc7c28b2e9..e6f097f200 100644 --- a/src/mod/applications/mod_conference/conference_api.c +++ b/src/mod/applications/mod_conference/conference_api.c @@ -2510,6 +2510,11 @@ switch_status_t conference_api_sub_record(conference_obj_t *conference, switch_s return SWITCH_STATUS_GENERR; } + if (conference->conference_video_mode == CONF_VIDEO_MODE_PASSTHROUGH) { + stream->write_function(stream, "-ERR Video Passthru enabled, recording not permitted.\n"); + return SWITCH_STATUS_SUCCESS; + } + if (conference_utils_test_flag(conference, CFLAG_PERSONAL_CANVAS)) { stream->write_function(stream, "-ERR Personal Canvas enabled, recording not permitted.\n"); return SWITCH_STATUS_SUCCESS; diff --git a/src/mod/applications/mod_conference/conference_record.c b/src/mod/applications/mod_conference/conference_record.c index 2ff3ae4dbd..843f04fa18 100644 --- a/src/mod/applications/mod_conference/conference_record.c +++ b/src/mod/applications/mod_conference/conference_record.c @@ -60,6 +60,11 @@ void conference_record_launch_thread(conference_obj_t *conference, char *path, i return; } + if (conference->conference_video_mode == CONF_VIDEO_MODE_PASSTHROUGH) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Video Passthru enabled, recording not permitted.\n"); + return; + } + if (conference_utils_test_flag(conference, CFLAG_PERSONAL_CANVAS)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Personal Canvas enabled, recording not permitted.\n"); return; From 1805f1ac235612dad1b56c74a3f920570ed83486 Mon Sep 17 00:00:00 2001 From: Ken Rice Date: Tue, 26 Apr 2016 11:06:02 -0500 Subject: [PATCH 04/32] FS-9075 [deb packaging] tweak freeswitch-meta-all dependancies to more fully install FreeSWITCH. --- debian/bootstrap.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/bootstrap.sh b/debian/bootstrap.sh index 51a844deb6..4ed0a933a4 100755 --- a/debian/bootstrap.sh +++ b/debian/bootstrap.sh @@ -561,7 +561,6 @@ Description: Cross-Platform Scalable Multi-Protocol Soft Switch Package: freeswitch-meta-all Architecture: any Depends: \${misc:Depends}, freeswitch (= \${binary:Version}), -Recommends: freeswitch-init (= \${binary:Version}), freeswitch-lang (= \${binary:Version}), freeswitch-timezones (= \${binary:Version}), @@ -613,7 +612,6 @@ Recommends: freeswitch-mod-stress (= \${binary:Version}), freeswitch-mod-translate (= \${binary:Version}), freeswitch-mod-valet-parking (= \${binary:Version}), - freeswitch-mod-vmd (= \${binary:Version}), freeswitch-mod-voicemail (= \${binary:Version}), freeswitch-mod-voicemail-ivr (= \${binary:Version}), freeswitch-mod-flite (= \${binary:Version}), @@ -666,7 +664,9 @@ Recommends: freeswitch-mod-xml-curl (= \${binary:Version}), freeswitch-mod-xml-rpc (= \${binary:Version}), freeswitch-mod-xml-scgi (= \${binary:Version}), +Recommends: Suggests: + freeswitch-mod-vmd (= \${binary:Version}), freeswitch-mod-vlc (= \${binary:Version}), Description: Cross-Platform Scalable Multi-Protocol Soft Switch $(debian_wrap "${fs_description}") From 36916532cce01ec3f2bbe05462f4dfe1fb2e6634 Mon Sep 17 00:00:00 2001 From: Ken Rice Date: Tue, 26 Apr 2016 14:36:46 -0500 Subject: [PATCH 05/32] mod_html5 has been long depricated. this is a dead package --- debian/bootstrap.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/debian/bootstrap.sh b/debian/bootstrap.sh index 4ed0a933a4..5662041b88 100755 --- a/debian/bootstrap.sh +++ b/debian/bootstrap.sh @@ -529,7 +529,6 @@ Recommends: freeswitch-mod-pocketsphinx (= \${binary:Version}), freeswitch-mod-tts-commandline (= \${binary:Version}), freeswitch-mod-dialplan-xml (= \${binary:Version}), - freeswitch-mod-html5 (= \${binary:Version}), freeswitch-mod-loopback (= \${binary:Version}), freeswitch-mod-rtmp (= \${binary:Version}), freeswitch-mod-skinny (= \${binary:Version}), @@ -624,7 +623,6 @@ Depends: \${misc:Depends}, freeswitch (= \${binary:Version}), freeswitch-mod-ldap (= \${binary:Version}), freeswitch-mod-alsa (= \${binary:Version}), freeswitch-mod-dingaling (= \${binary:Version}), - freeswitch-mod-html5 (= \${binary:Version}), freeswitch-mod-loopback (= \${binary:Version}), freeswitch-mod-portaudio (= \${binary:Version}), freeswitch-mod-rtmp (= \${binary:Version}), From 0823f885193e5c11fb5b703810213984771e19a5 Mon Sep 17 00:00:00 2001 From: Ken Rice Date: Tue, 26 Apr 2016 15:31:09 -0500 Subject: [PATCH 06/32] FS-9075 [deb packaging] removing some meta-all dependancies that are causing issues --- debian/bootstrap.sh | 8 -------- 1 file changed, 8 deletions(-) diff --git a/debian/bootstrap.sh b/debian/bootstrap.sh index 5662041b88..7e87169ee6 100755 --- a/debian/bootstrap.sh +++ b/debian/bootstrap.sh @@ -510,7 +510,6 @@ Recommends: freeswitch-mod-lcr (= \${binary:Version}), freeswitch-mod-nibblebill (= \${binary:Version}), freeswitch-mod-oreka (= \${binary:Version}), - freeswitch-mod-random (= \${binary:Version}), freeswitch-mod-redis (= \${binary:Version}), freeswitch-mod-rss (= \${binary:Version}), freeswitch-mod-sms (= \${binary:Version}), @@ -597,12 +596,10 @@ Depends: \${misc:Depends}, freeswitch (= \${binary:Version}), freeswitch-mod-memcache (= \${binary:Version}), freeswitch-mod-nibblebill (= \${binary:Version}), freeswitch-mod-oreka (= \${binary:Version}), - freeswitch-mod-random (= \${binary:Version}), freeswitch-mod-redis (= \${binary:Version}), freeswitch-mod-rss (= \${binary:Version}), freeswitch-mod-sms (= \${binary:Version}), freeswitch-mod-snapshot (= \${binary:Version}), - freeswitch-mod-snipe-hunt (= \${binary:Version}), freeswitch-mod-snom (= \${binary:Version}), freeswitch-mod-sonar (= \${binary:Version}), freeswitch-mod-soundtouch (= \${binary:Version}), @@ -621,7 +618,6 @@ Depends: \${misc:Depends}, freeswitch (= \${binary:Version}), freeswitch-mod-dialplan-directory (= \${binary:Version}), freeswitch-mod-dialplan-xml (= \${binary:Version}), freeswitch-mod-ldap (= \${binary:Version}), - freeswitch-mod-alsa (= \${binary:Version}), freeswitch-mod-dingaling (= \${binary:Version}), freeswitch-mod-loopback (= \${binary:Version}), freeswitch-mod-portaudio (= \${binary:Version}), @@ -631,16 +627,13 @@ Depends: \${misc:Depends}, freeswitch (= \${binary:Version}), freeswitch-mod-sofia (= \${binary:Version}), freeswitch-mod-cdr-csv (= \${binary:Version}), freeswitch-mod-cdr-mongodb (= \${binary:Version}), - freeswitch-mod-cdr-pg-csv (= \${binary:Version}), freeswitch-mod-cdr-sqlite (= \${binary:Version}), freeswitch-mod-erlang-event (= \${binary:Version}), freeswitch-mod-event-multicast (= \${binary:Version}), freeswitch-mod-event-socket (= \${binary:Version}), freeswitch-mod-event-test (= \${binary:Version}), - freeswitch-mod-event-zmq (= \${binary:Version}), freeswitch-mod-json-cdr (= \${binary:Version}), freeswitch-mod-kazoo (= \${binary:Version}), - freeswitch-mod-radius-cdr (= \${binary:Version}), freeswitch-mod-snmp (= \${binary:Version}), freeswitch-mod-local-stream (= \${binary:Version}), freeswitch-mod-native-file (= \${binary:Version}), @@ -690,7 +683,6 @@ Depends: \${misc:Depends}, freeswitch (= \${binary:Version}), freeswitch-mod-silk (= \${binary:Version}), freeswitch-mod-spandsp (= \${binary:Version}), freeswitch-mod-theora (= \${binary:Version}), - freeswitch-mod-vp8 (= \${binary:Version}) Suggests: freeswitch-mod-ilbc (= \${binary:Version}), freeswitch-mod-siren (= \${binary:Version}) From 4c477b02e5ba1918acad7540ece598ebbd41553d Mon Sep 17 00:00:00 2001 From: Ken Rice Date: Tue, 26 Apr 2016 19:11:09 -0500 Subject: [PATCH 07/32] FS-9075 [deb packaging] removing some more meta-all dependancies that are causing issues --- debian/bootstrap.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/debian/bootstrap.sh b/debian/bootstrap.sh index 7e87169ee6..6b1b0b685e 100755 --- a/debian/bootstrap.sh +++ b/debian/bootstrap.sh @@ -591,7 +591,6 @@ Depends: \${misc:Depends}, freeswitch (= \${binary:Version}), freeswitch-mod-hash (= \${binary:Version}), freeswitch-mod-httapi (= \${binary:Version}), freeswitch-mod-http-cache (= \${binary:Version}), - freeswitch-mod-ladspa (= \${binary:Version}), freeswitch-mod-lcr (= \${binary:Version}), freeswitch-mod-memcache (= \${binary:Version}), freeswitch-mod-nibblebill (= \${binary:Version}), @@ -631,7 +630,6 @@ Depends: \${misc:Depends}, freeswitch (= \${binary:Version}), freeswitch-mod-erlang-event (= \${binary:Version}), freeswitch-mod-event-multicast (= \${binary:Version}), freeswitch-mod-event-socket (= \${binary:Version}), - freeswitch-mod-event-test (= \${binary:Version}), freeswitch-mod-json-cdr (= \${binary:Version}), freeswitch-mod-kazoo (= \${binary:Version}), freeswitch-mod-snmp (= \${binary:Version}), From 8ad3d5cb24f23474dbf62c7702185675b36c466d Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 26 Apr 2016 23:05:08 -0500 Subject: [PATCH 08/32] FS-9106 #resolve [vpx performance tweaks] --- src/mod/applications/mod_conference/conference_video.c | 2 +- src/switch_vpx.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/mod/applications/mod_conference/conference_video.c b/src/mod/applications/mod_conference/conference_video.c index 998486400e..01f87a8ac7 100644 --- a/src/mod/applications/mod_conference/conference_video.c +++ b/src/mod/applications/mod_conference/conference_video.c @@ -1514,7 +1514,7 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_write_thread_run(switch_thread_ return NULL; } - switch_core_autobind_cpu(); + //switch_core_autobind_cpu(); while(conference_utils_member_test_flag(member, MFLAG_RUNNING)) { if (switch_queue_pop(member->mux_out_queue, &pop) == SWITCH_STATUS_SUCCESS) { diff --git a/src/switch_vpx.c b/src/switch_vpx.c index f195eab300..6ad449f14e 100644 --- a/src/switch_vpx.c +++ b/src/switch_vpx.c @@ -403,8 +403,8 @@ static switch_status_t init_encoder(switch_codec_t *codec) config->g_h = context->codec_settings.video.height; config->rc_target_bitrate = context->bandwidth; config->g_lag_in_frames = 0; - config->kf_max_dist = 2000; - config->g_threads = 1;//(cpus > 1) ? 2 : 1; + config->kf_max_dist = 360;//2000; + config->g_threads = cpus - 1;//(cpus > 1) ? 2 : 1; if (context->is_vp9) { //config->rc_dropframe_thresh = 2; @@ -435,7 +435,7 @@ static switch_status_t init_encoder(switch_codec_t *codec) config->rc_end_usage = VPX_CBR; //config->g_pass = VPX_RC_ONE_PASS; config->kf_mode = VPX_KF_AUTO; - config->kf_max_dist = 1000; + config->kf_max_dist = 360;//1000; //config->kf_mode = VPX_KF_DISABLED; config->rc_resize_allowed = 1; @@ -545,7 +545,7 @@ static switch_status_t init_encoder(switch_codec_t *codec) vpx_codec_control(&context->encoder, VP8E_SET_CPUUSED, -8); } - vpx_codec_control(&context->encoder, VP8E_SET_STATIC_THRESHOLD, 100); + vpx_codec_control(&context->encoder, VP8E_SET_STATIC_THRESHOLD, 1000); vpx_codec_control(&context->encoder, VP8E_SET_TOKEN_PARTITIONS, token_parts); vpx_codec_control(&context->encoder, VP9E_SET_TUNE_CONTENT, VP9E_CONTENT_SCREEN); From 0685a073edf191b855c1328f795995b9f331f5d0 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 26 Apr 2016 23:19:25 -0500 Subject: [PATCH 09/32] FS-9106 up default FPS to 30 --- src/mod/applications/mod_conference/mod_conference.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 9fd34cb736..d4e4445c6e 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -2464,7 +2464,7 @@ conference_obj_t *conference_new(char *name, conference_xml_cfg_t cfg, switch_co conference_video_mode_t conference_video_mode = CONF_VIDEO_MODE_PASSTHROUGH; int conference_video_quality = 1; int auto_kps_debounce = 30000; - float fps = 15.0f; + float fps = 30.0f; uint32_t max_members = 0; uint32_t announce_count = 0; char *maxmember_sound = NULL; From 0eec84c20f9febbb78ab1384c6845685a7209f6e Mon Sep 17 00:00:00 2001 From: Ken Rice Date: Wed, 27 Apr 2016 07:28:12 -0500 Subject: [PATCH 10/32] FS-9075 [deb packaging] tweak dep for freeswitch-init --- debian/bootstrap.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/debian/bootstrap.sh b/debian/bootstrap.sh index 6b1b0b685e..2506fae85a 100755 --- a/debian/bootstrap.sh +++ b/debian/bootstrap.sh @@ -373,7 +373,7 @@ Depends: \${misc:Depends}, freeswitch (= \${binary:Version}) Recommends: freeswitch-doc (= \${binary:Version}), freeswitch-mod-commands (= \${binary:Version}), - freeswitch-init (= \${binary:Version}), + freeswitch-init, freeswitch-lang (= \${binary:Version}), freeswitch-timezones (= \${binary:Version}), freeswitch-music, @@ -407,7 +407,7 @@ Depends: \${misc:Depends}, freeswitch (= \${binary:Version}), freeswitch-mod-console (= \${binary:Version}), freeswitch-mod-say-en (= \${binary:Version}) Recommends: - freeswitch-init (= \${binary:Version}), + freeswitch-init, freeswitch-lang (= \${binary:Version}), freeswitch-timezones (= \${binary:Version}), freeswitch-meta-codecs (= \${binary:Version}), @@ -429,6 +429,7 @@ Description: Cross-Platform Scalable Multi-Protocol Soft Switch Package: freeswitch-meta-vanilla Architecture: any Depends: \${misc:Depends}, freeswitch (= \${binary:Version}), + freeswitch-init, freeswitch-mod-console (= \${binary:Version}), freeswitch-mod-logfile (= \${binary:Version}), freeswitch-mod-enum (= \${binary:Version}), @@ -462,7 +463,6 @@ Depends: \${misc:Depends}, freeswitch (= \${binary:Version}), freeswitch-mod-lua (= \${binary:Version}), freeswitch-mod-say-en (= \${binary:Version}), Recommends: - freeswitch-init (= \${binary:Version}), freeswitch-lang (= \${binary:Version}), freeswitch-timezones (= \${binary:Version}), freeswitch-music, @@ -478,7 +478,7 @@ Package: freeswitch-meta-sorbet Architecture: any Depends: \${misc:Depends}, freeswitch (= \${binary:Version}), Recommends: - freeswitch-init (= \${binary:Version}), + freeswitch-init, freeswitch-lang (= \${binary:Version}), freeswitch-timezones (= \${binary:Version}), freeswitch-meta-codecs (= \${binary:Version}), @@ -559,7 +559,7 @@ Description: Cross-Platform Scalable Multi-Protocol Soft Switch Package: freeswitch-meta-all Architecture: any Depends: \${misc:Depends}, freeswitch (= \${binary:Version}), - freeswitch-init (= \${binary:Version}), + freeswitch-init, freeswitch-lang (= \${binary:Version}), freeswitch-timezones (= \${binary:Version}), freeswitch-meta-codecs (= \${binary:Version}), From ff169d8133719d8d219dfda959142301eb246f58 Mon Sep 17 00:00:00 2001 From: Brian West Date: Wed, 27 Apr 2016 11:00:29 -0500 Subject: [PATCH 11/32] Revert "FS-8704: Add min-members, wait-min-members-timeout, wait-mod-timeout, wait-min-members-timeout-message, wait-mod-timeout-message, endconf-mod-exit-message, and endconf-message parameters and functionality to mod_conference." This reverts commit c39fbb295f6b9bc01baa5dbfc578e12022c088ae. --- .../mod_conference/conference_api.c | 35 +---- .../mod_conference/conference_loop.c | 22 +-- .../mod_conference/conference_member.c | 18 +-- .../mod_conference/mod_conference.c | 140 ++---------------- .../mod_conference/mod_conference.h | 8 - 5 files changed, 17 insertions(+), 206 deletions(-) diff --git a/src/mod/applications/mod_conference/conference_api.c b/src/mod/applications/mod_conference/conference_api.c index e6f097f200..4cac47c661 100644 --- a/src/mod/applications/mod_conference/conference_api.c +++ b/src/mod/applications/mod_conference/conference_api.c @@ -91,7 +91,7 @@ api_command_t conference_api_sub_commands[] = { {"pin", (void_fn_t) & conference_api_sub_pin, CONF_API_SUB_ARGS_SPLIT, "pin", ""}, {"nopin", (void_fn_t) & conference_api_sub_pin, CONF_API_SUB_ARGS_SPLIT, "nopin", ""}, {"get", (void_fn_t) & conference_api_sub_get, CONF_API_SUB_ARGS_SPLIT, "get", ""}, - {"set", (void_fn_t) & conference_api_sub_set, CONF_API_SUB_ARGS_SPLIT, "set", " "}, + {"set", (void_fn_t) & conference_api_sub_set, CONF_API_SUB_ARGS_SPLIT, "set", " "}, {"file-vol", (void_fn_t) & conference_api_sub_file_vol, CONF_API_SUB_ARGS_SPLIT, "file-vol", ""}, {"floor", (void_fn_t) & conference_api_sub_floor, CONF_API_SUB_MEMBER_TARGET, "floor", ""}, {"vid-floor", (void_fn_t) & conference_api_sub_vid_floor, CONF_API_SUB_MEMBER_TARGET, "vid-floor", " [force]"}, @@ -2744,15 +2744,6 @@ switch_status_t conference_api_sub_get(conference_obj_t *conference, } else if (strcasecmp(argv[2], "count_ghosts") == 0) { stream->write_function(stream, "%d", conference->count_ghosts); - } else if (strcasecmp(argv[2], "min_members") == 0) { - stream->write_function(stream, "%d", - conference->min_members); - } else if (strcasecmp(argv[2], "wait_min_members_timeout") == 0) { - stream->write_function(stream, "%d", - conference->wait_min_members_timeout); - } else if (strcasecmp(argv[2], "wait_mod_timeout") == 0) { - stream->write_function(stream, "%d", - conference->wait_mod_timeout); } else if (strcasecmp(argv[2], "max_members") == 0) { stream->write_function(stream, "%d", conference->max_members); @@ -2807,30 +2798,6 @@ switch_status_t conference_api_sub_set(conference_obj_t *conference, } else { ret_status = SWITCH_STATUS_FALSE; } - } else if (strcasecmp(argv[2], "min_members") == 0) { - int new_min = atoi(argv[3]); - if (new_min >= 0 && (!conference->count || conference_utils_test_flag(conference, CFLAG_WAIT_MIN_MEMBERS))) { - stream->write_function(stream, "%d", conference->min_members); - conference->min_members = new_min; - } else { - ret_status = SWITCH_STATUS_FALSE; - } - } else if (strcasecmp(argv[2], "wait_min_members_timeout") == 0) { - int32_t new_min = atoll(argv[3]); - if (new_min >= 0 && (!conference->count || conference_utils_test_flag(conference, CFLAG_WAIT_MIN_MEMBERS))) { - stream->write_function(stream, "%d", conference->wait_min_members_timeout); - conference->wait_min_members_timeout = new_min; - } else { - ret_status = SWITCH_STATUS_FALSE; - } - } else if (strcasecmp(argv[2], "wait_mod_timeout") == 0) { - int32_t new_timeout = atoll(argv[3]); - if (new_timeout >= 0 && conference_utils_test_flag(conference, CFLAG_WAIT_MOD)) { - stream->write_function(stream, "%d", conference->wait_mod_timeout); - conference->wait_mod_timeout = new_timeout; - } else { - ret_status = SWITCH_STATUS_FALSE; - } } else if (strcasecmp(argv[2], "sound_prefix") == 0) { stream->write_function(stream, "%s",conference->sound_prefix); conference->sound_prefix = switch_core_strdup(conference->pool, argv[3]); diff --git a/src/mod/applications/mod_conference/conference_loop.c b/src/mod/applications/mod_conference/conference_loop.c index f6def401df..ed2d54bf12 100644 --- a/src/mod/applications/mod_conference/conference_loop.c +++ b/src/mod/applications/mod_conference/conference_loop.c @@ -969,8 +969,7 @@ void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t *thread, void *ob /* skip frames that are not actual media or when we are muted or silent */ if ((conference_utils_member_test_flag(member, MFLAG_TALKING) || member->energy_level == 0 || conference_utils_test_flag(member->conference, CFLAG_AUDIO_ALWAYS)) && conference_utils_member_test_flag(member, MFLAG_CAN_SPEAK) && !conference_utils_test_flag(member->conference, CFLAG_WAIT_MOD) - && (!conference_utils_test_flag(member->conference, CFLAG_WAIT_MIN_MEMBERS) || (member->conference->record_count && member->conference->count >= member->conference->min_recording_participants))) { - + && (member->conference->count > 1 || (member->conference->record_count && member->conference->count >= member->conference->min_recording_participants))) { switch_audio_resampler_t *read_resampler = member->read_resampler; void *data; uint32_t datalen; @@ -1378,25 +1377,6 @@ void conference_loop_output(conference_member_t *member) switch_cond_next(); } - if (member->conference->wait_min_members_timeout && switch_epoch_time_now(NULL) - member->join_time >= member->conference->wait_min_members_timeout && - conference_utils_test_flag(member->conference, CFLAG_WAIT_MIN_MEMBERS)) - { - if (!zstr(member->conference->wait_min_members_timeout_message)) { - conference_member_play_file(member, member->conference->wait_min_members_timeout_message, 0, SWITCH_TRUE); - } - member->loop_loop = SWITCH_FALSE; - break; - } - if (member->conference->wait_mod_timeout && switch_epoch_time_now(NULL) - member->join_time >= member->conference->wait_mod_timeout && - conference_utils_test_flag(member->conference, CFLAG_WAIT_MOD)) - { - if (!zstr(member->conference->wait_mod_timeout_message)) { - conference_member_play_file(member, member->conference->wait_mod_timeout_message, 0, SWITCH_TRUE); - } - member->loop_loop = SWITCH_FALSE; - break; - } - } /* Rinse ... Repeat */ end: diff --git a/src/mod/applications/mod_conference/conference_member.c b/src/mod/applications/mod_conference/conference_member.c index 655b368e3a..21e29dbc2a 100644 --- a/src/mod/applications/mod_conference/conference_member.c +++ b/src/mod/applications/mod_conference/conference_member.c @@ -724,9 +724,6 @@ switch_status_t conference_member_add(conference_obj_t *conference, conference_m conference->count_ghosts++; } else { conference->count++; - if (conference->min_members && conference->count >= conference->min_members) { - conference_utils_clear_flag_locked(conference, CFLAG_WAIT_MIN_MEMBERS); - } } if (conference_utils_member_test_flag(member, MFLAG_ENDCONF)) { @@ -817,7 +814,7 @@ switch_status_t conference_member_add(conference_obj_t *conference, conference_m conference_utils_clear_flag(conference, CFLAG_WAIT_MOD); } - if (!conference_utils_test_flag(conference, CFLAG_WAIT_MIN_MEMBERS)) { + if (conference->count > 1) { if ((conference->moh_sound && !conference_utils_test_flag(conference, CFLAG_WAIT_MOD)) || (conference_utils_test_flag(conference, CFLAG_WAIT_MOD) && !switch_true(switch_channel_get_variable(channel, "conference_permanent_wait_mod_moh")))) { /* stop MoH if any */ @@ -829,9 +826,9 @@ switch_status_t conference_member_add(conference_obj_t *conference, conference_m if (conference_utils_test_flag(conference, CFLAG_ENTER_SOUND) && !conference_utils_member_test_flag(member, MFLAG_SILENT)) { if (!zstr(enter_sound)) { conference_file_play(conference, (char *)enter_sound, CONF_DEFAULT_LEADIN, - switch_core_session_get_channel(member->session), !conference_utils_test_flag(conference, CFLAG_WAIT_MOD) ? 0 : 1); + switch_core_session_get_channel(member->session), 0); } else { - conference_file_play(conference, conference->enter_sound, CONF_DEFAULT_LEADIN, switch_core_session_get_channel(member->session), !conference_utils_test_flag(conference, CFLAG_WAIT_MOD) ? 0 : 1); + conference_file_play(conference, conference->enter_sound, CONF_DEFAULT_LEADIN, switch_core_session_get_channel(member->session), 0); } } } @@ -1194,13 +1191,6 @@ switch_status_t conference_member_del(conference_obj_t *conference, conference_m if (!--conference->end_count) { //conference_utils_set_flag_locked(conference, CFLAG_DESTRUCT); conference->endconference_time = switch_epoch_time_now(NULL); - if (conference_utils_member_test_flag(member, MFLAG_MOD) && !zstr(conference->endconf_mod_exit_message)) { - conference_file_play(conference, conference->endconf_mod_exit_message, 0, channel, 0); - } else { - if (!zstr(conference->endconf_message)) { - conference_file_play(conference, conference->endconf_message, 0, channel, 0); - } - } } } @@ -1218,7 +1208,7 @@ switch_status_t conference_member_del(conference_obj_t *conference, conference_m if (!exit_sound && conference->exit_sound && conference_utils_test_flag(conference, CFLAG_EXIT_SOUND) && !conference_utils_member_test_flag(member, MFLAG_SILENT)) { conference_file_play(conference, conference->exit_sound, 0, channel, 0); } - if (!conference_utils_test_flag(conference, CFLAG_WAIT_MIN_MEMBERS) && conference->alone_sound && !conference_utils_test_flag(conference, CFLAG_WAIT_MOD) && !conference_utils_member_test_flag(member, MFLAG_GHOST)) { + if (conference->count == 1 && conference->alone_sound && !conference_utils_test_flag(conference, CFLAG_WAIT_MOD) && !conference_utils_member_test_flag(member, MFLAG_GHOST)) { conference_file_stop(conference, FILE_STOP_ASYNC); conference_file_play(conference, conference->alone_sound, 0, channel, 0); } diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index d4e4445c6e..cc1e51ba5d 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -318,14 +318,14 @@ void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, void *ob if (conference->perpetual_sound && !conference->async_fnode) { conference_file_play(conference, conference->perpetual_sound, CONF_DEFAULT_LEADIN, NULL, 1); - } else if (conference->moh_sound && ((nomoh == 0 && conference_utils_test_flag(conference, CFLAG_WAIT_MIN_MEMBERS)) + } else if (conference->moh_sound && ((nomoh == 0 && conference->count == 1) || conference_utils_test_flag(conference, CFLAG_WAIT_MOD)) && !conference->async_fnode && !conference->fnode) { conference_file_play(conference, conference->moh_sound, CONF_DEFAULT_LEADIN, NULL, 1); } /* Find if no one talked for more than x number of second */ - if (conference->terminate_on_silence && !conference_utils_test_flag(conference, CFLAG_WAIT_MIN_MEMBERS)) { + if (conference->terminate_on_silence && conference->count > 1) { int is_talking = 0; for (imember = conference->members; imember; imember = imember->next) { @@ -1102,21 +1102,6 @@ void conference_xlist(conference_obj_t *conference, switch_xml_t x_conference, i switch_xml_set_attr_d(x_conference, "enter_sound", "true"); } - if (conference->min_members > 0) { - switch_snprintf(i, sizeof(i), "%d", conference->min_members); - switch_xml_set_attr_d(x_conference, "min_members", ival); - } - - if (conference->wait_min_members_timeout > 0) { - switch_snprintf(i, sizeof(i), "%d", conference->wait_min_members_timeout); - switch_xml_set_attr_d(x_conference, "wait_min_members_timeout", ival); - } - - if (conference->wait_mod_timeout > 0) { - switch_snprintf(i, sizeof(i), "%d", conference->wait_mod_timeout); - switch_xml_set_attr_d(x_conference, "wait_mod_timeout", ival); - } - if (conference->max_members > 0) { switch_snprintf(i, sizeof(i), "%d", conference->max_members); switch_xml_set_attr_d(x_conference, "max_members", ival); @@ -1838,12 +1823,9 @@ SWITCH_STANDARD_APP(conference_function) /* if the conference exists, get the pointer to it */ if (!conference) { - const char *max_members_str = NULL; - const char *endconference_grace_time_str = NULL; - const char *auto_record_str = NULL; - const char *min_members_str = NULL; - const char *wait_min_members_timeout_str = NULL; - const char *wait_mod_timeout_str = NULL; + const char *max_members_str; + const char *endconference_grace_time_str; + const char *auto_record_str; /* no conference yet, so check for join-only flag */ if (flags_str) { @@ -1856,9 +1838,9 @@ SWITCH_STANDARD_APP(conference_function) } if (mflags[MFLAG_JOIN_ONLY]) { - switch_event_t *event = NULL; - switch_xml_t jos_xml = NULL; - char *val = NULL; + switch_event_t *event; + switch_xml_t jos_xml; + char *val; /* send event */ switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT); switch_channel_event_set_basic_data(channel, event); @@ -1917,48 +1899,9 @@ SWITCH_STANDARD_APP(conference_function) /* Set the minimum number of members (once you go above it you cannot go below it) */ conference->min = 1; - /* check for variable used to specify override for min_members */ - if (!zstr(min_members_str = switch_channel_get_variable(channel, "conference_min_members"))) { - uint32_t min_members_val = 0; - errno = 0; /* sanity first */ - min_members_val = strtol(min_members_str, NULL, 0); /* base 0 lets 0x... for hex 0... for octal and base 10 otherwise through */ - if (errno == ERANGE || errno == EINVAL || (int32_t) min_members_val < 0) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, - "conference_min_members variable %s is invalid, not setting a limit\n", min_members_str); - } else { - conference->min_members = min_members_val; - } - } - - /* check for variable used to specify override for wait_min_members_timeout */ - if (!zstr(wait_min_members_timeout_str = switch_channel_get_variable(channel, "conference_wait_min_members_timeout"))) { - int32_t wait_min_members_timeout_val = 0; - errno = 0; /* sanity first */ - wait_min_members_timeout_val = strtol(wait_min_members_timeout_str, NULL, 0); /* base 0 lets 0x... for hex 0... for octal and base 10 otherwise through */ - if (errno == ERANGE || errno == EINVAL || (int32_t) wait_min_members_timeout_val < 0) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, - "conference_wait_min_members_timeout variable %s is invalid, not setting a limit\n", wait_min_members_timeout_str); - } else { - conference->wait_min_members_timeout = wait_min_members_timeout_val; - } - } - - /* check for variable used to specify override for wait_min_members_timeout */ - if (!zstr(wait_mod_timeout_str = switch_channel_get_variable(channel, "conference_wait_mod_timeout"))) { - int32_t wait_mod_timeout_val = 0; - errno = 0; /* sanity first */ - wait_mod_timeout_val = strtol(wait_mod_timeout_str, NULL, 0); /* base 0 lets 0x... for hex 0... for octal and base 10 otherwise through */ - if (errno == ERANGE || errno == EINVAL || (int32_t) wait_mod_timeout_val < 0) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, - "conference_wait_mod_timeout variable %s is invalid, not setting a limit\n", wait_mod_timeout_str); - } else { - conference->wait_mod_timeout = wait_mod_timeout_val; - } - } - /* check for variable used to specify override for max_members */ if (!zstr(max_members_str = switch_channel_get_variable(channel, "conference_max_members"))) { - uint32_t max_members_val = 0; + uint32_t max_members_val; errno = 0; /* sanity first */ max_members_val = strtol(max_members_str, NULL, 0); /* base 0 lets 0x... for hex 0... for octal and base 10 otherwise through */ if (errno == ERANGE || errno == EINVAL || (int32_t) max_members_val < 0 || max_members_val == 1) { @@ -1971,7 +1914,7 @@ SWITCH_STANDARD_APP(conference_function) /* check for variable to override endconference_grace_time profile value */ if (!zstr(endconference_grace_time_str = switch_channel_get_variable(channel, "conference_endconference_grace_time"))) { - uint32_t grace_time_val = 0; + uint32_t grace_time_val; errno = 0; /* sanity first */ grace_time_val = strtol(endconference_grace_time_str, NULL, 0); /* base 0 lets 0x... for hex 0... for octal and base 10 otherwise through */ if (errno == ERANGE || errno == EINVAL || (int32_t) grace_time_val < 0) { @@ -1987,10 +1930,6 @@ SWITCH_STANDARD_APP(conference_function) /* Indicate the conference is dynamic */ conference_utils_set_flag_locked(conference, CFLAG_DYNAMIC); - if (conference->min_members) { - conference_utils_set_flag_locked(conference, CFLAG_WAIT_MIN_MEMBERS); - } - /* acquire a read lock on the thread so it can't leave without us */ if (switch_thread_rwlock_tryrdlock(conference->rwlock) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "Read Lock Fail\n"); @@ -2024,7 +1963,7 @@ SWITCH_STANDARD_APP(conference_function) int pin_retries = conference->pin_retries; int pin_valid = 0; switch_status_t status = SWITCH_STATUS_SUCCESS; - char *supplied_pin_value = NULL; + char *supplied_pin_value; /* Answer the channel */ switch_channel_answer(channel); @@ -2444,13 +2383,6 @@ conference_obj_t *conference_new(char *name, conference_xml_cfg_t cfg, switch_co char *perpetual_sound = NULL; char *moh_sound = NULL; char *outcall_templ = NULL; - char *wait_min_members_timeout_message = NULL; - char *wait_mod_timeout_message = NULL; - char *endconf_mod_exit_message = NULL; - char *endconf_message = NULL; - uint32_t min_members = 0; - int32_t wait_min_members_timeout = 0; - int32_t wait_mod_timeout = 0; char *video_layout_name = NULL; char *video_layout_group = NULL; char *video_canvas_size = NULL; @@ -2680,14 +2612,6 @@ conference_obj_t *conference_new(char *name, conference_xml_cfg_t cfg, switch_co kicked_sound = val; } else if (!strcasecmp(var, "join-only-sound") && !zstr(val)) { join_only_sound = val; - } else if (!strcasecmp(var, "wait-min-members-timeout-message") && !zstr(val)) { - wait_min_members_timeout_message = val; - } else if (!strcasecmp(var, "wait-mod-timeout-message") && !zstr(val)) { - wait_mod_timeout_message = val; - } else if (!strcasecmp(var, "endconf-mod-exit-message") && !zstr(val)) { - endconf_mod_exit_message = val; - } else if (!strcasecmp(var, "endconf-message") && !zstr(val)) { - endconf_message = val; } else if (!strcasecmp(var, "pin") && !zstr(val)) { pin = val; } else if (!strcasecmp(var, "moderator-pin") && !zstr(val)) { @@ -2745,27 +2669,6 @@ conference_obj_t *conference_new(char *name, conference_xml_cfg_t cfg, switch_co } else if (!strcasecmp(var, "sound-prefix") && !zstr(val)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "override sound-prefix with: %s\n", val); sound_prefix = val; - } else if (!strcasecmp(var, "min-members") && !zstr(val)) { - errno = 0; /* sanity first */ - min_members = strtol(val, NULL, 0); /* base 0 lets 0x... for hex 0... for octal and base 10 otherwise through */ - if (errno == ERANGE || errno == EINVAL || (int32_t) min_members < 0) { - min_members = 0; /* set to 0 to disable min counts */ - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "min-members %s is invalid, not setting a limit\n", val); - } - } else if (!strcasecmp(var, "wait-min-members-timeout") && !zstr(val)) { - errno = 0; /* sanity first */ - wait_min_members_timeout = strtoll(val, NULL, 0); /* base 0 lets 0x... for hex 0... for octal and base 10 otherwise through */ - if (errno == ERANGE || errno == EINVAL || (int32_t) wait_min_members_timeout < 0) { - wait_min_members_timeout = 0; /* set to 0 to disable timeout waiting for min_members */ - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "wait-min-members-timeout %s is invalid, not setting a limit\n", val); - } - } else if (!strcasecmp(var, "wait-mod-timeout") && !zstr(val)) { - errno = 0; /* sanity first */ - wait_mod_timeout = strtoll(val, NULL, 0); /* base 0 lets 0x... for hex 0... for octal and base 10 otherwise through */ - if (errno == ERANGE || errno == EINVAL || (int32_t) wait_mod_timeout < 0) { - wait_mod_timeout = 0; /* set to 0 to disable timeout waiting for moderator */ - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "wait-mod-timeout %s is invalid, not setting a limit\n", val); - } } else if (!strcasecmp(var, "max-members") && !zstr(val)) { errno = 0; /* sanity first */ max_members = strtol(val, NULL, 0); /* base 0 lets 0x... for hex 0... for octal and base 10 otherwise through */ @@ -3173,22 +3076,6 @@ conference_obj_t *conference_new(char *name, conference_xml_cfg_t cfg, switch_co conference->is_unlocked_sound = switch_core_strdup(conference->pool, is_unlocked_sound); } - if (!zstr(wait_min_members_timeout_message)) { - conference->wait_min_members_timeout_message = switch_core_strdup(conference->pool, wait_min_members_timeout_message); - } - - if (!zstr(wait_mod_timeout_message)) { - conference->wait_mod_timeout_message = switch_core_strdup(conference->pool, wait_mod_timeout_message); - } - - if (!zstr(endconf_mod_exit_message)) { - conference->endconf_mod_exit_message = switch_core_strdup(conference->pool, endconf_mod_exit_message); - } - - if (!zstr(endconf_message)) { - conference->endconf_message = switch_core_strdup(conference->pool, endconf_message); - } - if (!zstr(energy_level)) { conference->energy_level = atoi(energy_level); if (conference->energy_level < 0) { @@ -3210,11 +3097,6 @@ conference_obj_t *conference_new(char *name, conference_xml_cfg_t cfg, switch_co } } - /* its going to be 0 by default, set to a value otherwise so this should be safe */ - conference->min_members = min_members; - conference->wait_min_members_timeout = wait_min_members_timeout; - conference->wait_mod_timeout = wait_mod_timeout; - if (!zstr(maxmember_sound)) { conference->maxmember_sound = switch_core_strdup(conference->pool, maxmember_sound); } diff --git a/src/mod/applications/mod_conference/mod_conference.h b/src/mod/applications/mod_conference/mod_conference.h index b9e281e991..9feb4e9e31 100644 --- a/src/mod/applications/mod_conference/mod_conference.h +++ b/src/mod/applications/mod_conference/mod_conference.h @@ -249,7 +249,6 @@ typedef enum { CFLAG_PERSONAL_CANVAS, CFLAG_REFRESH_LAYOUT, CFLAG_VIDEO_MUTE_EXIT_CANVAS, - CFLAG_WAIT_MIN_MEMBERS, ///////////////////////////////// CFLAG_MAX } conference_flag_t; @@ -558,13 +557,6 @@ typedef struct conference_obj { int auto_record_canvas; char *record_filename; char *outcall_templ; - char *wait_min_members_timeout_message; - char *wait_mod_timeout_message; - char *endconf_mod_exit_message; - char *endconf_message; - uint32_t min_members; - int32_t wait_min_members_timeout; - int32_t wait_mod_timeout; char *video_layout_name; char *video_layout_group; char *video_canvas_bgcolor; From 8bd56deb4e660cf670682da3af65783faee40442 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 27 Apr 2016 12:23:10 -0500 Subject: [PATCH 12/32] FS-9086 #resolve [Video files playing in mod_conference do not count in totals for calculating layout] --- .../mod_conference/conference_video.c | 52 +++++++++++-------- 1 file changed, 29 insertions(+), 23 deletions(-) diff --git a/src/mod/applications/mod_conference/conference_video.c b/src/mod/applications/mod_conference/conference_video.c index 01f87a8ac7..93588a87b6 100644 --- a/src/mod/applications/mod_conference/conference_video.c +++ b/src/mod/applications/mod_conference/conference_video.c @@ -2195,6 +2195,21 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr video_count = 0; + if (conference->async_fnode && switch_core_file_has_video(&conference->async_fnode->fh, SWITCH_TRUE)) { + check_async_file = 1; + file_count++; + video_count++; + files_playing = 1; + } + + if (conference->fnode && switch_core_file_has_video(&conference->fnode->fh, SWITCH_TRUE)) { + check_file = 1; + file_count++; + video_count++; + files_playing = 1; + } + + switch_mutex_lock(conference->member_mutex); for (imember = conference->members; imember; imember = imember->next) { int no_muted = conference_utils_test_flag(imember->conference, CFLAG_VIDEO_MUTE_EXIT_CANVAS); @@ -2203,10 +2218,11 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr if (imember->channel && switch_channel_ready(imember->channel) && switch_channel_test_flag(imember->channel, CF_VIDEO_READY) && !conference_utils_member_test_flag(imember, MFLAG_SECOND_SCREEN) && - conference_utils_member_test_flag(imember, MFLAG_RUNNING) && (!no_muted || seen) && (!no_av || imember->avatar_png_img) + conference_utils_member_test_flag(imember, MFLAG_RUNNING) && (!no_muted || seen) && (!no_av || (no_av && !imember->avatar_png_img)) && imember->canvas_id == canvas->canvas_id && imember->video_media_flow != SWITCH_MEDIA_FLOW_SENDONLY) { video_count++; } + } canvas->video_count = video_count; switch_mutex_unlock(conference->member_mutex); @@ -2240,10 +2256,21 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr conference_utils_clear_flag(conference, CFLAG_REFRESH_LAYOUT); } + if (count_changed) { + need_refresh = 1; + send_keyframe = 1; + do_refresh = 100; + } + + + if (file_count != last_file_count) { + count_changed = 1; + } + if (count_changed && !personal) { layout_group_t *lg = NULL; video_layout_t *vlayout = NULL; - + if (canvas->video_layout_group && (lg = switch_core_hash_find(conference->layout_group_hash, canvas->video_layout_group))) { if ((vlayout = conference_video_find_best_layout(conference, lg, canvas->video_count))) { switch_mutex_lock(conference->member_mutex); @@ -2252,28 +2279,7 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr } } } - - if (count_changed) { - need_refresh = 1; - send_keyframe = 1; - do_refresh = 100; - } - if (conference->async_fnode && switch_core_file_has_video(&conference->async_fnode->fh, SWITCH_TRUE)) { - check_async_file = 1; - file_count++; - files_playing = 1; - } - - if (conference->fnode && switch_core_file_has_video(&conference->fnode->fh, SWITCH_TRUE)) { - check_file = 1; - file_count++; - files_playing = 1; - } - - if (file_count != last_file_count) { - count_changed = 1; - } last_file_count = file_count; From 3d4475659186616e5b52ce62d54de9da93cdd4c9 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 27 Apr 2016 12:25:00 -0500 Subject: [PATCH 13/32] FS-9106 add new version of previous vpx sleep patch --- libs/libvpx/vp8/common/threading.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libs/libvpx/vp8/common/threading.h b/libs/libvpx/vp8/common/threading.h index c00e517a78..069e26b992 100644 --- a/libs/libvpx/vp8/common/threading.h +++ b/libs/libvpx/vp8/common/threading.h @@ -166,11 +166,11 @@ static inline int sem_destroy(sem_t * sem) #define sem_wait(sem) (semaphore_wait(*sem) ) #define sem_post(sem) semaphore_signal(*sem) #define sem_destroy(sem) semaphore_destroy(mach_task_self(),*sem) -#define thread_sleep(nms) /* { struct timespec ts;ts.tv_sec=0; ts.tv_nsec = 1000*nms;nanosleep(&ts, NULL);} */ +#define thread_sleep(nms) { struct timespec ts;ts.tv_sec=0; ts.tv_nsec = 1000*nms;nanosleep(&ts, NULL);} #else #include #include -#define thread_sleep(nms) sched_yield();/* {struct timespec ts;ts.tv_sec=0; ts.tv_nsec = 1000*nms;nanosleep(&ts, NULL);} */ +#define thread_sleep(nms) {struct timespec ts;ts.tv_sec=0; ts.tv_nsec = 1000*nms;nanosleep(&ts, NULL);} #endif /* Not Windows. Assume pthreads */ @@ -213,7 +213,7 @@ static INLINE void sync_read(pthread_mutex_t *const mutex, int mb_col, const int nsync) { while (mb_col > (protected_read(mutex, last_row_current_mb_col) - nsync)) { x86_pause_hint(); - thread_sleep(0); + thread_sleep(1); } } From e23bb54f9ad8ae8189d4f8245fb6eebc3a3d0e88 Mon Sep 17 00:00:00 2001 From: Mike Jerris Date: Wed, 27 Apr 2016 13:49:04 -0400 Subject: [PATCH 14/32] FS-9078: [sofia-sip] fix windows build of HEPv2/HEPv3 code --- .../libsofia-sip-ua/tport/tport_logging.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/libs/sofia-sip/libsofia-sip-ua/tport/tport_logging.c b/libs/sofia-sip/libsofia-sip-ua/tport/tport_logging.c index efe7efe69e..6803b5559b 100644 --- a/libs/sofia-sip/libsofia-sip-ua/tport/tport_logging.c +++ b/libs/sofia-sip/libsofia-sip-ua/tport/tport_logging.c @@ -558,7 +558,7 @@ int tport_capt_msg_hepv2 (tport_t const *self, msg_t *msg, size_t n, hep_time.tv_usec = now.tv_usec; hep_time.captid = mr->mr_agent_id; - memcpy((void*)*buffer+buflen, &hep_time, sizeof(struct hep_timehdr)); + memcpy((char*)*buffer+buflen, &hep_time, sizeof(struct hep_timehdr)); buflen += sizeof(struct hep_timehdr); } @@ -596,12 +596,12 @@ int tport_capt_msg_hepv3 (tport_t const *self, msg_t *msg, size_t n, struct hep_generic *hg=NULL; unsigned int buflen=0, iplen=0,tlen=0, payload_len = 0; su_time_t now; - hep_chunk_ip4_t src_ip4, dst_ip4; + hep_chunk_ip4_t src_ip4 = { 0 }, dst_ip4 = { 0 }; hep_chunk_t payload_chunk; int orig_n = 0; #if SU_HAVE_IN6 - hep_chunk_ip6_t src_ip6, dst_ip6; + hep_chunk_ip6_t src_ip6 = { 0 }, dst_ip6 = { 0 }; #endif int eth_frame_len = 16000; @@ -771,26 +771,26 @@ int tport_capt_msg_hepv3 (tport_t const *self, msg_t *msg, size_t n, /* IPv4 */ if(su->su_family == AF_INET) { /* SRC IP */ - memcpy((void*) *buffer+buflen, &src_ip4, sizeof(struct hep_chunk_ip4)); + memcpy((char*) *buffer+buflen, &src_ip4, sizeof(struct hep_chunk_ip4)); buflen += sizeof(struct hep_chunk_ip4); - memcpy((void*) *buffer+buflen, &dst_ip4, sizeof(struct hep_chunk_ip4)); + memcpy((char*) *buffer+buflen, &dst_ip4, sizeof(struct hep_chunk_ip4)); buflen += sizeof(struct hep_chunk_ip4); } #if SU_HAVE_IN6 /* IPv6 */ else if(su->su_family == AF_INET6) { /* SRC IPv6 */ - memcpy((void*) *buffer+buflen, &src_ip4, sizeof(struct hep_chunk_ip6)); + memcpy((char*) *buffer+buflen, &src_ip4, sizeof(struct hep_chunk_ip6)); buflen += sizeof(struct hep_chunk_ip6); - memcpy((void*) *buffer+buflen, &dst_ip6, sizeof(struct hep_chunk_ip6)); + memcpy((char*) *buffer+buflen, &dst_ip6, sizeof(struct hep_chunk_ip6)); buflen += sizeof(struct hep_chunk_ip6); } #endif /* PAYLOAD CHUNK */ - memcpy((void*) *buffer+buflen, &payload_chunk, sizeof(struct hep_chunk)); + memcpy((char*) *buffer+buflen, &payload_chunk, sizeof(struct hep_chunk)); buflen += sizeof(struct hep_chunk); /* PAYLOAD */ From 1bbb487396129260fc1575512a3b8bfc06071ecb Mon Sep 17 00:00:00 2001 From: Mike Jerris Date: Wed, 27 Apr 2016 13:49:50 -0400 Subject: [PATCH 15/32] FS-9099: [sofia-sip] fix windows build of websocket transport --- libs/win32/sofia/libsofia_sip_ua_static.2015.vcxproj | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libs/win32/sofia/libsofia_sip_ua_static.2015.vcxproj b/libs/win32/sofia/libsofia_sip_ua_static.2015.vcxproj index 61ef7d83f5..9409332599 100644 --- a/libs/win32/sofia/libsofia_sip_ua_static.2015.vcxproj +++ b/libs/win32/sofia/libsofia_sip_ua_static.2015.vcxproj @@ -86,7 +86,7 @@ if not exist "$(ProjectDir)$(IntDir)\auth_client.obj" "autogen.cmd" Disabled - ..\..\sofia-sip\win32;..\..\sofia-sip\libsofia-sip-ua\su;..\..\sofia-sip\libsofia-sip-ua\ipt;..\..\sofia-sip\libsofia-sip-ua\sresolv;..\..\sofia-sip\libsofia-sip-ua\bnf;..\..\sofia-sip\libsofia-sip-ua\url;..\..\sofia-sip\libsofia-sip-ua\msg;..\..\sofia-sip\libsofia-sip-ua\sip;..\..\sofia-sip\libsofia-sip-ua\nta;..\..\sofia-sip\libsofia-sip-ua\nua;..\..\sofia-sip\libsofia-sip-ua\iptsec;..\..\sofia-sip\libsofia-sip-ua\http;..\..\sofia-sip\libsofia-sip-ua\nth;..\..\sofia-sip\libsofia-sip-ua\nea;..\..\sofia-sip\libsofia-sip-ua\sdp;..\..\sofia-sip\libsofia-sip-ua\soa;..\..\sofia-sip\libsofia-sip-ua\stun;..\..\sofia-sip\libsofia-sip-ua\tport;..\..\sofia-sip\libsofia-sip-ua\features;..\..\pthreads-w32-2-9-1;.;..\..\openssl-$(OpenSSLVersion)\include;%(AdditionalIncludeDirectories) + ..\..\sofia-sip\win32;..\..\sofia-sip\libsofia-sip-ua\su;..\..\sofia-sip\libsofia-sip-ua\ipt;..\..\sofia-sip\libsofia-sip-ua\sresolv;..\..\sofia-sip\libsofia-sip-ua\bnf;..\..\sofia-sip\libsofia-sip-ua\url;..\..\sofia-sip\libsofia-sip-ua\msg;..\..\sofia-sip\libsofia-sip-ua\sip;..\..\sofia-sip\libsofia-sip-ua\nta;..\..\sofia-sip\libsofia-sip-ua\nua;..\..\sofia-sip\libsofia-sip-ua\iptsec;..\..\sofia-sip\libsofia-sip-ua\http;..\..\sofia-sip\libsofia-sip-ua\nth;..\..\sofia-sip\libsofia-sip-ua\nea;..\..\sofia-sip\libsofia-sip-ua\sdp;..\..\sofia-sip\libsofia-sip-ua\soa;..\..\sofia-sip\libsofia-sip-ua\stun;..\..\sofia-sip\libsofia-sip-ua\tport;..\..\sofia-sip\libsofia-sip-ua\features;..\..\pthreads-w32-2-9-1;.;..\..\openssl-$(OpenSSLVersion)\include;..\..\..\src\include;%(AdditionalIncludeDirectories) _TIMESPEC_DEFINED;WIN32;_DEBUG;_LIB;IN_LIBSOFIA_SIP_UA_STATIC;LIBSOFIA_SIP_UA_STATIC;LIBSRES_STATIC;PTW32_STATIC_LIB;HAVE_IPHLPAPI_H;SU_DEBUG=0;_WINSOCK_DEPRECATED_NO_WARNINGS;%(PreprocessorDefinitions) true EnableFastChecks @@ -123,7 +123,7 @@ if not exist "$(ProjectDir)$(IntDir)\auth_client.obj" "autogen.cmd" Disabled - ..\..\sofia-sip\win32;..\..\sofia-sip\libsofia-sip-ua\su;..\..\sofia-sip\libsofia-sip-ua\ipt;..\..\sofia-sip\libsofia-sip-ua\sresolv;..\..\sofia-sip\libsofia-sip-ua\bnf;..\..\sofia-sip\libsofia-sip-ua\url;..\..\sofia-sip\libsofia-sip-ua\msg;..\..\sofia-sip\libsofia-sip-ua\sip;..\..\sofia-sip\libsofia-sip-ua\nta;..\..\sofia-sip\libsofia-sip-ua\nua;..\..\sofia-sip\libsofia-sip-ua\iptsec;..\..\sofia-sip\libsofia-sip-ua\http;..\..\sofia-sip\libsofia-sip-ua\nth;..\..\sofia-sip\libsofia-sip-ua\nea;..\..\sofia-sip\libsofia-sip-ua\sdp;..\..\sofia-sip\libsofia-sip-ua\soa;..\..\sofia-sip\libsofia-sip-ua\stun;..\..\sofia-sip\libsofia-sip-ua\tport;..\..\sofia-sip\libsofia-sip-ua\features;..\..\pthreads-w32-2-9-1;.;..\..\openssl-$(OpenSSLVersion)\include;%(AdditionalIncludeDirectories) + ..\..\sofia-sip\win32;..\..\sofia-sip\libsofia-sip-ua\su;..\..\sofia-sip\libsofia-sip-ua\ipt;..\..\sofia-sip\libsofia-sip-ua\sresolv;..\..\sofia-sip\libsofia-sip-ua\bnf;..\..\sofia-sip\libsofia-sip-ua\url;..\..\sofia-sip\libsofia-sip-ua\msg;..\..\sofia-sip\libsofia-sip-ua\sip;..\..\sofia-sip\libsofia-sip-ua\nta;..\..\sofia-sip\libsofia-sip-ua\nua;..\..\sofia-sip\libsofia-sip-ua\iptsec;..\..\sofia-sip\libsofia-sip-ua\http;..\..\sofia-sip\libsofia-sip-ua\nth;..\..\sofia-sip\libsofia-sip-ua\nea;..\..\sofia-sip\libsofia-sip-ua\sdp;..\..\sofia-sip\libsofia-sip-ua\soa;..\..\sofia-sip\libsofia-sip-ua\stun;..\..\sofia-sip\libsofia-sip-ua\tport;..\..\sofia-sip\libsofia-sip-ua\features;..\..\pthreads-w32-2-9-1;.;..\..\openssl-$(OpenSSLVersion)\include;..\..\..\src\include;%(AdditionalIncludeDirectories) _TIMESPEC_DEFINED;_WIN64;WIN32;_DEBUG;_LIB;IN_LIBSOFIA_SIP_UA_STATIC;LIBSOFIA_SIP_UA_STATIC;LIBSRES_STATIC;PTW32_STATIC_LIB;HAVE_IPHLPAPI_H;SU_DEBUG=0;_WINSOCK_DEPRECATED_NO_WARNINGS;%(PreprocessorDefinitions) true EnableFastChecks @@ -158,7 +158,7 @@ if not exist "$(ProjectDir)$(IntDir)\auth_client.obj" "autogen.cmd" MaxSpeed OnlyExplicitInline - ..\..\sofia-sip\win32;..\..\sofia-sip\libsofia-sip-ua\su;..\..\sofia-sip\libsofia-sip-ua\ipt;..\..\sofia-sip\libsofia-sip-ua\sresolv;..\..\sofia-sip\libsofia-sip-ua\bnf;..\..\sofia-sip\libsofia-sip-ua\url;..\..\sofia-sip\libsofia-sip-ua\msg;..\..\sofia-sip\libsofia-sip-ua\sip;..\..\sofia-sip\libsofia-sip-ua\nta;..\..\sofia-sip\libsofia-sip-ua\nua;..\..\sofia-sip\libsofia-sip-ua\iptsec;..\..\sofia-sip\libsofia-sip-ua\http;..\..\sofia-sip\libsofia-sip-ua\nth;..\..\sofia-sip\libsofia-sip-ua\nea;..\..\sofia-sip\libsofia-sip-ua\sdp;..\..\sofia-sip\libsofia-sip-ua\soa;..\..\sofia-sip\libsofia-sip-ua\stun;..\..\sofia-sip\libsofia-sip-ua\tport;..\..\sofia-sip\libsofia-sip-ua\features;..\..\pthreads-w32-2-9-1;.;..\..\openssl-$(OpenSSLVersion)\include;%(AdditionalIncludeDirectories) + ..\..\sofia-sip\win32;..\..\sofia-sip\libsofia-sip-ua\su;..\..\sofia-sip\libsofia-sip-ua\ipt;..\..\sofia-sip\libsofia-sip-ua\sresolv;..\..\sofia-sip\libsofia-sip-ua\bnf;..\..\sofia-sip\libsofia-sip-ua\url;..\..\sofia-sip\libsofia-sip-ua\msg;..\..\sofia-sip\libsofia-sip-ua\sip;..\..\sofia-sip\libsofia-sip-ua\nta;..\..\sofia-sip\libsofia-sip-ua\nua;..\..\sofia-sip\libsofia-sip-ua\iptsec;..\..\sofia-sip\libsofia-sip-ua\http;..\..\sofia-sip\libsofia-sip-ua\nth;..\..\sofia-sip\libsofia-sip-ua\nea;..\..\sofia-sip\libsofia-sip-ua\sdp;..\..\sofia-sip\libsofia-sip-ua\soa;..\..\sofia-sip\libsofia-sip-ua\stun;..\..\sofia-sip\libsofia-sip-ua\tport;..\..\sofia-sip\libsofia-sip-ua\features;..\..\pthreads-w32-2-9-1;.;..\..\openssl-$(OpenSSLVersion)\include;..\..\..\src\include;%(AdditionalIncludeDirectories) _TIMESPEC_DEFINED;WIN32;NDEBUG;_LIB;IN_LIBSOFIA_SIP_UA_STATIC;LIBSOFIA_SIP_UA_STATIC;LIBSRES_STATIC;PTW32_STATIC_LIB;HAVE_IPHLPAPI_H;SU_DEBUG=0;_WINSOCK_DEPRECATED_NO_WARNINGS;%(PreprocessorDefinitions) true MultiThreadedDLL @@ -196,7 +196,7 @@ if not exist "$(ProjectDir)$(IntDir)\auth_client.obj" "autogen.cmd" MaxSpeed OnlyExplicitInline - ..\..\sofia-sip\win32;..\..\sofia-sip\libsofia-sip-ua\su;..\..\sofia-sip\libsofia-sip-ua\ipt;..\..\sofia-sip\libsofia-sip-ua\sresolv;..\..\sofia-sip\libsofia-sip-ua\bnf;..\..\sofia-sip\libsofia-sip-ua\url;..\..\sofia-sip\libsofia-sip-ua\msg;..\..\sofia-sip\libsofia-sip-ua\sip;..\..\sofia-sip\libsofia-sip-ua\nta;..\..\sofia-sip\libsofia-sip-ua\nua;..\..\sofia-sip\libsofia-sip-ua\iptsec;..\..\sofia-sip\libsofia-sip-ua\http;..\..\sofia-sip\libsofia-sip-ua\nth;..\..\sofia-sip\libsofia-sip-ua\nea;..\..\sofia-sip\libsofia-sip-ua\sdp;..\..\sofia-sip\libsofia-sip-ua\soa;..\..\sofia-sip\libsofia-sip-ua\stun;..\..\sofia-sip\libsofia-sip-ua\tport;..\..\sofia-sip\libsofia-sip-ua\features;..\..\pthreads-w32-2-9-1;.;..\..\openssl-$(OpenSSLVersion)\include;%(AdditionalIncludeDirectories) + ..\..\sofia-sip\win32;..\..\sofia-sip\libsofia-sip-ua\su;..\..\sofia-sip\libsofia-sip-ua\ipt;..\..\sofia-sip\libsofia-sip-ua\sresolv;..\..\sofia-sip\libsofia-sip-ua\bnf;..\..\sofia-sip\libsofia-sip-ua\url;..\..\sofia-sip\libsofia-sip-ua\msg;..\..\sofia-sip\libsofia-sip-ua\sip;..\..\sofia-sip\libsofia-sip-ua\nta;..\..\sofia-sip\libsofia-sip-ua\nua;..\..\sofia-sip\libsofia-sip-ua\iptsec;..\..\sofia-sip\libsofia-sip-ua\http;..\..\sofia-sip\libsofia-sip-ua\nth;..\..\sofia-sip\libsofia-sip-ua\nea;..\..\sofia-sip\libsofia-sip-ua\sdp;..\..\sofia-sip\libsofia-sip-ua\soa;..\..\sofia-sip\libsofia-sip-ua\stun;..\..\sofia-sip\libsofia-sip-ua\tport;..\..\sofia-sip\libsofia-sip-ua\features;..\..\pthreads-w32-2-9-1;.;..\..\openssl-$(OpenSSLVersion)\include;..\..\..\src\include;%(AdditionalIncludeDirectories) _TIMESPEC_DEFINED;_WIN64;WIN32;NDEBUG;_LIB;IN_LIBSOFIA_SIP_UA_STATIC;LIBSOFIA_SIP_UA_STATIC;LIBSRES_STATIC;PTW32_STATIC_LIB;HAVE_IPHLPAPI_H;SU_DEBUG=0;_WINSOCK_DEPRECATED_NO_WARNINGS;%(PreprocessorDefinitions) true MultiThreadedDLL From 6ce69adcb36244298b3fa0f3f1db62861aa0e24e Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Wed, 27 Apr 2016 14:45:09 -0500 Subject: [PATCH 16/32] FS-9099: remove unneeded header include --- libs/sofia-sip/libsofia-sip-ua/tport/ws.c | 1 - 1 file changed, 1 deletion(-) diff --git a/libs/sofia-sip/libsofia-sip-ua/tport/ws.c b/libs/sofia-sip/libsofia-sip-ua/tport/ws.c index 7fe9f182bf..12d90a25d7 100644 --- a/libs/sofia-sip/libsofia-sip-ua/tport/ws.c +++ b/libs/sofia-sip/libsofia-sip-ua/tport/ws.c @@ -1,4 +1,3 @@ -#include #include "ws.h" #include From c6d0a994954d43a6d2e9593acaa1dffa80a30ef6 Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Wed, 27 Apr 2016 14:45:59 -0500 Subject: [PATCH 17/32] FS-9078: [sofia-sip] fix linux build of HEPv2/HEPv3 code --- libs/sofia-sip/libsofia-sip-ua/tport/tport_logging.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/sofia-sip/libsofia-sip-ua/tport/tport_logging.c b/libs/sofia-sip/libsofia-sip-ua/tport/tport_logging.c index 6803b5559b..01c0259993 100644 --- a/libs/sofia-sip/libsofia-sip-ua/tport/tport_logging.c +++ b/libs/sofia-sip/libsofia-sip-ua/tport/tport_logging.c @@ -596,12 +596,12 @@ int tport_capt_msg_hepv3 (tport_t const *self, msg_t *msg, size_t n, struct hep_generic *hg=NULL; unsigned int buflen=0, iplen=0,tlen=0, payload_len = 0; su_time_t now; - hep_chunk_ip4_t src_ip4 = { 0 }, dst_ip4 = { 0 }; + hep_chunk_ip4_t src_ip4 = {{0}}, dst_ip4 = {{0}}; hep_chunk_t payload_chunk; int orig_n = 0; #if SU_HAVE_IN6 - hep_chunk_ip6_t src_ip6 = { 0 }, dst_ip6 = { 0 }; + hep_chunk_ip6_t src_ip6 = {{0}}, dst_ip6 = {{0}}; #endif int eth_frame_len = 16000; From bc74c70562cc549a1d6584ff4878d18064d894db Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Wed, 27 Apr 2016 14:46:37 -0500 Subject: [PATCH 18/32] .update --- libs/sofia-sip/.update | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/sofia-sip/.update b/libs/sofia-sip/.update index 768af17e16..b43350194e 100644 --- a/libs/sofia-sip/.update +++ b/libs/sofia-sip/.update @@ -1 +1 @@ -Mon Apr 25 17:16:25 CDT 2016 +Wed Apr 27 14:46:29 CDT 2016 From 3caa794f7a55e7e412b37a4b2191ce31993dd689 Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Wed, 27 Apr 2016 16:02:00 -0400 Subject: [PATCH 19/32] FS-9078: [sofia-sip] fix linux build of HEPv2/HEPv3 code --- libs/sofia-sip/.update | 2 +- libs/sofia-sip/configure.ac | 2 +- libs/sofia-sip/libsofia-sip-ua/tport/switch.h | 18 ++++++++++++++++++ libs/sofia-sip/libsofia-sip-ua/tport/ws.c | 1 + 4 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 libs/sofia-sip/libsofia-sip-ua/tport/switch.h diff --git a/libs/sofia-sip/.update b/libs/sofia-sip/.update index b43350194e..7d1f2d2217 100644 --- a/libs/sofia-sip/.update +++ b/libs/sofia-sip/.update @@ -1 +1 @@ -Wed Apr 27 14:46:29 CDT 2016 +Wed Apr 27 16:01:46 EDT 2016 diff --git a/libs/sofia-sip/configure.ac b/libs/sofia-sip/configure.ac index e20ddcb4c6..ca6bd3a82e 100644 --- a/libs/sofia-sip/configure.ac +++ b/libs/sofia-sip/configure.ac @@ -218,7 +218,7 @@ fi AC_C_CONST AC_C_INLINE AC_C_INLINE_DEFINE -AC_C_BIGENDIAN +AC_C_BIGENDIAN(AC_DEFINE([__BYTE_ORDER],__BIG_ENDIAN,[Big Endian]),AC_DEFINE([__BYTE_ORDER],__LITTLE_ENDIAN,[Little Endian])) AC_C_VAR_FUNC AC_C_MACRO_FUNCTION diff --git a/libs/sofia-sip/libsofia-sip-ua/tport/switch.h b/libs/sofia-sip/libsofia-sip-ua/tport/switch.h new file mode 100644 index 0000000000..26f269ef18 --- /dev/null +++ b/libs/sofia-sip/libsofia-sip-ua/tport/switch.h @@ -0,0 +1,18 @@ +#include "config.h" + +#ifndef _MSC_VER +#ifndef __LITTLE_ENDIAN +#define __LITTLE_ENDIAN 1234 +#endif +#ifndef __BIG_ENDIAN +#define __BIG_ENDIAN 4321 +#endif +#ifndef __BYTE_ORDER +#ifdef SWITCH_BYTE_ORDER +#define __BYTE_ORDER SWITCH_BYTE_ORDER +#else +#define __BYTE_ORDER __LITTLE_ENDIAN +#endif +#endif +#endif + diff --git a/libs/sofia-sip/libsofia-sip-ua/tport/ws.c b/libs/sofia-sip/libsofia-sip-ua/tport/ws.c index 12d90a25d7..7fe9f182bf 100644 --- a/libs/sofia-sip/libsofia-sip-ua/tport/ws.c +++ b/libs/sofia-sip/libsofia-sip-ua/tport/ws.c @@ -1,3 +1,4 @@ +#include #include "ws.h" #include From 943e8ef3231dfcef1ba3b6e873fdded816c3876c Mon Sep 17 00:00:00 2001 From: Mike Jerris Date: Wed, 27 Apr 2016 16:08:13 -0400 Subject: [PATCH 20/32] FS-9099: [sofia-sip] fix windows build of websocket transport --- libs/sofia-sip/libsofia-sip-ua/tport/switch.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/libs/sofia-sip/libsofia-sip-ua/tport/switch.h b/libs/sofia-sip/libsofia-sip-ua/tport/switch.h index 26f269ef18..e6e7938dcd 100644 --- a/libs/sofia-sip/libsofia-sip-ua/tport/switch.h +++ b/libs/sofia-sip/libsofia-sip-ua/tport/switch.h @@ -1,6 +1,5 @@ #include "config.h" -#ifndef _MSC_VER #ifndef __LITTLE_ENDIAN #define __LITTLE_ENDIAN 1234 #endif @@ -14,5 +13,4 @@ #define __BYTE_ORDER __LITTLE_ENDIAN #endif #endif -#endif From 0ba86871b43a0431cba19e394cadbde7e7691395 Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Wed, 27 Apr 2016 15:33:56 -0500 Subject: [PATCH 21/32] FS-9078: [sofia-sip] fix typo in HEP3 --- libs/sofia-sip/libsofia-sip-ua/tport/tport_logging.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/sofia-sip/libsofia-sip-ua/tport/tport_logging.c b/libs/sofia-sip/libsofia-sip-ua/tport/tport_logging.c index 01c0259993..b66989b99e 100644 --- a/libs/sofia-sip/libsofia-sip-ua/tport/tport_logging.c +++ b/libs/sofia-sip/libsofia-sip-ua/tport/tport_logging.c @@ -781,7 +781,7 @@ int tport_capt_msg_hepv3 (tport_t const *self, msg_t *msg, size_t n, /* IPv6 */ else if(su->su_family == AF_INET6) { /* SRC IPv6 */ - memcpy((char*) *buffer+buflen, &src_ip4, sizeof(struct hep_chunk_ip6)); + memcpy((char*) *buffer+buflen, &src_ip6, sizeof(struct hep_chunk_ip6)); buflen += sizeof(struct hep_chunk_ip6); memcpy((char*) *buffer+buflen, &dst_ip6, sizeof(struct hep_chunk_ip6)); From bf140e9b68a68ff1da2546012524350a5e504ae5 Mon Sep 17 00:00:00 2001 From: Piotr Gregor Date: Sat, 23 Apr 2016 00:01:11 +0100 Subject: [PATCH 22/32] FS-9011 [avmd] Add XML config Add XML configuration file. Bind reloadxml callback. Add safe parsers of user's input. Add show/set/load/reload API commands. --- .../applications/mod_avmd/avmd_fast_acosf.c | 5 - .../applications/mod_avmd/avmd_fast_acosf.h | 13 +- src/mod/applications/mod_avmd/avmd_sma_buf.h | 6 +- .../conf/autoload_configs/avmd.conf.xml | 52 ++ src/mod/applications/mod_avmd/mod_avmd.c | 835 +++++++++++++----- 5 files changed, 676 insertions(+), 235 deletions(-) create mode 100644 src/mod/applications/mod_avmd/conf/autoload_configs/avmd.conf.xml diff --git a/src/mod/applications/mod_avmd/avmd_fast_acosf.c b/src/mod/applications/mod_avmd/avmd_fast_acosf.c index 985e95b6f7..1974c9852f 100644 --- a/src/mod/applications/mod_avmd/avmd_fast_acosf.c +++ b/src/mod/applications/mod_avmd/avmd_fast_acosf.c @@ -20,8 +20,6 @@ #include "avmd_fast_acosf.h" #include "avmd_options.h" -#ifdef AVMD_FAST_MATH - typedef union { uint32_t i; @@ -315,6 +313,3 @@ dump_table_summary(void) } #endif /* FAST_ACOSF_TESTING */ - - -#endif diff --git a/src/mod/applications/mod_avmd/avmd_fast_acosf.h b/src/mod/applications/mod_avmd/avmd_fast_acosf.h index 3c404039fe..1c3b68ca1a 100644 --- a/src/mod/applications/mod_avmd/avmd_fast_acosf.h +++ b/src/mod/applications/mod_avmd/avmd_fast_acosf.h @@ -1,7 +1,9 @@ /* * @brief Fast arithmetic using precomputed arc cosine table. - * @author Eric des Courtis - * @par Modifications: Piotr Gregor < piotrek.gregor gmail.com > + * Contributor(s): + * + * Eric des Courtis + * Piotr Gregor */ @@ -14,8 +16,6 @@ /*! \brief Arc cosine table initialization. * - * @author Eric des Courtis - * @par Modifications: Piotr Gregor < piotrek.gregor gmail.com > * @return 0 on success, negative value otherwise: * -1 can't access arc cos table with error != NOENT, * -2 table creation failed (compute_table) @@ -26,8 +26,6 @@ extern int init_fast_acosf(void); /*! \brief Arc cosine table deinitialization. * - * @author Eric des Courtis - * @par Modifications: Piotr Gregor < piotrek.gregor gmail.com > * @return 0 on success, negative value otherwise: * -1 munmap failed, * -2 close failed @@ -36,14 +34,11 @@ extern int destroy_fast_acosf(void); /*! \brief Return arc cos for this argument. * @details Uses previously created and mmapped file. - * @author Eric des Courtis */ extern float fast_acosf(float x); /*! \brief Arc cosine table creation. * - * @author Eric des Courtis - * @par Modifications: Piotr Gregor < piotrek.gregor gmail.com > * @return 0 on success, negative value otherwise: * -1 fwrite failed, * -2 fclose failed diff --git a/src/mod/applications/mod_avmd/avmd_sma_buf.h b/src/mod/applications/mod_avmd/avmd_sma_buf.h index 2871cc9b7d..b514b95bea 100644 --- a/src/mod/applications/mod_avmd/avmd_sma_buf.h +++ b/src/mod/applications/mod_avmd/avmd_sma_buf.h @@ -1,8 +1,10 @@ /* * @brief SMA buffer. * - * @author Eric des Courtis - * @par Modifications: Piotr Gregor < piotrek.gregor gmail.com > + * Contributor(s): + * + * Eric des Courtis + * Piotr Gregor */ diff --git a/src/mod/applications/mod_avmd/conf/autoload_configs/avmd.conf.xml b/src/mod/applications/mod_avmd/conf/autoload_configs/avmd.conf.xml new file mode 100644 index 0000000000..9f10c3e599 --- /dev/null +++ b/src/mod/applications/mod_avmd/conf/autoload_configs/avmd.conf.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mod/applications/mod_avmd/mod_avmd.c b/src/mod/applications/mod_avmd/mod_avmd.c index 059f7ed52e..5e8e2a7ecc 100644 --- a/src/mod/applications/mod_avmd/mod_avmd.c +++ b/src/mod/applications/mod_avmd/mod_avmd.c @@ -19,8 +19,8 @@ * * Contributor(s): * - * Piotr Gregor : * Eric des Courtis + * Piotr Gregor : * * mod_avmd.c -- Advanced Voicemail Detection Module * @@ -48,9 +48,7 @@ #include "avmd_sma_buf.h" #include "avmd_options.h" -#ifdef AVMD_FAST_MATH #include "avmd_fast_acosf.h" -#endif /*! Calculate how many audio samples per ms based on the rate */ @@ -101,10 +99,11 @@ #endif /*! Syntax of the API call. */ -#define AVMD_SYNTAX " " +#define AVMD_SYNTAX " < start | stop | set [inbound|outbound|default] | load [inbound|outbound] | reload | show>" /*! Number of expected parameters in api call. */ -#define AVMD_PARAMS 2 +#define AVMD_PARAMS_MIN 1u +#define AVMD_PARAMS_MAX 2u enum avmd_event { @@ -112,14 +111,15 @@ enum avmd_event AVMD_EVENT_SESSION_START = 1, AVMD_EVENT_SESSION_STOP = 2 }; +/* This array MUST be NULL terminated! */ const char* avmd_events_str[] = { [AVMD_EVENT_BEEP] = "avmd::beep", [AVMD_EVENT_SESSION_START] = "avmd::start", [AVMD_EVENT_SESSION_STOP] = "avmd::stop", - NULL + NULL /* MUST be last and always here */ }; -#define AVMD_CHAR_BUF_LEN 20 -#define AVMD_BUF_LINEAR_LEN 160 +#define AVMD_CHAR_BUF_LEN 20u +#define AVMD_BUF_LINEAR_LEN 160u /* Prototypes */ @@ -131,6 +131,17 @@ SWITCH_STANDARD_APP(avmd_start_app); SWITCH_STANDARD_APP(avmd_stop_app); SWITCH_STANDARD_APP(avmd_start_function); +struct avmd_settings { + uint8_t debug; + uint8_t report_status; + uint8_t fast_math; + uint8_t require_continuous_streak; + uint16_t sample_n_to_skeep; + uint8_t simplified_estimation; + uint8_t inbound_channnel; + uint8_t outbound_channnel; +}; + /*! Status of the beep detection */ typedef enum { BEEP_DETECTED, @@ -146,13 +157,15 @@ typedef struct { /*! Type that holds session information pertinent to the avmd module. */ typedef struct { /*! Internal FreeSWITCH session. */ - switch_core_session_t *session; - uint32_t rate; - circ_buffer_t b; - sma_buffer_t sma_b; - sma_buffer_t sqa_b; - size_t pos; - double f; + switch_core_session_t *session; + switch_mutex_t *mutex; + struct avmd_settings settings; + uint32_t rate; + circ_buffer_t b; + sma_buffer_t sma_b; + sma_buffer_t sqa_b; + size_t pos; + double f; /* freq_table_t ft; */ avmd_state_t state; switch_time_t start_time; @@ -163,7 +176,14 @@ typedef struct { size_t sample_count; } avmd_session_t; -static void avmd_process(avmd_session_t *s, switch_frame_t *frame); +struct avmd_globals +{ + switch_mutex_t *mutex; + struct avmd_settings settings; + switch_memory_pool_t *pool; +} avmd_globals; + +static void avmd_process(avmd_session_t *session, switch_frame_t *frame); static switch_bool_t avmd_callback(switch_media_bug_t * bug, void *user_data, switch_abc_type_t type); @@ -177,16 +197,43 @@ static void avmd_fire_event(enum avmd_event type, switch_core_session_t *fs_s, double freq, double v); +/* API [set default], reset to factory settings */ +static void avmd_set_xml_default_configuration(switch_mutex_t *mutex); +/* API [set inbound], set inbound = 1, outbound = 0 */ +static void avmd_set_xml_inbound_configuration(switch_mutex_t *mutex); +/* API [set outbound], set inbound = 0, outbound = 1 */ +static void avmd_set_xml_outbound_configuration(switch_mutex_t *mutex); + +/* API [reload], reload XML configuration data from RAM */ +static switch_status_t avmd_load_xml_configuration(switch_mutex_t *mutex); +/* API [load inbound], reload + set inbound */ +static switch_status_t avmd_load_xml_inbound_configuration(switch_mutex_t *mutex); +/* API [load outbound], reload + set outbound */ +static switch_status_t avmd_load_xml_outbound_configuration(switch_mutex_t *mutex); + +/* bind callback */ +static void +avmd_reloadxml_event_handler(switch_event_t *event); + +/* API command */ +static void +avmd_show(switch_stream_handle_t *stream, switch_mutex_t *mutex); + /*! \brief The avmd session data initialization function. - * @author Eric des Courtis * @param avmd_session A reference to a avmd session. * @param fs_session A reference to a FreeSWITCH session. */ static switch_status_t init_avmd_session_data(avmd_session_t *avmd_session, - switch_core_session_t *fs_session) + switch_core_session_t *fs_session, switch_mutex_t *mutex) { - size_t buf_sz; + size_t buf_sz; + switch_status_t status = SWITCH_STATUS_SUCCESS; + + if (mutex != NULL) + { + switch_mutex_lock(mutex); + } /*! This is a worst case sample rate estimate */ avmd_session->rate = 48000; @@ -195,7 +242,8 @@ init_avmd_session_data(avmd_session_t *avmd_session, (size_t)FRAME_LEN(avmd_session->rate), fs_session); if (avmd_session->b.buf == NULL) { - return SWITCH_STATUS_MEMERR; + status = SWITCH_STATUS_MEMERR; + goto end; } avmd_session->session = fs_session; avmd_session->pos = 0; @@ -205,31 +253,40 @@ init_avmd_session_data(avmd_session_t *avmd_session, #ifdef AVMD_REQUIRE_CONTINUOUS_STREAK avmd_session->samples_streak = SAMPLES_CONSECUTIVE_STREAK; #endif + memset(&avmd_session->settings, 0, sizeof(struct avmd_settings)); + switch_mutex_init(&avmd_session->mutex, SWITCH_MUTEX_DEFAULT, + switch_core_session_get_pool(fs_session)); avmd_session->sample_count = 0; buf_sz = BEEP_LEN((uint32_t)avmd_session->rate) / (uint32_t)SINE_LEN(avmd_session->rate); if (buf_sz < 1) { - return SWITCH_STATUS_MORE_DATA; + status = SWITCH_STATUS_MORE_DATA; + goto end; } INIT_SMA_BUFFER(&avmd_session->sma_b, buf_sz, fs_session); if (avmd_session->sma_b.data == NULL) { - return SWITCH_STATUS_FALSE; + status = SWITCH_STATUS_FALSE; + goto end; } memset(avmd_session->sma_b.data, 0, sizeof(BUFF_TYPE) * buf_sz); INIT_SMA_BUFFER(&avmd_session->sqa_b, buf_sz, fs_session); if (avmd_session->sqa_b.data == NULL) { - return SWITCH_STATUS_FALSE; + status = SWITCH_STATUS_FALSE; + goto end; } memset(avmd_session->sqa_b.data, 0, sizeof(BUFF_TYPE) * buf_sz); - return SWITCH_STATUS_SUCCESS; +end: + if (mutex != NULL) + { + switch_mutex_unlock(mutex); + } + return status; } /*! \brief The callback function that is called when new audio data becomes available. - * - * @author Eric des Courtis * @param bug A reference to the media bug. * @param user_data The session information for this call. * @param type The switch callback type. @@ -365,8 +422,9 @@ avmd_fire_event(enum avmd_event type, switch_core_session_t *fs_s, double freq, status = switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, avmd_events_str[type]); - if (status != SWITCH_STATUS_SUCCESS) + if (status != SWITCH_STATUS_SUCCESS) { return; + } switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Unique-ID", switch_core_session_get_uuid(fs_s)); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "call-command", "avmd"); @@ -406,27 +464,233 @@ avmd_fire_event(enum avmd_event type, switch_core_session_t *fs_s, double freq, return; } - if ((switch_event_dup(&event_copy, event)) != SWITCH_STATUS_SUCCESS) + if ((switch_event_dup(&event_copy, event)) != SWITCH_STATUS_SUCCESS) { return; + } switch_core_session_queue_event(fs_s, &event); switch_event_fire(&event_copy); return; } -/*! \brief FreeSWITCH module loading function. - * - * @author Eric des Courtis - * @par Modifications: Piotr Gregor - * @return On success SWITCH_STATUS_SUCCES, - * on failure SWITCH_STATUS_TERM. - */ +int +avmd_parse_u8_user_input(const char *input, uint8_t *output, + uint8_t min, uint8_t max) +{ + char *pCh; + unsigned long helper; + helper = strtoul(input, &pCh, 10); + if (helper < min || helper > UINT8_MAX || helper > max || (pCh == input) || (*pCh != '\0')) { + return -1; + } + *output= helper; + return 0; +} + +int +avmd_parse_u16_user_input(const char *input, uint16_t *output, + uint16_t min, uint16_t max) +{ + char *pCh; + unsigned long helper; + if (min > max) { + return -1; + } + helper = strtoul(input, &pCh, 10); + if (helper < min || helper > UINT16_MAX || helper > max || (pCh == input) || (*pCh != '\0')) { + return -1; + } + *output= helper; + return 0; +} + +static void avmd_set_xml_default_configuration(switch_mutex_t *mutex) +{ + if (mutex != NULL) { + switch_mutex_lock(mutex); + } + + avmd_globals.settings.debug = 0; + avmd_globals.settings.report_status = 1; + avmd_globals.settings.fast_math = 0; + avmd_globals.settings.require_continuous_streak = 1; + avmd_globals.settings.sample_n_to_skeep = 6; + avmd_globals.settings.simplified_estimation = 1; + avmd_globals.settings.inbound_channnel = 0; + avmd_globals.settings.outbound_channnel = 1; + + if (mutex != NULL) { + switch_mutex_unlock(avmd_globals.mutex); + } + return; +} + +static void +avmd_set_xml_inbound_configuration(switch_mutex_t *mutex) +{ + if (mutex != NULL) { + switch_mutex_lock(mutex); + } + + avmd_globals.settings.inbound_channnel = 1; + avmd_globals.settings.outbound_channnel = 0; + + if (mutex != NULL) { + switch_mutex_unlock(avmd_globals.mutex); + } + return; +} + +static void +avmd_set_xml_outbound_configuration(switch_mutex_t *mutex) +{ + if (mutex != NULL) { + switch_mutex_lock(mutex); + } + + avmd_globals.settings.inbound_channnel = 0; + avmd_globals.settings.outbound_channnel = 1; + + if (mutex != NULL) { + switch_mutex_unlock(avmd_globals.mutex); + } + return; +} + +static switch_status_t +avmd_load_xml_configuration(switch_mutex_t *mutex) +{ + switch_xml_t xml = NULL, x_lists = NULL, x_list = NULL, cfg = NULL; + switch_status_t status = SWITCH_STATUS_FALSE; + + if (mutex != NULL) { + switch_mutex_lock(mutex); + } + + if ((xml = switch_xml_open_cfg("avmd.conf", &cfg, NULL)) == NULL) { + status = SWITCH_STATUS_TERM; + } else { + status = SWITCH_STATUS_SUCCESS; + + if ((x_lists = switch_xml_child(cfg, "settings"))) { + for (x_list = switch_xml_child(x_lists, "param"); x_list; x_list = x_list->next) { + const char *name = switch_xml_attr(x_list, "name"); + const char *value = switch_xml_attr(x_list, "value"); + + if (zstr(name)) { + continue; + } + if (zstr(value)) { + continue; + } + + if (!strcmp(name, "debug")) { + avmd_globals.settings.debug = switch_true(value) ? 1 : 0; + } else if (!strcmp(name, "report_status")) { + avmd_globals.settings.report_status = switch_true(value) ? 1 : 0; + } else if (!strcmp(name, "fast_math")) { + avmd_globals.settings.fast_math = switch_true(value) ? 1 : 0; + } else if (!strcmp(name, "require_continuous_streak")) { + avmd_globals.settings.require_continuous_streak = switch_true(value) ? 1 : 0; + } else if (!strcmp(name, "sample_n_to_skeep")) { + if(avmd_parse_u16_user_input(value, &avmd_globals.settings.sample_n_to_skeep, 0, UINT16_MAX) == -1) + { + status = SWITCH_STATUS_TERM; + goto done; + } + } else if (!strcmp(name, "simplified_estimation")) { + avmd_globals.settings.simplified_estimation = switch_true(value) ? 1 : 0; + } else if (!strcmp(name, "inbound_channel")) { + avmd_globals.settings.inbound_channnel = switch_true(value) ? 1 : 0; + } else if (!strcmp(name, "outbound_channel")) { + avmd_globals.settings.outbound_channnel = switch_true(value) ? 1 : 0; + } + } + } + + done: + + switch_xml_free(xml); + } + + if (mutex != NULL) { + switch_mutex_unlock(mutex); + } + + return status; +} +static switch_status_t avmd_load_xml_inbound_configuration(switch_mutex_t *mutex) +{ + if (avmd_load_xml_configuration(mutex) != SWITCH_STATUS_SUCCESS) { + return SWITCH_STATUS_TERM; + } + + if (mutex != NULL) { + switch_mutex_lock(mutex); + } + + avmd_globals.settings.inbound_channnel = 1; + avmd_globals.settings.outbound_channnel = 0; + + if (mutex != NULL) { + switch_mutex_unlock(avmd_globals.mutex); + } + return SWITCH_STATUS_SUCCESS; +} + +static switch_status_t avmd_load_xml_outbound_configuration(switch_mutex_t *mutex) +{ + if (avmd_load_xml_configuration(mutex) != SWITCH_STATUS_SUCCESS) { + return SWITCH_STATUS_TERM; + } + + if (mutex != NULL) { + switch_mutex_lock(mutex); + } + + avmd_globals.settings.inbound_channnel = 0; + avmd_globals.settings.outbound_channnel = 1; + + if (mutex != NULL) { + switch_mutex_unlock(avmd_globals.mutex); + } + return SWITCH_STATUS_SUCCESS; +} + +static void +avmd_show(switch_stream_handle_t *stream, switch_mutex_t *mutex) +{ + const char *line = "================================================================================================="; + if (stream == NULL) { + return; + } + + if (mutex != NULL) { + switch_mutex_lock(mutex); + } + + stream->write_function(stream, "\n\n"); + stream->write_function(stream, "%s\n\n", line); + stream->write_function(stream, "%s\n", "Avmd global settings\n\n"); + stream->write_function(stream, "debug \t%u\n", avmd_globals.settings.debug); + stream->write_function(stream, "report status \t%u\n", avmd_globals.settings.report_status); + stream->write_function(stream, "fast_math \t%u\n", avmd_globals.settings.fast_math); + stream->write_function(stream, "require continuous treak\t%u\n", avmd_globals.settings.require_continuous_streak); + stream->write_function(stream, "sample n to skeep \t%u\n", avmd_globals.settings.sample_n_to_skeep); + stream->write_function(stream, "simplified estimation \t%u\n", avmd_globals.settings.simplified_estimation); + stream->write_function(stream, "inbound channel \t%u\n", avmd_globals.settings.inbound_channnel); + stream->write_function(stream, "outbound channel \t%u\n", avmd_globals.settings.outbound_channnel); + stream->write_function(stream, "\n\n"); + + if (mutex != NULL) { + switch_mutex_unlock(mutex); + } +} + SWITCH_MODULE_LOAD_FUNCTION(mod_avmd_load) { -#ifdef AVMD_FAST_MATH char err[150]; int ret; -#endif switch_application_interface_t *app_interface; switch_api_interface_t *api_interface; @@ -438,51 +702,72 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_avmd_load) "Couldn't register avmd events!\n"); return SWITCH_STATUS_TERM; } - - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, - "Advanced voicemail detection enabled\n"); -#ifdef AVMD_FAST_MATH - ret = init_fast_acosf(); - if (ret != 0) { - strerror_r(errno, err, 150); - switch (ret) { - - case -1: - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, - "Can't access file [%s], error [%s]\n", - ACOS_TABLE_FILENAME, err); - break; - case -2: - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, - "Error creating file [%s], error [%s]\n", - ACOS_TABLE_FILENAME, err); - break; - case -3: - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, - "Access rights are OK but can't open file [%s], error [%s]\n", - ACOS_TABLE_FILENAME, err); - break; - case -4: - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, - "Access rights are OK but can't mmap file [%s], error [%s]\n", - ACOS_TABLE_FILENAME, err); - break; - default: - switch_log_printf(SWITCH_CHANNEL_LOG,SWITCH_LOG_ERROR, - "Unknown error [%d] while initializing fast cos table [%s], " - "errno [%s]\n", ret, ACOS_TABLE_FILENAME, err); - return SWITCH_STATUS_TERM; - } + memset(&avmd_globals, 0, sizeof(avmd_globals)); + if (pool == NULL) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, + "No memory pool assigned!\n"); return SWITCH_STATUS_TERM; - } else - switch_log_printf( - SWITCH_CHANNEL_LOG, - SWITCH_LOG_NOTICE, - "Advanced voicemail detection: fast math enabled, arc cosine table " - "is [%s]\n", ACOS_TABLE_FILENAME - ); -#endif + } + switch_mutex_init(&avmd_globals.mutex, SWITCH_MUTEX_DEFAULT, pool); + avmd_globals.pool = pool; + + if (avmd_load_xml_configuration(NULL) != SWITCH_STATUS_SUCCESS) + { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, + "Couldn't load XML configuration\n"); + return SWITCH_STATUS_TERM; + } + + if ((switch_event_bind(modname, SWITCH_EVENT_RELOADXML, NULL, + avmd_reloadxml_event_handler, NULL) != SWITCH_STATUS_SUCCESS)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, + "Couldn't bind our reloadxml handler! Module will not react " + "to changes made in XML configuration\n"); + /* Not so severe to prevent further loading, well - it depends, anyway */ + } + + if (avmd_globals.settings.fast_math == 1) { + ret = init_fast_acosf(); + if (ret != 0) { + strerror_r(errno, err, 150); + switch (ret) { + + case -1: + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, + "Can't access file [%s], error [%s]\n", + ACOS_TABLE_FILENAME, err); + break; + case -2: + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, + "Error creating file [%s], error [%s]\n", + ACOS_TABLE_FILENAME, err); + break; + case -3: + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, + "Access rights are OK but can't open file [%s], error [%s]\n", + ACOS_TABLE_FILENAME, err); + break; + case -4: + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, + "Access rights are OK but can't mmap file [%s], error [%s]\n", + ACOS_TABLE_FILENAME, err); + break; + default: + switch_log_printf(SWITCH_CHANNEL_LOG,SWITCH_LOG_ERROR, + "Unknown error [%d] while initializing fast cos table [%s], " + "errno [%s]\n", ret, ACOS_TABLE_FILENAME, err); + return SWITCH_STATUS_TERM; + } + return SWITCH_STATUS_TERM; + } else + switch_log_printf( + SWITCH_CHANNEL_LOG, + SWITCH_LOG_NOTICE, + "Advanced voicemail detection: fast math enabled, arc cosine table " + "is [%s]\n", ACOS_TABLE_FILENAME + ); + } SWITCH_ADD_APP(app_interface, "avmd_start","Start avmd detection", "Start avmd detection", avmd_start_app, "", SAF_NONE); @@ -496,17 +781,22 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_avmd_load) avmd_api_main, AVMD_SYNTAX); switch_console_set_complete("add avmd ::console::list_uuid ::[start:stop"); + switch_console_set_complete("add avmd set inbound"); /* set inbound = 1, outbound = 0 */ + switch_console_set_complete("add avmd set outbound"); /* set inbound = 0, outbound = 1 */ + switch_console_set_complete("add avmd set default"); /* restore to factory settings */ + switch_console_set_complete("add avmd load inbound"); /* reload + set inbound */ + switch_console_set_complete("add avmd load outbound"); /* reload + set outbound */ + switch_console_set_complete("add avmd reload"); /* reload XML (it loads from FS installation + * folder, not module's conf/autoload_configs */ + switch_console_set_complete("add avmd show"); + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, + "Advanced voicemail detection enabled\n"); /* indicate that the module should continue to be loaded */ return SWITCH_STATUS_SUCCESS; } -/*! \brief FreeSWITCH application handler function. - * This handles avmd start request calls made from applications - * such as LUA and the dialplan. - * - * @return Success or failure of the function. - */ SWITCH_STANDARD_APP(avmd_start_app) { switch_media_bug_t *bug; @@ -543,44 +833,49 @@ SWITCH_STANDARD_APP(avmd_start_app) return; } -#ifdef AVMD_OUTBOUND_CHANNEL - if (SWITCH_CALL_DIRECTION_OUTBOUND != switch_channel_direction(channel)) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, - "Channel [%s] is not outbound!\n", switch_channel_get_name(channel)); + switch_mutex_lock(avmd_globals.mutex); + + if (avmd_globals.settings.outbound_channnel == 1) { + if (SWITCH_CALL_DIRECTION_OUTBOUND != switch_channel_direction(channel)) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, + "Channel [%s] is not outbound!\n", switch_channel_get_name(channel)); + } else { + flags |= SMBF_READ_REPLACE; + } + } else if (avmd_globals.settings.inbound_channnel == 1) { + if (SWITCH_CALL_DIRECTION_INBOUND != switch_channel_direction(channel)) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, + "Channel [%s] is not inbound!\n", switch_channel_get_name(channel)); + } else { + flags |= SMBF_WRITE_REPLACE; + } } else { - flags |= SMBF_READ_REPLACE; - } -#endif -#ifdef AVMD_INBOUND_CHANNEL - if (SWITCH_CALL_DIRECTION_INBOUND != switch_channel_direction(channel)) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, - "Channel [%s] is not inbound!\n", switch_channel_get_name(channel)); - } else { - flags |= SMBF_WRITE_REPLACE; - } -#endif - if(flags == 0) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Can't set direction for channel [%s]\n", switch_channel_get_name(channel)); - return; + goto end; } -#ifdef AVMD_OUTBOUND_CHANNEL - if (switch_channel_test_flag(channel, CF_MEDIA_SET) == 0) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, - "Failed to start session. Channel [%s] has no codec assigned yet." - " Please try again\n", switch_channel_get_name(channel)); - return; + if (avmd_globals.settings.outbound_channnel == 1) { + if (switch_channel_test_flag(channel, CF_MEDIA_SET) == 0) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, + "Failed to start session. Channel [%s] has no codec assigned yet." + " Please try again\n", switch_channel_get_name(channel)); + goto end; + } } -#endif /* Allocate memory attached to this FreeSWITCH session for * use in the callback routine and to store state information */ avmd_session = (avmd_session_t *) switch_core_session_alloc( session, sizeof(avmd_session_t)); + if (avmd_session == NULL) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, + "Can't allocate memory for avmd session!\n"); + goto end; + } - status = init_avmd_session_data(avmd_session, session); + status = init_avmd_session_data(avmd_session, session, NULL); if (status != SWITCH_STATUS_SUCCESS) { switch (status) { case SWITCH_STATUS_MEMERR: @@ -605,7 +900,7 @@ SWITCH_STANDARD_APP(avmd_start_app) break; } - return; + goto end; } /* Add a media bug that allows me to intercept the @@ -625,7 +920,7 @@ SWITCH_STANDARD_APP(avmd_start_app) if (status != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Failed to add media bug!\n"); - return; + goto end; } /* Set the avmd tag to detect an existing avmd media bug */ @@ -637,14 +932,12 @@ SWITCH_STANDARD_APP(avmd_start_app) switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Avmd on channel [%s] started!\n", switch_channel_get_name(channel)); #endif + +end: + switch_mutex_unlock(avmd_globals.mutex); + return; } -/*! \brief FreeSWITCH application handler function. - * This handles avmd stop request calls made from applications - * such as LUA and the dialplan. - * - * @return Success or failure of the function. - */ SWITCH_STANDARD_APP(avmd_stop_app) { switch_media_bug_t *bug; @@ -691,9 +984,6 @@ SWITCH_STANDARD_APP(avmd_stop_app) /*! \brief FreeSWITCH application handler function. * This handles calls made from applications such as LUA and the dialplan. - * - * @author Eric des Courtis - * @return Success or failure of the function. */ SWITCH_STANDARD_APP(avmd_start_function) { @@ -730,36 +1020,35 @@ SWITCH_STANDARD_APP(avmd_start_function) avmd_start_app(session, NULL); } -/*! \brief Called when the module shuts down. - * - * @author Eric des Courtis - * @return The success or failure of the function. - */ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_avmd_shutdown) { -#ifdef AVMD_FAST_MATH int res; -#endif + + switch_mutex_lock(avmd_globals.mutex); avmd_unregister_all_events(); - -#ifdef AVMD_FAST_MATH - res = destroy_fast_acosf(); - if (res != 0) { - switch (res) { - case -1: - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, - "Failed unmap arc cosine table\n"); + + if (avmd_globals.settings.fast_math == 1) { + res = destroy_fast_acosf(); + if (res != 0) { + switch (res) { + case -1: + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, + "Failed unmap arc cosine table\n"); + break; + case -2: + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, + "Failed closing arc cosine table\n"); + break; + default: break; - case -2: - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, - "Failed closing arc cosine table\n"); - break; - default: - break; + } } } -#endif + + switch_event_unbind_callback(avmd_reloadxml_event_handler); + + switch_mutex_unlock(avmd_globals.mutex); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Advanced voicemail detection disabled\n"); @@ -771,23 +1060,21 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_avmd_shutdown) * This function handles API calls such as the ones * from mod_event_socket and in some cases * scripts such as LUA scripts. - * - * @author Eric des Courtis - * @return The success or failure of the function. */ SWITCH_STANDARD_API(avmd_api_main) { switch_media_bug_t *bug; avmd_session_t *avmd_session; switch_channel_t *channel; - int argc; - char *argv[AVMD_PARAMS]; - char *ccmd = NULL; - char *uuid, *uuid_dup; - char *command; - switch_core_media_flag_t flags = 0; - switch_status_t status = SWITCH_STATUS_SUCCESS; - switch_core_session_t *fs_session = NULL; + int argc; + const char *uuid, *uuid_dup; + const char *command; + char *dupped = NULL, *argv[AVMD_PARAMS_MAX + 1] = { 0 }; + switch_core_media_flag_t flags = 0; + switch_status_t status = SWITCH_STATUS_SUCCESS; + switch_core_session_t *fs_session = NULL; + + switch_mutex_lock(avmd_globals.mutex); /* No command? Display usage */ if (zstr(cmd)) { @@ -797,18 +1084,122 @@ SWITCH_STANDARD_API(avmd_api_main) } /* Duplicated contents of original string */ - ccmd = strdup(cmd); + dupped = strdup(cmd); + switch_assert(dupped); /* Separate the arguments */ - argc = switch_separate_string(ccmd, ' ', argv, AVMD_PARAMS); + argc = switch_separate_string((char*)dupped, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); /* If we don't have the expected number of parameters * display usage */ - if (argc != AVMD_PARAMS) { - stream->write_function(stream, "-ERR, avmd takes [%u] parameters!\n" - "-USAGE: %s\n\n", AVMD_PARAMS, AVMD_SYNTAX); + if (argc < AVMD_PARAMS_MIN) { + stream->write_function(stream, "-ERR, avmd takes [%u] min and [%u] max parameters!\n" + "-USAGE: %s\n\n", AVMD_PARAMS_MIN, AVMD_PARAMS_MAX, AVMD_SYNTAX); goto end; } + command = argv[0]; + if (strcasecmp(command, "reload") == 0) { + if (avmd_load_xml_configuration(NULL) != SWITCH_STATUS_SUCCESS) + { + stream->write_function(stream, "-ERR, couldn't reload XML configuration\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, + "Couldn't reload XML configuration\n"); + } + if (avmd_globals.settings.report_status == 1) { + stream->write_function(stream, "+OK\n XML reloaded\n\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, + "XML reloaded\n"); + } + goto end; + } + if (strcasecmp(command, "load") == 0) { + if (argc != 2) { + stream->write_function(stream, "-ERR, load command takes 1 parameter!\n" + "-USAGE: %s\n\n", AVMD_SYNTAX); + goto end; + } + command = argv[1]; + if (strcasecmp(command, "inbound") == 0) { + status = avmd_load_xml_inbound_configuration(NULL); + if (avmd_globals.settings.report_status == 1) { + if (status != SWITCH_STATUS_SUCCESS) { + stream->write_function(stream, "-ERR, couldn't load XML configuration\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, + "Couldn't load XML configuration\n"); + } else { + stream->write_function(stream, "+OK\n inbound " + "XML configuration loaded\n\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, + "Inbound XML configuration loaded\n"); + } + goto end; + } + } else if (strcasecmp(command, "outbound") == 0) { + status = avmd_load_xml_outbound_configuration(NULL); + if (avmd_globals.settings.report_status == 1) { + if (status != SWITCH_STATUS_SUCCESS) { + stream->write_function(stream, "-ERR, couldn't load XML configuration\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, + "Couldn't load XML configuration\n"); + } else { + stream->write_function(stream, "+OK\n outbound " + "XML configuration loaded\n\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, + "Outbound XML configuration loaded\n"); + } + goto end; + } + } else { + stream->write_function(stream, "-ERR, load command: bad syntax!\n" + "-USAGE: %s\n\n", AVMD_SYNTAX); + } + goto end; + } + if (strcasecmp(command, "set") == 0) { + if (argc != 2) { + stream->write_function(stream, "-ERR, set command takes 1 parameter!\n" + "-USAGE: %s\n\n", AVMD_SYNTAX); + goto end; + } + command = argv[1]; + if (strcasecmp(command, "inbound") == 0) { + avmd_set_xml_inbound_configuration(NULL); + if (avmd_globals.settings.report_status == 1) { + stream->write_function(stream, "+OK\n inbound " + "XML configuration loaded\n\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, + "Inbound XML configuration loaded\n"); + } + } else if (strcasecmp(command, "outbound") == 0) { + avmd_set_xml_outbound_configuration(NULL); + if (avmd_globals.settings.report_status == 1) { + stream->write_function(stream, "+OK\n outbound " + "XML configuration loaded\n\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, + "Outbound XML configuration loaded\n"); + } + } else if (strcasecmp(command, "default") == 0) { + avmd_set_xml_default_configuration(NULL); + if (avmd_globals.settings.report_status == 1) { + stream->write_function(stream, "+OK\n reset " + "to factory settings\n\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, + "Reset to factory settings\n"); + } + } else { + stream->write_function(stream, "-ERR, set command: bad syntax!\n" + "-USAGE: %s\n\n", AVMD_SYNTAX); + } + goto end; + } + if (strcasecmp(command, "show") == 0) { + avmd_show(stream, NULL); + if (avmd_globals.settings.report_status == 1) { + stream->write_function(stream, "+OK\n show\n\n"); + } + goto end; + } + uuid = argv[0]; command = argv[1]; @@ -843,22 +1234,21 @@ SWITCH_STANDARD_API(avmd_api_main) switch_channel_set_private(channel, "_avmd_", NULL); switch_core_media_bug_remove(fs_session, &bug); avmd_fire_event(AVMD_EVENT_SESSION_STOP, fs_session, 0, 0); -#ifdef AVMD_REPORT_STATUS - stream->write_function(stream, "+OK\n [%s] [%s] stopped\n\n", - uuid_dup, switch_channel_get_name(channel)); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fs_session), SWITCH_LOG_INFO, - "Avmd on channel [%s] stopped!\n", switch_channel_get_name(channel)); -#endif + if (avmd_globals.settings.report_status == 1) { + stream->write_function(stream, "+OK\n [%s] [%s] stopped\n\n", + uuid_dup, switch_channel_get_name(channel)); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fs_session), SWITCH_LOG_INFO, + "Avmd on channel [%s] stopped!\n", switch_channel_get_name(channel)); + } goto end; } - -#ifdef AVMD_REPORT_STATUS - /* We have already started */ - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fs_session), - SWITCH_LOG_ERROR, "Avmd already started!\n"); - stream->write_function(stream, "-ERR, avmd for FreeSWITCH session [%s]" - "\n already started\n\n", uuid); -#endif + if (avmd_globals.settings.report_status == 1) { + /* We have already started */ + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fs_session), + SWITCH_LOG_ERROR, "Avmd already started!\n"); + stream->write_function(stream, "-ERR, avmd for FreeSWITCH session [%s]" + "\n already started\n\n", uuid); + } goto end; } @@ -872,27 +1262,25 @@ SWITCH_STANDARD_API(avmd_api_main) goto end; } -#ifdef AVMD_OUTBOUND_CHANNEL - if (SWITCH_CALL_DIRECTION_OUTBOUND != switch_channel_direction(channel)) { - stream->write_function(stream, "-ERR, channel for FreeSWITCH session [%s]" - "\n is not outbound\n\n", uuid); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fs_session), SWITCH_LOG_WARNING, - "Channel [%s] is not outbound!\n", switch_channel_get_name(channel)); + if (avmd_globals.settings.outbound_channnel == 1) { + if (SWITCH_CALL_DIRECTION_OUTBOUND != switch_channel_direction(channel)) { + stream->write_function(stream, "-ERR, channel for FreeSWITCH session [%s]" + "\n is not outbound\n\n", uuid); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fs_session), SWITCH_LOG_WARNING, + "Channel [%s] is not outbound!\n", switch_channel_get_name(channel)); + } else { + flags |= SMBF_READ_REPLACE; + } + } else if (avmd_globals.settings.inbound_channnel == 1) { + if (SWITCH_CALL_DIRECTION_INBOUND != switch_channel_direction(channel)) { + stream->write_function(stream, "-ERR, channel for FreeSWITCH session [%s]" + "\n is not inbound\n\n", uuid); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fs_session), SWITCH_LOG_WARNING, + "Channel [%s] is not inbound!\n", switch_channel_get_name(channel)); + } else { + flags |= SMBF_WRITE_REPLACE; + } } else { - flags |= SMBF_READ_REPLACE; - } -#endif -#ifdef AVMD_INBOUND_CHANNEL - if (SWITCH_CALL_DIRECTION_INBOUND != switch_channel_direction(channel)) { - stream->write_function(stream, "-ERR, channel for FreeSWITCH session [%s]" - "\n is not inbound\n\n", uuid); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fs_session), SWITCH_LOG_WARNING, - "Channel [%s] is not inbound!\n", switch_channel_get_name(channel)); - } else { - flags |= SMBF_WRITE_REPLACE; - } -#endif - if(flags == 0) { stream->write_function(stream, "-ERR, can't set direction for channel [%s]\n" " for FreeSWITCH session [%s]. Please check avmd configuration\n\n", switch_channel_get_name(channel), uuid); @@ -902,17 +1290,17 @@ SWITCH_STANDARD_API(avmd_api_main) } -#ifdef AVMD_OUTBOUND_CHANNEL - if (switch_channel_test_flag(channel, CF_MEDIA_SET) == 0) { - stream->write_function(stream, "-ERR, channel [%s] for FreeSWITCH session [%s]" - "\n has no read codec assigned yet. Please try again.\n\n", - switch_channel_get_name(channel), uuid); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fs_session), SWITCH_LOG_ERROR, - "Failed to start session. Channel [%s] has no codec assigned yet." - " Please try again\n", switch_channel_get_name(channel)); - goto end; + if (avmd_globals.settings.outbound_channnel == 1) { + if (switch_channel_test_flag(channel, CF_MEDIA_SET) == 0) { + stream->write_function(stream, "-ERR, channel [%s] for FreeSWITCH session [%s]" + "\n has no read codec assigned yet. Please try again.\n\n", + switch_channel_get_name(channel), uuid); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fs_session), SWITCH_LOG_ERROR, + "Failed to start session. Channel [%s] has no codec assigned yet." + " Please try again\n", switch_channel_get_name(channel)); + goto end; + } } -#endif /* If we don't see the expected start exit */ if (strcasecmp(command, "start") != 0) { @@ -925,7 +1313,7 @@ SWITCH_STANDARD_API(avmd_api_main) * use in the callback routine and to store state information */ avmd_session = (avmd_session_t *) switch_core_session_alloc( fs_session, sizeof(avmd_session_t)); - status = init_avmd_session_data(avmd_session, fs_session); + status = init_avmd_session_data(avmd_session, fs_session, NULL); if (status != SWITCH_STATUS_SUCCESS) { stream->write_function(stream, "-ERR, failed to initialize avmd session\n" " for FreeSWITCH session [%s]\n", uuid); @@ -985,27 +1373,27 @@ SWITCH_STANDARD_API(avmd_api_main) /* OK */ avmd_fire_event(AVMD_EVENT_SESSION_START, fs_session, 0, 0); -#ifdef AVMD_REPORT_STATUS - stream->write_function(stream, "+OK\n [%s] [%s] started!\n\n", - uuid, switch_channel_get_name(channel)); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fs_session), SWITCH_LOG_INFO, - "Avmd on channel [%s] started!\n", switch_channel_get_name(channel)); - switch_assert(status == SWITCH_STATUS_SUCCESS); -#endif + if (avmd_globals.settings.report_status == 1) { + stream->write_function(stream, "+OK\n [%s] [%s] started!\n\n", + uuid, switch_channel_get_name(channel)); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fs_session), SWITCH_LOG_INFO, + "Avmd on channel [%s] started!\n", switch_channel_get_name(channel)); + switch_assert(status == SWITCH_STATUS_SUCCESS); + } end: if (fs_session) { switch_core_session_rwunlock(fs_session); } - switch_safe_free(ccmd); + switch_safe_free(dupped); + + switch_mutex_unlock(avmd_globals.mutex); return SWITCH_STATUS_SUCCESS; } /*! \brief Process one frame of data with avmd algorithm. - * @author Eric des Courtis - * @par Modifications: Piotr Gregor * @param session An avmd session. * @param frame An audio frame. */ @@ -1088,17 +1476,20 @@ static void avmd_process(avmd_session_t *s, switch_frame_t *frame) } /* saturate */ - if (omega < -0.9999) + if (omega < -0.9999) { omega = -0.9999; - if (omega > 0.9999) + } + if (omega > 0.9999) { omega = 0.9999; + } /* append */ APPEND_SMA_VAL(&s->sma_b, omega); APPEND_SMA_VAL(&s->sqa_b, omega * omega); #ifdef AVMD_REQUIRE_CONTINUOUS_STREAK - if (s->samples_streak > 0) + if (s->samples_streak > 0) { --s->samples_streak; + } #endif /* calculate variance (biased estimator) */ v = s->sqa_b.sma - (s->sma_b.sma * s->sma_b.sma); @@ -1171,6 +1562,13 @@ done: return; } +static void +avmd_reloadxml_event_handler(switch_event_t *event) +{ + avmd_load_xml_configuration(avmd_globals.mutex); +} + + /* For Emacs: * Local Variables: * mode:c @@ -1181,4 +1579,3 @@ done: * For VIM: * vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet: */ - From 2b479574ee9ffaa39d7c5f172f8277883dbc0c5f Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Thu, 28 Apr 2016 13:32:14 +0000 Subject: [PATCH 23/32] Update debian/control-modules for new modules We were missing mod_smpp; mod_json_cdr needed to be placed differently in the file such that it matches the output of the automated generator we use to check the completeness of this file. --- debian/control-modules | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/debian/control-modules b/debian/control-modules index 28d6aea2d0..c6dae250b7 100644 --- a/debian/control-modules +++ b/debian/control-modules @@ -525,16 +525,16 @@ Module: event_handlers/mod_format_cdr Description: mod_format_cdr Adds mod_format_cdr. +Module: event_handlers/mod_json_cdr +Description: mod_json_cdr + Adds mod_json_cdr. + Module: event_handlers/mod_kazoo Description: mod_kazoo Adds mod_kazoo. Build-Depends: erlang-dev Depends: erlang -Module: event_handlers/mod_json_cdr -Description: mod_json_cdr - Adds mod_json_cdr. - Module: event_handlers/mod_odbc_cdr Description: mod_odbc_cdr Adds mod_odbc_cdr. @@ -548,6 +548,10 @@ Description: mod_rayo Adds mod_rayo. Depends: freeswitch-mod-ssml (= ${binary:Version}) +Module: event_handlers/mod_smpp +Description: mod_snmp + Adds mod_snmp. + Module: event_handlers/mod_snmp Description: mod_snmp Adds mod_snmp. From 686988884564286381520f7da46e1a844b68f32c Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Thu, 28 Apr 2016 13:52:11 +0000 Subject: [PATCH 24/32] Ignore debian/freeswitch-init.provided_by in git This is a generated file that was added by commit: commit 77f52bb6a81a812a33fc1ef30010856aa9b3ae71 "FS-7928 FS-7618 systemd and package build improvements" --- debian/.gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/debian/.gitignore b/debian/.gitignore index 896d998162..3847f6b7c5 100644 --- a/debian/.gitignore +++ b/debian/.gitignore @@ -9,6 +9,7 @@ /freeswitch-autotools.install /freeswitch-mod-*.install /freeswitch-conf-*.install +/freeswitch-init.provided_by /freeswitch-lang-*.install /freeswitch-music-*.install /freeswitch-sounds-*.install From 0742defa9b017ddb156508d060d6d3d6093faeac Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Thu, 28 Apr 2016 13:06:35 -0500 Subject: [PATCH 25/32] FS-9109: [build] attempt to fix misleading indentation errors on gcc 6.0 --- configure.ac | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/configure.ac b/configure.ac index cac1f02b8c..ccc17e53bc 100644 --- a/configure.ac +++ b/configure.ac @@ -377,6 +377,16 @@ if test "$ax_cv_c_compiler_vendor" = "gnu"; then [ac_cv_gcc_supports_w_no_unused_result=no])]) CFLAGS="$saved_CFLAGS" AC_MSG_RESULT($ac_cv_gcc_supports_w_no_unused_result) + + saved_CFLAGS="$CFLAGS" + AC_CACHE_CHECK([whether compiler supports -Wno-misleading-indentation], + [ac_cv_gcc_supports_w_no_misleading_indentation], [ + CFLAGS="$CFLAGS -Wno-misleading-indentation -Wno-error=misleading-indentation" + AC_TRY_COMPILE([],[return 0;], + [ac_cv_gcc_supports_w_no_misleading_indentation=yes], + [ac_cv_gcc_supports_w_no_misleading_indentation=no])]) + CFLAGS="$saved_CFLAGS" + AC_MSG_RESULT($ac_cv_gcc_supports_w_no_misleading_indentation) fi # tweak compiler specific flags @@ -413,6 +423,9 @@ elif test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then APR_ADDTO(SWITCH_AM_CFLAGS, -Werror) APR_ADDTO(SWITCH_AM_CFLAGS, -Wno-unused-result) fi + if test "$ac_cv_gcc_supports_w_no_misleading_indentation" = yes; then + APR_ADDTO(SWITCH_AM_CFLAGS, -Wno-misleading-indentation) + fi if test "${enable_64}" = "yes"; then case "$host" in *darwin*) From db4693b57042a10d350c1e5e7b0d82a1041ef551 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 28 Apr 2016 14:32:18 -0500 Subject: [PATCH 26/32] FS-9100 #resolve [Recording Fails if There Are Zero Webcams] --- src/mod/applications/mod_conference/conference_record.c | 2 +- src/mod/applications/mod_conference/conference_video.c | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/mod/applications/mod_conference/conference_record.c b/src/mod/applications/mod_conference/conference_record.c index 843f04fa18..7eb8fd0a18 100644 --- a/src/mod/applications/mod_conference/conference_record.c +++ b/src/mod/applications/mod_conference/conference_record.c @@ -234,7 +234,7 @@ void *SWITCH_THREAD_FUNC conference_record_thread_run(switch_thread_t *thread, v flags = SWITCH_FILE_FLAG_WRITE | SWITCH_FILE_DATA_SHORT; - if (conference->members_with_video && conference_utils_test_flag(conference, CFLAG_TRANSCODE_VIDEO)) { + if (conference_utils_test_flag(conference, CFLAG_TRANSCODE_VIDEO)) { flags |= SWITCH_FILE_FLAG_VIDEO; if (canvas) { char *orig_path = rec->path; diff --git a/src/mod/applications/mod_conference/conference_video.c b/src/mod/applications/mod_conference/conference_video.c index 93588a87b6..dd16741fb5 100644 --- a/src/mod/applications/mod_conference/conference_video.c +++ b/src/mod/applications/mod_conference/conference_video.c @@ -2224,6 +2224,11 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr } } + + if (video_count != canvas->video_count) { + count_changed = 1; + } + canvas->video_count = video_count; switch_mutex_unlock(conference->member_mutex); From 65460fae2516ed41388ed7b1a63437f331ba7633 Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Thu, 28 Apr 2016 14:29:25 -0500 Subject: [PATCH 27/32] FS-9099: fix windows build --- .../libsofia-sip-ua/tport/{ => include}/switch.h | 0 libs/win32/sofia/libsofia_sip_ua_static.2015.vcxproj | 12 ++++++------ 2 files changed, 6 insertions(+), 6 deletions(-) rename libs/sofia-sip/libsofia-sip-ua/tport/{ => include}/switch.h (100%) diff --git a/libs/sofia-sip/libsofia-sip-ua/tport/switch.h b/libs/sofia-sip/libsofia-sip-ua/tport/include/switch.h similarity index 100% rename from libs/sofia-sip/libsofia-sip-ua/tport/switch.h rename to libs/sofia-sip/libsofia-sip-ua/tport/include/switch.h diff --git a/libs/win32/sofia/libsofia_sip_ua_static.2015.vcxproj b/libs/win32/sofia/libsofia_sip_ua_static.2015.vcxproj index 9409332599..bf308a894b 100644 --- a/libs/win32/sofia/libsofia_sip_ua_static.2015.vcxproj +++ b/libs/win32/sofia/libsofia_sip_ua_static.2015.vcxproj @@ -1,4 +1,4 @@ - + @@ -86,7 +86,7 @@ if not exist "$(ProjectDir)$(IntDir)\auth_client.obj" "autogen.cmd" Disabled - ..\..\sofia-sip\win32;..\..\sofia-sip\libsofia-sip-ua\su;..\..\sofia-sip\libsofia-sip-ua\ipt;..\..\sofia-sip\libsofia-sip-ua\sresolv;..\..\sofia-sip\libsofia-sip-ua\bnf;..\..\sofia-sip\libsofia-sip-ua\url;..\..\sofia-sip\libsofia-sip-ua\msg;..\..\sofia-sip\libsofia-sip-ua\sip;..\..\sofia-sip\libsofia-sip-ua\nta;..\..\sofia-sip\libsofia-sip-ua\nua;..\..\sofia-sip\libsofia-sip-ua\iptsec;..\..\sofia-sip\libsofia-sip-ua\http;..\..\sofia-sip\libsofia-sip-ua\nth;..\..\sofia-sip\libsofia-sip-ua\nea;..\..\sofia-sip\libsofia-sip-ua\sdp;..\..\sofia-sip\libsofia-sip-ua\soa;..\..\sofia-sip\libsofia-sip-ua\stun;..\..\sofia-sip\libsofia-sip-ua\tport;..\..\sofia-sip\libsofia-sip-ua\features;..\..\pthreads-w32-2-9-1;.;..\..\openssl-$(OpenSSLVersion)\include;..\..\..\src\include;%(AdditionalIncludeDirectories) + ..\..\sofia-sip\win32;..\..\sofia-sip\libsofia-sip-ua\su;..\..\sofia-sip\libsofia-sip-ua\ipt;..\..\sofia-sip\libsofia-sip-ua\sresolv;..\..\sofia-sip\libsofia-sip-ua\bnf;..\..\sofia-sip\libsofia-sip-ua\url;..\..\sofia-sip\libsofia-sip-ua\msg;..\..\sofia-sip\libsofia-sip-ua\sip;..\..\sofia-sip\libsofia-sip-ua\nta;..\..\sofia-sip\libsofia-sip-ua\nua;..\..\sofia-sip\libsofia-sip-ua\iptsec;..\..\sofia-sip\libsofia-sip-ua\http;..\..\sofia-sip\libsofia-sip-ua\nth;..\..\sofia-sip\libsofia-sip-ua\nea;..\..\sofia-sip\libsofia-sip-ua\sdp;..\..\sofia-sip\libsofia-sip-ua\soa;..\..\sofia-sip\libsofia-sip-ua\stun;..\..\sofia-sip\libsofia-sip-ua\tport;..\..\sofia-sip\libsofia-sip-ua\tport\include;..\..\sofia-sip\libsofia-sip-ua\features;..\..\pthreads-w32-2-9-1;.;..\..\openssl-$(OpenSSLVersion)\include;..\..\..\src\include;%(AdditionalIncludeDirectories) _TIMESPEC_DEFINED;WIN32;_DEBUG;_LIB;IN_LIBSOFIA_SIP_UA_STATIC;LIBSOFIA_SIP_UA_STATIC;LIBSRES_STATIC;PTW32_STATIC_LIB;HAVE_IPHLPAPI_H;SU_DEBUG=0;_WINSOCK_DEPRECATED_NO_WARNINGS;%(PreprocessorDefinitions) true EnableFastChecks @@ -123,7 +123,7 @@ if not exist "$(ProjectDir)$(IntDir)\auth_client.obj" "autogen.cmd" Disabled - ..\..\sofia-sip\win32;..\..\sofia-sip\libsofia-sip-ua\su;..\..\sofia-sip\libsofia-sip-ua\ipt;..\..\sofia-sip\libsofia-sip-ua\sresolv;..\..\sofia-sip\libsofia-sip-ua\bnf;..\..\sofia-sip\libsofia-sip-ua\url;..\..\sofia-sip\libsofia-sip-ua\msg;..\..\sofia-sip\libsofia-sip-ua\sip;..\..\sofia-sip\libsofia-sip-ua\nta;..\..\sofia-sip\libsofia-sip-ua\nua;..\..\sofia-sip\libsofia-sip-ua\iptsec;..\..\sofia-sip\libsofia-sip-ua\http;..\..\sofia-sip\libsofia-sip-ua\nth;..\..\sofia-sip\libsofia-sip-ua\nea;..\..\sofia-sip\libsofia-sip-ua\sdp;..\..\sofia-sip\libsofia-sip-ua\soa;..\..\sofia-sip\libsofia-sip-ua\stun;..\..\sofia-sip\libsofia-sip-ua\tport;..\..\sofia-sip\libsofia-sip-ua\features;..\..\pthreads-w32-2-9-1;.;..\..\openssl-$(OpenSSLVersion)\include;..\..\..\src\include;%(AdditionalIncludeDirectories) + ..\..\sofia-sip\win32;..\..\sofia-sip\libsofia-sip-ua\su;..\..\sofia-sip\libsofia-sip-ua\ipt;..\..\sofia-sip\libsofia-sip-ua\sresolv;..\..\sofia-sip\libsofia-sip-ua\bnf;..\..\sofia-sip\libsofia-sip-ua\url;..\..\sofia-sip\libsofia-sip-ua\msg;..\..\sofia-sip\libsofia-sip-ua\sip;..\..\sofia-sip\libsofia-sip-ua\nta;..\..\sofia-sip\libsofia-sip-ua\nua;..\..\sofia-sip\libsofia-sip-ua\iptsec;..\..\sofia-sip\libsofia-sip-ua\http;..\..\sofia-sip\libsofia-sip-ua\nth;..\..\sofia-sip\libsofia-sip-ua\nea;..\..\sofia-sip\libsofia-sip-ua\sdp;..\..\sofia-sip\libsofia-sip-ua\soa;..\..\sofia-sip\libsofia-sip-ua\stun;..\..\sofia-sip\libsofia-sip-ua\tport;..\..\sofia-sip\libsofia-sip-ua\tport\include;..\..\sofia-sip\libsofia-sip-ua\features;..\..\pthreads-w32-2-9-1;.;..\..\openssl-$(OpenSSLVersion)\include;..\..\..\src\include;%(AdditionalIncludeDirectories) _TIMESPEC_DEFINED;_WIN64;WIN32;_DEBUG;_LIB;IN_LIBSOFIA_SIP_UA_STATIC;LIBSOFIA_SIP_UA_STATIC;LIBSRES_STATIC;PTW32_STATIC_LIB;HAVE_IPHLPAPI_H;SU_DEBUG=0;_WINSOCK_DEPRECATED_NO_WARNINGS;%(PreprocessorDefinitions) true EnableFastChecks @@ -158,7 +158,7 @@ if not exist "$(ProjectDir)$(IntDir)\auth_client.obj" "autogen.cmd" MaxSpeed OnlyExplicitInline - ..\..\sofia-sip\win32;..\..\sofia-sip\libsofia-sip-ua\su;..\..\sofia-sip\libsofia-sip-ua\ipt;..\..\sofia-sip\libsofia-sip-ua\sresolv;..\..\sofia-sip\libsofia-sip-ua\bnf;..\..\sofia-sip\libsofia-sip-ua\url;..\..\sofia-sip\libsofia-sip-ua\msg;..\..\sofia-sip\libsofia-sip-ua\sip;..\..\sofia-sip\libsofia-sip-ua\nta;..\..\sofia-sip\libsofia-sip-ua\nua;..\..\sofia-sip\libsofia-sip-ua\iptsec;..\..\sofia-sip\libsofia-sip-ua\http;..\..\sofia-sip\libsofia-sip-ua\nth;..\..\sofia-sip\libsofia-sip-ua\nea;..\..\sofia-sip\libsofia-sip-ua\sdp;..\..\sofia-sip\libsofia-sip-ua\soa;..\..\sofia-sip\libsofia-sip-ua\stun;..\..\sofia-sip\libsofia-sip-ua\tport;..\..\sofia-sip\libsofia-sip-ua\features;..\..\pthreads-w32-2-9-1;.;..\..\openssl-$(OpenSSLVersion)\include;..\..\..\src\include;%(AdditionalIncludeDirectories) + ..\..\sofia-sip\win32;..\..\sofia-sip\libsofia-sip-ua\su;..\..\sofia-sip\libsofia-sip-ua\ipt;..\..\sofia-sip\libsofia-sip-ua\sresolv;..\..\sofia-sip\libsofia-sip-ua\bnf;..\..\sofia-sip\libsofia-sip-ua\url;..\..\sofia-sip\libsofia-sip-ua\msg;..\..\sofia-sip\libsofia-sip-ua\sip;..\..\sofia-sip\libsofia-sip-ua\nta;..\..\sofia-sip\libsofia-sip-ua\nua;..\..\sofia-sip\libsofia-sip-ua\iptsec;..\..\sofia-sip\libsofia-sip-ua\http;..\..\sofia-sip\libsofia-sip-ua\nth;..\..\sofia-sip\libsofia-sip-ua\nea;..\..\sofia-sip\libsofia-sip-ua\sdp;..\..\sofia-sip\libsofia-sip-ua\soa;..\..\sofia-sip\libsofia-sip-ua\stun;..\..\sofia-sip\libsofia-sip-ua\tport;..\..\sofia-sip\libsofia-sip-ua\tport\include;..\..\sofia-sip\libsofia-sip-ua\features;..\..\pthreads-w32-2-9-1;.;..\..\openssl-$(OpenSSLVersion)\include;..\..\..\src\include;%(AdditionalIncludeDirectories) _TIMESPEC_DEFINED;WIN32;NDEBUG;_LIB;IN_LIBSOFIA_SIP_UA_STATIC;LIBSOFIA_SIP_UA_STATIC;LIBSRES_STATIC;PTW32_STATIC_LIB;HAVE_IPHLPAPI_H;SU_DEBUG=0;_WINSOCK_DEPRECATED_NO_WARNINGS;%(PreprocessorDefinitions) true MultiThreadedDLL @@ -196,7 +196,7 @@ if not exist "$(ProjectDir)$(IntDir)\auth_client.obj" "autogen.cmd" MaxSpeed OnlyExplicitInline - ..\..\sofia-sip\win32;..\..\sofia-sip\libsofia-sip-ua\su;..\..\sofia-sip\libsofia-sip-ua\ipt;..\..\sofia-sip\libsofia-sip-ua\sresolv;..\..\sofia-sip\libsofia-sip-ua\bnf;..\..\sofia-sip\libsofia-sip-ua\url;..\..\sofia-sip\libsofia-sip-ua\msg;..\..\sofia-sip\libsofia-sip-ua\sip;..\..\sofia-sip\libsofia-sip-ua\nta;..\..\sofia-sip\libsofia-sip-ua\nua;..\..\sofia-sip\libsofia-sip-ua\iptsec;..\..\sofia-sip\libsofia-sip-ua\http;..\..\sofia-sip\libsofia-sip-ua\nth;..\..\sofia-sip\libsofia-sip-ua\nea;..\..\sofia-sip\libsofia-sip-ua\sdp;..\..\sofia-sip\libsofia-sip-ua\soa;..\..\sofia-sip\libsofia-sip-ua\stun;..\..\sofia-sip\libsofia-sip-ua\tport;..\..\sofia-sip\libsofia-sip-ua\features;..\..\pthreads-w32-2-9-1;.;..\..\openssl-$(OpenSSLVersion)\include;..\..\..\src\include;%(AdditionalIncludeDirectories) + ..\..\sofia-sip\win32;..\..\sofia-sip\libsofia-sip-ua\su;..\..\sofia-sip\libsofia-sip-ua\ipt;..\..\sofia-sip\libsofia-sip-ua\sresolv;..\..\sofia-sip\libsofia-sip-ua\bnf;..\..\sofia-sip\libsofia-sip-ua\url;..\..\sofia-sip\libsofia-sip-ua\msg;..\..\sofia-sip\libsofia-sip-ua\sip;..\..\sofia-sip\libsofia-sip-ua\nta;..\..\sofia-sip\libsofia-sip-ua\nua;..\..\sofia-sip\libsofia-sip-ua\iptsec;..\..\sofia-sip\libsofia-sip-ua\http;..\..\sofia-sip\libsofia-sip-ua\nth;..\..\sofia-sip\libsofia-sip-ua\nea;..\..\sofia-sip\libsofia-sip-ua\sdp;..\..\sofia-sip\libsofia-sip-ua\soa;..\..\sofia-sip\libsofia-sip-ua\stun;..\..\sofia-sip\libsofia-sip-ua\tport;..\..\sofia-sip\libsofia-sip-ua\tport\include;..\..\sofia-sip\libsofia-sip-ua\features;..\..\pthreads-w32-2-9-1;.;..\..\openssl-$(OpenSSLVersion)\include;..\..\..\src\include;%(AdditionalIncludeDirectories) _TIMESPEC_DEFINED;_WIN64;WIN32;NDEBUG;_LIB;IN_LIBSOFIA_SIP_UA_STATIC;LIBSOFIA_SIP_UA_STATIC;LIBSRES_STATIC;PTW32_STATIC_LIB;HAVE_IPHLPAPI_H;SU_DEBUG=0;_WINSOCK_DEPRECATED_NO_WARNINGS;%(PreprocessorDefinitions) true MultiThreadedDLL @@ -535,4 +535,4 @@ if not exist "$(ProjectDir)$(IntDir)\auth_client.obj" "autogen.cmd" - \ No newline at end of file + From bb8960a667c8a487fbdc75372ba5f25e4769bacf Mon Sep 17 00:00:00 2001 From: Ken Rice Date: Tue, 19 Apr 2016 12:52:46 -0500 Subject: [PATCH 28/32] Revert "FS-9081 Correction to e8f83d0" This reverts commit 1b9fda720a462a25254d53da366fe06a91a1e24e. --- debian/util.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/util.sh b/debian/util.sh index b961ad0968..b5a10e3f94 100755 --- a/debian/util.sh +++ b/debian/util.sh @@ -260,7 +260,7 @@ get_sources () { prefix=`echo $distro | awk -F/ '{print $1}'` suffix="`echo $distro | awk -F/ '{print $2}'`" if test -n "$suffix" ; then full="$tgt_distro/$suffix" ; else full="$tgt_distro" ; fi - if [ "$distro" == "trusty" -a "$components" == "main" ] ; then components="main universe"; fi + if [ "$distro" == "trusty" -a "$components" == "main" ] ; then components="main universe"; echo "Forcing components to include universe"; fi printf "$type $path $full $components\n" done < "$2" } From 9b1d5c35f6ba3c5029920c4ce710abe8555940c1 Mon Sep 17 00:00:00 2001 From: Ken Rice Date: Tue, 19 Apr 2016 12:52:52 -0500 Subject: [PATCH 29/32] Revert "FS-9081 to build all modules for trusty needs the universe components" This reverts commit e8f83d0558ad8efe9744cc885e8fce938ff00a31. --- debian/util.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/debian/util.sh b/debian/util.sh index b5a10e3f94..3c481a3aa3 100755 --- a/debian/util.sh +++ b/debian/util.sh @@ -260,7 +260,6 @@ get_sources () { prefix=`echo $distro | awk -F/ '{print $1}'` suffix="`echo $distro | awk -F/ '{print $2}'`" if test -n "$suffix" ; then full="$tgt_distro/$suffix" ; else full="$tgt_distro" ; fi - if [ "$distro" == "trusty" -a "$components" == "main" ] ; then components="main universe"; echo "Forcing components to include universe"; fi printf "$type $path $full $components\n" done < "$2" } From 7375ad9e89679bf546fcaaeb2706a9adc405abd9 Mon Sep 17 00:00:00 2001 From: Ken Rice Date: Tue, 19 Apr 2016 12:55:26 -0500 Subject: [PATCH 30/32] FS-9081 [Ubuntu Packaging] WIP Patches to build system and configure to allow FS to build on 14.04 --- configure.ac | 6 +++--- debian/util.sh | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index ccc17e53bc..efe5473ab0 100644 --- a/configure.ac +++ b/configure.ac @@ -819,7 +819,7 @@ if test "x$have_libz" = "xyes" ; then APR_ADDTO([PLATFORM_CORE_LIBS], [-lz]) fi -PKG_CHECK_MODULES([MPG123], [libmpg123 >= 1.20.1],[ +PKG_CHECK_MODULES([MPG123], [libmpg123 >= 1.16.0],[ AM_CONDITIONAL([HAVE_MPG123],[true])],[ AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_MPG123],[false])]) @@ -1300,7 +1300,7 @@ PKG_CHECK_MODULES([SNDFILE], [sndfile >= 1.0.20],[ AM_CONDITIONAL([HAVE_SNDFILE],[true])],[ AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_SNDFILE],[false])]) -PKG_CHECK_MODULES([MPG123], [libmpg123 >= 1.20.1],[ +PKG_CHECK_MODULES([MPG123], [libmpg123 >= 1.16.0],[ AM_CONDITIONAL([HAVE_MPG123],[true])],[ AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_MPG123],[false])]) @@ -1379,7 +1379,7 @@ PKG_CHECK_MODULES([OPUS], [opus >= 1.1],[ AM_CONDITIONAL([HAVE_OPUS],[true])],[ AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_OPUS],[false])]) -PKG_CHECK_MODULES([SOUNDTOUCH], [soundtouch >= 1.7.1],[ +PKG_CHECK_MODULES([SOUNDTOUCH], [soundtouch >= 1.7.0],[ AM_CONDITIONAL([HAVE_SOUNDTOUCH],[true])],[ AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_SOUNDTOUCH],[false])]) diff --git a/debian/util.sh b/debian/util.sh index 3c481a3aa3..aa828e365c 100755 --- a/debian/util.sh +++ b/debian/util.sh @@ -292,7 +292,9 @@ build_debs () { if [ "$custom_sources_file" == "/etc/apt/sources.list" ]; then # If you are using the system sources, then it is reasonable that you expect to use all of the supplementary repos too cat /etc/apt/sources.list > /tmp/fs.sources.list - for X in /etc/apt/sources.list.d/*; do cat $X >> /tmp/fs.sources.list; done + if [ "$(ls -A /etc/apt/sources.list.d)" ]; then + for X in /etc/apt/sources.list.d/*; do cat $X >> /tmp/fs.sources.list; done + fi custom_sources_file="/tmp/fs.sources.list" apt-key exportall > "/tmp/fs.asc" custom_keyring="/tmp/fs.asc" From 5ddac2845eba8db5ed6cc48b1cd69f19ed149f9f Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Fri, 29 Apr 2016 12:38:51 -0400 Subject: [PATCH 31/32] FS-9109 --- libs/libdingaling/src/sha1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/libdingaling/src/sha1.c b/libs/libdingaling/src/sha1.c index b96446c122..100ab0e513 100644 --- a/libs/libdingaling/src/sha1.c +++ b/libs/libdingaling/src/sha1.c @@ -62,7 +62,7 @@ #pragma clang diagnostic ignored "-Wunused-const-variable" #endif -#ifndef lint +#if 0 static const char rcsid[] = "$Id: sha1.c 680 2003-07-25 21:57:38Z asaddi $"; #endif /* !lint */ From f476e23c0068d58d2e93987005fb420b648a0dd1 Mon Sep 17 00:00:00 2001 From: Piotr Gregor Date: Fri, 29 Apr 2016 18:23:33 +0100 Subject: [PATCH 32/32] FS-9117 [avmd] #fix build on Windows --- .../applications/mod_avmd/avmd_fast_acosf.c | 6 ++++- .../applications/mod_avmd/avmd_fast_acosf.h | 2 ++ src/mod/applications/mod_avmd/mod_avmd.c | 22 +++++++++++++------ 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/src/mod/applications/mod_avmd/avmd_fast_acosf.c b/src/mod/applications/mod_avmd/avmd_fast_acosf.c index 1974c9852f..cb0500b315 100644 --- a/src/mod/applications/mod_avmd/avmd_fast_acosf.c +++ b/src/mod/applications/mod_avmd/avmd_fast_acosf.c @@ -1,3 +1,6 @@ +#ifndef WIN32 /* currently we support fast acosf computation only on UNIX/Linux */ + + #include #include #include @@ -312,4 +315,5 @@ dump_table_summary(void) printf("i [%d] from float [%f]\n", index_from_float(f), f); } -#endif /* FAST_ACOSF_TESTING */ +#endif /* FAST_ACOSF_TESTING */ +#endif /* WIN32 */ diff --git a/src/mod/applications/mod_avmd/avmd_fast_acosf.h b/src/mod/applications/mod_avmd/avmd_fast_acosf.h index 1c3b68ca1a..0b9752713f 100644 --- a/src/mod/applications/mod_avmd/avmd_fast_acosf.h +++ b/src/mod/applications/mod_avmd/avmd_fast_acosf.h @@ -1,3 +1,4 @@ +#ifndef WIN32 /* currently we support fast acosf computation only on UNIX/Linux */ /* * @brief Fast arithmetic using precomputed arc cosine table. * Contributor(s): @@ -46,3 +47,4 @@ extern float fast_acosf(float x); extern int compute_table(void); #endif /* __AVMD_FAST_ACOSF_H__ */ +#endif diff --git a/src/mod/applications/mod_avmd/mod_avmd.c b/src/mod/applications/mod_avmd/mod_avmd.c index 5e8e2a7ecc..73db88916d 100644 --- a/src/mod/applications/mod_avmd/mod_avmd.c +++ b/src/mod/applications/mod_avmd/mod_avmd.c @@ -483,7 +483,7 @@ avmd_parse_u8_user_input(const char *input, uint8_t *output, if (helper < min || helper > UINT8_MAX || helper > max || (pCh == input) || (*pCh != '\0')) { return -1; } - *output= helper; + *output = (uint8_t) helper; return 0; } @@ -500,7 +500,7 @@ avmd_parse_u16_user_input(const char *input, uint16_t *output, if (helper < min || helper > UINT16_MAX || helper > max || (pCh == input) || (*pCh != '\0')) { return -1; } - *output= helper; + *output = (uint16_t) helper; return 0; } @@ -689,8 +689,10 @@ avmd_show(switch_stream_handle_t *stream, switch_mutex_t *mutex) SWITCH_MODULE_LOAD_FUNCTION(mod_avmd_load) { +#ifndef WIN32 char err[150]; int ret; +#endif switch_application_interface_t *app_interface; switch_api_interface_t *api_interface; @@ -727,6 +729,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_avmd_load) /* Not so severe to prevent further loading, well - it depends, anyway */ } +#ifndef WIN32 if (avmd_globals.settings.fast_math == 1) { ret = init_fast_acosf(); if (ret != 0) { @@ -768,6 +771,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_avmd_load) "is [%s]\n", ACOS_TABLE_FILENAME ); } +#endif SWITCH_ADD_APP(app_interface, "avmd_start","Start avmd detection", "Start avmd detection", avmd_start_app, "", SAF_NONE); @@ -1022,12 +1026,15 @@ SWITCH_STANDARD_APP(avmd_start_function) SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_avmd_shutdown) { +#ifndef WIN32 int res; +#endif switch_mutex_lock(avmd_globals.mutex); avmd_unregister_all_events(); - + +#ifndef WIN32 if (avmd_globals.settings.fast_math == 1) { res = destroy_fast_acosf(); if (res != 0) { @@ -1045,6 +1052,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_avmd_shutdown) } } } +#endif switch_event_unbind_callback(avmd_reloadxml_event_handler); @@ -1494,13 +1502,13 @@ static void avmd_process(avmd_session_t *s, switch_frame_t *frame) /* calculate variance (biased estimator) */ v = s->sqa_b.sma - (s->sma_b.sma * s->sma_b.sma); #ifdef AVMD_DEBUG - #ifdef AVMD_FAST_MATH + #if !defined(WIN32) && defined(AVMD_FAST_MATH) f = 0.5 * (double) fast_acosf((float)omega); sma_digital_freq = 0.5 * (double) fast_acosf((float)s->sma_b.sma); #else f = 0.5 * acos(omega); sma_digital_freq = 0.5 * acos(s->sma_b.sma); - #endif /* AVMD_FAST_MATH */ + #endif /* !WIN32 && AVMD_FAST_MATH */ #ifdef AVMD_REQUIRE_CONTINUOUS_STREAK switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(s->session), SWITCH_LOG_DEBUG, "<<< AVMD v[%.10f]\tomega[%f]\tf[%f] [%f]Hz\t\tsma[%f][%f]Hz\t\tsqa[%f]\t" @@ -1527,11 +1535,11 @@ static void avmd_process(avmd_session_t *s, switch_frame_t *frame) #else if (v < VARIANCE_THRESHOLD && (s->sma_b.lpos > 1)) { #endif - #ifdef AVMD_FAST_MATH + #if !defined(WIN32) && defined(AVMD_FAST_MATH) sma_digital_freq = 0.5 * (double) fast_acosf((float)s->sma_b.sma); #else sma_digital_freq = 0.5 * acos(s->sma_b.sma); - #endif /* AVMD_FAST_MATH */ + #endif /* !WIN32 && AVMD_FAST_MATH */ switch_channel_set_variable_printf(channel, "avmd_total_time", "[%d]", (int)(switch_micro_time_now() - s->start_time) / 1000);