Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
1ddd4c99
提交
1ddd4c99
authored
12月 14, 2018
作者:
Seven Du
提交者:
Chris Rienzo
12月 20, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-11569 add rate to null endpoint
上级
97f42d42
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
29 行增加
和
6 行删除
+29
-6
switch_test.h
src/include/test/switch_test.h
+11
-1
mod_loopback.c
src/mod/endpoints/mod_loopback/mod_loopback.c
+18
-5
没有找到文件。
src/include/test/switch_test.h
浏览文件 @
1ddd4c99
...
@@ -416,8 +416,10 @@ static void fst_init_core_and_modload(const char *confdir, const char *basedir,
...
@@ -416,8 +416,10 @@ static void fst_init_core_and_modload(const char *confdir, const char *basedir,
* switch_channel_t *fst_channel; The outbound null session's channel.
* switch_channel_t *fst_channel; The outbound null session's channel.
*
*
* @param name the name of this test
* @param name the name of this test
* @param rate the rate of the channel
*/
*/
#define FST_SESSION_BEGIN(name) \
#define FST_SESSION_BEGIN_RATE(name, rate) \
FCT_TEST_BGN(name) \
FCT_TEST_BGN(name) \
{ \
{ \
switch_core_session_t *fst_session = NULL; \
switch_core_session_t *fst_session = NULL; \
...
@@ -432,6 +434,7 @@ static void fst_init_core_and_modload(const char *confdir, const char *basedir,
...
@@ -432,6 +434,7 @@ static void fst_init_core_and_modload(const char *confdir, const char *basedir,
fst_requires(switch_core_running()); \
fst_requires(switch_core_running()); \
fst_requires(switch_event_create_plain(&fst_originate_vars, SWITCH_EVENT_CHANNEL_DATA) == SWITCH_STATUS_SUCCESS); \
fst_requires(switch_event_create_plain(&fst_originate_vars, SWITCH_EVENT_CHANNEL_DATA) == SWITCH_STATUS_SUCCESS); \
switch_event_add_header_string(fst_originate_vars, SWITCH_STACK_BOTTOM, "origination_caller_id_number", "+15551112222"); \
switch_event_add_header_string(fst_originate_vars, SWITCH_STACK_BOTTOM, "origination_caller_id_number", "+15551112222"); \
switch_event_add_header(fst_originate_vars, SWITCH_STACK_BOTTOM, "rate", "%d", rate); \
if (switch_ivr_originate(NULL, &fst_session, &fst_cause, "null/+15553334444", 2, NULL, NULL, NULL, NULL, fst_originate_vars, SOF_NONE, NULL, NULL) == SWITCH_STATUS_SUCCESS && fst_session) { \
if (switch_ivr_originate(NULL, &fst_session, &fst_cause, "null/+15553334444", 2, NULL, NULL, NULL, NULL, fst_originate_vars, SOF_NONE, NULL, NULL) == SWITCH_STATUS_SUCCESS && fst_session) { \
switch_memory_pool_t *fst_session_pool = switch_core_session_get_pool(fst_session); \
switch_memory_pool_t *fst_session_pool = switch_core_session_get_pool(fst_session); \
switch_channel_t *fst_channel = switch_core_session_get_channel(fst_session); \
switch_channel_t *fst_channel = switch_core_session_get_channel(fst_session); \
...
@@ -442,6 +445,13 @@ static void fst_init_core_and_modload(const char *confdir, const char *basedir,
...
@@ -442,6 +445,13 @@ static void fst_init_core_and_modload(const char *confdir, const char *basedir,
switch_ivr_record_session(fst_session, (char *)"/tmp/"#name".wav", 0, NULL); \
switch_ivr_record_session(fst_session, (char *)"/tmp/"#name".wav", 0, NULL); \
for(;;) {
for(;;) {
/**
* Define a session test in a test suite. This can be used to test IVR functions.
* See FST_SESSION_BEGIN_RATE
*/
#define FST_SESSION_BEGIN(name) FST_SESSION_BEGIN_RATE(name, 8000)
/* BODY OF TEST CASE HERE */
/* BODY OF TEST CASE HERE */
/**
/**
...
...
src/mod/endpoints/mod_loopback/mod_loopback.c
浏览文件 @
1ddd4c99
...
@@ -1220,6 +1220,7 @@ struct null_private_object {
...
@@ -1220,6 +1220,7 @@ struct null_private_object {
switch_caller_profile_t
*
caller_profile
;
switch_caller_profile_t
*
caller_profile
;
switch_frame_t
read_frame
;
switch_frame_t
read_frame
;
int16_t
*
null_buf
;
int16_t
*
null_buf
;
int
rate
;
};
};
typedef
struct
null_private_object
null_private_t
;
typedef
struct
null_private_object
null_private_t
;
...
@@ -1239,20 +1240,19 @@ static switch_status_t null_channel_kill_channel(switch_core_session_t *session,
...
@@ -1239,20 +1240,19 @@ static switch_status_t null_channel_kill_channel(switch_core_session_t *session,
static
switch_status_t
null_tech_init
(
null_private_t
*
tech_pvt
,
switch_core_session_t
*
session
)
static
switch_status_t
null_tech_init
(
null_private_t
*
tech_pvt
,
switch_core_session_t
*
session
)
{
{
const
char
*
iananame
=
"L16"
;
const
char
*
iananame
=
"L16"
;
uint32_t
rate
=
8000
;
uint32_t
interval
=
20
;
uint32_t
interval
=
20
;
switch_status_t
status
=
SWITCH_STATUS_SUCCESS
;
switch_status_t
status
=
SWITCH_STATUS_SUCCESS
;
switch_channel_t
*
channel
=
switch_core_session_get_channel
(
session
);
switch_channel_t
*
channel
=
switch_core_session_get_channel
(
session
);
const
switch_codec_implementation_t
*
read_impl
;
const
switch_codec_implementation_t
*
read_impl
;
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_DEBUG
,
"%s setup codec %s/%d/%d
\n
"
,
switch_channel_get_name
(
channel
),
iananame
,
rate
,
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_DEBUG
,
"%s setup codec %s/%d/%d
\n
"
,
interval
);
switch_channel_get_name
(
channel
),
iananame
,
tech_pvt
->
rate
,
interval
);
status
=
switch_core_codec_init
(
&
tech_pvt
->
read_codec
,
status
=
switch_core_codec_init
(
&
tech_pvt
->
read_codec
,
iananame
,
iananame
,
NULL
,
NULL
,
NULL
,
NULL
,
rate
,
interval
,
1
,
SWITCH_CODEC_FLAG_ENCODE
|
SWITCH_CODEC_FLAG_DECODE
,
NULL
,
switch_core_session_get_pool
(
session
));
tech_pvt
->
rate
,
interval
,
1
,
SWITCH_CODEC_FLAG_ENCODE
|
SWITCH_CODEC_FLAG_DECODE
,
NULL
,
switch_core_session_get_pool
(
session
));
if
(
status
!=
SWITCH_STATUS_SUCCESS
||
!
tech_pvt
->
read_codec
.
implementation
||
!
switch_core_codec_ready
(
&
tech_pvt
->
read_codec
))
{
if
(
status
!=
SWITCH_STATUS_SUCCESS
||
!
tech_pvt
->
read_codec
.
implementation
||
!
switch_core_codec_ready
(
&
tech_pvt
->
read_codec
))
{
goto
end
;
goto
end
;
...
@@ -1262,7 +1262,7 @@ static switch_status_t null_tech_init(null_private_t *tech_pvt, switch_core_sess
...
@@ -1262,7 +1262,7 @@ static switch_status_t null_tech_init(null_private_t *tech_pvt, switch_core_sess
iananame
,
iananame
,
NULL
,
NULL
,
NULL
,
NULL
,
rate
,
interval
,
1
,
SWITCH_CODEC_FLAG_ENCODE
|
SWITCH_CODEC_FLAG_DECODE
,
NULL
,
switch_core_session_get_pool
(
session
));
tech_pvt
->
rate
,
interval
,
1
,
SWITCH_CODEC_FLAG_ENCODE
|
SWITCH_CODEC_FLAG_DECODE
,
NULL
,
switch_core_session_get_pool
(
session
));
if
(
status
!=
SWITCH_STATUS_SUCCESS
)
{
if
(
status
!=
SWITCH_STATUS_SUCCESS
)
{
...
@@ -1494,6 +1494,19 @@ static switch_call_cause_t null_channel_outgoing_channel(switch_core_session_t *
...
@@ -1494,6 +1494,19 @@ static switch_call_cause_t null_channel_outgoing_channel(switch_core_session_t *
switch_core_session_add_stream
(
*
new_session
,
NULL
);
switch_core_session_add_stream
(
*
new_session
,
NULL
);
if
((
tech_pvt
=
(
null_private_t
*
)
switch_core_session_alloc
(
*
new_session
,
sizeof
(
null_private_t
)))
!=
0
)
{
if
((
tech_pvt
=
(
null_private_t
*
)
switch_core_session_alloc
(
*
new_session
,
sizeof
(
null_private_t
)))
!=
0
)
{
const
char
*
rate_
=
switch_event_get_header
(
var_event
,
"rate"
);
int
rate
=
0
;
if
(
rate_
)
{
rate
=
atoi
(
rate_
);
}
if
(
!
(
rate
>
0
&&
rate
%
8000
==
0
))
{
rate
=
8000
;
}
tech_pvt
->
rate
=
rate
;
channel
=
switch_core_session_get_channel
(
*
new_session
);
channel
=
switch_core_session_get_channel
(
*
new_session
);
switch_snprintf
(
name
,
sizeof
(
name
),
"null/%s"
,
outbound_profile
->
destination_number
);
switch_snprintf
(
name
,
sizeof
(
name
),
"null/%s"
,
outbound_profile
->
destination_number
);
switch_channel_set_name
(
channel
,
name
);
switch_channel_set_name
(
channel
,
name
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论