diff --git a/libs/libscgi/src/scgi.c b/libs/libscgi/src/scgi.c index df05b5980b..d0eeab5203 100644 --- a/libs/libscgi/src/scgi.c +++ b/libs/libscgi/src/scgi.c @@ -606,7 +606,7 @@ SCGI_DECLARE(scgi_status_t) scgi_accept(scgi_socket_t server_sock, scgi_socket_t clntLen = sizeof(*echoClntAddr); if ((client_sock = accept(server_sock, (struct sockaddr *) echoClntAddr, &clntLen)) == SCGI_SOCK_INVALID) { - printf("FRICK %s\n", strerror(errno)); + //printf("FRICK %s\n", strerror(errno)); status = SCGI_FAIL; } else { *client_sock_p = client_sock; diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index fa5f02e8b9..8a2dd2dc02 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -4903,13 +4903,96 @@ static switch_status_t conf_api_sub_list(conference_obj_t *conference, switch_st if (conference == NULL) { switch_mutex_lock(globals.hash_mutex); for (hi = switch_hash_first(NULL, globals.conference_hash); hi; hi = switch_hash_next(hi)) { + int fcount = 0; switch_hash_this(hi, NULL, NULL, &val); conference = (conference_obj_t *) val; - stream->write_function(stream, "Conference %s (%u member%s rate: %u%s)\n", + stream->write_function(stream, "Conference %s (%u member%s rate: %u%s flags: ", conference->name, conference->count, conference->count == 1 ? "" : "s", conference->rate, switch_test_flag(conference, CFLAG_LOCKED) ? " locked" : ""); + + if (switch_test_flag(conference, CFLAG_LOCKED)) { + stream->write_function(stream, "%slocked", fcount ? "|" : ""); + fcount++; + } + + if (switch_test_flag(conference, CFLAG_DESTRUCT)) { + stream->write_function(stream, "%sdestruct", fcount ? "|" : ""); + fcount++; + } + + if (switch_test_flag(conference, CFLAG_WAIT_MOD)) { + stream->write_function(stream, "%swait_mod", fcount ? "|" : ""); + fcount++; + } + + if (switch_test_flag(conference, CFLAG_AUDIO_ALWAYS)) { + stream->write_function(stream, "%saudio_always", fcount ? "|" : ""); + fcount++; + } + + if (switch_test_flag(conference, CFLAG_RUNNING)) { + stream->write_function(stream, "%srunning", fcount ? "|" : ""); + fcount++; + } + + if (switch_test_flag(conference, CFLAG_ANSWERED)) { + stream->write_function(stream, "%sanswered", fcount ? "|" : ""); + fcount++; + } + + if (switch_test_flag(conference, CFLAG_ENFORCE_MIN)) { + stream->write_function(stream, "%senforce_min", fcount ? "|" : ""); + fcount++; + } + + if (switch_test_flag(conference, CFLAG_BRIDGE_TO)) { + stream->write_function(stream, "%sbridge_to", fcount ? "|" : ""); + fcount++; + } + + if (switch_test_flag(conference, CFLAG_DYNAMIC)) { + stream->write_function(stream, "%sdynamic", fcount ? "|" : ""); + fcount++; + } + + if (switch_test_flag(conference, CFLAG_EXIT_SOUND)) { + stream->write_function(stream, "%sexit_sound", fcount ? "|" : ""); + fcount++; + } + + if (switch_test_flag(conference, CFLAG_ENTER_SOUND)) { + stream->write_function(stream, "%senter_sound", fcount ? "|" : ""); + fcount++; + } + + if (conference->record_count > 0) { + stream->write_function(stream, "%srecording", fcount ? "|" : ""); + fcount++; + } + + if (switch_test_flag(conference, CFLAG_VIDEO_BRIDGE)) { + stream->write_function(stream, "%svideo_bridge", fcount ? "|" : ""); + fcount++; + } + + if (switch_test_flag(conference, CFLAG_VID_FLOOR)) { + stream->write_function(stream, "%svideo_floor_only", fcount ? "|" : ""); + fcount++; + } + + if (switch_test_flag(conference, CFLAG_RFC4579)) { + stream->write_function(stream, "%svideo_rfc4579", fcount ? "|" : ""); + fcount++; + } + + if (!fcount) { + stream->write_function(stream, "none"); + } + + stream->write_function(stream, ")\n"); + count++; if (!summary) { if (pretty) { @@ -5074,6 +5157,18 @@ static void conference_xlist(conference_obj_t *conference, switch_xml_t x_confer switch_xml_set_attr_d(x_conference, "endconf_grace_time", ival); } + if (switch_test_flag(conference, CFLAG_VIDEO_BRIDGE)) { + switch_xml_set_attr_d(x_conference, "video_bridge", "true"); + } + + if (switch_test_flag(conference, CFLAG_VID_FLOOR)) { + switch_xml_set_attr_d(x_conference, "video_floor_only", "true"); + } + + if (switch_test_flag(conference, CFLAG_RFC4579)) { + switch_xml_set_attr_d(x_conference, "video_rfc4579", "true"); + } + switch_snprintf(i, sizeof(i), "%d", switch_epoch_time_now(NULL) - conference->run_time); switch_xml_set_attr_d(x_conference, "run_time", ival); @@ -5172,6 +5267,9 @@ static void conference_xlist(conference_obj_t *conference, switch_xml_t x_confer x_tag = switch_xml_add_child_d(x_flags, "has_video", count++); switch_xml_set_txt_d(x_tag, switch_channel_test_flag(switch_core_session_get_channel(member->session), CF_VIDEO) ? "true" : "false"); + x_tag = switch_xml_add_child_d(x_flags, "video_bridge", count++); + switch_xml_set_txt_d(x_tag, switch_test_flag(member, MFLAG_VIDEO_BRIDGE) ? "true" : "false"); + x_tag = switch_xml_add_child_d(x_flags, "has_floor", count++); switch_xml_set_txt_d(x_tag, (member == member->conference->floor_holder) ? "true" : "false"); diff --git a/src/mod/applications/mod_http_cache/mod_http_cache.c b/src/mod/applications/mod_http_cache/mod_http_cache.c index aec7be684d..d4117d0a69 100644 --- a/src/mod/applications/mod_http_cache/mod_http_cache.c +++ b/src/mod/applications/mod_http_cache/mod_http_cache.c @@ -191,29 +191,29 @@ static void url_cache_clear(url_cache_t *cache, switch_core_session_t *session); static switch_status_t http_put(url_cache_t *cache, switch_core_session_t *session, const char *url, const char *filename) { switch_status_t status = SWITCH_STATUS_SUCCESS; - - switch_curl_slist_t *headers = NULL; /* optional linked-list of HTTP headers */ - char *ext; /* file extension, used for MIME type identification */ - const char *mime_type = "application/octet-stream"; - char *buf; - + + switch_curl_slist_t *headers = NULL; /* optional linked-list of HTTP headers */ + char *ext; /* file extension, used for MIME type identification */ + const char *mime_type = "application/octet-stream"; + char *buf; + CURL *curl_handle = NULL; long httpRes = 0; struct stat file_info = {0}; FILE *file_to_put = NULL; int fd; - - /* guess what type of mime content this is going to be */ - if ((ext = strrchr(filename, '.'))) { - ext++; - if (!(mime_type = switch_core_mime_ext2type(ext))) { - mime_type = "application/octet-stream"; - } - } - - buf = switch_mprintf("Content-Type: %s", mime_type); - headers = switch_curl_slist_append(headers, buf); - + + /* guess what type of mime content this is going to be */ + if ((ext = strrchr(filename, '.'))) { + ext++; + if (!(mime_type = switch_core_mime_ext2type(ext))) { + mime_type = "application/octet-stream"; + } + } + + buf = switch_mprintf("Content-Type: %s", mime_type); + headers = switch_curl_slist_append(headers, buf); + /* open file and get the file size */ switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "opening %s for upload to %s\n", filename, url); fd = open(filename, O_RDONLY); @@ -244,7 +244,7 @@ static switch_status_t http_put(url_cache_t *cache, switch_core_session_t *sessi switch_curl_easy_setopt(curl_handle, CURLOPT_UPLOAD, 1); switch_curl_easy_setopt(curl_handle, CURLOPT_PUT, 1); switch_curl_easy_setopt(curl_handle, CURLOPT_NOSIGNAL, 1); - switch_curl_easy_setopt(curl_handle, CURLOPT_HTTPHEADER, headers); + switch_curl_easy_setopt(curl_handle, CURLOPT_HTTPHEADER, headers); switch_curl_easy_setopt(curl_handle, CURLOPT_URL, url); switch_curl_easy_setopt(curl_handle, CURLOPT_READDATA, file_to_put); switch_curl_easy_setopt(curl_handle, CURLOPT_INFILESIZE_LARGE, (curl_off_t)file_info.st_size); @@ -279,12 +279,12 @@ done: fclose(file_to_put); } - if (headers) { - switch_curl_slist_free_all(headers); - } - - switch_safe_free(buf); - + if (headers) { + switch_curl_slist_free_all(headers); + } + + switch_safe_free(buf); + return status; } @@ -698,6 +698,7 @@ static cached_url_t *cached_url_create(url_cache_t *cache, const char *url) char *dirname = NULL; cached_url_t *u = NULL; const char *file_extension = ""; + const char *ext = NULL; if (zstr(url)) { return NULL; @@ -716,7 +717,7 @@ static cached_url_t *cached_url_create(url_cache_t *cache, const char *url) switch_dir_make_recursive(dirname, SWITCH_DEFAULT_DIR_PERMS, cache->pool); /* find extension on the end of URL */ - for(const char *ext = &url[strlen(url) - 1]; ext != url; ext--) { + for (ext = &url[strlen(url) - 1]; ext != url; ext--) { if (*ext == '/' || *ext == '\\') { break; } diff --git a/src/mod/applications/mod_voicemail/mod_voicemail.c b/src/mod/applications/mod_voicemail/mod_voicemail.c index de44945e8e..699bc96311 100644 --- a/src/mod/applications/mod_voicemail/mod_voicemail.c +++ b/src/mod/applications/mod_voicemail/mod_voicemail.c @@ -2548,7 +2548,10 @@ static void voicemail_check_main(switch_core_session_t *session, vm_profile_t *p if (authed) { switch_channel_set_variable(channel, "user_pin_authenticated", "true"); switch_channel_set_variable(channel, "user_pin_authenticated_user", myid); - if (!zstr(myid)) switch_ivr_set_user(session, myid); + if (!zstr(myid) && !zstr(domain_name)) { + char *account = switch_core_session_sprintf(session, "%s@%s", myid, domain_name); + switch_ivr_set_user(session, account); + } } else { switch_channel_hangup(channel, SWITCH_CAUSE_USER_CHALLENGE); } @@ -3535,12 +3538,12 @@ SWITCH_STANDARD_APP(voicemail_function) if (argv[x] && !strcasecmp(argv[x], "check")) { check++; x++; - } else if (argv[x] && !strcasecmp(argv[x], "auth")) { - auth++; - x++; } else if (argv[x] && !strcasecmp(argv[x], "auth_only")) { auth = 2; x++; + } else if (argv[x] && !strcasecmp(argv[x], "auth")) { + auth++; + x++; } else { break; } @@ -3584,7 +3587,7 @@ SWITCH_STANDARD_APP(voicemail_function) return; } - if (check) { + if (check || auth == 2) { if (argv[x]) { uuid = argv[x++]; } diff --git a/src/mod/event_handlers/mod_erlang_event/handle_msg.c b/src/mod/event_handlers/mod_erlang_event/handle_msg.c index e6d0d7a5f9..618b7eb829 100644 --- a/src/mod/event_handlers/mod_erlang_event/handle_msg.c +++ b/src/mod/event_handlers/mod_erlang_event/handle_msg.c @@ -634,7 +634,7 @@ static switch_status_t handle_msg_api(listener_t *listener, erlang_msg * msg, in ei_get_type(buf->buff, &buf->index, &type, &size); arg = malloc(size + 1); - if (ei_decode_string(buf->buff, &buf->index, arg)) { + if (ei_decode_string_or_binary(buf->buff, &buf->index, size, arg)) { fail = SWITCH_TRUE; } @@ -664,7 +664,7 @@ static switch_status_t handle_msg_bgapi(listener_t *listener, erlang_msg * msg, { char api_cmd[MAXATOMLEN]; char arg[1024]; - if (arity < 3 || ei_decode_atom(buf->buff, &buf->index, api_cmd) || ei_decode_string(buf->buff, &buf->index, arg)) { + if (arity < 3 || ei_decode_atom(buf->buff, &buf->index, api_cmd) || ei_decode_string_or_binary(buf->buff, &buf->index, 1023, arg)) { ei_x_encode_tuple_header(rbuf, 2); ei_x_encode_atom(rbuf, "error"); ei_x_encode_atom(rbuf, "badarg");