Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
730d2f88
提交
730d2f88
authored
6月 13, 2014
作者:
Chris Rienzo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
mod_rayo: rename reference counting functions to something more sensible
上级
9aa51021
全部展开
显示空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
90 行增加
和
86 行删除
+90
-86
mod_rayo.c
src/mod/event_handlers/mod_rayo/mod_rayo.c
+49
-49
mod_rayo.h
src/mod/event_handlers/mod_rayo/mod_rayo.h
+4
-4
rayo_components.c
src/mod/event_handlers/mod_rayo/rayo_components.c
+2
-2
rayo_cpa_component.c
src/mod/event_handlers/mod_rayo/rayo_cpa_component.c
+6
-6
rayo_fax_components.c
src/mod/event_handlers/mod_rayo/rayo_fax_components.c
+5
-5
rayo_input_component.c
src/mod/event_handlers/mod_rayo/rayo_input_component.c
+13
-9
rayo_output_component.c
src/mod/event_handlers/mod_rayo/rayo_output_component.c
+4
-4
rayo_prompt_component.c
src/mod/event_handlers/mod_rayo/rayo_prompt_component.c
+2
-2
rayo_record_component.c
src/mod/event_handlers/mod_rayo/rayo_record_component.c
+5
-5
没有找到文件。
src/mod/event_handlers/mod_rayo/mod_rayo.c
浏览文件 @
730d2f88
差异被折叠。
点击展开。
src/mod/event_handlers/mod_rayo/mod_rayo.h
浏览文件 @
730d2f88
...
...
@@ -142,8 +142,8 @@ extern iks *rayo_message_remove_payload(struct rayo_message *msg);
extern
struct
rayo_actor
*
rayo_actor_locate
(
const
char
*
jid
,
const
char
*
file
,
int
line
);
extern
struct
rayo_actor
*
rayo_actor_locate_by_id
(
const
char
*
id
,
const
char
*
file
,
int
line
);
extern
int
rayo_actor_seq_next
(
struct
rayo_actor
*
actor
);
extern
void
rayo_actor_r
dlock
(
struct
rayo_actor
*
actor
,
const
char
*
file
,
int
line
);
extern
void
rayo_actor_
unlock
(
struct
rayo_actor
*
actor
,
const
char
*
file
,
int
line
);
extern
void
rayo_actor_r
etain
(
struct
rayo_actor
*
actor
,
const
char
*
file
,
int
line
);
extern
void
rayo_actor_
release
(
struct
rayo_actor
*
actor
,
const
char
*
file
,
int
line
);
extern
void
rayo_actor_destroy
(
struct
rayo_actor
*
actor
,
const
char
*
file
,
int
line
);
#define RAYO_LOCATE(jid) rayo_actor_locate(jid, __FILE__, __LINE__)
...
...
@@ -153,8 +153,8 @@ extern void rayo_actor_destroy(struct rayo_actor *actor, const char *file, int l
#define RAYO_JID(x) RAYO_ACTOR(x)->jid
#define RAYO_ID(x) RAYO_ACTOR(x)->id
#define RAYO_POOL(x) RAYO_ACTOR(x)->pool
#define RAYO_R
DLOCK(x) rayo_actor_rdlock
(RAYO_ACTOR(x), __FILE__, __LINE__)
#define RAYO_
UNLOCK(x) rayo_actor_unlock
(RAYO_ACTOR(x), __FILE__, __LINE__)
#define RAYO_R
ETAIN(x) rayo_actor_retain
(RAYO_ACTOR(x), __FILE__, __LINE__)
#define RAYO_
RELEASE(x) rayo_actor_release
(RAYO_ACTOR(x), __FILE__, __LINE__)
#define RAYO_DESTROY(x) rayo_actor_destroy(RAYO_ACTOR(x), __FILE__, __LINE__)
#define RAYO_SEQ_NEXT(x) rayo_actor_seq_next(RAYO_ACTOR(x))
...
...
src/mod/event_handlers/mod_rayo/rayo_components.c
浏览文件 @
730d2f88
...
...
@@ -43,7 +43,7 @@ struct rayo_component *rayo_component_locate(const char *id, const char *file, i
if
(
actor
&&
is_component_actor
(
actor
))
{
return
RAYO_COMPONENT
(
actor
);
}
else
if
(
actor
)
{
RAYO_
UNLOCK
(
actor
);
RAYO_
RELEASE
(
actor
);
}
return
NULL
;
}
...
...
@@ -114,7 +114,7 @@ void rayo_component_send_complete_event(struct rayo_component *component, iks *r
{
component
->
complete
=
1
;
RAYO_SEND_REPLY
(
component
,
iks_find_attrib
(
response
,
"to"
),
response
);
RAYO_
UNLOCK
(
component
);
RAYO_
RELEASE
(
component
);
RAYO_DESTROY
(
component
);
}
...
...
src/mod/event_handlers/mod_rayo/rayo_cpa_component.c
浏览文件 @
730d2f88
...
...
@@ -236,7 +236,7 @@ static void rayo_cpa_detector_event(const char *jid, void *user_data)
}
else
{
switch_log_printf
(
SWITCH_CHANNEL_UUID_LOG
(
RAYO_COMPONENT
(
component
)
->
parent
->
id
),
SWITCH_LOG_DEBUG
,
"Skipping CPA event
\n
"
);
}
RAYO_
UNLOCK
(
component
);
RAYO_
RELEASE
(
component
);
}
}
...
...
@@ -257,7 +257,7 @@ static void rayo_cpa_component_hangup(const char *jid, void *user_data)
if
(
component
)
{
stop_cpa_detectors
(
CPA_COMPONENT
(
component
));
rayo_component_send_complete
(
RAYO_COMPONENT
(
component
),
COMPONENT_COMPLETE_HANGUP
);
RAYO_
UNLOCK
(
component
);
RAYO_
RELEASE
(
component
);
}
}
...
...
@@ -303,7 +303,7 @@ iks *rayo_cpa_component_start(struct rayo_actor *call, struct rayo_message *msg,
if
(
zstr
(
url
))
{
stop_cpa_detectors
(
component
);
RAYO_
UNLOCK
(
component
);
RAYO_
RELEASE
(
component
);
RAYO_DESTROY
(
component
);
return
iks_new_error_detailed
(
iq
,
STANZA_ERROR_BAD_REQUEST
,
"Missing grammar URL"
);
}
...
...
@@ -318,7 +318,7 @@ iks *rayo_cpa_component_start(struct rayo_actor *call, struct rayo_message *msg,
if
(
switch_core_hash_find
(
component
->
signals
,
url
))
{
free
(
url_dup
);
stop_cpa_detectors
(
component
);
RAYO_
UNLOCK
(
component
);
RAYO_
RELEASE
(
component
);
RAYO_DESTROY
(
component
);
return
iks_new_error_detailed
(
iq
,
STANZA_ERROR_BAD_REQUEST
,
"Duplicate URL"
);
}
...
...
@@ -334,7 +334,7 @@ iks *rayo_cpa_component_start(struct rayo_actor *call, struct rayo_message *msg,
}
else
{
free
(
url_dup
);
stop_cpa_detectors
(
component
);
RAYO_
UNLOCK
(
component
);
RAYO_
RELEASE
(
component
);
RAYO_DESTROY
(
component
);
return
iks_new_error_detailed
(
iq
,
STANZA_ERROR_INTERNAL_SERVER_ERROR
,
error_str
);
}
...
...
@@ -345,7 +345,7 @@ iks *rayo_cpa_component_start(struct rayo_actor *call, struct rayo_message *msg,
if
(
!
have_grammar
)
{
stop_cpa_detectors
(
component
);
RAYO_
UNLOCK
(
component
);
RAYO_
RELEASE
(
component
);
RAYO_DESTROY
(
component
);
return
iks_new_error_detailed
(
iq
,
STANZA_ERROR_BAD_REQUEST
,
"No grammar defined"
);
}
...
...
src/mod/event_handlers/mod_rayo/rayo_fax_components.c
浏览文件 @
730d2f88
...
...
@@ -217,7 +217,7 @@ static iks *start_sendfax_component(struct rayo_actor *call, struct rayo_message
switch_event_destroy
(
&
execute_event
);
}
rayo_call_set_faxing
(
RAYO_CALL
(
call
),
0
);
RAYO_
UNLOCK
(
sendfax_component
);
RAYO_
RELEASE
(
sendfax_component
);
}
else
{
/* component starting... */
rayo_component_send_start
(
RAYO_COMPONENT
(
sendfax_component
),
iq
);
...
...
@@ -225,7 +225,7 @@ static iks *start_sendfax_component(struct rayo_actor *call, struct rayo_message
}
else
{
response
=
iks_new_error_detailed
(
iq
,
STANZA_ERROR_INTERNAL_SERVER_ERROR
,
"failed to create txfax event"
);
rayo_call_set_faxing
(
RAYO_CALL
(
call
),
0
);
RAYO_
UNLOCK
(
sendfax_component
);
RAYO_
RELEASE
(
sendfax_component
);
}
return
response
;
...
...
@@ -320,7 +320,7 @@ static iks *start_receivefax_component(struct rayo_actor *call, struct rayo_mess
switch_event_destroy
(
&
execute_event
);
}
rayo_call_set_faxing
(
RAYO_CALL
(
call
),
0
);
RAYO_
UNLOCK
(
receivefax_component
);
RAYO_
RELEASE
(
receivefax_component
);
}
else
{
/* component starting... */
rayo_component_send_start
(
RAYO_COMPONENT
(
receivefax_component
),
iq
);
...
...
@@ -328,7 +328,7 @@ static iks *start_receivefax_component(struct rayo_actor *call, struct rayo_mess
}
else
{
response
=
iks_new_error_detailed
(
iq
,
STANZA_ERROR_INTERNAL_SERVER_ERROR
,
"failed to create rxfax event"
);
rayo_call_set_faxing
(
RAYO_CALL
(
call
),
0
);
RAYO_
UNLOCK
(
receivefax_component
);
RAYO_
RELEASE
(
receivefax_component
);
}
return
response
;
...
...
@@ -463,7 +463,7 @@ static void on_execute_complete_event(switch_event_t *event)
rayo_component_send_complete_event
(
RAYO_COMPONENT
(
component
),
result
);
RAYO_
UNLOCK
(
component
);
RAYO_
RELEASE
(
component
);
}
}
}
...
...
src/mod/event_handlers/mod_rayo/rayo_input_component.c
浏览文件 @
730d2f88
...
...
@@ -551,7 +551,7 @@ static iks *start_call_voice_input(struct input_component *component, switch_cor
if
(
component
->
speech_mode
&&
handler
->
voice_component
)
{
/* don't allow multi voice input */
RAYO_
UNLOCK
(
component
);
RAYO_
RELEASE
(
component
);
RAYO_DESTROY
(
component
);
return
iks_new_error_detailed
(
iq
,
STANZA_ERROR_CONFLICT
,
"Multiple voice input is not allowed"
);
}
...
...
@@ -565,7 +565,7 @@ static iks *start_call_voice_input(struct input_component *component, switch_cor
/* if recognition engine is different, we can't handle this request */
if
(
!
zstr
(
handler
->
last_recognizer
)
&&
strcmp
(
component
->
recognizer
,
handler
->
last_recognizer
))
{
handler
->
voice_component
=
NULL
;
RAYO_
UNLOCK
(
component
);
RAYO_
RELEASE
(
component
);
RAYO_DESTROY
(
component
);
return
iks_new_error_detailed
(
iq
,
STANZA_ERROR_BAD_REQUEST
,
"Must use the same recognizer for the entire call"
);
}
else
if
(
zstr
(
handler
->
last_recognizer
))
{
...
...
@@ -582,7 +582,7 @@ static iks *start_call_voice_input(struct input_component *component, switch_cor
if
(
!
grammar
)
{
handler
->
voice_component
=
NULL
;
RAYO_
UNLOCK
(
component
);
RAYO_
RELEASE
(
component
);
RAYO_DESTROY
(
component
);
return
iks_new_error_detailed
(
iq
,
stanza_error
,
error_detail
);
}
...
...
@@ -614,7 +614,7 @@ static iks *start_call_dtmf_input(struct input_component *component, switch_core
/* parse the grammar */
if
(
!
(
component
->
grammar
=
srgs_parse
(
globals
.
parser
,
iks_find_cdata
(
input
,
"grammar"
))))
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_DEBUG
,
"Failed to parse grammar body
\n
"
);
RAYO_
UNLOCK
(
component
);
RAYO_
RELEASE
(
component
);
RAYO_DESTROY
(
component
);
return
iks_new_error_detailed
(
iq
,
STANZA_ERROR_BAD_REQUEST
,
"Failed to parse grammar body"
);
}
...
...
@@ -654,7 +654,7 @@ static iks *start_call_input(struct input_component *component, switch_core_sess
/* fire up media bug to monitor lifecycle */
if
(
switch_core_media_bug_add
(
session
,
"rayo_input_component"
,
NULL
,
input_handler_bug_callback
,
handler
,
0
,
SMBF_READ_REPLACE
,
&
handler
->
bug
)
!=
SWITCH_STATUS_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_DEBUG
,
"Failed to create input handler media bug
\n
"
);
RAYO_
UNLOCK
(
component
);
RAYO_
RELEASE
(
component
);
RAYO_DESTROY
(
component
);
return
iks_new_error_detailed
(
iq
,
STANZA_ERROR_INTERNAL_SERVER_ERROR
,
"Failed to create input handler media bug"
);
}
...
...
@@ -666,7 +666,7 @@ static iks *start_call_input(struct input_component *component, switch_core_sess
/* handler bug was destroyed */
switch_mutex_unlock
(
handler
->
mutex
);
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_DEBUG
,
"Input handler media bug is closed
\n
"
);
RAYO_
UNLOCK
(
component
);
RAYO_
RELEASE
(
component
);
RAYO_DESTROY
(
component
);
return
iks_new_error_detailed
(
iq
,
STANZA_ERROR_INTERNAL_SERVER_ERROR
,
"Input handler media bug is closed
\n
"
);
}
...
...
@@ -767,7 +767,9 @@ static iks *stop_call_input_component(struct rayo_actor *component, struct rayo_
switch_mutex_lock
(
input_component
->
handler
->
mutex
);
input_component
->
stop
=
1
;
if
(
input_component
->
speech_mode
)
{
switch_mutex_unlock
(
input_component
->
handler
->
mutex
);
switch_ivr_stop_detect_speech
(
session
);
switch_mutex_lock
(
input_component
->
handler
->
mutex
);
rayo_component_send_complete
(
RAYO_COMPONENT
(
component
),
COMPONENT_COMPLETE_STOP
);
}
switch_mutex_unlock
(
input_component
->
handler
->
mutex
);
...
...
@@ -789,7 +791,9 @@ static iks *start_timers_call_input_component(struct rayo_actor *component, stru
if
(
session
)
{
switch_mutex_lock
(
input_component
->
handler
->
mutex
);
if
(
input_component
->
speech_mode
)
{
switch_mutex_unlock
(
input_component
->
handler
->
mutex
);
switch_ivr_detect_speech_start_input_timers
(
session
);
switch_mutex_lock
(
input_component
->
handler
->
mutex
);
}
else
{
input_component
->
last_digit_time
=
switch_micro_time_now
();
input_component
->
start_timers
=
1
;
...
...
@@ -861,7 +865,7 @@ static void on_detected_speech_event(switch_event_t *event)
rayo_component_send_complete
(
component
,
INPUT_NOMATCH
);
}
}
RAYO_
UNLOCK
(
component
);
RAYO_
RELEASE
(
component
);
}
}
else
if
(
!
strcasecmp
(
"begin-speaking"
,
speech_type
))
{
char
*
component_id
=
switch_mprintf
(
"%s-input-voice"
,
uuid
);
...
...
@@ -870,7 +874,7 @@ static void on_detected_speech_event(switch_event_t *event)
if
(
component
&&
INPUT_COMPONENT
(
component
)
->
barge_event
)
{
send_barge_event
(
component
);
}
RAYO_
UNLOCK
(
component
);
RAYO_
RELEASE
(
component
);
}
else
if
(
!
strcasecmp
(
"closed"
,
speech_type
))
{
char
*
component_id
=
switch_mprintf
(
"%s-input-voice"
,
uuid
);
struct
rayo_component
*
component
=
RAYO_COMPONENT_LOCATE
(
component_id
);
...
...
@@ -887,7 +891,7 @@ static void on_detected_speech_event(switch_event_t *event)
/* shouldn't get here... */
rayo_component_send_complete
(
component
,
COMPONENT_COMPLETE_ERROR
);
}
RAYO_
UNLOCK
(
component
);
RAYO_
RELEASE
(
component
);
}
}
switch_safe_free
(
event_str
);
...
...
src/mod/event_handlers/mod_rayo/rayo_output_component.c
浏览文件 @
730d2f88
...
...
@@ -112,11 +112,11 @@ static iks *start_call_output(struct rayo_component *component, switch_core_sess
stream
.
write_function
(
&
stream
,
"}fileman://rayo://%s"
,
RAYO_JID
(
component
));
if
(
switch_ivr_displace_session
(
session
,
stream
.
data
,
0
,
"m"
)
==
SWITCH_STATUS_SUCCESS
)
{
RAYO_
UNLOCK
(
component
);
RAYO_
RELEASE
(
component
);
}
else
{
if
(
component
->
complete
)
{
/* component is already destroyed */
RAYO_
UNLOCK
(
component
);
RAYO_
RELEASE
(
component
);
}
else
{
/* need to destroy component */
if
(
OUTPUT_COMPONENT
(
component
)
->
document
)
{
...
...
@@ -210,7 +210,7 @@ static iks *start_mixer_output_component(struct rayo_actor *mixer, struct rayo_m
rayo_component_api_execute_async
(
component
,
"conference"
,
stream
.
data
);
switch_safe_free
(
stream
.
data
);
RAYO_
UNLOCK
(
component
);
RAYO_
RELEASE
(
component
);
return
NULL
;
}
...
...
@@ -512,7 +512,7 @@ static switch_status_t rayo_file_open(switch_file_handle_t *handle, const char *
if
(
status
!=
SWITCH_STATUS_SUCCESS
&&
context
->
component
)
{
/* complete error event will be sent by calling thread */
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_INFO
,
"Status = %i
\n
"
,
status
);
RAYO_
UNLOCK
(
context
->
component
);
RAYO_
RELEASE
(
context
->
component
);
}
return
status
;
...
...
src/mod/event_handlers/mod_rayo/rayo_prompt_component.c
浏览文件 @
730d2f88
...
...
@@ -288,7 +288,7 @@ static iks *prompt_component_handle_input_error(struct rayo_actor *prompt, struc
/* done */
iks_delete
(
PROMPT_COMPONENT
(
prompt
)
->
iq
);
RAYO_
UNLOCK
(
prompt
);
RAYO_
RELEASE
(
prompt
);
RAYO_DESTROY
(
prompt
);
break
;
...
...
@@ -357,7 +357,7 @@ static iks *prompt_component_handle_output_error(struct rayo_actor *prompt, stru
/* done */
iks_delete
(
PROMPT_COMPONENT
(
prompt
)
->
iq
);
RAYO_
UNLOCK
(
prompt
);
RAYO_
RELEASE
(
prompt
);
RAYO_DESTROY
(
prompt
);
break
;
...
...
src/mod/event_handlers/mod_rayo/rayo_record_component.c
浏览文件 @
730d2f88
...
...
@@ -141,7 +141,7 @@ static void on_call_record_stop_event(switch_event_t *event)
/* TODO assume final timeout, for now */
complete_record
(
component
,
RECORD_COMPLETE_FINAL_TIMEOUT
);
}
RAYO_
UNLOCK
(
component
);
RAYO_
RELEASE
(
component
);
}
}
...
...
@@ -282,7 +282,7 @@ static iks *start_call_record_component(struct rayo_actor *call, struct rayo_mes
if
(
start_call_record
(
session
,
component
))
{
rayo_component_send_start
(
component
,
iq
);
}
else
{
RAYO_
UNLOCK
(
component
);
RAYO_
RELEASE
(
component
);
RAYO_DESTROY
(
component
);
return
iks_new_error
(
iq
,
STANZA_ERROR_INTERNAL_SERVER_ERROR
);
}
...
...
@@ -369,7 +369,7 @@ static void on_mixer_record_event(switch_event_t *event)
complete_record
(
component
,
RECORD_COMPLETE_FINAL_TIMEOUT
);
}
}
RAYO_
UNLOCK
(
component
);
RAYO_
RELEASE
(
component
);
}
}
...
...
@@ -412,7 +412,7 @@ static iks *start_mixer_record_component(struct rayo_actor *mixer, struct rayo_m
/* mixer doesn't allow "send" */
if
(
!
strcmp
(
"send"
,
iks_find_attrib_soft
(
record
,
"direction"
)))
{
RAYO_
UNLOCK
(
component
);
RAYO_
RELEASE
(
component
);
RAYO_DESTROY
(
component
);
return
iks_new_error
(
iq
,
STANZA_ERROR_BAD_REQUEST
);
}
...
...
@@ -420,7 +420,7 @@ static iks *start_mixer_record_component(struct rayo_actor *mixer, struct rayo_m
if
(
start_mixer_record
(
component
))
{
rayo_component_send_start
(
component
,
iq
);
}
else
{
RAYO_
UNLOCK
(
component
);
RAYO_
RELEASE
(
component
);
RAYO_DESTROY
(
component
);
return
iks_new_error
(
iq
,
STANZA_ERROR_INTERNAL_SERVER_ERROR
);
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论