switch_ivr_async.patch
3.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
--- freeswitch-1.0.6/src/switch_ivr_async.c 2010-04-07 02:05:28.000000000 +0800
+++ freeswitch-1.0.6/src/switch_ivr_async.c 2012-04-10 20:00:17.000000000 +0800
@@ -475,10 +475,12 @@
switch_core_file_close(rh->fh);
+ /*
if (rh->fh->samples_out < rh->fh->samplerate * rh->min_sec) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Discarding short file %s\n", rh->file);
switch_file_remove(rh->file, switch_core_session_get_pool(session));
}
+ */
}
}
@@ -993,10 +995,26 @@
file = switch_core_session_sprintf(session, "%s%s%s%s%s", switch_str_nil(tfile), tfile ? "]" : "", prefix, SWITCH_PATH_SEPARATOR, file);
}
+ if(file){
+ char *p=NULL;
+ char *path=switch_core_session_strdup(session,file);
+ if ((p = strrchr(path, *SWITCH_PATH_SEPARATOR))) {
+ *p = '\0';
+ if (switch_dir_make_recursive(path, SWITCH_DEFAULT_DIR_PERMS, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR,"Error creating %s\n", path);
+ return SWITCH_STATUS_GENERR;
+ }
+ }
+ else {
+ switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error finding the folder path section in '%s'\n", path);
+ path = NULL;
+ }
+ }
+
if (switch_core_file_open(fh, file, channels, read_impl.actual_samples_per_second, file_flags, NULL) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error opening %s\n", file);
- switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
- switch_core_session_reset(session, SWITCH_TRUE, SWITCH_TRUE);
+ //switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
+ //switch_core_session_reset(session, SWITCH_TRUE, SWITCH_TRUE);
return SWITCH_STATUS_GENERR;
}
@@ -2856,7 +2874,7 @@
int app_flags = 0, nomedia = 0;
switch_assert(path);
-
+ switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "broadcast info, uuid(%s), path(%s)\n", uuid, path);
if (!(master = session = switch_core_session_locate(uuid))) {
return SWITCH_STATUS_FALSE;
}
@@ -2885,6 +2903,7 @@
}
}
+ switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "broadcast info, cause(%s)\n", cause);
if ((flags & SMF_ECHO_BLEG) && (other_uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))
&& (other_session = switch_core_session_locate(other_uuid))) {
if ((flags & SMF_EXEC_INLINE)) {
@@ -2950,7 +2969,9 @@
}
if (cause) {
+ switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "broadcast info, enter cause(%s)\n", cause);
if (switch_event_create(&event, SWITCH_EVENT_COMMAND) == SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "broadcast info, send hangup info\n");
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "call-command", "execute");
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "execute-app-name", "hangup");
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "execute-app-arg", cause);