Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
071e720f
提交
071e720f
authored
10月 09, 2006
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update
git-svn-id:
http://svn.freeswitch.org/svn/freeswitch/trunk@3009
d0543943-73ff-0310-b7d9-9358b9ac24b2
上级
dcdc0cda
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
68 行增加
和
10 行删除
+68
-10
Makefile
src/mod/codecs/mod_amr/Makefile
+1
-1
mod_amr.c
src/mod/codecs/mod_amr/mod_amr.c
+28
-7
mod_sofia.c
src/mod/endpoints/mod_sofia/mod_sofia.c
+39
-2
没有找到文件。
src/mod/codecs/mod_amr/Makefile
浏览文件 @
071e720f
CFLAGS
+=
-I
$(PREFIX)
/include/amr
CFLAGS
+=
-I
$(PREFIX)
/include/amr
LDFLAGS
+=
-lamr
nb
LDFLAGS
+=
-lamr
all
:
$(MODNAME).$(DYNAMIC_LIB_EXTEN)
all
:
$(MODNAME).$(DYNAMIC_LIB_EXTEN)
...
...
src/mod/codecs/mod_amr/mod_amr.c
浏览文件 @
071e720f
...
@@ -88,13 +88,15 @@ enum
...
@@ -88,13 +88,15 @@ enum
AMR_BITRATE_1220
AMR_BITRATE_1220
};
};
#define AMR_Mode
7
#define AMR_Mode 7
static
switch_status_t
switch_amr_init
(
switch_codec_t
*
codec
,
switch_codec_flag_t
flags
,
static
switch_status_t
switch_amr_init
(
switch_codec_t
*
codec
,
switch_codec_flag_t
flags
,
const
switch_codec_settings_t
*
codec_settings
)
const
switch_codec_settings_t
*
codec_settings
)
{
{
struct
amr_context
*
context
=
NULL
;
struct
amr_context
*
context
=
NULL
;
int
encoding
,
decoding
;
int
encoding
,
decoding
;
int
x
,
argc
;
char
*
argv
[
10
];
encoding
=
(
flags
&
SWITCH_CODEC_FLAG_ENCODE
);
encoding
=
(
flags
&
SWITCH_CODEC_FLAG_ENCODE
);
decoding
=
(
flags
&
SWITCH_CODEC_FLAG_DECODE
);
decoding
=
(
flags
&
SWITCH_CODEC_FLAG_DECODE
);
...
@@ -103,12 +105,31 @@ static switch_status_t switch_amr_init(switch_codec_t *codec, switch_codec_flag_
...
@@ -103,12 +105,31 @@ static switch_status_t switch_amr_init(switch_codec_t *codec, switch_codec_flag_
return
SWITCH_STATUS_FALSE
;
return
SWITCH_STATUS_FALSE
;
}
else
{
}
else
{
if
(
codec
->
fmtp_in
)
{
argc
=
switch_separate_string
(
codec
->
fmtp_in
,
';'
,
argv
,
(
sizeof
(
argv
)
/
sizeof
(
argv
[
0
])));
for
(
x
=
0
;
x
<
argc
;
x
++
)
{
char
*
data
=
argv
[
x
];
char
*
arg
;
while
(
*
data
&&
*
data
==
' '
)
{
data
++
;
}
if
((
arg
=
strchr
(
data
,
'='
)))
{
*
arg
++
=
'\0'
;
printf
(
"Codec arg %d [%s]=[%s]
\n
"
,
x
,
data
,
arg
);
}
}
}
codec
->
fmtp_out
=
"octet-align=0; mode-set=7"
;
context
->
enc_mode
=
AMR_Mode
;
/* start in mode 7 */
context
->
enc_mode
=
AMR_Mode
;
/* start in mode 7 */
context
->
encoder_state
=
NULL
;
context
->
encoder_state
=
NULL
;
context
->
decoder_state
=
NULL
;
context
->
decoder_state
=
NULL
;
if
(
encoding
)
{
if
(
encoding
)
{
context
->
encoder_state
=
Encoder_Interface_init
(
0
);
context
->
encoder_state
=
Encoder_Interface_init
(
1
);
}
}
if
(
decoding
)
{
if
(
decoding
)
{
...
@@ -152,8 +173,8 @@ static switch_status_t switch_amr_encode(switch_codec_t *codec,
...
@@ -152,8 +173,8 @@ static switch_status_t switch_amr_encode(switch_codec_t *codec,
if
(
!
context
)
{
if
(
!
context
)
{
return
SWITCH_STATUS_FALSE
;
return
SWITCH_STATUS_FALSE
;
}
}
*
encoded_data_len
=
Encoder_Interface_Encode
(
context
->
encoder_state
,
context
->
enc_mode
,
(
void
*
)
decoded_data
,
encoded_data
,
0
);
*
encoded_data_len
=
Encoder_Interface_Encode
(
context
->
encoder_state
,
context
->
enc_mode
,
(
int16_t
*
)
decoded_data
,
(
int8_t
*
)
encoded_data
,
0
);
return
SWITCH_STATUS_SUCCESS
;
return
SWITCH_STATUS_SUCCESS
;
}
}
...
@@ -177,9 +198,8 @@ static switch_status_t switch_amr_decode(switch_codec_t *codec,
...
@@ -177,9 +198,8 @@ static switch_status_t switch_amr_decode(switch_codec_t *codec,
}
}
Decoder_Interface_Decode
(
context
->
decoder_state
,
(
void
*
)
encoded_data
,
(
void
*
)
decoded_data
,
0
);
Decoder_Interface_Decode
(
context
->
decoder_state
,
(
void
*
)
encoded_data
,
(
void
*
)
decoded_data
,
0
);
*
decoded_data_len
=
codec
->
implementation
->
bytes_per_frame
;
*
decoded_data_len
=
codec
->
implementation
->
bytes_per_frame
;
//printf("D %d/%d\n", encoded_data_len, *decoded_data_len);
return
SWITCH_STATUS_SUCCESS
;
return
SWITCH_STATUS_SUCCESS
;
}
}
...
@@ -187,8 +207,9 @@ static switch_status_t switch_amr_decode(switch_codec_t *codec,
...
@@ -187,8 +207,9 @@ static switch_status_t switch_amr_decode(switch_codec_t *codec,
static
const
switch_codec_implementation_t
amr_implementation
=
{
static
const
switch_codec_implementation_t
amr_implementation
=
{
/*.codec_type */
SWITCH_CODEC_TYPE_AUDIO
,
/*.codec_type */
SWITCH_CODEC_TYPE_AUDIO
,
/*.ianacode */
118
,
/*.ianacode */
96
,
/*.iananame */
"AMR"
,
/*.iananame */
"AMR"
,
/*.fmtp */
"octet-align=0"
,
/*.samples_per_second */
8000
,
/*.samples_per_second */
8000
,
/*.bits_per_second */
0
,
/*.bits_per_second */
0
,
/*.microseconds_per_frame */
20000
,
/*.microseconds_per_frame */
20000
,
...
...
src/mod/endpoints/mod_sofia/mod_sofia.c
浏览文件 @
071e720f
...
@@ -69,6 +69,7 @@ typedef struct private_object private_object_t;
...
@@ -69,6 +69,7 @@ typedef struct private_object private_object_t;
#include <sofia-sip/sip_protos.h>
#include <sofia-sip/sip_protos.h>
#include <sofia-sip/auth_module.h>
#include <sofia-sip/auth_module.h>
#include <sofia-sip/su_md5.h>
#include <sofia-sip/su_md5.h>
#include <sofia-sip/su_log.h>
static
char
reg_sql
[]
=
static
char
reg_sql
[]
=
"CREATE TABLE sip_registrations (
\n
"
"CREATE TABLE sip_registrations (
\n
"
...
@@ -1682,6 +1683,31 @@ static const switch_loadable_module_interface_t sofia_module_interface = {
...
@@ -1682,6 +1683,31 @@ static const switch_loadable_module_interface_t sofia_module_interface = {
/*.application_interface */
NULL
/*.application_interface */
NULL
};
};
static
void
logger
(
void
*
logarg
,
char
const
*
fmt
,
va_list
ap
)
{
char
*
data
;
int
ret
;
if
(
fmt
)
{
#ifdef HAVE_VASPRINTF
ret
=
vasprintf
(
&
data
,
fmt
,
ap
);
#else
data
=
(
char
*
)
malloc
(
2048
);
vsnprintf
(
data
,
2048
,
fmt
,
ap
);
#endif
if
(
ret
==
-
1
)
{
return
;
}
}
if
(
data
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG_CLEAN
,
SWITCH_LOG_DEBUG
,
(
char
*
)
"%s: %s"
,
__FILE__
,
data
);
free
(
data
);
}
}
static
switch_status_t
sofia_outgoing_channel
(
switch_core_session_t
*
session
,
switch_caller_profile_t
*
outbound_profile
,
static
switch_status_t
sofia_outgoing_channel
(
switch_core_session_t
*
session
,
switch_caller_profile_t
*
outbound_profile
,
switch_core_session_t
**
new_session
,
switch_memory_pool_t
*
pool
)
switch_core_session_t
**
new_session
,
switch_memory_pool_t
*
pool
)
{
{
...
@@ -3258,6 +3284,16 @@ static switch_status_t config_sofia(int reload)
...
@@ -3258,6 +3284,16 @@ static switch_status_t config_sofia(int reload)
goto
done
;
goto
done
;
}
}
if
((
settings
=
switch_xml_child
(
cfg
,
"global_settings"
)))
{
for
(
param
=
switch_xml_child
(
settings
,
"param"
);
param
;
param
=
param
->
next
)
{
char
*
var
=
(
char
*
)
switch_xml_attr_soft
(
param
,
"name"
);
char
*
val
=
(
char
*
)
switch_xml_attr_soft
(
param
,
"value"
);
if
(
!
strcasecmp
(
var
,
"log-level"
))
{
su_log_set_level
(
NULL
,
atoi
(
val
));
}
}
}
if
((
profiles
=
switch_xml_child
(
cfg
,
"profiles"
)))
{
if
((
profiles
=
switch_xml_child
(
cfg
,
"profiles"
)))
{
for
(
xprofile
=
switch_xml_child
(
profiles
,
"profile"
);
xprofile
;
xprofile
=
xprofile
->
next
)
{
for
(
xprofile
=
switch_xml_child
(
profiles
,
"profile"
);
xprofile
;
xprofile
=
xprofile
->
next
)
{
if
(
!
(
settings
=
switch_xml_child
(
xprofile
,
"settings"
)))
{
if
(
!
(
settings
=
switch_xml_child
(
xprofile
,
"settings"
)))
{
...
@@ -3564,14 +3600,15 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_mod
...
@@ -3564,14 +3600,15 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_mod
}
}
su_init
();
su_init
();
su_log_redirect
(
NULL
,
logger
,
NULL
);
switch_core_hash_init
(
&
globals
.
profile_hash
,
module_pool
);
switch_core_hash_init
(
&
globals
.
profile_hash
,
module_pool
);
switch_mutex_init
(
&
globals
.
hash_mutex
,
SWITCH_MUTEX_NESTED
,
module_pool
);
switch_mutex_init
(
&
globals
.
hash_mutex
,
SWITCH_MUTEX_NESTED
,
module_pool
);
config_sofia
(
0
);
config_sofia
(
0
);
/* connect my internal structure to the blank pointer passed to me */
/* connect my internal structure to the blank pointer passed to me */
*
module_interface
=
&
sofia_module_interface
;
*
module_interface
=
&
sofia_module_interface
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论