Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
03f91afd
提交
03f91afd
authored
4月 16, 2010
作者:
Mathieu Parent
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Skinny: VersionMessage per device type
上级
d265cbfc
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
80 行增加
和
3 行删除
+80
-3
mod_skinny.c
src/mod/endpoints/mod_skinny/mod_skinny.c
+30
-2
mod_skinny.h
src/mod/endpoints/mod_skinny/mod_skinny.h
+7
-1
skinny_protocol.c
src/mod/endpoints/mod_skinny/skinny_protocol.c
+15
-0
skinny_tables.c
src/mod/endpoints/mod_skinny/skinny_tables.c
+18
-0
skinny_tables.h
src/mod/endpoints/mod_skinny/skinny_tables.h
+5
-0
test-skinny.pl
src/mod/endpoints/mod_skinny/test-skinny.pl
+5
-0
没有找到文件。
src/mod/endpoints/mod_skinny/mod_skinny.c
浏览文件 @
03f91afd
...
...
@@ -1460,13 +1460,14 @@ static switch_status_t load_skinny_config(void)
if
((
xprofiles
=
switch_xml_child
(
xcfg
,
"profiles"
)))
{
for
(
xprofile
=
switch_xml_child
(
xprofiles
,
"profile"
);
xprofile
;
xprofile
=
xprofile
->
next
)
{
char
*
profile_name
=
(
char
*
)
switch_xml_attr_soft
(
xprofile
,
"name"
);
switch_xml_t
xsettings
=
switch_xml_child
(
xprofile
,
"settings"
);
switch_xml_t
xsettings
;
switch_xml_t
xdevice_types
;
if
(
zstr
(
profile_name
))
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"<profile> is missing name attribute
\n
"
);
continue
;
}
if
(
xsettings
)
{
if
(
(
xsettings
=
switch_xml_child
(
xprofile
,
"settings"
))
)
{
switch_memory_pool_t
*
profile_pool
=
NULL
;
char
dbname
[
256
];
switch_core_db_t
*
db
;
...
...
@@ -1521,6 +1522,7 @@ static switch_status_t load_skinny_config(void)
profile
->
port
=
2000
;
}
/* Database */
switch_snprintf
(
dbname
,
sizeof
(
dbname
),
"skinny_%s"
,
profile
->
name
);
profile
->
dbname
=
switch_core_strdup
(
profile
->
pool
,
dbname
);
...
...
@@ -1558,6 +1560,32 @@ static switch_status_t load_skinny_config(void)
skinny_execute_sql_callback
(
profile
,
profile
->
sql_mutex
,
"DELETE FROM skinny_buttons"
,
NULL
,
NULL
);
skinny_execute_sql_callback
(
profile
,
profile
->
sql_mutex
,
"DELETE FROM skinny_active_lines"
,
NULL
,
NULL
);
/* Device types */
switch_core_hash_init
(
&
profile
->
device_type_params_hash
,
profile
->
pool
);
if
((
xdevice_types
=
switch_xml_child
(
xprofile
,
"device-types"
)))
{
switch_xml_t
xdevice_type
;
for
(
xdevice_type
=
switch_xml_child
(
xdevice_types
,
"device-type"
);
xdevice_type
;
xdevice_type
=
xdevice_type
->
next
)
{
uint32_t
id
=
skinny_str2device_type
(
switch_xml_attr_soft
(
xdevice_type
,
"id"
));
if
(
id
!=
0
)
{
char
*
id_str
=
switch_mprintf
(
"%d"
,
id
);
skinny_device_type_params_t
*
params
=
switch_core_alloc
(
profile
->
pool
,
sizeof
(
skinny_device_type_params_t
));
for
(
param
=
switch_xml_child
(
xdevice_type
,
"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
,
"firmware-version"
))
{
strncpy
(
params
->
firmware_version
,
val
,
16
);
}
}
/* param */
switch_core_hash_insert
(
profile
->
device_type_params_hash
,
id_str
,
params
);
}
else
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_WARNING
,
"Unknow device type %s in profile %s.
\n
"
,
switch_xml_attr_soft
(
xdevice_type
,
"id"
),
profile
->
name
);
}
}
}
/* Register profile */
switch_mutex_lock
(
globals
.
mutex
);
switch_core_hash_insert
(
globals
.
profile_hash
,
profile
->
name
,
profile
);
switch_mutex_unlock
(
globals
.
mutex
);
...
...
src/mod/endpoints/mod_skinny/mod_skinny.h
浏览文件 @
03f91afd
...
...
@@ -67,6 +67,7 @@ struct skinny_profile {
uint32_t
keep_alive
;
char
date_format
[
6
];
int
debug
;
switch_hash_t
*
device_type_params_hash
;
/* db */
char
*
dbname
;
char
*
odbc_dsn
;
...
...
@@ -93,6 +94,10 @@ struct skinny_profile {
};
typedef
struct
skinny_profile
skinny_profile_t
;
struct
skinny_device_type_params
{
char
firmware_version
[
16
];
};
typedef
struct
skinny_device_type_params
skinny_device_type_params_t
;
/*****************************************************************************/
/* LISTENERS TYPES */
...
...
@@ -107,8 +112,9 @@ struct listener {
skinny_profile_t
*
profile
;
char
device_name
[
16
];
uint32_t
device_instance
;
uint32_t
device_type
;
char
firmware_version
[
16
];
char
firmware_version
[
16
];
switch_socket_t
*
sock
;
switch_memory_pool_t
*
pool
;
...
...
src/mod/endpoints/mod_skinny/skinny_protocol.c
浏览文件 @
03f91afd
...
...
@@ -1394,6 +1394,8 @@ switch_status_t send_version(listener_t *listener,
{
skinny_message_t
*
message
;
message
=
switch_core_alloc
(
listener
->
pool
,
12
+
sizeof
(
message
->
data
.
version
));
message
->
type
=
VERSION_MESSAGE
;
message
->
length
=
4
+
sizeof
(
message
->
data
.
version
);
strncpy
(
message
->
data
.
version
.
version
,
version
,
16
);
return
skinny_send_reply
(
listener
,
message
);
}
...
...
@@ -1655,6 +1657,7 @@ switch_status_t skinny_handle_register(listener_t *listener, skinny_message_t *r
strncpy
(
listener
->
device_name
,
request
->
data
.
reg
.
device_name
,
16
);
listener
->
device_instance
=
request
->
data
.
reg
.
instance
;
listener
->
device_type
=
request
->
data
.
reg
.
device_type
;
xskinny
=
switch_xml_child
(
xuser
,
"skinny"
);
if
(
xskinny
)
{
...
...
@@ -2126,6 +2129,18 @@ switch_status_t skinny_handle_button_template_request(listener_t *listener, skin
switch_status_t
skinny_handle_version_request
(
listener_t
*
listener
,
skinny_message_t
*
request
)
{
if
(
zstr
(
listener
->
firmware_version
))
{
char
*
id_str
;
skinny_device_type_params_t
*
params
;
id_str
=
switch_mprintf
(
"%d"
,
listener
->
device_type
);
params
=
(
skinny_device_type_params_t
*
)
switch_core_hash_find
(
listener
->
profile
->
device_type_params_hash
,
id_str
);
if
(
params
)
{
if
(
!
zstr
(
params
->
firmware_version
))
{
strncpy
(
listener
->
firmware_version
,
params
->
firmware_version
,
16
);
}
}
}
if
(
!
zstr
(
listener
->
firmware_version
))
{
return
send_version
(
listener
,
listener
->
firmware_version
);
}
else
{
...
...
src/mod/endpoints/mod_skinny/skinny_tables.c
浏览文件 @
03f91afd
...
...
@@ -98,6 +98,24 @@ struct skinny_table SKINNY_MESSAGE_TYPES[] = {
SKINNY_DECLARE_ID2STR
(
skinny_message_type2str
,
SKINNY_MESSAGE_TYPES
,
"UnknownMessage"
)
SKINNY_DECLARE_STR2ID
(
skinny_str2message_type
,
SKINNY_MESSAGE_TYPES
,
-
1
)
struct
skinny_table
SKINNY_DEVICE_TYPES
[]
=
{
{
"Cisco 30 SP+"
,
0x0001
},
{
"Cisco 12 SP+"
,
0x0002
},
{
"Cisco 12 SP"
,
0x0003
},
{
"Cisco 12"
,
0x0004
},
{
"Cisco 30 VIP"
,
0x0005
},
{
"Cisco IP Phone 7910"
,
0x0006
},
{
"Cisco IP Phone 7960"
,
0x0007
},
{
"Cisco IP Phone 7940"
,
0x0008
},
{
"Cisco IP Phone 7935"
,
0x0009
},
{
"Cisco ATA 186"
,
0x000c
},
{
"Cisco IP Phone 7961"
,
0x4275
},
{
"Cisco IP Phone 7936"
,
0x4276
},
{
NULL
,
0
}
};
SKINNY_DECLARE_ID2STR
(
skinny_device_type2str
,
SKINNY_DEVICE_TYPES
,
"UnknownDeviceType"
)
SKINNY_DECLARE_STR2ID
(
skinny_str2device_type
,
SKINNY_DEVICE_TYPES
,
-
1
)
struct
skinny_table
SKINNY_RING_TYPES
[]
=
{
{
"RingOff"
,
SKINNY_RING_OFF
},
{
"RingInside"
,
SKINNY_RING_INSIDE
},
...
...
src/mod/endpoints/mod_skinny/skinny_tables.h
浏览文件 @
03f91afd
...
...
@@ -89,6 +89,11 @@ const char *skinny_message_type2str(uint32_t id);
uint32_t
skinny_str2message_type
(
const
char
*
str
);
#define SKINNY_PUSH_MESSAGE_TYPES SKINNY_DECLARE_PUSH_MATCH(SKINNY_MESSAGE_TYPES)
struct
skinny_table
SKINNY_DEVICE_TYPES
[
13
];
const
char
*
skinny_device_type2str
(
uint32_t
id
);
uint32_t
skinny_str2device_type
(
const
char
*
str
);
#define SKINNY_PUSH_DEVICE_TYPES SKINNY_DECLARE_PUSH_MATCH(SKINNY_DEVICE_TYPES)
enum
skinny_tone
{
SKINNY_TONE_SILENCE
=
0x00
,
SKINNY_TONE_DIALTONE
=
0x21
,
...
...
src/mod/endpoints/mod_skinny/test-skinny.pl
浏览文件 @
03f91afd
...
...
@@ -64,6 +64,11 @@ $socket->send_message(
)
);
if
(
0
)
{
$socket
->
send_message
(
VERSION_REQ_MESSAGE
);
$socket
->
receive_message
();
# VersionMessage
}
$socket
->
send_message
(
BUTTON_TEMPLATE_REQ_MESSAGE
);
$socket
->
receive_message
();
# ButtonTemplateMessage
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论