Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
54e73c77
提交
54e73c77
authored
4月 01, 2010
作者:
Mathieu Parent
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Skinny: Check for socket to see if listener is alive
also, use tab to indent
上级
542f643e
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
2518 行增加
和
2517 行删除
+2518
-2517
mod_skinny.c
src/mod/endpoints/mod_skinny/mod_skinny.c
+182
-181
mod_skinny.h
src/mod/endpoints/mod_skinny/mod_skinny.h
+100
-100
skinny_protocol.c
src/mod/endpoints/mod_skinny/skinny_protocol.c
+1669
-1669
skinny_protocol.h
src/mod/endpoints/mod_skinny/skinny_protocol.h
+347
-347
skinny_tables.c
src/mod/endpoints/mod_skinny/skinny_tables.c
+111
-111
skinny_tables.h
src/mod/endpoints/mod_skinny/skinny_tables.h
+109
-109
没有找到文件。
src/mod/endpoints/mod_skinny/mod_skinny.c
浏览文件 @
54e73c77
...
...
@@ -132,7 +132,7 @@ switch_status_t skinny_profile_dump(const skinny_profile_t *profile, switch_stre
skinny_profile_t
*
skinny_find_profile
(
const
char
*
profile_name
)
{
skinny_profile_t
*
profile
;
skinny_profile_t
*
profile
;
switch_mutex_lock
(
globals
.
mutex
);
profile
=
(
skinny_profile_t
*
)
switch_core_hash_find
(
globals
.
profile_hash
,
profile_name
);
switch_mutex_unlock
(
globals
.
mutex
);
...
...
@@ -166,7 +166,7 @@ switch_status_t skinny_profile_find_listener_by_device_name_and_instance(skinny_
}
struct
skinny_profile_find_session_uuid_helper
{
skinny_profile_t
*
profile
;
skinny_profile_t
*
profile
;
char
*
channel_uuid
;
uint32_t
line_instance
;
};
...
...
@@ -178,12 +178,12 @@ int skinny_profile_find_session_uuid_callback(void *pArg, int argc, char **argv,
char
*
channel_uuid
=
argv
[
0
];
uint32_t
line_instance
=
atoi
(
argv
[
1
]);
if
(
helper
->
channel_uuid
==
NULL
)
{
helper
->
channel_uuid
=
switch_mprintf
(
"%s"
,
channel_uuid
);
helper
->
line_instance
=
line_instance
;
}
if
(
helper
->
channel_uuid
==
NULL
)
{
helper
->
channel_uuid
=
switch_mprintf
(
"%s"
,
channel_uuid
);
helper
->
line_instance
=
line_instance
;
}
return
0
;
return
0
;
}
char
*
skinny_profile_find_session_uuid
(
skinny_profile_t
*
profile
,
listener_t
*
listener
,
uint32_t
*
line_instance_p
,
uint32_t
call_id
)
...
...
@@ -193,28 +193,28 @@ char * skinny_profile_find_session_uuid(skinny_profile_t *profile, listener_t *l
char
*
device_condition
=
NULL
;
char
*
line_instance_condition
=
NULL
;
char
*
call_id_condition
=
NULL
;
switch_assert
(
profile
);
helper
.
profile
=
profile
;
helper
.
channel_uuid
=
NULL
;
if
(
listener
)
{
device_condition
=
switch_mprintf
(
"device_name='%s' AND device_instance=%d"
,
listener
->
device_name
,
listener
->
device_instance
);
device_condition
=
switch_mprintf
(
"device_name='%s' AND device_instance=%d"
,
listener
->
device_name
,
listener
->
device_instance
);
}
else
{
device_condition
=
switch_mprintf
(
"1=1"
);
device_condition
=
switch_mprintf
(
"1=1"
);
}
switch_assert
(
device_condition
);
if
(
*
line_instance_p
>
0
)
{
line_instance_condition
=
switch_mprintf
(
"line_instance=%d"
,
*
line_instance_p
);
line_instance_condition
=
switch_mprintf
(
"line_instance=%d"
,
*
line_instance_p
);
}
else
{
line_instance_condition
=
switch_mprintf
(
"1=1"
);
line_instance_condition
=
switch_mprintf
(
"1=1"
);
}
switch_assert
(
line_instance_condition
);
if
(
call_id
>
0
)
{
call_id_condition
=
switch_mprintf
(
"call_id=%d"
,
call_id
);
call_id_condition
=
switch_mprintf
(
"call_id=%d"
,
call_id
);
}
else
{
call_id_condition
=
switch_mprintf
(
"1=1"
);
call_id_condition
=
switch_mprintf
(
"1=1"
);
}
switch_assert
(
call_id_condition
);
if
((
sql
=
switch_mprintf
(
...
...
@@ -225,7 +225,7 @@ char * skinny_profile_find_session_uuid(skinny_profile_t *profile, listener_t *l
device_condition
,
line_instance_condition
,
call_id_condition
)))
{
skinny_execute_sql_callback
(
profile
,
profile
->
sql_mutex
,
sql
,
skinny_profile_find_session_uuid_callback
,
&
helper
);
skinny_profile_find_session_uuid_callback
,
&
helper
);
switch_safe_free
(
sql
);
}
switch_safe_free
(
device_condition
);
...
...
@@ -237,21 +237,21 @@ char * skinny_profile_find_session_uuid(skinny_profile_t *profile, listener_t *l
switch_core_session_t
*
skinny_profile_find_session
(
skinny_profile_t
*
profile
,
listener_t
*
listener
,
uint32_t
*
line_instance_p
,
uint32_t
call_id
)
{
char
*
uuid
;
switch_core_session_t
*
result
=
NULL
;
uuid
=
skinny_profile_find_session_uuid
(
profile
,
listener
,
line_instance_p
,
call_id
);
char
*
uuid
;
switch_core_session_t
*
result
=
NULL
;
uuid
=
skinny_profile_find_session_uuid
(
profile
,
listener
,
line_instance_p
,
call_id
);
if
(
!
zstr
(
uuid
))
{
/* TODO Why should we force? */
result
=
switch_core_session_force_locate
(
uuid
);
if
(
!
zstr
(
uuid
))
{
/* TODO Why should we force? */
result
=
switch_core_session_force_locate
(
uuid
);
if
(
!
result
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_WARNING
,
"Unable to find session %s on %s:%d, line %d
\n
"
,
uuid
,
listener
->
device_name
,
listener
->
device_instance
,
*
line_instance_p
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_WARNING
,
"Unable to find session %s on %s:%d, line %d
\n
"
,
uuid
,
listener
->
device_name
,
listener
->
device_instance
,
*
line_instance_p
);
}
switch_safe_free
(
uuid
);
}
return
result
;
}
return
result
;
}
/*****************************************************************************/
...
...
@@ -337,7 +337,7 @@ switch_bool_t skinny_execute_sql_callback(skinny_profile_t *profile,
void
skinny_line_perform_set_state
(
const
char
*
file
,
const
char
*
func
,
int
line
,
listener_t
*
listener
,
uint32_t
line_instance
,
uint32_t
call_id
,
uint32_t
call_state
)
{
switch_event_t
*
event
=
NULL
;
switch_assert
(
listener
);
switch_assert
(
listener
);
skinny_device_event
(
listener
,
&
event
,
SWITCH_EVENT_CUSTOM
,
SKINNY_EVENT_CALL_STATE
);
switch_event_add_header
(
event
,
SWITCH_STACK_BOTTOM
,
"Skinny-Line-Instance"
,
"%d"
,
line_instance
);
...
...
@@ -359,30 +359,30 @@ int skinny_line_get_state_callback(void *pArg, int argc, char **argv, char **col
{
struct
skinny_line_get_state_helper
*
helper
=
pArg
;
helper
->
call_state
=
atoi
(
argv
[
0
]);
return
0
;
return
0
;
}
uint32_t
skinny_line_get_state
(
listener_t
*
listener
,
uint32_t
line_instance
,
uint32_t
call_id
)
{
char
*
line_instance_condition
;
char
*
call_id_condition
;
char
*
sql
;
char
*
line_instance_condition
;
char
*
call_id_condition
;
char
*
sql
;
struct
skinny_line_get_state_helper
helper
=
{
0
};
switch_assert
(
listener
);
if
(
line_instance
>
0
)
{
line_instance_condition
=
switch_mprintf
(
"line_instance=%d"
,
line_instance
);
}
else
{
line_instance_condition
=
switch_mprintf
(
"1=1"
);
}
switch_assert
(
line_instance_condition
);
if
(
call_id
>
0
)
{
call_id_condition
=
switch_mprintf
(
"call_id=%d"
,
call_id
);
}
else
{
call_id_condition
=
switch_mprintf
(
"1=1"
);
}
switch_assert
(
call_id_condition
);
switch_assert
(
listener
);
if
(
line_instance
>
0
)
{
line_instance_condition
=
switch_mprintf
(
"line_instance=%d"
,
line_instance
);
}
else
{
line_instance_condition
=
switch_mprintf
(
"1=1"
);
}
switch_assert
(
line_instance_condition
);
if
(
call_id
>
0
)
{
call_id_condition
=
switch_mprintf
(
"call_id=%d"
,
call_id
);
}
else
{
call_id_condition
=
switch_mprintf
(
"1=1"
);
}
switch_assert
(
call_id_condition
);
if
((
sql
=
switch_mprintf
(
"SELECT call_state FROM skinny_active_lines "
...
...
@@ -396,7 +396,7 @@ uint32_t skinny_line_get_state(listener_t *listener, uint32_t line_instance, uin
}
switch_safe_free
(
line_instance_condition
);
switch_safe_free
(
call_id_condition
);
return
helper
.
call_state
;
}
...
...
@@ -419,11 +419,11 @@ switch_status_t skinny_tech_set_codec(private_t *tech_pvt, int force)
if
(
strcasecmp
(
tech_pvt
->
read_impl
.
iananame
,
tech_pvt
->
iananame
)
||
tech_pvt
->
read_impl
.
samples_per_second
!=
tech_pvt
->
rm_rate
||
tech_pvt
->
codec_ms
!=
(
uint32_t
)
tech_pvt
->
read_impl
.
microseconds_per_packet
/
1000
)
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
tech_pvt
->
session
),
SWITCH_LOG_DEBUG
,
"Changing Codec from %s@%dms to %s@%dms
\n
"
,
tech_pvt
->
read_impl
.
iananame
,
tech_pvt
->
read_impl
.
microseconds_per_packet
/
1000
,
tech_pvt
->
rm_encoding
,
tech_pvt
->
codec_ms
);
switch_core_session_lock_codec_write
(
tech_pvt
->
session
);
switch_core_session_lock_codec_read
(
tech_pvt
->
session
);
resetting
=
1
;
...
...
@@ -434,7 +434,7 @@ switch_status_t skinny_tech_set_codec(private_t *tech_pvt, int force)
switch_goto_status
(
SWITCH_STATUS_SUCCESS
,
end
);
}
}
if
(
switch_core_codec_init
(
&
tech_pvt
->
read_codec
,
tech_pvt
->
iananame
,
tech_pvt
->
rm_fmtp
,
...
...
@@ -526,7 +526,7 @@ void tech_init(private_t *tech_pvt, skinny_profile_t *profile, switch_core_sessi
{
switch_assert
(
tech_pvt
);
switch_assert
(
session
);
tech_pvt
->
read_frame
.
data
=
tech_pvt
->
databuf
;
tech_pvt
->
read_frame
.
buflen
=
sizeof
(
tech_pvt
->
databuf
);
switch_mutex_init
(
&
tech_pvt
->
mutex
,
SWITCH_MUTEX_NESTED
,
switch_core_session_get_pool
(
session
));
...
...
@@ -562,7 +562,7 @@ switch_status_t channel_on_init(switch_core_session_t *session)
switch_status_t
channel_on_routing
(
switch_core_session_t
*
session
)
{
switch_channel_t
*
channel
=
switch_core_session_get_channel
(
session
);
switch_channel_t
*
channel
=
switch_core_session_get_channel
(
session
);
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_DEBUG
,
"%s CHANNEL ROUTING
\n
"
,
switch_channel_get_name
(
channel
));
...
...
@@ -571,7 +571,7 @@ switch_status_t channel_on_routing(switch_core_session_t *session)
switch_status_t
channel_on_execute
(
switch_core_session_t
*
session
)
{
switch_channel_t
*
channel
=
switch_core_session_get_channel
(
session
);
switch_channel_t
*
channel
=
switch_core_session_get_channel
(
session
);
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_DEBUG
,
"%s CHANNEL EXECUTE
\n
"
,
switch_channel_get_name
(
channel
));
...
...
@@ -588,7 +588,7 @@ switch_status_t channel_on_destroy(switch_core_session_t *session)
if
(
switch_core_codec_ready
(
&
tech_pvt
->
read_codec
))
{
switch_core_codec_destroy
(
&
tech_pvt
->
read_codec
);
}
if
(
switch_core_codec_ready
(
&
tech_pvt
->
write_codec
))
{
switch_core_codec_destroy
(
&
tech_pvt
->
write_codec
);
}
...
...
@@ -627,33 +627,33 @@ int channel_on_hangup_callback(void *pArg, int argc, char **argv, char **columnN
uint32_t
call_state
=
atoi
(
argv
[
16
]);
skinny_profile_find_listener_by_device_name_and_instance
(
helper
->
tech_pvt
->
profile
,
device_name
,
device_instance
,
&
listener
);
if
(
listener
)
{
if
(
call_state
==
SKINNY_CONNECTED
)
{
stop_tone
(
listener
,
line_instance
,
call_id
);
}
set_lamp
(
listener
,
SKINNY_BUTTON_LINE
,
line_instance
,
SKINNY_LAMP_OFF
);
clear_prompt_status
(
listener
,
line_instance
,
call_id
);
if
(
call_state
==
SKINNY_CONNECTED
)
{
/* calling parties */
close_receive_channel
(
listener
,
call_id
,
/* uint32_t conference_id, */
helper
->
tech_pvt
->
party_id
,
/* uint32_t pass_thru_party_id, */
call_id
/* uint32_t conference_id2, */
);
stop_media_transmission
(
listener
,
call_id
,
/* uint32_t conference_id, */
helper
->
tech_pvt
->
party_id
,
/* uint32_t pass_thru_party_id, */
call_id
/* uint32_t conference_id2, */
);
}
skinny_line_set_state
(
listener
,
line_instance
,
call_id
,
SKINNY_ON_HOOK
);
send_select_soft_keys
(
listener
,
line_instance
,
call_id
,
SKINNY_KEY_SET_ON_HOOK
,
0xffff
);
/* TODO: DefineTimeDate */
set_speaker_mode
(
listener
,
SKINNY_SPEAKER_OFF
);
set_ringer
(
listener
,
SKINNY_RING_OFF
,
SKINNY_RING_FOREVER
,
0
,
call_id
);
}
return
0
;
if
(
listener
)
{
if
(
call_state
==
SKINNY_CONNECTED
)
{
stop_tone
(
listener
,
line_instance
,
call_id
);
}
set_lamp
(
listener
,
SKINNY_BUTTON_LINE
,
line_instance
,
SKINNY_LAMP_OFF
);
clear_prompt_status
(
listener
,
line_instance
,
call_id
);
if
(
call_state
==
SKINNY_CONNECTED
)
{
/* calling parties */
close_receive_channel
(
listener
,
call_id
,
/* uint32_t conference_id, */
helper
->
tech_pvt
->
party_id
,
/* uint32_t pass_thru_party_id, */
call_id
/* uint32_t conference_id2, */
);
stop_media_transmission
(
listener
,
call_id
,
/* uint32_t conference_id, */
helper
->
tech_pvt
->
party_id
,
/* uint32_t pass_thru_party_id, */
call_id
/* uint32_t conference_id2, */
);
}
skinny_line_set_state
(
listener
,
line_instance
,
call_id
,
SKINNY_ON_HOOK
);
send_select_soft_keys
(
listener
,
line_instance
,
call_id
,
SKINNY_KEY_SET_ON_HOOK
,
0xffff
);
/* TODO: DefineTimeDate */
set_speaker_mode
(
listener
,
SKINNY_SPEAKER_OFF
);
set_ringer
(
listener
,
SKINNY_RING_OFF
,
SKINNY_RING_FOREVER
,
0
,
call_id
);
}
return
0
;
}
switch_status_t
channel_on_hangup
(
switch_core_session_t
*
session
)
...
...
@@ -668,9 +668,9 @@ switch_status_t channel_on_hangup(switch_core_session_t *session)
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_DEBUG
,
"%s CHANNEL HANGUP
\n
"
,
switch_channel_get_name
(
channel
));
helper
.
tech_pvt
=
tech_pvt
;
helper
.
tech_pvt
=
tech_pvt
;
skinny_session_walk_lines
(
tech_pvt
->
profile
,
switch_core_session_get_uuid
(
session
),
channel_on_hangup_callback
,
&
helper
);
skinny_session_walk_lines
(
tech_pvt
->
profile
,
switch_core_session_get_uuid
(
session
),
channel_on_hangup_callback
,
&
helper
);
if
((
sql
=
switch_mprintf
(
"DELETE FROM skinny_active_lines WHERE channel_uuid='%s'"
,
switch_core_session_get_uuid
(
session
)
...
...
@@ -698,7 +698,7 @@ switch_status_t channel_kill_channel(switch_core_session_t *session, int sig)
default:
break
;
}
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_DEBUG
,
"%s CHANNEL KILL %d
\n
"
,
switch_channel_get_name
(
channel
),
sig
);
return
SWITCH_STATUS_SUCCESS
;
...
...
@@ -728,7 +728,7 @@ switch_status_t channel_send_dtmf(switch_core_session_t *session, const switch_d
switch_status_t
channel_read_frame
(
switch_core_session_t
*
session
,
switch_frame_t
**
frame
,
switch_io_flag_t
flags
,
int
stream_id
)
{
switch_channel_t
*
channel
=
switch_core_session_get_channel
(
session
);
switch_channel_t
*
channel
=
switch_core_session_get_channel
(
session
);
private_t
*
tech_pvt
=
switch_core_session_get_private
(
session
);
int
payload
=
0
;
...
...
@@ -799,7 +799,7 @@ switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame
private_t
*
tech_pvt
=
switch_core_session_get_private
(
session
);
//switch_frame_t *pframe;
switch_status_t
status
=
SWITCH_STATUS_SUCCESS
;
if
(
!
switch_test_flag
(
tech_pvt
,
TFLAG_IO
))
{
return
SWITCH_STATUS_FALSE
;
}
...
...
@@ -850,7 +850,7 @@ switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session, swi
switch_call_cause_t
cause
=
SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER
;
switch_core_session_t
*
nsession
=
NULL
;
private_t
*
tech_pvt
;
char
*
profile_name
,
*
dest
;
skinny_profile_t
*
profile
=
NULL
;
char
*
sql
;
...
...
@@ -891,12 +891,12 @@ switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session, swi
cause
=
SWITCH_CAUSE_UNALLOCATED_NUMBER
;
goto
error
;
}
snprintf
(
name
,
sizeof
(
name
),
"SKINNY/%s/%s"
,
profile
->
name
,
dest
);
channel
=
switch_core_session_get_channel
(
nsession
);
switch_channel_set_name
(
channel
,
name
);
tech_init
(
tech_pvt
,
profile
,
nsession
);
caller_profile
=
switch_caller_profile_clone
(
nsession
,
outbound_profile
);
...
...
@@ -917,9 +917,9 @@ switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session, swi
skinny_execute_sql
(
profile
,
sql
,
profile
->
sql_mutex
);
switch_safe_free
(
sql
);
}
cause
=
skinny_ring_lines
(
tech_pvt
);
if
(
cause
!=
SWITCH_CAUSE_SUCCESS
)
{
goto
error
;
}
...
...
@@ -1001,10 +1001,11 @@ switch_io_routines_t skinny_io_routines = {
uint8_t
listener_is_ready
(
listener_t
*
listener
)
{
return
globals
.
running
&&
listener
&&
switch_test_flag
(
listener
,
LFLAG_RUNNING
)
&&
listener
->
profile
->
listener_ready
;
return
globals
.
running
&&
listener
&&
listener
->
sock
&&
switch_test_flag
(
listener
,
LFLAG_RUNNING
)
&&
listener
->
profile
->
listener_ready
;
}
static
void
add_listener
(
listener_t
*
listener
)
...
...
@@ -1049,7 +1050,7 @@ static void walk_listeners(skinny_listener_callback_func_t callback, void *pvt)
void
*
val
;
skinny_profile_t
*
profile
;
listener_t
*
l
;
/* walk listeners */
switch_mutex_lock
(
globals
.
mutex
);
for
(
hi
=
switch_hash_first
(
NULL
,
globals
.
profile_hash
);
hi
;
hi
=
switch_hash_next
(
hi
))
{
...
...
@@ -1071,7 +1072,7 @@ static void flush_listener(listener_t *listener, switch_bool_t flush_log, switch
if
(
!
zstr
(
listener
->
device_name
))
{
skinny_profile_t
*
profile
=
listener
->
profile
;
char
*
sql
;
if
((
sql
=
switch_mprintf
(
"DELETE FROM skinny_devices "
"WHERE name='%s' and instance=%d"
,
...
...
@@ -1180,7 +1181,7 @@ switch_status_t keepalive_listener(listener_t *listener, void *pvt)
switch_assert
(
listener
);
assert
(
listener
->
profile
);
profile
=
listener
->
profile
;
listener
->
expire_time
=
switch_epoch_time_now
(
NULL
)
+
profile
->
keep_alive
*
110
/
100
;
return
SWITCH_STATUS_SUCCESS
;
...
...
@@ -1201,9 +1202,9 @@ static void *SWITCH_THREAD_FUNC listener_run(switch_thread_t *thread, void *obj)
switch_mutex_lock
(
profile
->
listener_mutex
);
profile
->
listener_threads
++
;
switch_mutex_unlock
(
profile
->
listener_mutex
);
switch_assert
(
listener
!=
NULL
);
switch_socket_opt_set
(
listener
->
sock
,
SWITCH_SO_TCP_NODELAY
,
TRUE
);
switch_socket_opt_set
(
listener
->
sock
,
SWITCH_SO_NONBLOCK
,
TRUE
);
...
...
@@ -1260,7 +1261,7 @@ static void *SWITCH_THREAD_FUNC listener_run(switch_thread_t *thread, void *obj)
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"Connection Closed
\n
"
);
}
/* TODO
/* TODO
for(int line = 0 ; line < SKINNY_MAX_BUTTON_COUNT ; line++) {
if(listener->session[line]) {
switch_channel_clear_flag(switch_core_session_get_channel(listener->session[line]), CF_CONTROLLED);
...
...
@@ -1362,7 +1363,7 @@ static void *SWITCH_THREAD_FUNC skinny_profile_run(switch_thread_t *thread, void
errs
=
0
;
}
if
(
!
(
listener
=
switch_core_alloc
(
listener_pool
,
sizeof
(
*
listener
))))
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Memory Error
\n
"
);
break
;
...
...
@@ -1388,7 +1389,7 @@ static void *SWITCH_THREAD_FUNC skinny_profile_run(switch_thread_t *thread, void
end:
close_socket
(
&
profile
->
sock
,
profile
);
if
(
tmp_pool
)
{
switch_core_destroy_memory_pool
(
&
tmp_pool
);
}
...
...
@@ -1461,23 +1462,23 @@ static switch_status_t load_skinny_config(void)
continue
;
}
if
(
xsettings
)
{
switch_memory_pool_t
*
profile_pool
=
NULL
;
switch_memory_pool_t
*
profile_pool
=
NULL
;
char
dbname
[
256
];
switch_core_db_t
*
db
;
skinny_profile_t
*
profile
=
NULL
;
switch_xml_t
param
;
if
(
switch_core_new_memory_pool
(
&
profile_pool
)
!=
SWITCH_STATUS_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"OH OH no pool
\n
"
);
return
SWITCH_STATUS_TERM
;
}
if
(
switch_core_new_memory_pool
(
&
profile_pool
)
!=
SWITCH_STATUS_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"OH OH no pool
\n
"
);
return
SWITCH_STATUS_TERM
;
}
profile
=
switch_core_alloc
(
profile_pool
,
sizeof
(
skinny_profile_t
));
profile
->
pool
=
profile_pool
;
profile
->
name
=
profile_name
;
switch_mutex_init
(
&
profile
->
listener_mutex
,
SWITCH_MUTEX_NESTED
,
profile
->
pool
);
switch_mutex_init
(
&
profile
->
sql_mutex
,
SWITCH_MUTEX_NESTED
,
profile
->
pool
);
switch_mutex_init
(
&
profile
->
sock_mutex
,
SWITCH_MUTEX_NESTED
,
profile
->
pool
);
switch_mutex_init
(
&
profile
->
listener_mutex
,
SWITCH_MUTEX_NESTED
,
profile
->
pool
);
switch_mutex_init
(
&
profile
->
sql_mutex
,
SWITCH_MUTEX_NESTED
,
profile
->
pool
);
switch_mutex_init
(
&
profile
->
sock_mutex
,
SWITCH_MUTEX_NESTED
,
profile
->
pool
);
for
(
param
=
switch_xml_child
(
xsettings
,
"param"
);
param
;
param
=
param
->
next
)
{
char
*
var
=
(
char
*
)
switch_xml_attr_soft
(
param
,
"name"
);
char
*
val
=
(
char
*
)
switch_xml_attr_soft
(
param
,
"value"
);
...
...
@@ -1502,7 +1503,7 @@ static switch_status_t load_skinny_config(void)
profile
->
debug
=
atoi
(
val
);
}
}
/* param */
if
(
!
profile
->
dialplan
)
{
skinny_profile_set
(
profile
,
"dialplan"
,
"default"
);
}
...
...
@@ -1546,15 +1547,15 @@ static switch_status_t load_skinny_config(void)
}
switch_core_db_close
(
db
);
}
skinny_execute_sql_callback
(
profile
,
profile
->
sql_mutex
,
"DELETE FROM skinny_devices"
,
NULL
,
NULL
);
skinny_execute_sql_callback
(
profile
,
profile
->
sql_mutex
,
"DELETE FROM skinny_lines"
,
NULL
,
NULL
);
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
);
switch_mutex_lock
(
globals
.
mutex
);
switch_core_hash_insert
(
globals
.
profile_hash
,
profile
->
name
,
profile
);
switch_mutex_unlock
(
globals
.
mutex
);
switch_mutex_lock
(
globals
.
mutex
);
switch_core_hash_insert
(
globals
.
profile_hash
,
profile
->
name
,
profile
);
switch_mutex_unlock
(
globals
.
mutex
);
profile
=
NULL
;
}
else
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
...
...
@@ -1575,50 +1576,50 @@ static void event_handler(switch_event_t *event)
if
(
event
->
event_id
==
SWITCH_EVENT_HEARTBEAT
)
{
walk_listeners
(
kill_expired_listener
,
NULL
);
}
else
if
((
subclass
=
switch_event_get_header_nil
(
event
,
"Event-Subclass"
))
&&
!
strcasecmp
(
subclass
,
SKINNY_EVENT_CALL_STATE
))
{
char
*
profile_name
=
switch_event_get_header_nil
(
event
,
"Skinny-Profile-Name"
);
char
*
device_name
=
switch_event_get_header_nil
(
event
,
"Skinny-Device-Name"
);
uint32_t
device_instance
=
atoi
(
switch_event_get_header_nil
(
event
,
"Skinny-Device-Instance"
));
char
*
profile_name
=
switch_event_get_header_nil
(
event
,
"Skinny-Profile-Name"
);
char
*
device_name
=
switch_event_get_header_nil
(
event
,
"Skinny-Device-Name"
);
uint32_t
device_instance
=
atoi
(
switch_event_get_header_nil
(
event
,
"Skinny-Device-Instance"
));
uint32_t
line_instance
=
atoi
(
switch_event_get_header_nil
(
event
,
"Skinny-Line-Instance"
));
uint32_t
call_id
=
atoi
(
switch_event_get_header_nil
(
event
,
"Skinny-Call-Id"
));
uint32_t
call_state
=
atoi
(
switch_event_get_header_nil
(
event
,
"Skinny-Call-State"
));
skinny_profile_t
*
profile
;
listener_t
*
listener
=
NULL
;
char
*
line_instance_condition
,
*
call_id_condition
;
char
*
sql
;
if
((
profile
=
skinny_find_profile
(
profile_name
)))
{
skinny_profile_find_listener_by_device_name_and_instance
(
profile
,
device_name
,
device_instance
,
&
listener
);
if
(
listener
)
{
if
(
line_instance
>
0
)
{
line_instance_condition
=
switch_mprintf
(
"line_instance=%d"
,
line_instance
);
}
else
{
line_instance_condition
=
switch_mprintf
(
"1=1"
);
}
switch_assert
(
line_instance_condition
);
if
(
call_id
>
0
)
{
call_id_condition
=
switch_mprintf
(
"call_id=%d"
,
call_id
);
}
else
{
call_id_condition
=
switch_mprintf
(
"1=1"
);
}
switch_assert
(
call_id_condition
);
if
((
sql
=
switch_mprintf
(
"UPDATE skinny_active_lines "
"SET call_state=%d "
"WHERE device_name='%s' AND device_instance=%d "
"AND %s AND %s"
,
call_state
,
listener
->
device_name
,
listener
->
device_instance
,
line_instance_condition
,
call_id_condition
)))
{
skinny_execute_sql
(
listener
->
profile
,
sql
,
listener
->
profile
->
sql_mutex
);
switch_safe_free
(
sql
);
send_call_state
(
listener
,
call_state
,
line_instance
,
call_id
);
}
switch_safe_free
(
line_instance_condition
);
switch_safe_free
(
call_id_condition
);
}
}
skinny_profile_t
*
profile
;
listener_t
*
listener
=
NULL
;
char
*
line_instance_condition
,
*
call_id_condition
;
char
*
sql
;
if
((
profile
=
skinny_find_profile
(
profile_name
)))
{
skinny_profile_find_listener_by_device_name_and_instance
(
profile
,
device_name
,
device_instance
,
&
listener
);
if
(
listener
)
{
if
(
line_instance
>
0
)
{
line_instance_condition
=
switch_mprintf
(
"line_instance=%d"
,
line_instance
);
}
else
{
line_instance_condition
=
switch_mprintf
(
"1=1"
);
}
switch_assert
(
line_instance_condition
);
if
(
call_id
>
0
)
{
call_id_condition
=
switch_mprintf
(
"call_id=%d"
,
call_id
);
}
else
{
call_id_condition
=
switch_mprintf
(
"1=1"
);
}
switch_assert
(
call_id_condition
);
if
((
sql
=
switch_mprintf
(
"UPDATE skinny_active_lines "
"SET call_state=%d "
"WHERE device_name='%s' AND device_instance=%d "
"AND %s AND %s"
,
call_state
,
listener
->
device_name
,
listener
->
device_instance
,
line_instance_condition
,
call_id_condition
)))
{
skinny_execute_sql
(
listener
->
profile
,
sql
,
listener
->
profile
->
sql_mutex
);
switch_safe_free
(
sql
);
send_call_state
(
listener
,
call_state
,
line_instance
,
call_id
);
}
switch_safe_free
(
line_instance_condition
);
switch_safe_free
(
call_id_condition
);
}
}
}
}
...
...
@@ -1627,20 +1628,20 @@ static void event_handler(switch_event_t *event)
SWITCH_MODULE_LOAD_FUNCTION
(
mod_skinny_load
)
{
switch_hash_index_t
*
hi
;
/* globals init */
/* globals init */
memset
(
&
globals
,
0
,
sizeof
(
globals
));
if
(
switch_core_new_memory_pool
(
&
globals
.
pool
)
!=
SWITCH_STATUS_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"OH OH no pool
\n
"
);
return
SWITCH_STATUS_TERM
;
}
if
(
switch_core_new_memory_pool
(
&
globals
.
pool
)
!=
SWITCH_STATUS_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"OH OH no pool
\n
"
);
return
SWITCH_STATUS_TERM
;
}
switch_mutex_init
(
&
globals
.
mutex
,
SWITCH_MUTEX_NESTED
,
globals
.
pool
);
switch_core_hash_init
(
&
globals
.
profile_hash
,
globals
.
pool
);
globals
.
running
=
1
;
load_skinny_config
();
/* bind to events */
/* bind to events */
if
((
switch_event_bind_removable
(
modname
,
SWITCH_EVENT_HEARTBEAT
,
NULL
,
event_handler
,
NULL
,
&
globals
.
heartbeat_node
)
!=
SWITCH_STATUS_SUCCESS
))
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Couldn't bind our heartbeat handler!
\n
"
);
/* Not such severe to prevent loading */
...
...
@@ -1650,7 +1651,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_skinny_load)
return
SWITCH_STATUS_TERM
;
}
/* reserve events */
/* reserve events */
if
(
switch_event_reserve_subclass
(
SKINNY_EVENT_REGISTER
)
!=
SWITCH_STATUS_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Couldn't register subclass %s!
\n
"
,
SKINNY_EVENT_REGISTER
);
return
SWITCH_STATUS_TERM
;
...
...
@@ -1679,23 +1680,23 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_skinny_load)
skinny_endpoint_interface
->
io_routines
=
&
skinny_io_routines
;
skinny_endpoint_interface
->
state_handler
=
&
skinny_state_handlers
;
skinny_api_register
(
module_interface
);
skinny_api_register
(
module_interface
);
/* launch listeners */
switch_mutex_lock
(
globals
.
mutex
);
for
(
hi
=
switch_hash_first
(
NULL
,
globals
.
profile_hash
);
hi
;
hi
=
switch_hash_next
(
hi
))
{
void
*
val
;
skinny_profile_t
*
profile
;
switch_thread_t
*
thread
;
switch_threadattr_t
*
thd_attr
=
NULL
;
void
*
val
;
skinny_profile_t
*
profile
;
switch_thread_t
*
thread
;
switch_threadattr_t
*
thd_attr
=
NULL
;
switch_hash_this
(
hi
,
NULL
,
NULL
,
&
val
);
profile
=
(
skinny_profile_t
*
)
val
;
switch_threadattr_create
(
&
thd_attr
,
profile
->
pool
);
switch_threadattr_detach_set
(
thd_attr
,
1
);
switch_threadattr_stacksize_set
(
thd_attr
,
SWITCH_THREAD_STACKSIZE
);
switch_thread_create
(
&
thread
,
thd_attr
,
skinny_profile_run
,
profile
,
profile
->
pool
);
switch_threadattr_create
(
&
thd_attr
,
profile
->
pool
);
switch_threadattr_detach_set
(
thd_attr
,
1
);
switch_threadattr_stacksize_set
(
thd_attr
,
SWITCH_THREAD_STACKSIZE
);
switch_thread_create
(
&
thread
,
thd_attr
,
skinny_profile_run
,
profile
,
profile
->
pool
);
}
switch_mutex_unlock
(
globals
.
mutex
);
...
...
@@ -1711,7 +1712,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_skinny_shutdown)
switch_mutex_t
*
mutex
=
globals
.
mutex
;
int
sanity
=
0
;
/* release events */
/* release events */
switch_event_unbind
(
&
globals
.
heartbeat_node
);
switch_event_unbind
(
&
globals
.
call_state_node
);
switch_event_free_subclass
(
SKINNY_EVENT_REGISTER
);
...
...
@@ -1730,7 +1731,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_skinny_shutdown)
/* close sockets */
switch_mutex_lock
(
globals
.
mutex
);
for
(
hi
=
switch_hash_first
(
NULL
,
globals
.
profile_hash
);
hi
;
hi
=
switch_hash_next
(
hi
))
{
skinny_profile_t
*
profile
;
skinny_profile_t
*
profile
;
switch_hash_this
(
hi
,
NULL
,
NULL
,
&
val
);
profile
=
(
skinny_profile_t
*
)
val
;
...
...
@@ -1743,7 +1744,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_skinny_shutdown)
break
;
}
}
switch_core_destroy_memory_pool
(
&
profile
->
pool
);
switch_core_destroy_memory_pool
(
&
profile
->
pool
);
}
switch_mutex_unlock
(
globals
.
mutex
);
...
...
src/mod/endpoints/mod_skinny/mod_skinny.h
浏览文件 @
54e73c77
...
...
@@ -45,51 +45,51 @@
#define SKINNY_EVENT_CALL_STATE "skinny::call_state"
struct
skinny_globals
{
int
running
;
switch_memory_pool_t
*
pool
;
switch_mutex_t
*
mutex
;
switch_hash_t
*
profile_hash
;
switch_event_node_t
*
heartbeat_node
;
switch_event_node_t
*
call_state_node
;
int
running
;
switch_memory_pool_t
*
pool
;
switch_mutex_t
*
mutex
;
switch_hash_t
*
profile_hash
;
switch_event_node_t
*
heartbeat_node
;
switch_event_node_t
*
call_state_node
;
};
typedef
struct
skinny_globals
skinny_globals_t
;
skinny_globals_t
globals
;
struct
skinny_profile
{
/* prefs */
char
*
name
;
char
*
domain
;
char
*
ip
;
unsigned
int
port
;
char
*
dialplan
;
char
*
context
;
uint32_t
keep_alive
;
char
date_format
[
6
];
int
debug
;
/* db */
char
*
dbname
;
char
*
odbc_dsn
;
char
*
odbc_user
;
char
*
odbc_pass
;
switch_odbc_handle_t
*
master_odbc
;
switch_mutex_t
*
sql_mutex
;
/* stats */
uint32_t
ib_calls
;
uint32_t
ob_calls
;
uint32_t
ib_failed_calls
;
uint32_t
ob_failed_calls
;
/* listener */
int
listener_threads
;
switch_mutex_t
*
listener_mutex
;
switch_socket_t
*
sock
;
switch_mutex_t
*
sock_mutex
;
struct
listener
*
listeners
;
uint8_t
listener_ready
;
/* call id */
uint32_t
next_call_id
;
/* others */
switch_memory_pool_t
*
pool
;
/* prefs */
char
*
name
;
char
*
domain
;
char
*
ip
;
unsigned
int
port
;
char
*
dialplan
;
char
*
context
;
uint32_t
keep_alive
;
char
date_format
[
6
];
int
debug
;
/* db */
char
*
dbname
;
char
*
odbc_dsn
;
char
*
odbc_user
;
char
*
odbc_pass
;
switch_odbc_handle_t
*
master_odbc
;
switch_mutex_t
*
sql_mutex
;
/* stats */
uint32_t
ib_calls
;
uint32_t
ob_calls
;
uint32_t
ib_failed_calls
;
uint32_t
ob_failed_calls
;
/* listener */
int
listener_threads
;
switch_mutex_t
*
listener_mutex
;
switch_socket_t
*
sock
;
switch_mutex_t
*
sock_mutex
;
struct
listener
*
listeners
;
uint8_t
listener_ready
;
/* call id */
uint32_t
next_call_id
;
/* others */
switch_memory_pool_t
*
pool
;
};
typedef
struct
skinny_profile
skinny_profile_t
;
...
...
@@ -99,26 +99,26 @@ typedef struct skinny_profile skinny_profile_t;
/*****************************************************************************/
typedef
enum
{
LFLAG_RUNNING
=
(
1
<<
0
),
LFLAG_RUNNING
=
(
1
<<
0
),
}
event_flag_t
;
#define SKINNY_MAX_LINES 42
struct
listener
{
skinny_profile_t
*
profile
;
char
device_name
[
16
];
uint32_t
device_instance
;
switch_socket_t
*
sock
;
switch_memory_pool_t
*
pool
;
switch_thread_rwlock_t
*
rwlock
;
switch_sockaddr_t
*
sa
;
char
remote_ip
[
50
];
switch_mutex_t
*
flag_mutex
;
uint32_t
flags
;
switch_port_t
remote_port
;
uint32_t
id
;
time_t
expire_time
;
struct
listener
*
next
;
skinny_profile_t
*
profile
;
char
device_name
[
16
];
uint32_t
device_instance
;
switch_socket_t
*
sock
;
switch_memory_pool_t
*
pool
;
switch_thread_rwlock_t
*
rwlock
;
switch_sockaddr_t
*
sa
;
char
remote_ip
[
50
];
switch_mutex_t
*
flag_mutex
;
uint32_t
flags
;
switch_port_t
remote_port
;
uint32_t
id
;
time_t
expire_time
;
struct
listener
*
next
;
};
typedef
struct
listener
listener_t
;
...
...
@@ -129,54 +129,54 @@ typedef switch_status_t (*skinny_listener_callback_func_t) (listener_t *listener
/* CHANNEL TYPES */
/*****************************************************************************/
typedef
enum
{
TFLAG_IO
=
(
1
<<
0
),
TFLAG_INBOUND
=
(
1
<<
1
),
TFLAG_OUTBOUND
=
(
1
<<
2
),
TFLAG_DTMF
=
(
1
<<
3
),
TFLAG_VOICE
=
(
1
<<
4
),
TFLAG_HANGUP
=
(
1
<<
5
),
TFLAG_LINEAR
=
(
1
<<
6
),
TFLAG_CODEC
=
(
1
<<
7
),
TFLAG_READING
=
(
1
<<
9
),
TFLAG_WRITING
=
(
1
<<
10
)
TFLAG_IO
=
(
1
<<
0
),
TFLAG_INBOUND
=
(
1
<<
1
),
TFLAG_OUTBOUND
=
(
1
<<
2
),
TFLAG_DTMF
=
(
1
<<
3
),
TFLAG_VOICE
=
(
1
<<
4
),
TFLAG_HANGUP
=
(
1
<<
5
),
TFLAG_LINEAR
=
(
1
<<
6
),
TFLAG_CODEC
=
(
1
<<
7
),
TFLAG_READING
=
(
1
<<
9
),
TFLAG_WRITING
=
(
1
<<
10
)
}
TFLAGS
;
typedef
enum
{
GFLAG_MY_CODEC_PREFS
=
(
1
<<
0
)
GFLAG_MY_CODEC_PREFS
=
(
1
<<
0
)
}
GFLAGS
;
struct
private_object
{
unsigned
int
flags
;
switch_frame_t
read_frame
;
unsigned
char
databuf
[
SWITCH_RECOMMENDED_BUFFER_SIZE
];
switch_core_session_t
*
session
;
switch_caller_profile_t
*
caller_profile
;
switch_mutex_t
*
mutex
;
switch_mutex_t
*
flag_mutex
;
/* identification */
uint32_t
call_id
;
uint32_t
party_id
;
skinny_profile_t
*
profile
;
/* codec */
char
*
iananame
;
switch_codec_t
read_codec
;
switch_codec_t
write_codec
;
switch_codec_implementation_t
read_impl
;
switch_codec_implementation_t
write_impl
;
unsigned
long
rm_rate
;
uint32_t
codec_ms
;
char
*
rm_encoding
;
char
*
rm_fmtp
;
switch_payload_t
agreed_pt
;
/* RTP */
switch_rtp_t
*
rtp_session
;
char
*
local_sdp_audio_ip
;
switch_port_t
local_sdp_audio_port
;
char
*
remote_sdp_audio_ip
;
switch_port_t
remote_sdp_audio_port
;
unsigned
int
flags
;
switch_frame_t
read_frame
;
unsigned
char
databuf
[
SWITCH_RECOMMENDED_BUFFER_SIZE
];
switch_core_session_t
*
session
;
switch_caller_profile_t
*
caller_profile
;
switch_mutex_t
*
mutex
;
switch_mutex_t
*
flag_mutex
;
/* identification */
uint32_t
call_id
;
uint32_t
party_id
;
skinny_profile_t
*
profile
;
/* codec */
char
*
iananame
;
switch_codec_t
read_codec
;
switch_codec_t
write_codec
;
switch_codec_implementation_t
read_impl
;
switch_codec_implementation_t
write_impl
;
unsigned
long
rm_rate
;
uint32_t
codec_ms
;
char
*
rm_encoding
;
char
*
rm_fmtp
;
switch_payload_t
agreed_pt
;
/* RTP */
switch_rtp_t
*
rtp_session
;
char
*
local_sdp_audio_ip
;
switch_port_t
local_sdp_audio_port
;
char
*
remote_sdp_audio_ip
;
switch_port_t
remote_sdp_audio_port
;
};
typedef
struct
private_object
private_t
;
...
...
@@ -197,7 +197,7 @@ switch_status_t dump_device(skinny_profile_t *profile, const char *device_name,
/*****************************************************************************/
void
skinny_execute_sql
(
skinny_profile_t
*
profile
,
char
*
sql
,
switch_mutex_t
*
mutex
);
switch_bool_t
skinny_execute_sql_callback
(
skinny_profile_t
*
profile
,
switch_mutex_t
*
mutex
,
char
*
sql
,
switch_core_db_callback_func_t
callback
,
void
*
pdata
);
switch_mutex_t
*
mutex
,
char
*
sql
,
switch_core_db_callback_func_t
callback
,
void
*
pdata
);
/*****************************************************************************/
/* LISTENER FUNCTIONS */
...
...
@@ -222,8 +222,8 @@ switch_status_t channel_on_routing(switch_core_session_t *session);
switch_status_t
channel_on_exchange_media
(
switch_core_session_t
*
session
);
switch_status_t
channel_on_soft_execute
(
switch_core_session_t
*
session
);
switch_call_cause_t
channel_outgoing_channel
(
switch_core_session_t
*
session
,
switch_event_t
*
var_event
,
switch_caller_profile_t
*
outbound_profile
,
switch_core_session_t
**
new_session
,
switch_memory_pool_t
**
pool
,
switch_originate_flag_t
flags
,
switch_call_cause_t
*
cancel_cause
);
switch_caller_profile_t
*
outbound_profile
,
switch_core_session_t
**
new_session
,
switch_memory_pool_t
**
pool
,
switch_originate_flag_t
flags
,
switch_call_cause_t
*
cancel_cause
);
switch_status_t
channel_read_frame
(
switch_core_session_t
*
session
,
switch_frame_t
**
frame
,
switch_io_flag_t
flags
,
int
stream_id
);
switch_status_t
channel_write_frame
(
switch_core_session_t
*
session
,
switch_frame_t
*
frame
,
switch_io_flag_t
flags
,
int
stream_id
);
switch_status_t
channel_kill_channel
(
switch_core_session_t
*
session
,
int
sig
);
...
...
src/mod/endpoints/mod_skinny/skinny_protocol.c
浏览文件 @
54e73c77
This source diff could not be displayed because it is too large. You can
view the blob
instead.
src/mod/endpoints/mod_skinny/skinny_protocol.h
浏览文件 @
54e73c77
...
...
@@ -49,60 +49,60 @@
/* RegisterMessage */
#define REGISTER_MESSAGE 0x0001
struct
register_message
{
char
device_name
[
16
];
uint32_t
user_id
;
uint32_t
instance
;
struct
in_addr
ip
;
uint32_t
device_type
;
uint32_t
max_streams
;
char
device_name
[
16
];
uint32_t
user_id
;
uint32_t
instance
;
struct
in_addr
ip
;
uint32_t
device_type
;
uint32_t
max_streams
;
};
/* PortMessage */
#define PORT_MESSAGE 0x0002
struct
port_message
{
uint16_t
port
;
uint16_t
port
;
};
/* KeypadButtonMessage */
#define KEYPAD_BUTTON_MESSAGE 0x0003
struct
keypad_button_message
{
uint32_t
button
;
uint32_t
line_instance
;
uint32_t
call_id
;
uint32_t
button
;
uint32_t
line_instance
;
uint32_t
call_id
;
};
/* StimulusMessage */
#define STIMULUS_MESSAGE 0x0005
struct
stimulus_message
{
uint32_t
instance_type
;
/* See enum skinny_button_definition */
uint32_t
instance
;
uint32_t
call_id
;
uint32_t
instance_type
;
/* See enum skinny_button_definition */
uint32_t
instance
;
uint32_t
call_id
;
};
/* OffHookMessage */
#define OFF_HOOK_MESSAGE 0x0006
struct
off_hook_message
{
uint32_t
line_instance
;
uint32_t
call_id
;
uint32_t
line_instance
;
uint32_t
call_id
;
};
/* OnHookMessage */
#define ON_HOOK_MESSAGE 0x0007
struct
on_hook_message
{
uint32_t
line_instance
;
uint32_t
call_id
;
uint32_t
line_instance
;
uint32_t
call_id
;
};
/* SpeedDialStatReqMessage */
#define SPEED_DIAL_STAT_REQ_MESSAGE 0x000A
struct
speed_dial_stat_req_message
{
uint32_t
number
;
uint32_t
number
;
};
/* LineStatReqMessage */
#define LINE_STAT_REQ_MESSAGE 0x000B
struct
line_stat_req_message
{
uint32_t
number
;
uint32_t
number
;
};
/* ConfigStatReqMessage */
...
...
@@ -117,32 +117,32 @@ struct line_stat_req_message {
/* CapabilitiesResMessage */
#define CAPABILITIES_RES_MESSAGE 0x0010
struct
station_capabilities
{
uint32_t
codec
;
uint16_t
frames
;
char
reserved
[
10
];
uint32_t
codec
;
uint16_t
frames
;
char
reserved
[
10
];
};
struct
capabilities_res_message
{
uint32_t
count
;
struct
station_capabilities
caps
[
SWITCH_MAX_CODECS
];
uint32_t
count
;
struct
station_capabilities
caps
[
SWITCH_MAX_CODECS
];
};
/* AlarmMessage */
#define ALARM_MESSAGE 0x0020
struct
alarm_message
{
uint32_t
alarm_severity
;
char
display_message
[
80
];
uint32_t
alarm_param1
;
uint32_t
alarm_param2
;
uint32_t
alarm_severity
;
char
display_message
[
80
];
uint32_t
alarm_param1
;
uint32_t
alarm_param2
;
};
/* OpenReceiveChannelAck */
#define OPEN_RECEIVE_CHANNEL_ACK_MESSAGE 0x0022
struct
open_receive_channel_ack_message
{
uint32_t
status
;
struct
in_addr
ip
;
uint32_t
port
;
uint32_t
pass_thru_party_id
;
uint32_t
status
;
struct
in_addr
ip
;
uint32_t
port
;
uint32_t
pass_thru_party_id
;
};
/* SoftKeySetReqMessage */
...
...
@@ -151,9 +151,9 @@ struct open_receive_channel_ack_message {
/* SoftKeyEventMessage */
#define SOFT_KEY_EVENT_MESSAGE 0x0026
struct
soft_key_event_message
{
uint32_t
event
;
uint32_t
line_instance
;
uint32_t
call_id
;
uint32_t
event
;
uint32_t
line_instance
;
uint32_t
call_id
;
};
/* UnregisterMessage */
...
...
@@ -165,182 +165,182 @@ struct soft_key_event_message {
/* ServiceUrlStatReqMessage */
#define SERVICE_URL_STAT_REQ_MESSAGE 0x0033
struct
service_url_stat_req_message
{
uint32_t
service_url_index
;
uint32_t
service_url_index
;
};
/* FeatureStatReqMessage */
#define FEATURE_STAT_REQ_MESSAGE 0x0034
struct
feature_stat_req_message
{
uint32_t
feature_index
;
uint32_t
feature_index
;
};
/* HeadsetStatusMessage */
#define HEADSET_STATUS_MESSAGE 0x002B
struct
headset_status_message
{
uint32_t
mode
;
uint32_t
mode
;
};
/* RegisterAvailableLinesMessage */
#define REGISTER_AVAILABLE_LINES_MESSAGE 0x002D
struct
register_available_lines_message
{
uint32_t
count
;
uint32_t
count
;
};
/* RegisterAckMessage */
#define REGISTER_ACK_MESSAGE 0x0081
struct
register_ack_message
{
uint32_t
keep_alive
;
char
date_format
[
6
];
char
reserved
[
2
];
uint32_t
secondary_keep_alive
;
char
reserved2
[
4
];
uint32_t
keep_alive
;
char
date_format
[
6
];
char
reserved
[
2
];
uint32_t
secondary_keep_alive
;
char
reserved2
[
4
];
};
/* StartToneMessage */
#define START_TONE_MESSAGE 0x0082
struct
start_tone_message
{
uint32_t
tone
;
/* see enum skinny_tone */
uint32_t
reserved
;
uint32_t
line_instance
;
uint32_t
call_id
;
uint32_t
tone
;
/* see enum skinny_tone */
uint32_t
reserved
;
uint32_t
line_instance
;
uint32_t
call_id
;
};
/* StopToneMessage */
#define STOP_TONE_MESSAGE 0x0083
struct
stop_tone_message
{
uint32_t
line_instance
;
uint32_t
call_id
;
uint32_t
line_instance
;
uint32_t
call_id
;
};
/* SetRingerMessage */
#define SET_RINGER_MESSAGE 0x0085
struct
set_ringer_message
{
uint32_t
ring_type
;
/* See enum skinny_ring_type */
uint32_t
ring_mode
;
/* See enum skinny_ring_mode */
uint32_t
line_instance
;
uint32_t
call_id
;
uint32_t
ring_type
;
/* See enum skinny_ring_type */
uint32_t
ring_mode
;
/* See enum skinny_ring_mode */
uint32_t
line_instance
;
uint32_t
call_id
;
};
/* SetLampMessage */
#define SET_LAMP_MESSAGE 0x0086
struct
set_lamp_message
{
uint32_t
stimulus
;
/* See enum skinny_button_definition */
uint32_t
stimulus_instance
;
uint32_t
mode
;
/* See enum skinny_lamp_mode */
uint32_t
stimulus
;
/* See enum skinny_button_definition */
uint32_t
stimulus_instance
;
uint32_t
mode
;
/* See enum skinny_lamp_mode */
};
/* SetSpeakerModeMessage */
#define SET_SPEAKER_MODE_MESSAGE 0x0088
struct
set_speaker_mode_message
{
uint32_t
mode
;
/* See enum skinny_speaker_mode */
uint32_t
mode
;
/* See enum skinny_speaker_mode */
};
/* StartMediaTransmissionMessage */
#define START_MEDIA_TRANSMISSION_MESSAGE 0x008A
struct
start_media_transmission_message
{
uint32_t
conference_id
;
uint32_t
pass_thru_party_id
;
uint32_t
remote_ip
;
uint32_t
remote_port
;
uint32_t
ms_per_packet
;
uint32_t
payload_capacity
;
uint32_t
precedence
;
uint32_t
silence_suppression
;
uint16_t
max_frames_per_packet
;
uint32_t
g723_bitrate
;
/* ... */
uint32_t
conference_id
;
uint32_t
pass_thru_party_id
;
uint32_t
remote_ip
;
uint32_t
remote_port
;
uint32_t
ms_per_packet
;
uint32_t
payload_capacity
;
uint32_t
precedence
;
uint32_t
silence_suppression
;
uint16_t
max_frames_per_packet
;
uint32_t
g723_bitrate
;
/* ... */
};
/* StopMediaTransmissionMessage */
#define STOP_MEDIA_TRANSMISSION_MESSAGE 0x008B
struct
stop_media_transmission_message
{
uint32_t
conference_id
;
uint32_t
pass_thru_party_id
;
uint32_t
conference_id2
;
/* ... */
uint32_t
conference_id
;
uint32_t
pass_thru_party_id
;
uint32_t
conference_id2
;
/* ... */
};
/* CallInfoMessage */
#define CALL_INFO_MESSAGE 0x008F
struct
call_info_message
{
char
calling_party_name
[
40
];
char
calling_party
[
24
];
char
called_party_name
[
40
];
char
called_party
[
24
];
uint32_t
line_instance
;
uint32_t
call_id
;
uint32_t
call_type
;
/* See enum skinny_call_type */
char
original_called_party_name
[
40
];
char
original_called_party
[
24
];
char
last_redirecting_party_name
[
40
];
char
last_redirecting_party
[
24
];
uint32_t
original_called_party_redirect_reason
;
uint32_t
last_redirecting_reason
;
char
calling_party_voice_mailbox
[
24
];
char
called_party_voice_mailbox
[
24
];
char
original_called_party_voice_mailbox
[
24
];
char
last_redirecting_voice_mailbox
[
24
];
uint32_t
call_instance
;
uint32_t
call_security_status
;
uint32_t
party_pi_restriction_bits
;
char
calling_party_name
[
40
];
char
calling_party
[
24
];
char
called_party_name
[
40
];
char
called_party
[
24
];
uint32_t
line_instance
;
uint32_t
call_id
;
uint32_t
call_type
;
/* See enum skinny_call_type */
char
original_called_party_name
[
40
];
char
original_called_party
[
24
];
char
last_redirecting_party_name
[
40
];
char
last_redirecting_party
[
24
];
uint32_t
original_called_party_redirect_reason
;
uint32_t
last_redirecting_reason
;
char
calling_party_voice_mailbox
[
24
];
char
called_party_voice_mailbox
[
24
];
char
original_called_party_voice_mailbox
[
24
];
char
last_redirecting_voice_mailbox
[
24
];
uint32_t
call_instance
;
uint32_t
call_security_status
;
uint32_t
party_pi_restriction_bits
;
};
/* SpeedDialStatMessage */
#define SPEED_DIAL_STAT_RES_MESSAGE 0x0091
struct
speed_dial_stat_res_message
{
uint32_t
number
;
char
line
[
24
];
char
label
[
40
];
uint32_t
number
;
char
line
[
24
];
char
label
[
40
];
};
/* LineStatMessage */
#define LINE_STAT_RES_MESSAGE 0x0092
struct
line_stat_res_message
{
uint32_t
number
;
char
name
[
24
];
char
shortname
[
40
];
char
displayname
[
44
];
uint32_t
number
;
char
name
[
24
];
char
shortname
[
40
];
char
displayname
[
44
];
};
/* ConfigStatMessage */
#define CONFIG_STAT_RES_MESSAGE 0x0093
struct
config_stat_res_message
{
char
device_name
[
16
];
uint32_t
user_id
;
uint32_t
instance
;
char
user_name
[
40
];
char
server_name
[
40
];
uint32_t
number_lines
;
uint32_t
number_speed_dials
;
char
device_name
[
16
];
uint32_t
user_id
;
uint32_t
instance
;
char
user_name
[
40
];
char
server_name
[
40
];
uint32_t
number_lines
;
uint32_t
number_speed_dials
;
};
/* DefineTimeDate */
#define DEFINE_TIME_DATE_MESSAGE 0x0094
struct
define_time_date_message
{
uint32_t
year
;
uint32_t
month
;
uint32_t
day_of_week
;
/* monday = 1 */
uint32_t
day
;
uint32_t
hour
;
uint32_t
minute
;
uint32_t
seconds
;
uint32_t
milliseconds
;
uint32_t
timestamp
;
uint32_t
year
;
uint32_t
month
;
uint32_t
day_of_week
;
/* monday = 1 */
uint32_t
day
;
uint32_t
hour
;
uint32_t
minute
;
uint32_t
seconds
;
uint32_t
milliseconds
;
uint32_t
timestamp
;
};
/* ButtonTemplateMessage */
#define BUTTON_TEMPLATE_RES_MESSAGE 0x0097
struct
button_definition
{
uint8_t
instance_number
;
uint8_t
button_definition
;
/* See enum skinny_button_definition */
uint8_t
instance_number
;
uint8_t
button_definition
;
/* See enum skinny_button_definition */
};
#define SKINNY_MAX_BUTTON_COUNT 42
struct
button_template_message
{
uint32_t
button_offset
;
uint32_t
button_count
;
uint32_t
total_button_count
;
struct
button_definition
btn
[
SKINNY_MAX_BUTTON_COUNT
];
uint32_t
button_offset
;
uint32_t
button_count
;
uint32_t
total_button_count
;
struct
button_definition
btn
[
SKINNY_MAX_BUTTON_COUNT
];
};
/* CapabilitiesReqMessage */
...
...
@@ -349,13 +349,13 @@ struct button_template_message {
/* RegisterRejectMessage */
#define REGISTER_REJ_MESSAGE 0x009D
struct
register_rej_message
{
char
error
[
33
];
char
error
[
33
];
};
/* ResetMessage */
#define RESET_MESSAGE 0x009F
struct
reset_message
{
uint32_t
reset_type
;
/* See enum skinny_device_reset_types */
uint32_t
reset_type
;
/* See enum skinny_device_reset_types */
};
/* KeepAliveAckMessage */
...
...
@@ -364,130 +364,130 @@ struct reset_message {
/* OpenReceiveChannelMessage */
#define OPEN_RECEIVE_CHANNEL_MESSAGE 0x0105
struct
open_receive_channel_message
{
uint32_t
conference_id
;
uint32_t
pass_thru_party_id
;
uint32_t
packets
;
uint32_t
payload_capacity
;
uint32_t
echo_cancel_type
;
uint32_t
g723_bitrate
;
uint32_t
conference_id2
;
uint32_t
reserved
[
10
];
uint32_t
conference_id
;
uint32_t
pass_thru_party_id
;
uint32_t
packets
;
uint32_t
payload_capacity
;
uint32_t
echo_cancel_type
;
uint32_t
g723_bitrate
;
uint32_t
conference_id2
;
uint32_t
reserved
[
10
];
};
/* CloseReceiveChannelMessage */
#define CLOSE_RECEIVE_CHANNEL_MESSAGE 0x0106
struct
close_receive_channel_message
{
uint32_t
conference_id
;
uint32_t
pass_thru_party_id
;
uint32_t
conference_id2
;
uint32_t
conference_id
;
uint32_t
pass_thru_party_id
;
uint32_t
conference_id2
;
};
/* SoftKeyTemplateResMessage */
#define SOFT_KEY_TEMPLATE_RES_MESSAGE 0x0108
struct
soft_key_template_definition
{
char
soft_key_label
[
16
];
uint32_t
soft_key_event
;
char
soft_key_label
[
16
];
uint32_t
soft_key_event
;
};
struct
soft_key_template_res_message
{
uint32_t
soft_key_offset
;
uint32_t
soft_key_count
;
uint32_t
total_soft_key_count
;
struct
soft_key_template_definition
soft_key
[
32
];
uint32_t
soft_key_offset
;
uint32_t
soft_key_count
;
uint32_t
total_soft_key_count
;
struct
soft_key_template_definition
soft_key
[
32
];
};
/* SoftKeySetResMessage */
#define SOFT_KEY_SET_RES_MESSAGE 0x0109
struct
soft_key_set_definition
{
uint8_t
soft_key_template_index
[
16
];
/* See enum skinny_soft_key_event */
uint16_t
soft_key_info_index
[
16
];
uint8_t
soft_key_template_index
[
16
];
/* See enum skinny_soft_key_event */
uint16_t
soft_key_info_index
[
16
];
};
struct
soft_key_set_res_message
{
uint32_t
soft_key_set_offset
;
uint32_t
soft_key_set_count
;
uint32_t
total_soft_key_set_count
;
struct
soft_key_set_definition
soft_key_set
[
16
];
uint32_t
res
;
uint32_t
soft_key_set_offset
;
uint32_t
soft_key_set_count
;
uint32_t
total_soft_key_set_count
;
struct
soft_key_set_definition
soft_key_set
[
16
];
uint32_t
res
;
};
/* SelectSoftKeysMessage */
#define SELECT_SOFT_KEYS_MESSAGE 0x0110
struct
select_soft_keys_message
{
uint32_t
line_instance
;
uint32_t
call_id
;
uint32_t
soft_key_set
;
/* See enum skinny_key_set */
uint32_t
valid_key_mask
;
uint32_t
line_instance
;
uint32_t
call_id
;
uint32_t
soft_key_set
;
/* See enum skinny_key_set */
uint32_t
valid_key_mask
;
};
/* CallStateMessage */
#define CALL_STATE_MESSAGE 0x0111
struct
call_state_message
{
uint32_t
call_state
;
/* See enum skinny_call_state */
uint32_t
line_instance
;
uint32_t
call_id
;
uint32_t
call_state
;
/* See enum skinny_call_state */
uint32_t
line_instance
;
uint32_t
call_id
;
};
/* DisplayPromptStatusMessage */
#define DISPLAY_PROMPT_STATUS_MESSAGE 0x0112
struct
display_prompt_status_message
{
uint32_t
timeout
;
char
display
[
32
];
uint32_t
line_instance
;
uint32_t
call_id
;
uint32_t
timeout
;
char
display
[
32
];
uint32_t
line_instance
;
uint32_t
call_id
;
};
/* ClearPromptStatusMessage */
#define CLEAR_PROMPT_STATUS_MESSAGE 0x0113
struct
clear_prompt_status_message
{
uint32_t
line_instance
;
uint32_t
call_id
;
uint32_t
line_instance
;
uint32_t
call_id
;
};
/* ActivateCallPlaneMessage */
#define ACTIVATE_CALL_PLANE_MESSAGE 0x0116
struct
activate_call_plane_message
{
uint32_t
line_instance
;
uint32_t
line_instance
;
};
/* UnregisterAckMessage */
#define UNREGISTER_ACK_MESSAGE 0x0118
struct
unregister_ack_message
{
uint32_t
unregister_status
;
uint32_t
unregister_status
;
};
/* DialedNumberMessage */
#define DIALED_NUMBER_MESSAGE 0x011D
struct
dialed_number_message
{
char
called_party
[
24
];
uint32_t
line_instance
;
uint32_t
call_id
;
char
called_party
[
24
];
uint32_t
line_instance
;
uint32_t
call_id
;
};
/* FeatureStatMessage */
#define FEATURE_STAT_RES_MESSAGE 0x011F
struct
feature_stat_res_message
{
uint32_t
index
;
uint32_t
id
;
char
text_label
[
40
];
uint32_t
status
;
uint32_t
index
;
uint32_t
id
;
char
text_label
[
40
];
uint32_t
status
;
};
/* DisplayPriNotifyMessage */
#define DISPLAY_PRI_NOTIFY_MESSAGE 0x0120
struct
display_pri_notify_message
{
uint32_t
message_timeout
;
uint32_t
priority
;
char
notify
[
32
];
uint32_t
message_timeout
;
uint32_t
priority
;
char
notify
[
32
];
};
/* ServiceUrlStatMessage */
#define SERVICE_URL_STAT_RES_MESSAGE 0x012F
struct
service_url_stat_res_message
{
uint32_t
index
;
char
url
[
256
];
char
display_name
[
40
];
uint32_t
index
;
char
url
[
256
];
char
display_name
[
40
];
};
/*****************************************************************************/
...
...
@@ -498,56 +498,56 @@ struct service_url_stat_res_message {
#define SKINNY_MESSAGE_MAXSIZE 1000
union
skinny_data
{
struct
register_message
reg
;
struct
port_message
port
;
struct
keypad_button_message
keypad_button
;
struct
stimulus_message
stimulus
;
struct
off_hook_message
off_hook
;
struct
on_hook_message
on_hook
;
struct
speed_dial_stat_req_message
speed_dial_req
;
struct
line_stat_req_message
line_req
;
struct
capabilities_res_message
cap_res
;
struct
alarm_message
alarm
;
struct
open_receive_channel_ack_message
open_receive_channel_ack
;
struct
soft_key_event_message
soft_key_event
;
struct
service_url_stat_req_message
service_url_req
;
struct
feature_stat_req_message
feature_req
;
struct
headset_status_message
headset_status
;
struct
register_available_lines_message
reg_lines
;
struct
register_ack_message
reg_ack
;
struct
start_tone_message
start_tone
;
struct
stop_tone_message
stop_tone
;
struct
set_ringer_message
ringer
;
struct
set_lamp_message
lamp
;
struct
set_speaker_mode_message
speaker_mode
;
struct
start_media_transmission_message
start_media
;
struct
stop_media_transmission_message
stop_media
;
struct
call_info_message
call_info
;
struct
speed_dial_stat_res_message
speed_dial_res
;
struct
line_stat_res_message
line_res
;
struct
config_stat_res_message
config_res
;
struct
define_time_date_message
define_time_date
;
struct
button_template_message
button_template
;
struct
register_rej_message
reg_rej
;
struct
reset_message
reset
;
struct
open_receive_channel_message
open_receive_channel
;
struct
close_receive_channel_message
close_receive_channel
;
struct
soft_key_template_res_message
soft_key_template
;
struct
soft_key_set_res_message
soft_key_set
;
struct
select_soft_keys_message
select_soft_keys
;
struct
call_state_message
call_state
;
struct
display_prompt_status_message
display_prompt_status
;
struct
clear_prompt_status_message
clear_prompt_status
;
struct
activate_call_plane_message
activate_call_plane
;
struct
unregister_ack_message
unregister_ack
;
struct
dialed_number_message
dialed_number
;
struct
feature_stat_res_message
feature_res
;
struct
display_pri_notify_message
display_pri_notify
;
struct
service_url_stat_res_message
service_url_res
;
uint16_t
as_uint16
;
char
as_char
;
void
*
raw
;
struct
register_message
reg
;
struct
port_message
port
;
struct
keypad_button_message
keypad_button
;
struct
stimulus_message
stimulus
;
struct
off_hook_message
off_hook
;
struct
on_hook_message
on_hook
;
struct
speed_dial_stat_req_message
speed_dial_req
;
struct
line_stat_req_message
line_req
;
struct
capabilities_res_message
cap_res
;
struct
alarm_message
alarm
;
struct
open_receive_channel_ack_message
open_receive_channel_ack
;
struct
soft_key_event_message
soft_key_event
;
struct
service_url_stat_req_message
service_url_req
;
struct
feature_stat_req_message
feature_req
;
struct
headset_status_message
headset_status
;
struct
register_available_lines_message
reg_lines
;
struct
register_ack_message
reg_ack
;
struct
start_tone_message
start_tone
;
struct
stop_tone_message
stop_tone
;
struct
set_ringer_message
ringer
;
struct
set_lamp_message
lamp
;
struct
set_speaker_mode_message
speaker_mode
;
struct
start_media_transmission_message
start_media
;
struct
stop_media_transmission_message
stop_media
;
struct
call_info_message
call_info
;
struct
speed_dial_stat_res_message
speed_dial_res
;
struct
line_stat_res_message
line_res
;
struct
config_stat_res_message
config_res
;
struct
define_time_date_message
define_time_date
;
struct
button_template_message
button_template
;
struct
register_rej_message
reg_rej
;
struct
reset_message
reset
;
struct
open_receive_channel_message
open_receive_channel
;
struct
close_receive_channel_message
close_receive_channel
;
struct
soft_key_template_res_message
soft_key_template
;
struct
soft_key_set_res_message
soft_key_set
;
struct
select_soft_keys_message
select_soft_keys
;
struct
call_state_message
call_state
;
struct
display_prompt_status_message
display_prompt_status
;
struct
clear_prompt_status_message
clear_prompt_status
;
struct
activate_call_plane_message
activate_call_plane
;
struct
unregister_ack_message
unregister_ack
;
struct
dialed_number_message
dialed_number
;
struct
feature_stat_res_message
feature_res
;
struct
display_pri_notify_message
display_pri_notify
;
struct
service_url_stat_res_message
service_url_res
;
uint16_t
as_uint16
;
char
as_char
;
void
*
raw
;
};
/*
...
...
@@ -555,10 +555,10 @@ union skinny_data {
* body is type+data
*/
struct
skinny_message
{
uint32_t
length
;
uint32_t
reserved
;
uint32_t
type
;
union
skinny_data
data
;
uint32_t
length
;
uint32_t
reserved
;
uint32_t
type
;
union
skinny_data
data
;
};
typedef
struct
skinny_message
skinny_message_t
;
...
...
@@ -566,40 +566,40 @@ typedef struct skinny_message skinny_message_t;
/* SKINNY TYPES */
/*****************************************************************************/
enum
skinny_codecs
{
SKINNY_CODEC_ALAW_64K
=
2
,
SKINNY_CODEC_ALAW_56K
=
3
,
SKINNY_CODEC_ULAW_64K
=
4
,
SKINNY_CODEC_ULAW_56K
=
5
,
SKINNY_CODEC_G722_64K
=
6
,
SKINNY_CODEC_G722_56K
=
7
,
SKINNY_CODEC_G722_48K
=
8
,
SKINNY_CODEC_G723_1
=
9
,
SKINNY_CODEC_G728
=
10
,
SKINNY_CODEC_G729
=
11
,
SKINNY_CODEC_G729A
=
12
,
SKINNY_CODEC_IS11172
=
13
,
SKINNY_CODEC_IS13818
=
14
,
SKINNY_CODEC_G729B
=
15
,
SKINNY_CODEC_G729AB
=
16
,
SKINNY_CODEC_GSM_FULL
=
18
,
SKINNY_CODEC_GSM_HALF
=
19
,
SKINNY_CODEC_GSM_EFULL
=
20
,
SKINNY_CODEC_WIDEBAND_256K
=
25
,
SKINNY_CODEC_DATA_64K
=
32
,
SKINNY_CODEC_DATA_56K
=
33
,
SKINNY_CODEC_GSM
=
80
,
SKINNY_CODEC_ACTIVEVOICE
=
81
,
SKINNY_CODEC_G726_32K
=
82
,
SKINNY_CODEC_G726_24K
=
83
,
SKINNY_CODEC_G726_16K
=
84
,
SKINNY_CODEC_G729B_BIS
=
85
,
SKINNY_CODEC_G729B_LOW
=
86
,
SKINNY_CODEC_H261
=
100
,
SKINNY_CODEC_H263
=
101
,
SKINNY_CODEC_VIDEO
=
102
,
SKINNY_CODEC_T120
=
105
,
SKINNY_CODEC_H224
=
106
,
SKINNY_CODEC_RFC2833_DYNPAYLOAD
=
257
SKINNY_CODEC_ALAW_64K
=
2
,
SKINNY_CODEC_ALAW_56K
=
3
,
SKINNY_CODEC_ULAW_64K
=
4
,
SKINNY_CODEC_ULAW_56K
=
5
,
SKINNY_CODEC_G722_64K
=
6
,
SKINNY_CODEC_G722_56K
=
7
,
SKINNY_CODEC_G722_48K
=
8
,
SKINNY_CODEC_G723_1
=
9
,
SKINNY_CODEC_G728
=
10
,
SKINNY_CODEC_G729
=
11
,
SKINNY_CODEC_G729A
=
12
,
SKINNY_CODEC_IS11172
=
13
,
SKINNY_CODEC_IS13818
=
14
,
SKINNY_CODEC_G729B
=
15
,
SKINNY_CODEC_G729AB
=
16
,
SKINNY_CODEC_GSM_FULL
=
18
,
SKINNY_CODEC_GSM_HALF
=
19
,
SKINNY_CODEC_GSM_EFULL
=
20
,
SKINNY_CODEC_WIDEBAND_256K
=
25
,
SKINNY_CODEC_DATA_64K
=
32
,
SKINNY_CODEC_DATA_56K
=
33
,
SKINNY_CODEC_GSM
=
80
,
SKINNY_CODEC_ACTIVEVOICE
=
81
,
SKINNY_CODEC_G726_32K
=
82
,
SKINNY_CODEC_G726_24K
=
83
,
SKINNY_CODEC_G726_16K
=
84
,
SKINNY_CODEC_G729B_BIS
=
85
,
SKINNY_CODEC_G729B_LOW
=
86
,
SKINNY_CODEC_H261
=
100
,
SKINNY_CODEC_H263
=
101
,
SKINNY_CODEC_VIDEO
=
102
,
SKINNY_CODEC_T120
=
105
,
SKINNY_CODEC_H224
=
106
,
SKINNY_CODEC_RFC2833_DYNPAYLOAD
=
257
};
typedef
switch_status_t
(
*
skinny_command_t
)
(
char
**
argv
,
int
argc
,
switch_stream_handle_t
*
stream
);
...
...
@@ -608,10 +608,10 @@ typedef switch_status_t (*skinny_command_t) (char **argv, int argc, switch_strea
/* SKINNY FUNCTIONS */
/*****************************************************************************/
#define skinny_check_data_length(message, len) \
if (message->length < len+4) {\
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Received Too Short Skinny Message (Expected %" SWITCH_SIZE_T_FMT ", got %d).\n", len+4, message->length);\
return SWITCH_STATUS_FALSE;\
}
if (message->length < len+4) {\
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Received Too Short Skinny Message (Expected %" SWITCH_SIZE_T_FMT ", got %d).\n", len+4, message->length);\
return SWITCH_STATUS_FALSE;\
}
#define skinny_check_data_length_soft(message, len) \
(message->length >= len+4)
...
...
@@ -643,102 +643,102 @@ switch_status_t skinny_handle_request(listener_t *listener, skinny_message_t *re
/* SKINNY MESSAGE HELPER */
/*****************************************************************************/
switch_status_t
start_tone
(
listener_t
*
listener
,
uint32_t
tone
,
uint32_t
reserved
,
uint32_t
line_instance
,
uint32_t
call_id
);
uint32_t
tone
,
uint32_t
reserved
,
uint32_t
line_instance
,
uint32_t
call_id
);
switch_status_t
stop_tone
(
listener_t
*
listener
,
uint32_t
line_instance
,
uint32_t
call_id
);
uint32_t
line_instance
,
uint32_t
call_id
);
switch_status_t
set_ringer
(
listener_t
*
listener
,
uint32_t
ring_type
,
uint32_t
ring_mode
,
uint32_t
line_instance
,
uint32_t
call_id
);
uint32_t
ring_type
,
uint32_t
ring_mode
,
uint32_t
line_instance
,
uint32_t
call_id
);
switch_status_t
set_lamp
(
listener_t
*
listener
,
uint32_t
stimulus
,
uint32_t
stimulus_instance
,
uint32_t
mode
);
uint32_t
stimulus
,
uint32_t
stimulus_instance
,
uint32_t
mode
);
switch_status_t
set_speaker_mode
(
listener_t
*
listener
,
uint32_t
mode
);
uint32_t
mode
);
switch_status_t
start_media_transmission
(
listener_t
*
listener
,
uint32_t
conference_id
,
uint32_t
pass_thru_party_id
,
uint32_t
remote_ip
,
uint32_t
remote_port
,
uint32_t
ms_per_packet
,
uint32_t
payload_capacity
,
uint32_t
precedence
,
uint32_t
silence_suppression
,
uint16_t
max_frames_per_packet
,
uint32_t
g723_bitrate
);
uint32_t
conference_id
,
uint32_t
pass_thru_party_id
,
uint32_t
remote_ip
,
uint32_t
remote_port
,
uint32_t
ms_per_packet
,
uint32_t
payload_capacity
,
uint32_t
precedence
,
uint32_t
silence_suppression
,
uint16_t
max_frames_per_packet
,
uint32_t
g723_bitrate
);
switch_status_t
stop_media_transmission
(
listener_t
*
listener
,
uint32_t
conference_id
,
uint32_t
pass_thru_party_id
,
uint32_t
conference_id2
);
uint32_t
conference_id
,
uint32_t
pass_thru_party_id
,
uint32_t
conference_id2
);
switch_status_t
send_call_info
(
listener_t
*
listener
,
char
calling_party_name
[
40
],
char
calling_party
[
24
],
char
called_party_name
[
40
],
char
called_party
[
24
],
uint32_t
line_instance
,
uint32_t
call_id
,
uint32_t
call_type
,
char
original_called_party_name
[
40
],
char
original_called_party
[
24
],
char
last_redirecting_party_name
[
40
],
char
last_redirecting_party
[
24
],
uint32_t
original_called_party_redirect_reason
,
uint32_t
last_redirecting_reason
,
char
calling_party_voice_mailbox
[
24
],
char
called_party_voice_mailbox
[
24
],
char
original_called_party_voice_mailbox
[
24
],
char
last_redirecting_voice_mailbox
[
24
],
uint32_t
call_instance
,
uint32_t
call_security_status
,
uint32_t
party_pi_restriction_bits
);
char
calling_party_name
[
40
],
char
calling_party
[
24
],
char
called_party_name
[
40
],
char
called_party
[
24
],
uint32_t
line_instance
,
uint32_t
call_id
,
uint32_t
call_type
,
char
original_called_party_name
[
40
],
char
original_called_party
[
24
],
char
last_redirecting_party_name
[
40
],
char
last_redirecting_party
[
24
],
uint32_t
original_called_party_redirect_reason
,
uint32_t
last_redirecting_reason
,
char
calling_party_voice_mailbox
[
24
],
char
called_party_voice_mailbox
[
24
],
char
original_called_party_voice_mailbox
[
24
],
char
last_redirecting_voice_mailbox
[
24
],
uint32_t
call_instance
,
uint32_t
call_security_status
,
uint32_t
party_pi_restriction_bits
);
switch_status_t
open_receive_channel
(
listener_t
*
listener
,
uint32_t
conference_id
,
uint32_t
pass_thru_party_id
,
uint32_t
packets
,
uint32_t
payload_capacity
,
uint32_t
echo_cancel_type
,
uint32_t
g723_bitrate
,
uint32_t
conference_id2
,
uint32_t
reserved
[
10
]);
uint32_t
conference_id
,
uint32_t
pass_thru_party_id
,
uint32_t
packets
,
uint32_t
payload_capacity
,
uint32_t
echo_cancel_type
,
uint32_t
g723_bitrate
,
uint32_t
conference_id2
,
uint32_t
reserved
[
10
]);
switch_status_t
close_receive_channel
(
listener_t
*
listener
,
uint32_t
conference_id
,
uint32_t
pass_thru_party_id
,
uint32_t
conference_id2
);
uint32_t
conference_id
,
uint32_t
pass_thru_party_id
,
uint32_t
conference_id2
);
switch_status_t
send_select_soft_keys
(
listener_t
*
listener
,
uint32_t
line_instance
,
uint32_t
call_id
,
uint32_t
soft_key_set
,
uint32_t
valid_key_mask
);
uint32_t
line_instance
,
uint32_t
call_id
,
uint32_t
soft_key_set
,
uint32_t
valid_key_mask
);
switch_status_t
send_call_state
(
listener_t
*
listener
,
uint32_t
call_state
,
uint32_t
line_instance
,
uint32_t
call_id
);
uint32_t
call_state
,
uint32_t
line_instance
,
uint32_t
call_id
);
switch_status_t
display_prompt_status
(
listener_t
*
listener
,
uint32_t
timeout
,
char
display
[
32
],
uint32_t
line_instance
,
uint32_t
call_id
);
uint32_t
timeout
,
char
display
[
32
],
uint32_t
line_instance
,
uint32_t
call_id
);
switch_status_t
clear_prompt_status
(
listener_t
*
listener
,
uint32_t
line_instance
,
uint32_t
call_id
);
uint32_t
line_instance
,
uint32_t
call_id
);
switch_status_t
activate_call_plane
(
listener_t
*
listener
,
uint32_t
line_instance
);
uint32_t
line_instance
);
switch_status_t
send_dialed_number
(
listener_t
*
listener
,
char
called_party
[
24
],
uint32_t
line_instance
,
uint32_t
call_id
);
char
called_party
[
24
],
uint32_t
line_instance
,
uint32_t
call_id
);
switch_status_t
send_display_pri_notify
(
listener_t
*
listener
,
uint32_t
message_timeout
,
uint32_t
priority
,
char
*
notify
);
uint32_t
message_timeout
,
uint32_t
priority
,
char
*
notify
);
switch_status_t
send_reset
(
listener_t
*
listener
,
uint32_t
reset_type
);
uint32_t
reset_type
);
#endif
/* _SKINNY_PROTOCOL_H */
...
...
src/mod/endpoints/mod_skinny/skinny_tables.c
浏览文件 @
54e73c77
...
...
@@ -35,157 +35,157 @@
/* Translation tables */
struct
skinny_table
SKINNY_MESSAGE_TYPES
[]
=
{
{
"KeepAliveMessage"
,
KEEP_ALIVE_MESSAGE
},
{
"RegisterMessage"
,
REGISTER_MESSAGE
},
{
"PortMessage"
,
PORT_MESSAGE
},
{
"KeypadButtonMessage"
,
KEYPAD_BUTTON_MESSAGE
},
{
"StimulusMessage"
,
STIMULUS_MESSAGE
},
{
"OffHookMessage"
,
OFF_HOOK_MESSAGE
},
{
"OnHookMessage"
,
ON_HOOK_MESSAGE
},
{
"SpeedDialStatReqMessage"
,
SPEED_DIAL_STAT_REQ_MESSAGE
},
{
"LineStatReqMessage"
,
LINE_STAT_REQ_MESSAGE
},
{
"ConfigStatReqMessage"
,
CONFIG_STAT_REQ_MESSAGE
},
{
"TimeDateReqMessage"
,
TIME_DATE_REQ_MESSAGE
},
{
"ButtonTemplateReqMessage"
,
BUTTON_TEMPLATE_REQ_MESSAGE
},
{
"CapabilitiesReqMessage"
,
CAPABILITIES_RES_MESSAGE
},
{
"AlarmMessage"
,
ALARM_MESSAGE
},
{
"OpenReceiveChannelAckMessage"
,
OPEN_RECEIVE_CHANNEL_ACK_MESSAGE
},
{
"SoftKeySetReqMessage"
,
SOFT_KEY_SET_REQ_MESSAGE
},
{
"SoftKeyEventMessage"
,
SOFT_KEY_EVENT_MESSAGE
},
{
"UnregisterMessage"
,
UNREGISTER_MESSAGE
},
{
"SoftKeyTemplateReqMessage"
,
SOFT_KEY_TEMPLATE_REQ_MESSAGE
},
{
"ServiceUrlStatReqMessage"
,
SERVICE_URL_STAT_REQ_MESSAGE
},
{
"FeatureStatReqMessage"
,
FEATURE_STAT_REQ_MESSAGE
},
{
"HeadsetStatusMessage"
,
HEADSET_STATUS_MESSAGE
},
{
"RegisterAvailableLinesMessage"
,
REGISTER_AVAILABLE_LINES_MESSAGE
},
{
"RegisterAckMessage"
,
REGISTER_ACK_MESSAGE
},
{
"StartToneMessage"
,
START_TONE_MESSAGE
},
{
"StopToneMessage"
,
STOP_TONE_MESSAGE
},
{
"SetRingerMessage"
,
SET_RINGER_MESSAGE
},
{
"SetLampMessage"
,
SET_LAMP_MESSAGE
},
{
"SetSpeakerModeMessage"
,
SET_SPEAKER_MODE_MESSAGE
},
{
"StartMediaTransmissionMessage"
,
START_MEDIA_TRANSMISSION_MESSAGE
},
{
"StopMediaTransmissionMessage"
,
STOP_MEDIA_TRANSMISSION_MESSAGE
},
{
"CallInfoMessage"
,
CALL_INFO_MESSAGE
},
{
"SpeedDialStatResMessage"
,
SPEED_DIAL_STAT_RES_MESSAGE
},
{
"LineStatResMessage"
,
LINE_STAT_RES_MESSAGE
},
{
"ConfigStatResMessage"
,
CONFIG_STAT_RES_MESSAGE
},
{
"DefineTimeDateMessage"
,
DEFINE_TIME_DATE_MESSAGE
},
{
"ButtonTemplateResMessage"
,
BUTTON_TEMPLATE_RES_MESSAGE
},
{
"CapabilitiesReqMessage"
,
CAPABILITIES_REQ_MESSAGE
},
{
"RegisterRejMessage"
,
REGISTER_REJ_MESSAGE
},
{
"ResetMessage"
,
RESET_MESSAGE
},
{
"KeepAliveAckMessage"
,
KEEP_ALIVE_ACK_MESSAGE
},
{
"OpenReceiveChannelMessage"
,
OPEN_RECEIVE_CHANNEL_MESSAGE
},
{
"CloseReceiveChannelMessage"
,
CLOSE_RECEIVE_CHANNEL_MESSAGE
},
{
"SoftKeyTemplateResMessage"
,
SOFT_KEY_TEMPLATE_RES_MESSAGE
},
{
"SoftKeySetResMessage"
,
SOFT_KEY_SET_RES_MESSAGE
},
{
"SelectSoftKeysMessage"
,
SELECT_SOFT_KEYS_MESSAGE
},
{
"CallStateMessage"
,
CALL_STATE_MESSAGE
},
{
"DisplayPromptStatusMessage"
,
DISPLAY_PROMPT_STATUS_MESSAGE
},
{
"ClearPromptStatusMessage"
,
CLEAR_PROMPT_STATUS_MESSAGE
},
{
"ActivateCallPlaneMessage"
,
ACTIVATE_CALL_PLANE_MESSAGE
},
{
"UnregisterAckMessage"
,
UNREGISTER_ACK_MESSAGE
},
{
"DialedNumberMessage"
,
DIALED_NUMBER_MESSAGE
},
{
"FeatureResMessage"
,
FEATURE_STAT_RES_MESSAGE
},
{
"DisplayPriNotifyMessage"
,
DISPLAY_PRI_NOTIFY_MESSAGE
},
{
"ServiceUrlStatMessage"
,
SERVICE_URL_STAT_RES_MESSAGE
},
{
NULL
,
0
}
{
"KeepAliveMessage"
,
KEEP_ALIVE_MESSAGE
},
{
"RegisterMessage"
,
REGISTER_MESSAGE
},
{
"PortMessage"
,
PORT_MESSAGE
},
{
"KeypadButtonMessage"
,
KEYPAD_BUTTON_MESSAGE
},
{
"StimulusMessage"
,
STIMULUS_MESSAGE
},
{
"OffHookMessage"
,
OFF_HOOK_MESSAGE
},
{
"OnHookMessage"
,
ON_HOOK_MESSAGE
},
{
"SpeedDialStatReqMessage"
,
SPEED_DIAL_STAT_REQ_MESSAGE
},
{
"LineStatReqMessage"
,
LINE_STAT_REQ_MESSAGE
},
{
"ConfigStatReqMessage"
,
CONFIG_STAT_REQ_MESSAGE
},
{
"TimeDateReqMessage"
,
TIME_DATE_REQ_MESSAGE
},
{
"ButtonTemplateReqMessage"
,
BUTTON_TEMPLATE_REQ_MESSAGE
},
{
"CapabilitiesReqMessage"
,
CAPABILITIES_RES_MESSAGE
},
{
"AlarmMessage"
,
ALARM_MESSAGE
},
{
"OpenReceiveChannelAckMessage"
,
OPEN_RECEIVE_CHANNEL_ACK_MESSAGE
},
{
"SoftKeySetReqMessage"
,
SOFT_KEY_SET_REQ_MESSAGE
},
{
"SoftKeyEventMessage"
,
SOFT_KEY_EVENT_MESSAGE
},
{
"UnregisterMessage"
,
UNREGISTER_MESSAGE
},
{
"SoftKeyTemplateReqMessage"
,
SOFT_KEY_TEMPLATE_REQ_MESSAGE
},
{
"ServiceUrlStatReqMessage"
,
SERVICE_URL_STAT_REQ_MESSAGE
},
{
"FeatureStatReqMessage"
,
FEATURE_STAT_REQ_MESSAGE
},
{
"HeadsetStatusMessage"
,
HEADSET_STATUS_MESSAGE
},
{
"RegisterAvailableLinesMessage"
,
REGISTER_AVAILABLE_LINES_MESSAGE
},
{
"RegisterAckMessage"
,
REGISTER_ACK_MESSAGE
},
{
"StartToneMessage"
,
START_TONE_MESSAGE
},
{
"StopToneMessage"
,
STOP_TONE_MESSAGE
},
{
"SetRingerMessage"
,
SET_RINGER_MESSAGE
},
{
"SetLampMessage"
,
SET_LAMP_MESSAGE
},
{
"SetSpeakerModeMessage"
,
SET_SPEAKER_MODE_MESSAGE
},
{
"StartMediaTransmissionMessage"
,
START_MEDIA_TRANSMISSION_MESSAGE
},
{
"StopMediaTransmissionMessage"
,
STOP_MEDIA_TRANSMISSION_MESSAGE
},
{
"CallInfoMessage"
,
CALL_INFO_MESSAGE
},
{
"SpeedDialStatResMessage"
,
SPEED_DIAL_STAT_RES_MESSAGE
},
{
"LineStatResMessage"
,
LINE_STAT_RES_MESSAGE
},
{
"ConfigStatResMessage"
,
CONFIG_STAT_RES_MESSAGE
},
{
"DefineTimeDateMessage"
,
DEFINE_TIME_DATE_MESSAGE
},
{
"ButtonTemplateResMessage"
,
BUTTON_TEMPLATE_RES_MESSAGE
},
{
"CapabilitiesReqMessage"
,
CAPABILITIES_REQ_MESSAGE
},
{
"RegisterRejMessage"
,
REGISTER_REJ_MESSAGE
},
{
"ResetMessage"
,
RESET_MESSAGE
},
{
"KeepAliveAckMessage"
,
KEEP_ALIVE_ACK_MESSAGE
},
{
"OpenReceiveChannelMessage"
,
OPEN_RECEIVE_CHANNEL_MESSAGE
},
{
"CloseReceiveChannelMessage"
,
CLOSE_RECEIVE_CHANNEL_MESSAGE
},
{
"SoftKeyTemplateResMessage"
,
SOFT_KEY_TEMPLATE_RES_MESSAGE
},
{
"SoftKeySetResMessage"
,
SOFT_KEY_SET_RES_MESSAGE
},
{
"SelectSoftKeysMessage"
,
SELECT_SOFT_KEYS_MESSAGE
},
{
"CallStateMessage"
,
CALL_STATE_MESSAGE
},
{
"DisplayPromptStatusMessage"
,
DISPLAY_PROMPT_STATUS_MESSAGE
},
{
"ClearPromptStatusMessage"
,
CLEAR_PROMPT_STATUS_MESSAGE
},
{
"ActivateCallPlaneMessage"
,
ACTIVATE_CALL_PLANE_MESSAGE
},
{
"UnregisterAckMessage"
,
UNREGISTER_ACK_MESSAGE
},
{
"DialedNumberMessage"
,
DIALED_NUMBER_MESSAGE
},
{
"FeatureResMessage"
,
FEATURE_STAT_RES_MESSAGE
},
{
"DisplayPriNotifyMessage"
,
DISPLAY_PRI_NOTIFY_MESSAGE
},
{
"ServiceUrlStatMessage"
,
SERVICE_URL_STAT_RES_MESSAGE
},
{
NULL
,
0
}
};
SKINNY_DECLARE_ID2STR
(
skinny_message_type2str
,
SKINNY_MESSAGE_TYPES
,
"UnknownMessage"
)
SKINNY_DECLARE_STR2ID
(
skinny_str2message_type
,
SKINNY_MESSAGE_TYPES
,
-
1
)
struct
skinny_table
SKINNY_RING_TYPES
[]
=
{
{
"RingOff"
,
SKINNY_RING_OFF
},
{
"RingInside"
,
SKINNY_RING_INSIDE
},
{
"RingOutside"
,
SKINNY_RING_OUTSIDE
},
{
"RingFeature"
,
SKINNY_RING_FEATURE
},
{
NULL
,
0
}
{
"RingOff"
,
SKINNY_RING_OFF
},
{
"RingInside"
,
SKINNY_RING_INSIDE
},
{
"RingOutside"
,
SKINNY_RING_OUTSIDE
},
{
"RingFeature"
,
SKINNY_RING_FEATURE
},
{
NULL
,
0
}
};
SKINNY_DECLARE_ID2STR
(
skinny_ring_type2str
,
SKINNY_RING_TYPES
,
"RingTypeUnknown"
)
SKINNY_DECLARE_STR2ID
(
skinny_str2ring_type
,
SKINNY_RING_TYPES
,
-
1
)
struct
skinny_table
SKINNY_RING_MODES
[]
=
{
{
"RingForever"
,
SKINNY_RING_FOREVER
},
{
"RingOnce"
,
SKINNY_RING_ONCE
},
{
NULL
,
0
}
{
"RingForever"
,
SKINNY_RING_FOREVER
},
{
"RingOnce"
,
SKINNY_RING_ONCE
},
{
NULL
,
0
}
};
SKINNY_DECLARE_ID2STR
(
skinny_ring_mode2str
,
SKINNY_RING_MODES
,
"RingModeUnknown"
)
SKINNY_DECLARE_STR2ID
(
skinny_str2ring_mode
,
SKINNY_RING_MODES
,
-
1
)
struct
skinny_table
SKINNY_BUTTONS
[]
=
{
{
"Unknown"
,
SKINNY_BUTTON_UNKNOWN
},
{
"LastNumberRedial"
,
SKINNY_BUTTON_LAST_NUMBER_REDIAL
},
{
"SpeedDial"
,
SKINNY_BUTTON_SPEED_DIAL
},
{
"Line"
,
SKINNY_BUTTON_LINE
},
{
"Voicemail"
,
SKINNY_BUTTON_VOICEMAIL
},
{
"Privacy"
,
SKINNY_BUTTON_PRIVACY
},
{
"ServiceUrl"
,
SKINNY_BUTTON_SERVICE_URL
},
{
"Undefined"
,
SKINNY_BUTTON_UNDEFINED
},
{
NULL
,
0
}
{
"Unknown"
,
SKINNY_BUTTON_UNKNOWN
},
{
"LastNumberRedial"
,
SKINNY_BUTTON_LAST_NUMBER_REDIAL
},
{
"SpeedDial"
,
SKINNY_BUTTON_SPEED_DIAL
},
{
"Line"
,
SKINNY_BUTTON_LINE
},
{
"Voicemail"
,
SKINNY_BUTTON_VOICEMAIL
},
{
"Privacy"
,
SKINNY_BUTTON_PRIVACY
},
{
"ServiceUrl"
,
SKINNY_BUTTON_SERVICE_URL
},
{
"Undefined"
,
SKINNY_BUTTON_UNDEFINED
},
{
NULL
,
0
}
};
SKINNY_DECLARE_ID2STR
(
skinny_button2str
,
SKINNY_BUTTONS
,
"Unknown"
)
SKINNY_DECLARE_STR2ID
(
skinny_str2button
,
SKINNY_BUTTONS
,
-
1
)
struct
skinny_table
SKINNY_LAMP_MODES
[]
=
{
{
"Off"
,
SKINNY_LAMP_OFF
},
{
"On"
,
SKINNY_LAMP_ON
},
{
"Wink"
,
SKINNY_LAMP_WINK
},
{
"Flash"
,
SKINNY_LAMP_FLASH
},
{
"Blink"
,
SKINNY_LAMP_BLINK
},
{
NULL
,
0
}
{
"Off"
,
SKINNY_LAMP_OFF
},
{
"On"
,
SKINNY_LAMP_ON
},
{
"Wink"
,
SKINNY_LAMP_WINK
},
{
"Flash"
,
SKINNY_LAMP_FLASH
},
{
"Blink"
,
SKINNY_LAMP_BLINK
},
{
NULL
,
0
}
};
SKINNY_DECLARE_ID2STR
(
skinny_lamp_mode2str
,
SKINNY_LAMP_MODES
,
"Unknown"
)
SKINNY_DECLARE_STR2ID
(
skinny_str2lamp_mode
,
SKINNY_LAMP_MODES
,
-
1
)
struct
skinny_table
SKINNY_SPEAKER_MODES
[]
=
{
{
"SpeakerOn"
,
SKINNY_SPEAKER_ON
},
{
"SpeakerOff"
,
SKINNY_SPEAKER_OFF
},
{
NULL
,
0
}
{
"SpeakerOn"
,
SKINNY_SPEAKER_ON
},
{
"SpeakerOff"
,
SKINNY_SPEAKER_OFF
},
{
NULL
,
0
}
};
SKINNY_DECLARE_ID2STR
(
skinny_speaker_mode2str
,
SKINNY_SPEAKER_MODES
,
"Unknown"
)
SKINNY_DECLARE_STR2ID
(
skinny_str2speaker_mode
,
SKINNY_SPEAKER_MODES
,
-
1
)
struct
skinny_table
SKINNY_KEY_SETS
[]
=
{
{
"KeySetOnHook"
,
SKINNY_KEY_SET_ON_HOOK
},
{
"KeySetConnected"
,
SKINNY_KEY_SET_CONNECTED
},
{
"KeySetOnHold"
,
SKINNY_KEY_SET_ON_HOLD
},
{
"KeySetRingIn"
,
SKINNY_KEY_SET_RING_IN
},
{
"KeySetOffHook"
,
SKINNY_KEY_SET_OFF_HOOK
},
{
"KeySetConnectedWithTransfer"
,
SKINNY_KEY_SET_CONNECTED_WITH_TRANSFER
},
{
"KeySetDigitsAfterDialingFirstDigit"
,
SKINNY_KEY_SET_DIGITS_AFTER_DIALING_FIRST_DIGIT
},
{
"KeySetConnectedWithConference"
,
SKINNY_KEY_SET_CONNECTED_WITH_CONFERENCE
},
{
"KeySetRingOut"
,
SKINNY_KEY_SET_RING_OUT
},
{
"KeySetOffHookWithFeatures"
,
SKINNY_KEY_SET_OFF_HOOK_WITH_FEATURES
},
{
NULL
,
0
}
{
"KeySetOnHook"
,
SKINNY_KEY_SET_ON_HOOK
},
{
"KeySetConnected"
,
SKINNY_KEY_SET_CONNECTED
},
{
"KeySetOnHold"
,
SKINNY_KEY_SET_ON_HOLD
},
{
"KeySetRingIn"
,
SKINNY_KEY_SET_RING_IN
},
{
"KeySetOffHook"
,
SKINNY_KEY_SET_OFF_HOOK
},
{
"KeySetConnectedWithTransfer"
,
SKINNY_KEY_SET_CONNECTED_WITH_TRANSFER
},
{
"KeySetDigitsAfterDialingFirstDigit"
,
SKINNY_KEY_SET_DIGITS_AFTER_DIALING_FIRST_DIGIT
},
{
"KeySetConnectedWithConference"
,
SKINNY_KEY_SET_CONNECTED_WITH_CONFERENCE
},
{
"KeySetRingOut"
,
SKINNY_KEY_SET_RING_OUT
},
{
"KeySetOffHookWithFeatures"
,
SKINNY_KEY_SET_OFF_HOOK_WITH_FEATURES
},
{
NULL
,
0
}
};
SKINNY_DECLARE_ID2STR
(
skinny_soft_key_set2str
,
SKINNY_KEY_SETS
,
"UNKNOWN_SOFT_KEY_SET"
)
SKINNY_DECLARE_STR2ID
(
skinny_str2soft_key_set
,
SKINNY_KEY_SETS
,
-
1
)
struct
skinny_table
SKINNY_CALL_STATES
[]
=
{
{
"OffHook"
,
SKINNY_OFF_HOOK
},
{
"OnHook"
,
SKINNY_ON_HOOK
},
{
"RingOut"
,
SKINNY_RING_OUT
},
{
"RingIn"
,
SKINNY_RING_IN
},
{
"Connected"
,
SKINNY_CONNECTED
},
{
"Busy"
,
SKINNY_BUSY
},
{
"LineInUse"
,
SKINNY_LINE_IN_USE
},
{
"Hold"
,
SKINNY_HOLD
},
{
"CallWaiting"
,
SKINNY_CALL_WAITING
},
{
"CallTransfer"
,
SKINNY_CALL_TRANSFER
},
{
"CallPark"
,
SKINNY_CALL_PARK
},
{
"Proceed"
,
SKINNY_PROCEED
},
{
"InUseRemotely"
,
SKINNY_IN_USE_REMOTELY
},
{
"InvalidNumber"
,
SKINNY_INVALID_NUMBER
},
{
NULL
,
0
}
{
"OffHook"
,
SKINNY_OFF_HOOK
},
{
"OnHook"
,
SKINNY_ON_HOOK
},
{
"RingOut"
,
SKINNY_RING_OUT
},
{
"RingIn"
,
SKINNY_RING_IN
},
{
"Connected"
,
SKINNY_CONNECTED
},
{
"Busy"
,
SKINNY_BUSY
},
{
"LineInUse"
,
SKINNY_LINE_IN_USE
},
{
"Hold"
,
SKINNY_HOLD
},
{
"CallWaiting"
,
SKINNY_CALL_WAITING
},
{
"CallTransfer"
,
SKINNY_CALL_TRANSFER
},
{
"CallPark"
,
SKINNY_CALL_PARK
},
{
"Proceed"
,
SKINNY_PROCEED
},
{
"InUseRemotely"
,
SKINNY_IN_USE_REMOTELY
},
{
"InvalidNumber"
,
SKINNY_INVALID_NUMBER
},
{
NULL
,
0
}
};
SKINNY_DECLARE_ID2STR
(
skinny_call_state2str
,
SKINNY_CALL_STATES
,
"CallStateUnknown"
)
SKINNY_DECLARE_STR2ID
(
skinny_str2call_state
,
SKINNY_CALL_STATES
,
-
1
)
struct
skinny_table
SKINNY_DEVICE_RESET_TYPES
[]
=
{
{
"DeviceReset"
,
SKINNY_DEVICE_RESET
},
{
"DeviceRestart"
,
SKINNY_DEVICE_RESTART
},
{
NULL
,
0
}
{
"DeviceReset"
,
SKINNY_DEVICE_RESET
},
{
"DeviceRestart"
,
SKINNY_DEVICE_RESTART
},
{
NULL
,
0
}
};
SKINNY_DECLARE_ID2STR
(
skinny_device_reset_type2str
,
SKINNY_DEVICE_RESET_TYPES
,
"DeviceResetTypeUnknown"
)
SKINNY_DECLARE_STR2ID
(
skinny_str2device_reset_type
,
SKINNY_DEVICE_RESET_TYPES
,
-
1
)
...
...
src/mod/endpoints/mod_skinny/skinny_tables.h
浏览文件 @
54e73c77
...
...
@@ -36,53 +36,53 @@
/* SKINNY TABLES */
/*****************************************************************************/
struct
skinny_table
{
const
char
*
name
;
uint32_t
id
;
const
char
*
name
;
uint32_t
id
;
};
#define SKINNY_DECLARE_ID2STR(func, TABLE, DEFAULT_STR) \
const char *func(uint32_t id) \
{ \
const char *str = DEFAULT_STR; \
\
for (uint8_t x = 0; x < (sizeof(TABLE) / sizeof(struct skinny_table)) - 1; x++) {\
if (TABLE[x].id == id) {\
str = TABLE[x].name;\
break;\
}\
}\
\
return str;\
const char *str = DEFAULT_STR; \
\
for (uint8_t x = 0; x < (sizeof(TABLE) / sizeof(struct skinny_table)) - 1; x++) {\
if (TABLE[x].id == id) {\
str = TABLE[x].name;\
break;\
}\
}\
\
return str;\
}
#define SKINNY_DECLARE_STR2ID(func, TABLE, DEFAULT_ID) \
uint32_t func(const char *str)\
{\
uint32_t id = DEFAULT_ID;\
\
if (*str > 47 && *str < 58) {\
id = atoi(str);\
} else {\
for (uint8_t x = 0; x < (sizeof(TABLE) / sizeof(struct skinny_table)) - 1 && TABLE[x].name; x++) {\
if (!strcasecmp(TABLE[x].name, str)) {\
id = TABLE[x].id;\
break;\
}\
}\
}\
return id;\
uint32_t id = DEFAULT_ID;\
\
if (*str > 47 && *str < 58) {\
id = atoi(str);\
} else {\
for (uint8_t x = 0; x < (sizeof(TABLE) / sizeof(struct skinny_table)) - 1 && TABLE[x].name; x++) {\
if (!strcasecmp(TABLE[x].name, str)) {\
id = TABLE[x].id;\
break;\
}\
}\
}\
return id;\
}
#define SKINNY_DECLARE_PUSH_MATCH(TABLE) \
switch_console_callback_match_t *my_matches = NULL;\
for (uint8_t x = 0; x < (sizeof(TABLE) / sizeof(struct skinny_table)) - 1; x++) {\
switch_console_push_match(&my_matches, TABLE[x].name);\
}\
if (my_matches) {\
*matches = my_matches;\
status = SWITCH_STATUS_SUCCESS;\
}
switch_console_callback_match_t *my_matches = NULL;\
for (uint8_t x = 0; x < (sizeof(TABLE) / sizeof(struct skinny_table)) - 1; x++) {\
switch_console_push_match(&my_matches, TABLE[x].name);\
}\
if (my_matches) {\
*matches = my_matches;\
status = SWITCH_STATUS_SUCCESS;\
}
struct
skinny_table
SKINNY_MESSAGE_TYPES
[
56
];
const
char
*
skinny_message_type2str
(
uint32_t
id
);
...
...
@@ -90,20 +90,20 @@ uint32_t skinny_str2message_type(const char *str);
#define SKINNY_PUSH_MESSAGE_TYPES SKINNY_DECLARE_PUSH_MATCH(SKINNY_MESSAGE_TYPES)
enum
skinny_tone
{
SKINNY_TONE_SILENCE
=
0x00
,
SKINNY_TONE_DIALTONE
=
0x21
,
SKINNY_TONE_BUSYTONE
=
0x23
,
SKINNY_TONE_ALERT
=
0x24
,
SKINNY_TONE_REORDER
=
0x25
,
SKINNY_TONE_CALLWAITTONE
=
0x2D
,
SKINNY_TONE_NOTONE
=
0x7F
,
SKINNY_TONE_SILENCE
=
0x00
,
SKINNY_TONE_DIALTONE
=
0x21
,
SKINNY_TONE_BUSYTONE
=
0x23
,
SKINNY_TONE_ALERT
=
0x24
,
SKINNY_TONE_REORDER
=
0x25
,
SKINNY_TONE_CALLWAITTONE
=
0x2D
,
SKINNY_TONE_NOTONE
=
0x7F
,
};
enum
skinny_ring_type
{
SKINNY_RING_OFF
=
1
,
SKINNY_RING_INSIDE
=
2
,
SKINNY_RING_OUTSIDE
=
3
,
SKINNY_RING_FEATURE
=
4
SKINNY_RING_OFF
=
1
,
SKINNY_RING_INSIDE
=
2
,
SKINNY_RING_OUTSIDE
=
3
,
SKINNY_RING_FEATURE
=
4
};
struct
skinny_table
SKINNY_RING_TYPES
[
5
];
const
char
*
skinny_ring_type2str
(
uint32_t
id
);
...
...
@@ -111,8 +111,8 @@ uint32_t skinny_str2ring_type(const char *str);
#define SKINNY_PUSH_RING_TYPES SKINNY_DECLARE_PUSH_MATCH(SKINNY_RING_TYPES)
enum
skinny_ring_mode
{
SKINNY_RING_FOREVER
=
1
,
SKINNY_RING_ONCE
=
2
,
SKINNY_RING_FOREVER
=
1
,
SKINNY_RING_ONCE
=
2
,
};
struct
skinny_table
SKINNY_RING_MODES
[
3
];
const
char
*
skinny_ring_mode2str
(
uint32_t
id
);
...
...
@@ -121,11 +121,11 @@ uint32_t skinny_str2ring_mode(const char *str);
enum
skinny_lamp_mode
{
SKINNY_LAMP_OFF
=
1
,
SKINNY_LAMP_ON
=
2
,
SKINNY_LAMP_WINK
=
3
,
SKINNY_LAMP_FLASH
=
4
,
SKINNY_LAMP_BLINK
=
5
,
SKINNY_LAMP_OFF
=
1
,
SKINNY_LAMP_ON
=
2
,
SKINNY_LAMP_WINK
=
3
,
SKINNY_LAMP_FLASH
=
4
,
SKINNY_LAMP_BLINK
=
5
,
};
struct
skinny_table
SKINNY_LAMP_MODES
[
6
];
const
char
*
skinny_lamp_mode2str
(
uint32_t
id
);
...
...
@@ -133,8 +133,8 @@ uint32_t skinny_str2lamp_mode(const char *str);
#define SKINNY_PUSH_LAMP_MODES SKINNY_DECLARE_PUSH_MATCH(SKINNY_LAMP_MODES)
enum
skinny_speaker_mode
{
SKINNY_SPEAKER_ON
=
1
,
SKINNY_SPEAKER_OFF
=
2
,
SKINNY_SPEAKER_ON
=
1
,
SKINNY_SPEAKER_OFF
=
2
,
};
struct
skinny_table
SKINNY_SPEAKER_MODES
[
3
];
const
char
*
skinny_speaker_mode2str
(
uint32_t
id
);
...
...
@@ -142,20 +142,20 @@ uint32_t skinny_str2speaker_mode(const char *str);
#define SKINNY_PUSH_SPEAKER_MODES SKINNY_DECLARE_PUSH_MATCH(SKINNY_SPEAKER_MODES)
enum
skinny_call_type
{
SKINNY_INBOUND_CALL
=
1
,
SKINNY_OUTBOUND_CALL
=
2
,
SKINNY_FORWARD_CALL
=
3
,
SKINNY_INBOUND_CALL
=
1
,
SKINNY_OUTBOUND_CALL
=
2
,
SKINNY_FORWARD_CALL
=
3
,
};
enum
skinny_button_definition
{
SKINNY_BUTTON_UNKNOWN
=
0x00
,
SKINNY_BUTTON_LAST_NUMBER_REDIAL
=
0x01
,
SKINNY_BUTTON_SPEED_DIAL
=
0x02
,
SKINNY_BUTTON_LINE
=
0x09
,
SKINNY_BUTTON_VOICEMAIL
=
0x0F
,
SKINNY_BUTTON_PRIVACY
=
0x13
,
SKINNY_BUTTON_SERVICE_URL
=
0x14
,
SKINNY_BUTTON_UNDEFINED
=
0xFF
,
SKINNY_BUTTON_UNKNOWN
=
0x00
,
SKINNY_BUTTON_LAST_NUMBER_REDIAL
=
0x01
,
SKINNY_BUTTON_SPEED_DIAL
=
0x02
,
SKINNY_BUTTON_LINE
=
0x09
,
SKINNY_BUTTON_VOICEMAIL
=
0x0F
,
SKINNY_BUTTON_PRIVACY
=
0x13
,
SKINNY_BUTTON_SERVICE_URL
=
0x14
,
SKINNY_BUTTON_UNDEFINED
=
0xFF
,
};
struct
skinny_table
SKINNY_BUTTONS
[
9
];
const
char
*
skinny_button2str
(
uint32_t
id
);
...
...
@@ -163,39 +163,39 @@ uint32_t skinny_str2button(const char *str);
#define SKINNY_PUSH_STIMULI SKINNY_DECLARE_PUSH_MATCH(SKINNY_BUTTONS)
enum
skinny_soft_key_event
{
SOFTKEY_REDIAL
=
0x01
,
SOFTKEY_NEWCALL
=
0x02
,
SOFTKEY_HOLD
=
0x03
,
SOFTKEY_TRANSFER
=
0x04
,
SOFTKEY_CFWDALL
=
0x05
,
SOFTKEY_CFWDBUSY
=
0x06
,
SOFTKEY_CFWDNOANSWER
=
0x07
,
SOFTKEY_BACKSPACE
=
0x08
,
SOFTKEY_ENDCALL
=
0x09
,
SOFTKEY_RESUME
=
0x0A
,
SOFTKEY_ANSWER
=
0x0B
,
SOFTKEY_INFO
=
0x0C
,
SOFTKEY_CONFRM
=
0x0D
,
SOFTKEY_PARK
=
0x0E
,
SOFTKEY_JOIN
=
0x0F
,
SOFTKEY_MEETMECONFRM
=
0x10
,
SOFTKEY_CALLPICKUP
=
0x11
,
SOFTKEY_GRPCALLPICKUP
=
0x12
,
SOFTKEY_DND
=
0x13
,
SOFTKEY_IDIVERT
=
0x14
,
SOFTKEY_REDIAL
=
0x01
,
SOFTKEY_NEWCALL
=
0x02
,
SOFTKEY_HOLD
=
0x03
,
SOFTKEY_TRANSFER
=
0x04
,
SOFTKEY_CFWDALL
=
0x05
,
SOFTKEY_CFWDBUSY
=
0x06
,
SOFTKEY_CFWDNOANSWER
=
0x07
,
SOFTKEY_BACKSPACE
=
0x08
,
SOFTKEY_ENDCALL
=
0x09
,
SOFTKEY_RESUME
=
0x0A
,
SOFTKEY_ANSWER
=
0x0B
,
SOFTKEY_INFO
=
0x0C
,
SOFTKEY_CONFRM
=
0x0D
,
SOFTKEY_PARK
=
0x0E
,
SOFTKEY_JOIN
=
0x0F
,
SOFTKEY_MEETMECONFRM
=
0x10
,
SOFTKEY_CALLPICKUP
=
0x11
,
SOFTKEY_GRPCALLPICKUP
=
0x12
,
SOFTKEY_DND
=
0x13
,
SOFTKEY_IDIVERT
=
0x14
,
};
enum
skinny_key_set
{
SKINNY_KEY_SET_ON_HOOK
=
0
,
SKINNY_KEY_SET_CONNECTED
=
1
,
SKINNY_KEY_SET_ON_HOLD
=
2
,
SKINNY_KEY_SET_RING_IN
=
3
,
SKINNY_KEY_SET_OFF_HOOK
=
4
,
SKINNY_KEY_SET_CONNECTED_WITH_TRANSFER
=
5
,
SKINNY_KEY_SET_DIGITS_AFTER_DIALING_FIRST_DIGIT
=
6
,
SKINNY_KEY_SET_CONNECTED_WITH_CONFERENCE
=
7
,
SKINNY_KEY_SET_RING_OUT
=
8
,
SKINNY_KEY_SET_OFF_HOOK_WITH_FEATURES
=
9
,
SKINNY_KEY_SET_ON_HOOK
=
0
,
SKINNY_KEY_SET_CONNECTED
=
1
,
SKINNY_KEY_SET_ON_HOLD
=
2
,
SKINNY_KEY_SET_RING_IN
=
3
,
SKINNY_KEY_SET_OFF_HOOK
=
4
,
SKINNY_KEY_SET_CONNECTED_WITH_TRANSFER
=
5
,
SKINNY_KEY_SET_DIGITS_AFTER_DIALING_FIRST_DIGIT
=
6
,
SKINNY_KEY_SET_CONNECTED_WITH_CONFERENCE
=
7
,
SKINNY_KEY_SET_RING_OUT
=
8
,
SKINNY_KEY_SET_OFF_HOOK_WITH_FEATURES
=
9
,
};
struct
skinny_table
SKINNY_KEY_SETS
[
11
];
const
char
*
skinny_soft_key_set2str
(
uint32_t
id
);
...
...
@@ -204,20 +204,20 @@ uint32_t skinny_str2soft_key_set(const char *str);
enum
skinny_call_state
{
SKINNY_OFF_HOOK
=
1
,
SKINNY_ON_HOOK
=
2
,
SKINNY_RING_OUT
=
3
,
SKINNY_RING_IN
=
4
,
SKINNY_CONNECTED
=
5
,
SKINNY_BUSY
=
6
,
SKINNY_LINE_IN_USE
=
7
,
SKINNY_HOLD
=
8
,
SKINNY_CALL_WAITING
=
9
,
SKINNY_CALL_TRANSFER
=
10
,
SKINNY_CALL_PARK
=
11
,
SKINNY_PROCEED
=
12
,
SKINNY_IN_USE_REMOTELY
=
13
,
SKINNY_INVALID_NUMBER
=
14
SKINNY_OFF_HOOK
=
1
,
SKINNY_ON_HOOK
=
2
,
SKINNY_RING_OUT
=
3
,
SKINNY_RING_IN
=
4
,
SKINNY_CONNECTED
=
5
,
SKINNY_BUSY
=
6
,
SKINNY_LINE_IN_USE
=
7
,
SKINNY_HOLD
=
8
,
SKINNY_CALL_WAITING
=
9
,
SKINNY_CALL_TRANSFER
=
10
,
SKINNY_CALL_PARK
=
11
,
SKINNY_PROCEED
=
12
,
SKINNY_IN_USE_REMOTELY
=
13
,
SKINNY_INVALID_NUMBER
=
14
};
struct
skinny_table
SKINNY_CALL_STATES
[
15
];
const
char
*
skinny_call_state2str
(
uint32_t
id
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论