Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
dd2346d2
提交
dd2346d2
authored
6月 24, 2013
作者:
Chris Rienzo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
mod_rayo: remove reply from send function - everything is send only now
上级
12b293d6
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
49 行增加
和
103 行删除
+49
-103
mod_rayo.c
src/mod/event_handlers/mod_rayo/mod_rayo.c
+40
-66
mod_rayo.h
src/mod/event_handlers/mod_rayo/mod_rayo.h
+3
-3
rayo_prompt_component.c
src/mod/event_handlers/mod_rayo/rayo_prompt_component.c
+6
-34
没有找到文件。
src/mod/event_handlers/mod_rayo/mod_rayo.c
浏览文件 @
dd2346d2
...
@@ -215,12 +215,12 @@ struct dial_gateway {
...
@@ -215,12 +215,12 @@ struct dial_gateway {
int
strip
;
int
strip
;
};
};
static
struct
rayo_message
*
rayo_call_send
(
struct
rayo_actor
*
client
,
struct
rayo_actor
*
call
,
struct
rayo_message
*
msg
,
const
char
*
file
,
int
line
);
static
void
rayo_call_send
(
struct
rayo_actor
*
client
,
struct
rayo_actor
*
call
,
struct
rayo_message
*
msg
,
const
char
*
file
,
int
line
);
static
struct
rayo_message
*
rayo_server_send
(
struct
rayo_actor
*
client
,
struct
rayo_actor
*
server
,
struct
rayo_message
*
msg
,
const
char
*
file
,
int
line
);
static
void
rayo_server_send
(
struct
rayo_actor
*
client
,
struct
rayo_actor
*
server
,
struct
rayo_message
*
msg
,
const
char
*
file
,
int
line
);
static
struct
rayo_message
*
rayo_mixer_send
(
struct
rayo_actor
*
client
,
struct
rayo_actor
*
mixer
,
struct
rayo_message
*
msg
,
const
char
*
file
,
int
line
);
static
void
rayo_mixer_send
(
struct
rayo_actor
*
client
,
struct
rayo_actor
*
mixer
,
struct
rayo_message
*
msg
,
const
char
*
file
,
int
line
);
static
struct
rayo_message
*
rayo_component_send
(
struct
rayo_actor
*
client
,
struct
rayo_actor
*
component
,
struct
rayo_message
*
msg
,
const
char
*
file
,
int
line
);
static
void
rayo_component_send
(
struct
rayo_actor
*
client
,
struct
rayo_actor
*
component
,
struct
rayo_message
*
msg
,
const
char
*
file
,
int
line
);
static
struct
rayo_message
*
rayo_client_send
(
struct
rayo_actor
*
from
,
struct
rayo_actor
*
client
,
struct
rayo_message
*
msg
,
const
char
*
file
,
int
line
);
static
void
rayo_client_send
(
struct
rayo_actor
*
from
,
struct
rayo_actor
*
client
,
struct
rayo_message
*
msg
,
const
char
*
file
,
int
line
);
static
struct
rayo_message
*
rayo_console_client_send
(
struct
rayo_actor
*
from
,
struct
rayo_actor
*
client
,
struct
rayo_message
*
msg
,
const
char
*
file
,
int
line
);
static
void
rayo_console_client_send
(
struct
rayo_actor
*
from
,
struct
rayo_actor
*
client
,
struct
rayo_message
*
msg
,
const
char
*
file
,
int
line
);
static
void
on_client_presence
(
struct
rayo_client
*
rclient
,
iks
*
node
);
static
void
on_client_presence
(
struct
rayo_client
*
rclient
,
iks
*
node
);
...
@@ -608,37 +608,32 @@ iks *rayo_message_remove_payload(struct rayo_message *msg)
...
@@ -608,37 +608,32 @@ iks *rayo_message_remove_payload(struct rayo_message *msg)
/**
/**
* Send message to actor
* Send message to actor
*/
*/
struct
rayo_message
*
rayo_actor_send
(
struct
rayo_actor
*
from
,
struct
rayo_actor
*
actor
,
struct
rayo_message
*
msg
,
const
char
*
file
,
int
line
)
void
rayo_actor_send
(
struct
rayo_actor
*
from
,
struct
rayo_actor
*
actor
,
struct
rayo_message
*
msg
,
const
char
*
file
,
int
line
)
{
{
struct
rayo_message
*
reply
=
NULL
;
iks
*
payload
=
msg
->
payload
;
iks
*
payload
=
msg
->
payload
;
char
*
msg_str
=
iks_string
(
iks_stack
(
payload
),
payload
);
char
*
msg_str
=
iks_string
(
iks_stack
(
payload
),
payload
);
switch_log_printf
(
SWITCH_CHANNEL_ID_LOG
,
file
,
""
,
line
,
""
,
SWITCH_LOG_DEBUG
,
"%s, %s
\n
"
,
RAYO_JID
(
from
),
msg_str
);
switch_log_printf
(
SWITCH_CHANNEL_ID_LOG
,
file
,
""
,
line
,
""
,
SWITCH_LOG_DEBUG
,
"%s, %s
\n
"
,
RAYO_JID
(
from
),
msg_str
);
switch_mutex_lock
(
actor
->
mutex
);
switch_mutex_lock
(
actor
->
mutex
);
reply
=
actor
->
send_fn
(
from
,
actor
,
msg
,
file
,
line
);
actor
->
send_fn
(
from
,
actor
,
msg
,
file
,
line
);
switch_mutex_unlock
(
actor
->
mutex
);
switch_mutex_unlock
(
actor
->
mutex
);
rayo_message_destroy
(
msg
);
rayo_message_destroy
(
msg
);
return
reply
;
}
}
/**
/**
* Send message to actor addressed by JID
* Send message to actor addressed by JID
*/
*/
struct
rayo_message
*
rayo_actor_send_by_jid
(
struct
rayo_actor
*
from
,
const
char
*
jid
,
struct
rayo_message
*
msg
,
const
char
*
file
,
int
line
)
void
rayo_actor_send_by_jid
(
struct
rayo_actor
*
from
,
const
char
*
jid
,
struct
rayo_message
*
msg
,
const
char
*
file
,
int
line
)
{
{
struct
rayo_message
*
reply
=
NULL
;
struct
rayo_actor
*
actor
=
RAYO_LOCATE
(
jid
);
struct
rayo_actor
*
actor
=
RAYO_LOCATE
(
jid
);
if
(
actor
)
{
if
(
actor
)
{
r
eply
=
r
ayo_actor_send
(
from
,
actor
,
msg
,
file
,
line
);
rayo_actor_send
(
from
,
actor
,
msg
,
file
,
line
);
RAYO_UNLOCK
(
actor
);
RAYO_UNLOCK
(
actor
);
}
else
{
}
else
{
switch_log_printf
(
SWITCH_CHANNEL_ID_LOG
,
file
,
""
,
line
,
""
,
SWITCH_LOG_DEBUG
,
"%s, failed to locate %s.
\n
"
,
RAYO_JID
(
from
),
jid
);
switch_log_printf
(
SWITCH_CHANNEL_ID_LOG
,
file
,
""
,
line
,
""
,
SWITCH_LOG_DEBUG
,
"%s, failed to locate %s.
\n
"
,
RAYO_JID
(
from
),
jid
);
rayo_message_destroy
(
msg
);
rayo_message_destroy
(
msg
);
}
}
return
reply
;
}
}
/**
/**
...
@@ -891,10 +886,9 @@ static struct rayo_mixer *rayo_mixer_locate(const char *mixer_name, const char *
...
@@ -891,10 +886,9 @@ static struct rayo_mixer *rayo_mixer_locate(const char *mixer_name, const char *
/**
/**
* Default message handler - drops messages
* Default message handler - drops messages
*/
*/
static
struct
rayo_message
*
rayo_actor_send_ignore
(
struct
rayo_actor
*
from
,
struct
rayo_actor
*
to
,
struct
rayo_message
*
msg
,
const
char
*
file
,
int
line
)
void
rayo_actor_send_ignore
(
struct
rayo_actor
*
from
,
struct
rayo_actor
*
to
,
struct
rayo_message
*
msg
,
const
char
*
file
,
int
line
)
{
{
switch_log_printf
(
SWITCH_CHANNEL_ID_LOG
,
file
,
""
,
line
,
""
,
SWITCH_LOG_WARNING
,
"%s, dropping unexpected message to %s.
\n
"
,
RAYO_JID
(
from
),
RAYO_JID
(
to
));
switch_log_printf
(
SWITCH_CHANNEL_ID_LOG
,
file
,
""
,
line
,
""
,
SWITCH_LOG_WARNING
,
"%s, dropping unexpected message to %s.
\n
"
,
RAYO_JID
(
from
),
RAYO_JID
(
to
));
return
NULL
;
}
}
#define RAYO_ACTOR_INIT(actor, pool, type, subtype, id, jid, cleanup, send) rayo_actor_init(actor, pool, type, subtype, id, jid, cleanup, send, __FILE__, __LINE__)
#define RAYO_ACTOR_INIT(actor, pool, type, subtype, id, jid, cleanup, send) rayo_actor_init(actor, pool, type, subtype, id, jid, cleanup, send, __FILE__, __LINE__)
...
@@ -1080,10 +1074,9 @@ struct rayo_component *_rayo_component_init(struct rayo_component *component, sw
...
@@ -1080,10 +1074,9 @@ struct rayo_component *_rayo_component_init(struct rayo_component *component, sw
/**
/**
* Send XMPP message to client
* Send XMPP message to client
*/
*/
static
struct
rayo_message
*
rayo_client_send
(
struct
rayo_actor
*
from
,
struct
rayo_actor
*
client
,
struct
rayo_message
*
msg
,
const
char
*
file
,
int
line
)
void
rayo_client_send
(
struct
rayo_actor
*
from
,
struct
rayo_actor
*
client
,
struct
rayo_message
*
msg
,
const
char
*
file
,
int
line
)
{
{
xmpp_stream_context_send
(
globals
.
xmpp_context
,
RAYO_CLIENT
(
client
)
->
route
,
msg
->
payload
);
xmpp_stream_context_send
(
globals
.
xmpp_context
,
RAYO_CLIENT
(
client
)
->
route
,
msg
->
payload
);
return
NULL
;
}
}
/**
/**
...
@@ -1163,10 +1156,9 @@ static struct rayo_client *rayo_client_create(const char *jid, const char *route
...
@@ -1163,10 +1156,9 @@ static struct rayo_client *rayo_client_create(const char *jid, const char *route
/**
/**
* Send XMPP message to peer server
* Send XMPP message to peer server
*/
*/
static
struct
rayo_message
*
rayo_peer_server_send
(
struct
rayo_actor
*
from
,
struct
rayo_actor
*
server
,
struct
rayo_message
*
msg
,
const
char
*
file
,
int
line
)
void
rayo_peer_server_send
(
struct
rayo_actor
*
from
,
struct
rayo_actor
*
server
,
struct
rayo_message
*
msg
,
const
char
*
file
,
int
line
)
{
{
xmpp_stream_context_send
(
globals
.
xmpp_context
,
RAYO_JID
(
server
),
msg
->
payload
);
xmpp_stream_context_send
(
globals
.
xmpp_context
,
RAYO_JID
(
server
),
msg
->
payload
);
return
NULL
;
}
}
/**
/**
...
@@ -1345,22 +1337,23 @@ static iks *rayo_component_command_ok(struct rayo_actor *rclient, struct rayo_co
...
@@ -1345,22 +1337,23 @@ static iks *rayo_component_command_ok(struct rayo_actor *rclient, struct rayo_co
/**
/**
* Handle server message
* Handle server message
*/
*/
static
struct
rayo_message
*
rayo_server_send
(
struct
rayo_actor
*
client
,
struct
rayo_actor
*
server
,
struct
rayo_message
*
msg
,
const
char
*
file
,
int
line
)
void
rayo_server_send
(
struct
rayo_actor
*
client
,
struct
rayo_actor
*
server
,
struct
rayo_message
*
msg
,
const
char
*
file
,
int
line
)
{
{
iks
*
response
=
NULL
;
rayo_actor_xmpp_handler
handler
=
NULL
;
rayo_actor_xmpp_handler
handler
=
NULL
;
iks
*
iq
=
msg
->
payload
;
iks
*
iq
=
msg
->
payload
;
iks
*
response
=
NULL
;
if
(
!
strcmp
(
"presence"
,
iks_name
(
iq
)))
{
if
(
!
strcmp
(
"presence"
,
iks_name
(
iq
)))
{
on_client_presence
(
RAYO_CLIENT
(
client
),
iq
);
on_client_presence
(
RAYO_CLIENT
(
client
),
iq
);
return
NULL
;
return
;
}
}
/* is this a command a server supports? */
/* is this a command a server supports? */
handler
=
rayo_actor_command_handler_find
(
server
,
iq
);
handler
=
rayo_actor_command_handler_find
(
server
,
iq
);
if
(
!
handler
)
{
if
(
!
handler
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"%s, no handler function for command to %s
\n
"
,
RAYO_JID
(
client
),
RAYO_JID
(
server
));
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"%s, no handler function for command to %s
\n
"
,
RAYO_JID
(
client
),
RAYO_JID
(
server
));
return
rayo_message_create
(
iks_new_error
(
iq
,
STANZA_ERROR_FEATURE_NOT_IMPLEMENTED
));
RAYO_SEND
(
server
,
client
,
rayo_message_create
(
iks_new_error
(
iq
,
STANZA_ERROR_FEATURE_NOT_IMPLEMENTED
)));
return
;
}
}
/* is the command valid? */
/* is the command valid? */
...
@@ -1369,15 +1362,14 @@ static struct rayo_message *rayo_server_send(struct rayo_actor *client, struct r
...
@@ -1369,15 +1362,14 @@ static struct rayo_message *rayo_server_send(struct rayo_actor *client, struct r
}
}
if
(
response
)
{
if
(
response
)
{
return
rayo_message_create
(
response
);
RAYO_SEND
(
server
,
client
,
rayo_message_create
(
response
)
);
}
}
return
NULL
;
}
}
/**
/**
* Handle call message
* Handle call message
*/
*/
static
struct
rayo_message
*
rayo_call_send
(
struct
rayo_actor
*
client
,
struct
rayo_actor
*
call
,
struct
rayo_message
*
msg
,
const
char
*
file
,
int
line
)
void
rayo_call_send
(
struct
rayo_actor
*
client
,
struct
rayo_actor
*
call
,
struct
rayo_message
*
msg
,
const
char
*
file
,
int
line
)
{
{
rayo_actor_xmpp_handler
handler
=
NULL
;
rayo_actor_xmpp_handler
handler
=
NULL
;
iks
*
iq
=
msg
->
payload
;
iks
*
iq
=
msg
->
payload
;
...
@@ -1388,14 +1380,16 @@ static struct rayo_message *rayo_call_send(struct rayo_actor *client, struct ray
...
@@ -1388,14 +1380,16 @@ static struct rayo_message *rayo_call_send(struct rayo_actor *client, struct ray
handler
=
rayo_actor_command_handler_find
(
call
,
iq
);
handler
=
rayo_actor_command_handler_find
(
call
,
iq
);
if
(
!
handler
)
{
if
(
!
handler
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"%s, no handler function for command
\n
"
,
RAYO_JID
(
call
));
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"%s, no handler function for command
\n
"
,
RAYO_JID
(
call
));
return
rayo_message_create
(
iks_new_error
(
iq
,
STANZA_ERROR_FEATURE_NOT_IMPLEMENTED
));
RAYO_SEND
(
call
,
client
,
rayo_message_create
(
iks_new_error
(
iq
,
STANZA_ERROR_FEATURE_NOT_IMPLEMENTED
)));
return
;
}
}
/* is the session still available? */
/* is the session still available? */
session
=
switch_core_session_locate
(
rayo_call_get_uuid
(
RAYO_CALL
(
call
)));
session
=
switch_core_session_locate
(
rayo_call_get_uuid
(
RAYO_CALL
(
call
)));
if
(
!
session
)
{
if
(
!
session
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"%s, session not found
\n
"
,
RAYO_JID
(
call
));
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"%s, session not found
\n
"
,
RAYO_JID
(
call
));
return
rayo_message_create
(
iks_new_error
(
iq
,
STANZA_ERROR_SERVICE_UNAVAILABLE
));
RAYO_SEND
(
call
,
client
,
rayo_message_create
(
iks_new_error
(
iq
,
STANZA_ERROR_SERVICE_UNAVAILABLE
)));
return
;
}
}
/* is the command valid? */
/* is the command valid? */
...
@@ -1408,15 +1402,14 @@ static struct rayo_message *rayo_call_send(struct rayo_actor *client, struct ray
...
@@ -1408,15 +1402,14 @@ static struct rayo_message *rayo_call_send(struct rayo_actor *client, struct ray
switch_core_session_rwunlock
(
session
);
switch_core_session_rwunlock
(
session
);
if
(
response
)
{
if
(
response
)
{
return
rayo_message_create
(
response
);
RAYO_SEND
(
call
,
client
,
rayo_message_create
(
response
)
);
}
}
return
NULL
;
}
}
/**
/**
* Handle mixer message
* Handle mixer message
*/
*/
static
struct
rayo_message
*
rayo_mixer_send
(
struct
rayo_actor
*
client
,
struct
rayo_actor
*
mixer
,
struct
rayo_message
*
msg
,
const
char
*
file
,
int
line
)
void
rayo_mixer_send
(
struct
rayo_actor
*
client
,
struct
rayo_actor
*
mixer
,
struct
rayo_message
*
msg
,
const
char
*
file
,
int
line
)
{
{
rayo_actor_xmpp_handler
handler
=
NULL
;
rayo_actor_xmpp_handler
handler
=
NULL
;
iks
*
iq
=
msg
->
payload
;
iks
*
iq
=
msg
->
payload
;
...
@@ -1426,21 +1419,21 @@ static struct rayo_message *rayo_mixer_send(struct rayo_actor *client, struct ra
...
@@ -1426,21 +1419,21 @@ static struct rayo_message *rayo_mixer_send(struct rayo_actor *client, struct ra
handler
=
rayo_actor_command_handler_find
(
mixer
,
iq
);
handler
=
rayo_actor_command_handler_find
(
mixer
,
iq
);
if
(
!
handler
)
{
if
(
!
handler
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"%s, no handler function for command
\n
"
,
RAYO_JID
(
mixer
));
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"%s, no handler function for command
\n
"
,
RAYO_JID
(
mixer
));
return
rayo_message_create
(
iks_new_error
(
iq
,
STANZA_ERROR_FEATURE_NOT_IMPLEMENTED
));
RAYO_SEND
(
mixer
,
client
,
rayo_message_create
(
iks_new_error
(
iq
,
STANZA_ERROR_FEATURE_NOT_IMPLEMENTED
)));
return
;
}
}
/* execute the command */
/* execute the command */
response
=
handler
(
client
,
mixer
,
iq
,
NULL
);
response
=
handler
(
client
,
mixer
,
iq
,
NULL
);
if
(
response
)
{
if
(
response
)
{
return
rayo_message_create
(
response
);
RAYO_SEND
(
mixer
,
client
,
rayo_message_create
(
response
)
);
}
}
return
NULL
;
}
}
/**
/**
* Handle mixer message
* Handle mixer message
*/
*/
static
struct
rayo_message
*
rayo_component_send
(
struct
rayo_actor
*
client
,
struct
rayo_actor
*
component
,
struct
rayo_message
*
msg
,
const
char
*
file
,
int
line
)
void
rayo_component_send
(
struct
rayo_actor
*
client
,
struct
rayo_actor
*
component
,
struct
rayo_message
*
msg
,
const
char
*
file
,
int
line
)
{
{
rayo_actor_xmpp_handler
handler
=
NULL
;
rayo_actor_xmpp_handler
handler
=
NULL
;
iks
*
xml_msg
=
msg
->
payload
;
iks
*
xml_msg
=
msg
->
payload
;
...
@@ -1451,7 +1444,8 @@ static struct rayo_message *rayo_component_send(struct rayo_actor *client, struc
...
@@ -1451,7 +1444,8 @@ static struct rayo_message *rayo_component_send(struct rayo_actor *client, struc
handler
=
rayo_actor_command_handler_find
(
component
,
xml_msg
);
handler
=
rayo_actor_command_handler_find
(
component
,
xml_msg
);
if
(
!
handler
)
{
if
(
!
handler
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"%s, no component handler function for command
\n
"
,
RAYO_JID
(
component
));
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"%s, no component handler function for command
\n
"
,
RAYO_JID
(
component
));
return
rayo_message_create
(
iks_new_error
(
xml_msg
,
STANZA_ERROR_FEATURE_NOT_IMPLEMENTED
));
RAYO_SEND
(
component
,
client
,
rayo_message_create
(
iks_new_error
(
xml_msg
,
STANZA_ERROR_FEATURE_NOT_IMPLEMENTED
)));
return
;
}
}
/* is the command valid? */
/* is the command valid? */
...
@@ -1462,22 +1456,21 @@ static struct rayo_message *rayo_component_send(struct rayo_actor *client, struc
...
@@ -1462,22 +1456,21 @@ static struct rayo_message *rayo_component_send(struct rayo_actor *client, struc
}
}
if
(
response
)
{
if
(
response
)
{
return
rayo_message_create
(
response
);
RAYO_SEND
(
component
,
client
,
rayo_message_create
(
response
));
return
;
}
}
}
else
if
(
!
strcmp
(
"presence"
,
iks_name
(
xml_msg
)))
{
}
else
if
(
!
strcmp
(
"presence"
,
iks_name
(
xml_msg
)))
{
/* is this an event the component wants? */
/* is this an event the component wants? */
handler
=
rayo_actor_event_handler_find
(
client
,
component
,
xml_msg
);
handler
=
rayo_actor_event_handler_find
(
client
,
component
,
xml_msg
);
if
(
!
handler
)
{
if
(
!
handler
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"%s, no component handler function for event
\n
"
,
RAYO_JID
(
component
));
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"%s, no component handler function for event
\n
"
,
RAYO_JID
(
component
));
return
NULL
;
return
;
}
}
/* forward the event */
/* forward the event */
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"%s, forwarding event
\n
"
,
RAYO_JID
(
component
));
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"%s, forwarding event
\n
"
,
RAYO_JID
(
component
));
handler
(
client
,
component
,
xml_msg
,
NULL
);
handler
(
client
,
component
,
xml_msg
,
NULL
);
}
}
return
NULL
;
}
}
/**
/**
...
@@ -2214,10 +2207,7 @@ static void rayo_client_command_recv(struct rayo_client *rclient, iks *iq)
...
@@ -2214,10 +2207,7 @@ static void rayo_client_command_recv(struct rayo_client *rclient, iks *iq)
if
(
command
)
{
if
(
command
)
{
struct
rayo_actor
*
actor
=
RAYO_LOCATE
(
to
);
struct
rayo_actor
*
actor
=
RAYO_LOCATE
(
to
);
if
(
actor
)
{
if
(
actor
)
{
struct
rayo_message
*
reply
=
RAYO_SEND
(
rclient
,
actor
,
rayo_message_create_dup
(
iq
));
RAYO_SEND
(
rclient
,
actor
,
rayo_message_create_dup
(
iq
));
if
(
reply
)
{
RAYO_SEND
(
actor
,
rclient
,
reply
);
}
RAYO_UNLOCK
(
actor
);
RAYO_UNLOCK
(
actor
);
}
else
{
}
else
{
RAYO_SEND
(
globals
.
server
,
rclient
,
rayo_message_create
(
iks_new_error
(
iq
,
STANZA_ERROR_ITEM_NOT_FOUND
)));
RAYO_SEND
(
globals
.
server
,
rclient
,
rayo_message_create
(
iks_new_error
(
iq
,
STANZA_ERROR_ITEM_NOT_FOUND
)));
...
@@ -2874,7 +2864,6 @@ static void rayo_client_presence_check(struct rayo_client *rclient)
...
@@ -2874,7 +2864,6 @@ static void rayo_client_presence_check(struct rayo_client *rclient)
rclient
->
availability
=
PS_ONLINE
;
rclient
->
availability
=
PS_ONLINE
;
#if 0
#if 0
/* send probe */
/* send probe */
struct rayo_message *reply;
switch_time_t now = switch_micro_time_now();
switch_time_t now = switch_micro_time_now();
/* throttle probes... */
/* throttle probes... */
...
@@ -2884,10 +2873,7 @@ static void rayo_client_presence_check(struct rayo_client *rclient)
...
@@ -2884,10 +2873,7 @@ static void rayo_client_presence_check(struct rayo_client *rclient)
iks_insert_attrib(probe, "type", "probe");
iks_insert_attrib(probe, "type", "probe");
iks_insert_attrib(probe, "from", RAYO_JID(globals.server));
iks_insert_attrib(probe, "from", RAYO_JID(globals.server));
iks_insert_attrib(probe, "to", RAYO_JID(rclient));
iks_insert_attrib(probe, "to", RAYO_JID(rclient));
reply = RAYO_SEND(globals.server, rclient, rayo_message_create(probe));
RAYO_SEND(globals.server, rclient, rayo_message_create(probe));
if (reply) {
rayo_message_destroy(reply);
}
}
}
} else {
} else {
rclient->last_probe = 0;
rclient->last_probe = 0;
...
@@ -3167,7 +3153,7 @@ static int dump_api(const char *cmd, switch_stream_handle_t *stream)
...
@@ -3167,7 +3153,7 @@ static int dump_api(const char *cmd, switch_stream_handle_t *stream)
/**
/**
* Process response to console command_api
* Process response to console command_api
*/
*/
static
struct
rayo_message
*
rayo_console_client_send
(
struct
rayo_actor
*
from
,
struct
rayo_actor
*
actor
,
struct
rayo_message
*
msg
,
const
char
*
file
,
int
line
)
void
rayo_console_client_send
(
struct
rayo_actor
*
from
,
struct
rayo_actor
*
actor
,
struct
rayo_message
*
msg
,
const
char
*
file
,
int
line
)
{
{
iks
*
response
=
msg
->
payload
;
iks
*
response
=
msg
->
payload
;
...
@@ -3176,8 +3162,6 @@ static struct rayo_message *rayo_console_client_send(struct rayo_actor *from, st
...
@@ -3176,8 +3162,6 @@ static struct rayo_message *rayo_console_client_send(struct rayo_actor *from, st
}
else
{
}
else
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_CONSOLE
,
"
\n
RECV: (null) from %s
\n
"
,
RAYO_JID
(
from
));
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_CONSOLE
,
"
\n
RECV: (null) from %s
\n
"
,
RAYO_JID
(
from
));
}
}
return
NULL
;
}
}
/**
/**
...
@@ -3273,7 +3257,6 @@ static void send_console_message(struct rayo_client *client, const char *to, con
...
@@ -3273,7 +3257,6 @@ static void send_console_message(struct rayo_client *client, const char *to, con
{
{
struct
rayo_actor
*
actor
=
RAYO_LOCATE
(
to
);
struct
rayo_actor
*
actor
=
RAYO_LOCATE
(
to
);
if
(
actor
)
{
if
(
actor
)
{
struct
rayo_message
*
reply
;
iks
*
message
=
NULL
,
*
x
;
iks
*
message
=
NULL
,
*
x
;
message
=
iks_new
(
"message"
);
message
=
iks_new
(
"message"
);
iks_insert_attrib
(
message
,
"to"
,
to
);
iks_insert_attrib
(
message
,
"to"
,
to
);
...
@@ -3283,11 +3266,7 @@ static void send_console_message(struct rayo_client *client, const char *to, con
...
@@ -3283,11 +3266,7 @@ static void send_console_message(struct rayo_client *client, const char *to, con
x
=
iks_insert
(
message
,
"body"
);
x
=
iks_insert
(
message
,
"body"
);
iks_insert_cdata
(
x
,
message_str
,
strlen
(
message_str
));
iks_insert_cdata
(
x
,
message_str
,
strlen
(
message_str
));
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_CONSOLE
,
"
\n
SEND: to %s, %s
\n
"
,
to
,
iks_string
(
iks_stack
(
message
),
message
));
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_CONSOLE
,
"
\n
SEND: to %s, %s
\n
"
,
to
,
iks_string
(
iks_stack
(
message
),
message
));
reply
=
RAYO_SEND
(
client
,
actor
,
rayo_message_create
(
message
));
RAYO_SEND
(
client
,
actor
,
rayo_message_create
(
message
));
if
(
reply
)
{
/* ignore reply */
rayo_message_destroy
(
reply
);
}
RAYO_UNLOCK
(
actor
);
RAYO_UNLOCK
(
actor
);
}
}
}
}
...
@@ -3321,7 +3300,6 @@ static void send_console_presence(struct rayo_client *client, const char *to, in
...
@@ -3321,7 +3300,6 @@ static void send_console_presence(struct rayo_client *client, const char *to, in
{
{
struct
rayo_actor
*
actor
=
RAYO_LOCATE
(
to
);
struct
rayo_actor
*
actor
=
RAYO_LOCATE
(
to
);
if
(
actor
)
{
if
(
actor
)
{
struct
rayo_message
*
reply
;
iks
*
presence
=
NULL
,
*
x
;
iks
*
presence
=
NULL
,
*
x
;
presence
=
iks_new
(
"presence"
);
presence
=
iks_new
(
"presence"
);
iks_insert_attrib
(
presence
,
"to"
,
to
);
iks_insert_attrib
(
presence
,
"to"
,
to
);
...
@@ -3333,11 +3311,7 @@ static void send_console_presence(struct rayo_client *client, const char *to, in
...
@@ -3333,11 +3311,7 @@ static void send_console_presence(struct rayo_client *client, const char *to, in
x
=
iks_insert
(
presence
,
"show"
);
x
=
iks_insert
(
presence
,
"show"
);
iks_insert_cdata
(
x
,
is_online
?
"chat"
:
"dnd"
,
0
);
iks_insert_cdata
(
x
,
is_online
?
"chat"
:
"dnd"
,
0
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_CONSOLE
,
"
\n
SEND: to %s, %s
\n
"
,
to
,
iks_string
(
iks_stack
(
presence
),
presence
));
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_CONSOLE
,
"
\n
SEND: to %s, %s
\n
"
,
to
,
iks_string
(
iks_stack
(
presence
),
presence
));
reply
=
RAYO_SEND
(
client
,
actor
,
rayo_message_create
(
presence
));
RAYO_SEND
(
client
,
actor
,
rayo_message_create
(
presence
));
if
(
reply
)
{
/* ignore reply */
rayo_message_destroy
(
reply
);
}
RAYO_UNLOCK
(
actor
);
RAYO_UNLOCK
(
actor
);
}
}
}
}
...
...
src/mod/event_handlers/mod_rayo/mod_rayo.h
浏览文件 @
dd2346d2
...
@@ -59,7 +59,7 @@ struct rayo_message {
...
@@ -59,7 +59,7 @@ struct rayo_message {
};
};
typedef
void
(
*
rayo_actor_cleanup_fn
)(
struct
rayo_actor
*
);
typedef
void
(
*
rayo_actor_cleanup_fn
)(
struct
rayo_actor
*
);
typedef
struct
rayo_message
*
(
*
rayo_actor_send_fn
)(
struct
rayo_actor
*
,
struct
rayo_actor
*
,
struct
rayo_message
*
,
const
char
*
file
,
int
line
);
typedef
void
(
*
rayo_actor_send_fn
)(
struct
rayo_actor
*
,
struct
rayo_actor
*
,
struct
rayo_message
*
,
const
char
*
file
,
int
line
);
/**
/**
* Type of actor
* Type of actor
...
@@ -133,8 +133,8 @@ extern iks *rayo_message_remove_payload(struct rayo_message *msg);
...
@@ -133,8 +133,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
(
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
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
int
rayo_actor_seq_next
(
struct
rayo_actor
*
actor
);
extern
struct
rayo_message
*
rayo_actor_send
(
struct
rayo_actor
*
from
,
struct
rayo_actor
*
to
,
struct
rayo_message
*
msg
,
const
char
*
file
,
int
line
);
extern
void
rayo_actor_send
(
struct
rayo_actor
*
from
,
struct
rayo_actor
*
to
,
struct
rayo_message
*
msg
,
const
char
*
file
,
int
line
);
extern
struct
rayo_message
*
rayo_actor_send_by_jid
(
struct
rayo_actor
*
from
,
const
char
*
jid
,
struct
rayo_message
*
msg
,
const
char
*
file
,
int
line
);
extern
void
rayo_actor_send_by_jid
(
struct
rayo_actor
*
from
,
const
char
*
jid
,
struct
rayo_message
*
msg
,
const
char
*
file
,
int
line
);
extern
void
rayo_actor_rdlock
(
struct
rayo_actor
*
actor
,
const
char
*
file
,
int
line
);
extern
void
rayo_actor_rdlock
(
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_unlock
(
struct
rayo_actor
*
actor
,
const
char
*
file
,
int
line
);
extern
void
rayo_actor_destroy
(
struct
rayo_actor
*
actor
,
const
char
*
file
,
int
line
);
extern
void
rayo_actor_destroy
(
struct
rayo_actor
*
actor
,
const
char
*
file
,
int
line
);
...
...
src/mod/event_handlers/mod_rayo/rayo_prompt_component.c
浏览文件 @
dd2346d2
...
@@ -91,7 +91,6 @@ static const char *prompt_component_state_to_string(enum prompt_component_state
...
@@ -91,7 +91,6 @@ static const char *prompt_component_state_to_string(enum prompt_component_state
*/
*/
static
void
rayo_component_send_stop
(
struct
rayo_actor
*
from
,
struct
rayo_actor
*
to
)
static
void
rayo_component_send_stop
(
struct
rayo_actor
*
from
,
struct
rayo_actor
*
to
)
{
{
struct
rayo_message
*
reply
;
iks
*
stop
=
iks_new
(
"iq"
);
iks
*
stop
=
iks_new
(
"iq"
);
iks
*
x
;
iks
*
x
;
iks_insert_attrib
(
stop
,
"from"
,
RAYO_JID
(
from
));
iks_insert_attrib
(
stop
,
"from"
,
RAYO_JID
(
from
));
...
@@ -100,11 +99,7 @@ static void rayo_component_send_stop(struct rayo_actor *from, struct rayo_actor
...
@@ -100,11 +99,7 @@ static void rayo_component_send_stop(struct rayo_actor *from, struct rayo_actor
iks_insert_attrib_printf
(
stop
,
"id"
,
"mod_rayo-%d"
,
RAYO_SEQ_NEXT
(
from
));
iks_insert_attrib_printf
(
stop
,
"id"
,
"mod_rayo-%d"
,
RAYO_SEQ_NEXT
(
from
));
x
=
iks_insert
(
stop
,
"stop"
);
x
=
iks_insert
(
stop
,
"stop"
);
iks_insert_attrib
(
x
,
"xmlns"
,
RAYO_EXT_NS
);
iks_insert_attrib
(
x
,
"xmlns"
,
RAYO_EXT_NS
);
reply
=
RAYO_SEND
(
from
,
to
,
rayo_message_create
(
stop
));
RAYO_SEND
(
from
,
to
,
rayo_message_create
(
stop
));
if
(
reply
)
{
/* don't care */
rayo_message_destroy
(
reply
);
}
}
}
/**
/**
...
@@ -112,7 +107,6 @@ static void rayo_component_send_stop(struct rayo_actor *from, struct rayo_actor
...
@@ -112,7 +107,6 @@ static void rayo_component_send_stop(struct rayo_actor *from, struct rayo_actor
*/
*/
static
void
start_input
(
struct
prompt_component
*
prompt
,
int
start_timers
,
int
barge_event
)
static
void
start_input
(
struct
prompt_component
*
prompt
,
int
start_timers
,
int
barge_event
)
{
{
struct
rayo_message
*
reply
;
iks
*
iq
=
iks_new
(
"iq"
);
iks
*
iq
=
iks_new
(
"iq"
);
iks
*
input
=
iks_find
(
PROMPT_COMPONENT
(
prompt
)
->
iq
,
"prompt"
);
iks
*
input
=
iks_find
(
PROMPT_COMPONENT
(
prompt
)
->
iq
,
"prompt"
);
input
=
iks_find
(
input
,
"input"
);
input
=
iks_find
(
input
,
"input"
);
...
@@ -124,11 +118,7 @@ static void start_input(struct prompt_component *prompt, int start_timers, int b
...
@@ -124,11 +118,7 @@ static void start_input(struct prompt_component *prompt, int start_timers, int b
iks_insert_attrib
(
input
,
"start-timers"
,
start_timers
?
"true"
:
"false"
);
iks_insert_attrib
(
input
,
"start-timers"
,
start_timers
?
"true"
:
"false"
);
iks_insert_attrib
(
input
,
"barge-event"
,
barge_event
?
"true"
:
"false"
);
iks_insert_attrib
(
input
,
"barge-event"
,
barge_event
?
"true"
:
"false"
);
iks_insert_node
(
iq
,
input
);
iks_insert_node
(
iq
,
input
);
reply
=
RAYO_SEND
(
prompt
,
RAYO_COMPONENT
(
prompt
)
->
parent
,
rayo_message_create
(
iq
));
RAYO_SEND
(
prompt
,
RAYO_COMPONENT
(
prompt
)
->
parent
,
rayo_message_create
(
iq
));
if
(
reply
)
{
/* handle response */
RAYO_SEND
(
RAYO_COMPONENT
(
prompt
)
->
parent
,
prompt
,
reply
);
}
}
}
/**
/**
...
@@ -136,7 +126,6 @@ static void start_input(struct prompt_component *prompt, int start_timers, int b
...
@@ -136,7 +126,6 @@ static void start_input(struct prompt_component *prompt, int start_timers, int b
*/
*/
static
void
start_input_timers
(
struct
prompt_component
*
prompt
)
static
void
start_input_timers
(
struct
prompt_component
*
prompt
)
{
{
struct
rayo_message
*
reply
;
iks
*
x
;
iks
*
x
;
iks
*
iq
=
iks_new
(
"iq"
);
iks
*
iq
=
iks_new
(
"iq"
);
iks_insert_attrib
(
iq
,
"from"
,
RAYO_JID
(
prompt
));
iks_insert_attrib
(
iq
,
"from"
,
RAYO_JID
(
prompt
));
...
@@ -145,11 +134,7 @@ static void start_input_timers(struct prompt_component *prompt)
...
@@ -145,11 +134,7 @@ static void start_input_timers(struct prompt_component *prompt)
iks_insert_attrib_printf
(
iq
,
"id"
,
"mod_rayo-%d"
,
RAYO_SEQ_NEXT
(
prompt
));
iks_insert_attrib_printf
(
iq
,
"id"
,
"mod_rayo-%d"
,
RAYO_SEQ_NEXT
(
prompt
));
x
=
iks_insert
(
iq
,
"start-timers"
);
x
=
iks_insert
(
iq
,
"start-timers"
);
iks_insert_attrib
(
x
,
"xmlns"
,
RAYO_INPUT_NS
);
iks_insert_attrib
(
x
,
"xmlns"
,
RAYO_INPUT_NS
);
reply
=
RAYO_SEND
(
prompt
,
prompt
->
input
,
rayo_message_create
(
iq
));
RAYO_SEND
(
prompt
,
prompt
->
input
,
rayo_message_create
(
iq
));
if
(
reply
)
{
/* process reply */
RAYO_SEND
(
prompt
->
input
,
prompt
,
reply
);
}
}
}
/**
/**
...
@@ -501,7 +486,6 @@ static iks *start_call_prompt_component(struct rayo_actor *client, struct rayo_a
...
@@ -501,7 +486,6 @@ static iks *start_call_prompt_component(struct rayo_actor *client, struct rayo_a
iks
*
prompt
=
iks_find
(
iq
,
"prompt"
);
iks
*
prompt
=
iks_find
(
iq
,
"prompt"
);
iks
*
input
;
iks
*
input
;
iks
*
output
;
iks
*
output
;
struct
rayo_message
*
reply
=
NULL
;
iks
*
cmd
;
iks
*
cmd
;
if
(
!
VALIDATE_RAYO_PROMPT
(
prompt
))
{
if
(
!
VALIDATE_RAYO_PROMPT
(
prompt
))
{
...
@@ -540,11 +524,7 @@ static iks *start_call_prompt_component(struct rayo_actor *client, struct rayo_a
...
@@ -540,11 +524,7 @@ static iks *start_call_prompt_component(struct rayo_actor *client, struct rayo_a
iks_insert_attrib
(
cmd
,
"type"
,
"set"
);
iks_insert_attrib
(
cmd
,
"type"
,
"set"
);
output
=
iks_copy_within
(
output
,
iks_stack
(
cmd
));
output
=
iks_copy_within
(
output
,
iks_stack
(
cmd
));
iks_insert_node
(
cmd
,
output
);
iks_insert_node
(
cmd
,
output
);
reply
=
RAYO_SEND
(
prompt_component
,
call
,
rayo_message_create
(
cmd
));
RAYO_SEND
(
prompt_component
,
call
,
rayo_message_create
(
cmd
));
if
(
reply
)
{
/* handle response */
RAYO_SEND
(
call
,
prompt_component
,
reply
);
}
return
NULL
;
return
NULL
;
}
}
...
@@ -607,17 +587,10 @@ static iks *forward_output_component_request(struct rayo_actor *client, struct r
...
@@ -607,17 +587,10 @@ static iks *forward_output_component_request(struct rayo_actor *client, struct r
case
PCS_START_INPUT_OUTPUT
:
case
PCS_START_INPUT_OUTPUT
:
case
PCS_INPUT_OUTPUT
:
{
case
PCS_INPUT_OUTPUT
:
{
/* forward request to output component */
/* forward request to output component */
struct
rayo_message
*
reply
;
iks_insert_attrib
(
iq
,
"from"
,
RAYO_JID
(
prompt
));
iks_insert_attrib
(
iq
,
"from"
,
RAYO_JID
(
prompt
));
iks_insert_attrib
(
iq
,
"to"
,
RAYO_JID
(
PROMPT_COMPONENT
(
prompt
)
->
output
));
iks_insert_attrib
(
iq
,
"to"
,
RAYO_JID
(
PROMPT_COMPONENT
(
prompt
)
->
output
));
reply
=
RAYO_SEND
(
prompt
,
PROMPT_COMPONENT
(
prompt
)
->
output
,
rayo_message_create_dup
(
iq
));
RAYO_SEND
(
prompt
,
PROMPT_COMPONENT
(
prompt
)
->
output
,
rayo_message_create_dup
(
iq
));
return
NULL
;
/* return reply to client */
iq
=
rayo_message_remove_payload
(
reply
);
rayo_message_destroy
(
reply
);
iks_insert_attrib
(
iq
,
"from"
,
RAYO_JID
(
prompt
));
iks_insert_attrib
(
iq
,
"to"
,
RAYO_JID
(
client
));
return
iq
;
}
}
case
PCS_START_INPUT_TIMERS
:
case
PCS_START_INPUT_TIMERS
:
case
PCS_START_OUTPUT
:
case
PCS_START_OUTPUT
:
...
@@ -632,7 +605,6 @@ static iks *forward_output_component_request(struct rayo_actor *client, struct r
...
@@ -632,7 +605,6 @@ static iks *forward_output_component_request(struct rayo_actor *client, struct r
case
PCS_DONE
:
case
PCS_DONE
:
return
iks_new_error_detailed
(
iq
,
STANZA_ERROR_UNEXPECTED_REQUEST
,
"output is finished"
);
return
iks_new_error_detailed
(
iq
,
STANZA_ERROR_UNEXPECTED_REQUEST
,
"output is finished"
);
}
}
return
NULL
;
return
NULL
;
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论