Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
1dea2b2f
提交
1dea2b2f
authored
3月 26, 2019
作者:
Mike Jerris
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1474 in FS/freeswitch from ~LAZEDO/freeswitch:feature/FS-10968 to master
* commit '
168a3c06
': FS-10968 [core] create recording vars
上级
f4a72741
168a3c06
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
73 行增加
和
27 行删除
+73
-27
switch_event.h
src/include/switch_event.h
+1
-1
switch_ivr.h
src/include/switch_ivr.h
+1
-0
mod_commands.c
src/mod/applications/mod_commands/mod_commands.c
+10
-3
mod_dptools.c
src/mod/applications/mod_dptools/mod_dptools.c
+25
-22
switch_ivr_async.c
src/switch_ivr_async.c
+36
-1
没有找到文件。
src/include/switch_event.h
浏览文件 @
1dea2b2f
...
...
@@ -215,7 +215,7 @@ SWITCH_DECLARE(int) switch_event_add_array(switch_event_t *event, const char *va
\param event pointer to the pointer to event to destroy
*/
SWITCH_DECLARE
(
void
)
switch_event_destroy
(
switch_event_t
**
event
);
#define switch_event_safe_destroy(_event) if (_event) switch_event_destroy(_event)
#define switch_event_safe_destroy(_event) if (_event) switch_event_destroy(
&
_event)
/*!
\brief Duplicate an event
...
...
src/include/switch_ivr.h
浏览文件 @
1dea2b2f
...
...
@@ -293,6 +293,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech_start_input_timers(swit
\return SWITCH_STATUS_SUCCESS if all is well
*/
SWITCH_DECLARE
(
switch_status_t
)
switch_ivr_record_session
(
switch_core_session_t
*
session
,
const
char
*
file
,
uint32_t
limit
,
switch_file_handle_t
*
fh
);
SWITCH_DECLARE
(
switch_status_t
)
switch_ivr_record_session_event
(
switch_core_session_t
*
session
,
const
char
*
file
,
uint32_t
limit
,
switch_file_handle_t
*
fh
,
switch_event_t
*
variables
);
SWITCH_DECLARE
(
switch_status_t
)
switch_ivr_transfer_recordings
(
switch_core_session_t
*
orig_session
,
switch_core_session_t
*
new_session
);
...
...
src/mod/applications/mod_commands/mod_commands.c
浏览文件 @
1dea2b2f
...
...
@@ -4657,14 +4657,16 @@ SWITCH_STANDARD_API(uuid_bridge_function)
return
SWITCH_STATUS_SUCCESS
;
}
#define SESS_REC_SYNTAX "<uuid> [start|stop|mask|unmask] <path> [<limit>]"
#define SESS_REC_SYNTAX "<uuid> [start|stop|mask|unmask] <path> [<limit>]
[<recording_vars>]
"
SWITCH_STANDARD_API
(
session_record_function
)
{
switch_core_session_t
*
rsession
=
NULL
;
char
*
mycmd
=
NULL
,
*
argv
[
4
]
=
{
0
};
char
*
mycmd
=
NULL
,
*
argv
[
5
]
=
{
0
};
char
*
uuid
=
NULL
,
*
action
=
NULL
,
*
path
=
NULL
;
int
argc
=
0
;
uint32_t
limit
=
0
;
switch_event_t
*
vars
=
NULL
;
char
*
new_fp
=
NULL
;
if
(
zstr
(
cmd
))
{
goto
usage
;
...
...
@@ -4693,11 +4695,16 @@ SWITCH_STANDARD_API(session_record_function)
}
if
(
!
strcasecmp
(
action
,
"start"
))
{
if
(
switch_ivr_record_session
(
rsession
,
path
,
limit
,
NULL
)
!=
SWITCH_STATUS_SUCCESS
)
{
if
(
argc
>
3
)
{
switch_url_decode
(
argv
[
4
]);
switch_event_create_brackets
(
argv
[
4
],
'{'
,
'}'
,
','
,
&
vars
,
&
new_fp
,
SWITCH_FALSE
);
}
if
(
switch_ivr_record_session_event
(
rsession
,
path
,
limit
,
NULL
,
vars
)
!=
SWITCH_STATUS_SUCCESS
)
{
stream
->
write_function
(
stream
,
"-ERR Cannot record session!
\n
"
);
}
else
{
stream
->
write_function
(
stream
,
"+OK Success
\n
"
);
}
switch_event_safe_destroy
(
vars
);
}
else
if
(
!
strcasecmp
(
action
,
"stop"
))
{
if
(
switch_ivr_stop_record_session
(
rsession
,
path
)
!=
SWITCH_STATUS_SUCCESS
)
{
stream
->
write_function
(
stream
,
"-ERR Cannot stop record session!
\n
"
);
...
...
src/mod/applications/mod_dptools/mod_dptools.c
浏览文件 @
1dea2b2f
...
...
@@ -3234,40 +3234,43 @@ SWITCH_STANDARD_APP(record_session_unmask_function)
SWITCH_STANDARD_APP
(
record_session_function
)
{
char
*
array
[
5
]
=
{
0
};
char
*
args
=
NULL
;
int
argc
;
char
*
path
=
NULL
;
char
*
path_end
;
uint32_t
limit
=
0
;
switch_event_t
*
vars
=
NULL
;
char
*
new_fp
=
NULL
;
if
(
zstr
(
data
))
{
return
;
}
path
=
switch_core_session_strdup
(
session
,
data
);
/* Search for a space then a plus followed by only numbers at the end of the path,
if found trim any spaces to the left/right of the plus use the left side as the
path and right side as a time limit on the recording
*/
args
=
switch_core_session_strdup
(
session
,
data
);
argc
=
switch_split
(
args
,
' '
,
array
);
/* if we find a + and the character before it is a space */
if
((
path_end
=
strrchr
(
path
,
'+'
))
&&
path_end
>
path
&&
*
(
path_end
-
1
)
==
' '
)
{
char
*
limit_start
=
path_end
+
1
;
if
(
argc
==
0
)
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_ERROR
,
"usage: <path> [+<timeout>] [{var1=x,var2=y}]
\n
"
);
}
/* not at the end and the rest is numbers lets parse out the limit and fix up the path */
if
(
*
limit_start
!=
'\0'
&&
switch_is_number
(
limit_start
)
==
SWITCH_TRUE
)
{
limit
=
atoi
(
limit_start
);
/* back it off by one character to the char before the + */
path_end
--
;
path
=
array
[
0
];
/* trim spaces to the left of the plus */
while
(
path_end
>
path
&&
*
path_end
==
' '
)
{
path_end
--
;
if
(
argc
>
1
)
{
if
(
*
array
[
1
]
==
'+'
)
{
limit
=
atoi
(
++
array
[
1
]);
if
(
argc
>
2
)
{
switch_url_decode
(
array
[
2
]);
switch_event_create_brackets
(
array
[
2
],
'{'
,
'}'
,
','
,
&
vars
,
&
new_fp
,
SWITCH_FALSE
);
}
*
(
path_end
+
1
)
=
'\0'
;
}
else
{
switch_url_decode
(
array
[
1
]);
switch_event_create_brackets
(
array
[
1
],
'{'
,
'}'
,
','
,
&
vars
,
&
new_fp
,
SWITCH_FALSE
);
}
}
switch_ivr_record_session
(
session
,
path
,
limit
,
NULL
);
switch_ivr_record_session_event
(
session
,
path
,
limit
,
NULL
,
vars
);
switch_event_safe_destroy
(
vars
);
}
SWITCH_STANDARD_APP
(
stop_record_session_function
)
...
...
@@ -5690,7 +5693,7 @@ void *SWITCH_THREAD_FUNC page_thread(switch_thread_t *thread, void *obj)
switch_mutex_unlock
(
pd
->
mutex
);
}
switch_event_safe_destroy
(
&
pd
->
var_event
);
switch_event_safe_destroy
(
pd
->
var_event
);
if
(
pool
)
{
switch_core_destroy_memory_pool
(
&
pool
);
...
...
src/switch_ivr_async.c
浏览文件 @
1dea2b2f
...
...
@@ -1146,6 +1146,7 @@ struct record_helper {
uint32_t
vwrites
;
const
char
*
completion_cause
;
int
start_event_sent
;
switch_event_t
*
variables
;
};
/**
...
...
@@ -1185,6 +1186,24 @@ static switch_bool_t is_silence_frame(switch_frame_t *frame, int silence_thresho
return
is_silence
;
}
static
void
merge_recording_variables
(
struct
record_helper
*
rh
,
switch_event_t
*
event
)
{
switch_event_header_t
*
hi
;
if
(
rh
->
variables
)
{
for
(
hi
=
rh
->
variables
->
headers
;
hi
;
hi
=
hi
->
next
)
{
char
buf
[
1024
];
char
*
vvar
=
NULL
,
*
vval
=
NULL
;
vvar
=
(
char
*
)
hi
->
name
;
vval
=
(
char
*
)
hi
->
value
;
switch_assert
(
vvar
&&
vval
);
switch_snprintf
(
buf
,
sizeof
(
buf
),
"Recording-Variable-%s"
,
vvar
);
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
buf
,
vval
);
}
}
}
static
void
send_record_stop_event
(
switch_channel_t
*
channel
,
switch_codec_implementation_t
*
read_impl
,
struct
record_helper
*
rh
)
{
switch_event_t
*
event
;
...
...
@@ -1205,10 +1224,12 @@ static void send_record_stop_event(switch_channel_t *channel, switch_codec_imple
if
(
switch_event_create
(
&
event
,
SWITCH_EVENT_RECORD_STOP
)
==
SWITCH_STATUS_SUCCESS
)
{
switch_channel_event_set_data
(
channel
,
event
);
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"Record-File-Path"
,
rh
->
file
);
merge_recording_variables
(
rh
,
event
);
if
(
!
zstr
(
rh
->
completion_cause
))
{
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"Record-Completion-Cause"
,
rh
->
completion_cause
);
}
switch_event_fire
(
&
event
);
switch_event_safe_destroy
(
rh
->
variables
);
}
}
...
...
@@ -1311,6 +1332,7 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s
if
(
switch_event_create
(
&
event
,
SWITCH_EVENT_RECORD_START
)
==
SWITCH_STATUS_SUCCESS
)
{
switch_channel_event_set_data
(
channel
,
event
);
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"Record-File-Path"
,
rh
->
file
);
merge_recording_variables
(
rh
,
event
);
switch_event_fire
(
&
event
);
}
}
...
...
@@ -1760,6 +1782,11 @@ static void* switch_ivr_record_user_data_dup(switch_core_session_t *session, voi
dup
->
file
=
switch_core_session_strdup
(
session
,
rh
->
file
);
dup
->
fh
=
switch_core_session_alloc
(
session
,
sizeof
(
switch_file_handle_t
));
memcpy
(
dup
->
fh
,
rh
->
fh
,
sizeof
(
switch_file_handle_t
));
dup
->
variables
=
NULL
;
if
(
rh
->
variables
)
{
switch_event_dup
(
&
dup
->
variables
,
rh
->
variables
);
switch_event_safe_destroy
(
rh
->
variables
);
}
return
dup
;
}
...
...
@@ -2538,7 +2565,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_eavesdrop_session(switch_core_session
return
status
;
}
SWITCH_DECLARE
(
switch_status_t
)
switch_ivr_record_session
(
switch_core_session_t
*
session
,
const
char
*
file
,
uint32_t
limit
,
switch_file_handle_t
*
fh
)
SWITCH_DECLARE
(
switch_status_t
)
switch_ivr_record_session
_event
(
switch_core_session_t
*
session
,
const
char
*
file
,
uint32_t
limit
,
switch_file_handle_t
*
fh
,
switch_event_t
*
vars
)
{
switch_channel_t
*
channel
=
switch_core_session_get_channel
(
session
);
const
char
*
p
;
...
...
@@ -2904,6 +2931,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_session(switch_core_session_t
}
}
if
(
vars
)
{
switch_event_dup
(
&
rh
->
variables
,
vars
);
}
rh
->
hangup_on_error
=
hangup_on_error
;
if
((
status
=
switch_core_media_bug_add
(
session
,
"session_record"
,
file
,
...
...
@@ -2942,6 +2973,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_session(switch_core_session_t
return
SWITCH_STATUS_SUCCESS
;
}
SWITCH_DECLARE
(
switch_status_t
)
switch_ivr_record_session
(
switch_core_session_t
*
session
,
const
char
*
file
,
uint32_t
limit
,
switch_file_handle_t
*
fh
)
{
return
switch_ivr_record_session_event
(
session
,
file
,
limit
,
fh
,
NULL
);
}
typedef
struct
{
SpeexPreprocessState
*
read_st
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论