Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
004c5ab2
提交
004c5ab2
authored
7月 24, 2014
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix some issues with duplicate chat events and some cleanup
上级
cd5e6d33
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
43 行增加
和
13 行删除
+43
-13
verto.js
html5/verto/demo/verto.js
+12
-3
mod_conference.c
src/mod/applications/mod_conference/mod_conference.c
+12
-5
mod_verto.c
src/mod/endpoints/mod_verto/mod_verto.c
+19
-5
没有找到文件。
html5/verto/demo/verto.js
浏览文件 @
004c5ab2
...
@@ -55,7 +55,11 @@ function setupChat() {
...
@@ -55,7 +55,11 @@ function setupChat() {
return
;
return
;
}
}
cur_call
.
message
({
to
:
chatting_with
,
body
:
$
(
"#chatmsg"
).
val
()});
cur_call
.
message
({
to
:
chatting_with
,
body
:
$
(
"#chatmsg"
).
val
(),
from_msg_name
:
cur_call
.
params
.
caller_id_name
,
from_msg_number
:
cur_call
.
params
.
caller_id_number
});
$
(
"#chatmsg"
).
val
(
""
);
$
(
"#chatmsg"
).
val
(
""
);
});
});
...
@@ -109,9 +113,14 @@ var callbacks = {
...
@@ -109,9 +113,14 @@ var callbacks = {
break
;
break
;
case
$
.
verto
.
enum
.
message
.
info
:
case
$
.
verto
.
enum
.
message
.
info
:
var
body
=
data
.
body
.
replace
(
/
(
http
[
s
]{0,1}
:
\/\/\S
+
)
/g
,
"<a target='_blank' href='$1'>$1<
\
/a>"
);
var
body
=
data
.
body
.
replace
(
/
(
http
[
s
]{0,1}
:
\/\/\S
+
)
/g
,
"<a target='_blank' href='$1'>$1<
\
/a>"
);
body
=
body
.
replace
(
/
(?:\r\n
|
\r
|
\n)
/g
,
'<br />'
);
$
(
"#chatwin"
).
append
(
"<span class=chatuid>"
+
data
.
from
+
":</span><br>"
+
body
);
if
(
body
.
slice
(
-
1
)
!==
"
\n
"
)
{
body
+=
"
\n
"
;
}
body
=
body
.
replace
(
/
(?:\r\n
|
\r
|
\n)
/g
,
'<br />'
);
var
from
=
data
.
from_msg_name
||
data
.
from
;
$
(
"#chatwin"
).
append
(
"<span class=chatuid>"
+
from
+
":</span><br>"
+
body
);
$
(
'#chatwin'
).
animate
({
"scrollTop"
:
$
(
'#chatwin'
)[
0
].
scrollHeight
},
"fast"
);
$
(
'#chatwin'
).
animate
({
"scrollTop"
:
$
(
'#chatwin'
)[
0
].
scrollHeight
},
"fast"
);
break
;
break
;
...
...
src/mod/applications/mod_conference/mod_conference.c
浏览文件 @
004c5ab2
...
@@ -5944,8 +5944,10 @@ static switch_status_t conference_say(conference_obj_t *conference, const char *
...
@@ -5944,8 +5944,10 @@ static switch_status_t conference_say(conference_obj_t *conference, const char *
static
void
chat_message_broadcast
(
conference_obj_t
*
conference
,
switch_event_t
*
event
)
static
void
chat_message_broadcast
(
conference_obj_t
*
conference
,
switch_event_t
*
event
)
{
{
conference_member_t
*
member
=
NULL
;
conference_member_t
*
member
=
NULL
;
switch_event_t
*
processed
;
switch_assert
(
conference
!=
NULL
);
switch_assert
(
conference
!=
NULL
);
switch_event_create
(
&
processed
,
SWITCH_EVENT_CHANNEL_DATA
);
switch_mutex_lock
(
conference
->
member_mutex
);
switch_mutex_lock
(
conference
->
member_mutex
);
for
(
member
=
conference
->
members
;
member
;
member
=
member
->
next
)
{
for
(
member
=
conference
->
members
;
member
;
member
=
member
->
next
)
{
...
@@ -5955,20 +5957,22 @@ static void chat_message_broadcast(conference_obj_t *conference, switch_event_t
...
@@ -5955,20 +5957,22 @@ static void chat_message_broadcast(conference_obj_t *conference, switch_event_t
switch_event_t
*
reply
=
NULL
;
switch_event_t
*
reply
=
NULL
;
if
(
presence_id
&&
chat_proto
)
{
if
(
presence_id
&&
chat_proto
)
{
if
(
switch_event_get_header
(
processed
,
presence_id
))
{
continue
;
}
switch_event_dup
(
&
reply
,
event
);
switch_event_dup
(
&
reply
,
event
);
switch_event_add_header_string
(
reply
,
SWITCH_STACK_BOTTOM
,
"to"
,
presence_id
);
switch_event_add_header_string
(
reply
,
SWITCH_STACK_BOTTOM
,
"to"
,
presence_id
);
switch_event_add_header_string
(
reply
,
SWITCH_STACK_BOTTOM
,
"conference_name"
,
conference
->
name
);
switch_event_add_header_string
(
reply
,
SWITCH_STACK_BOTTOM
,
"conference_name"
,
conference
->
name
);
switch_event_add_header_string
(
reply
,
SWITCH_STACK_BOTTOM
,
"conference_domain"
,
conference
->
domain
);
switch_event_add_header_string
(
reply
,
SWITCH_STACK_BOTTOM
,
"conference_domain"
,
conference
->
domain
);
switch_event_set_body
(
reply
,
switch_event_get_body
(
event
));
switch_event_set_body
(
reply
,
switch_event_get_body
(
event
));
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"SENDIT
\n
"
);
DUMP_EVENT
(
reply
);
switch_core_chat_deliver
(
chat_proto
,
&
reply
);
switch_core_chat_deliver
(
chat_proto
,
&
reply
);
switch_event_add_header_string
(
processed
,
SWITCH_STACK_BOTTOM
,
presence_id
,
"true"
);
}
}
}
}
}
}
switch_event_destroy
(
&
processed
);
switch_mutex_unlock
(
conference
->
member_mutex
);
switch_mutex_unlock
(
conference
->
member_mutex
);
}
}
...
@@ -9796,7 +9800,10 @@ static switch_status_t chat_send(switch_event_t *message_event)
...
@@ -9796,7 +9800,10 @@ static switch_status_t chat_send(switch_event_t *message_event)
switch_safe_free
(
lbuf
);
switch_safe_free
(
lbuf
);
switch_core_chat_send_args
(
proto
,
CONF_CHAT_PROTO
,
to
,
hint
&&
strchr
(
hint
,
'/'
)
?
hint
:
from
,
""
,
stream
.
data
,
NULL
,
NULL
,
SWITCH_FALSE
);
if
(
!
conference
->
broadcast_chat_messages
)
{
switch_core_chat_send_args
(
proto
,
CONF_CHAT_PROTO
,
to
,
hint
&&
strchr
(
hint
,
'/'
)
?
hint
:
from
,
""
,
stream
.
data
,
NULL
,
NULL
,
SWITCH_FALSE
);
}
switch_safe_free
(
stream
.
data
);
switch_safe_free
(
stream
.
data
);
switch_thread_rwlock_unlock
(
conference
->
rwlock
);
switch_thread_rwlock_unlock
(
conference
->
rwlock
);
...
...
src/mod/endpoints/mod_verto/mod_verto.c
浏览文件 @
004c5ab2
...
@@ -946,7 +946,7 @@ static void set_call_params(cJSON *params, verto_pvt_t *tech_pvt) {
...
@@ -946,7 +946,7 @@ static void set_call_params(cJSON *params, verto_pvt_t *tech_pvt) {
const
char
*
caller_id_name
=
NULL
;
const
char
*
caller_id_name
=
NULL
;
const
char
*
caller_id_number
=
NULL
;
const
char
*
caller_id_number
=
NULL
;
if
(
switch_channel_
out
bound_display
(
tech_pvt
->
channel
))
{
if
(
switch_channel_
in
bound_display
(
tech_pvt
->
channel
))
{
caller_id_name
=
switch_channel_get_variable
(
tech_pvt
->
channel
,
"caller_id_name"
);
caller_id_name
=
switch_channel_get_variable
(
tech_pvt
->
channel
,
"caller_id_name"
);
caller_id_number
=
switch_channel_get_variable
(
tech_pvt
->
channel
,
"caller_id_number"
);
caller_id_number
=
switch_channel_get_variable
(
tech_pvt
->
channel
,
"caller_id_number"
);
}
else
{
}
else
{
...
@@ -2563,10 +2563,10 @@ static switch_bool_t verto__info_func(const char *method, cJSON *params, jsock_t
...
@@ -2563,10 +2563,10 @@ static switch_bool_t verto__info_func(const char *method, cJSON *params, jsock_t
switch_event_t
*
event
;
switch_event_t
*
event
;
char
*
to
=
(
char
*
)
cJSON_GetObjectCstr
(
msg
,
"to"
);
char
*
to
=
(
char
*
)
cJSON_GetObjectCstr
(
msg
,
"to"
);
//char *from = (char *) cJSON_GetObjectCstr(msg, "from");
//char *from = (char *) cJSON_GetObjectCstr(msg, "from");
cJSON
*
indialog
=
cJSON_GetObjectItem
(
msg
,
"inDialog"
);
cJSON
*
i
,
*
i
ndialog
=
cJSON_GetObjectItem
(
msg
,
"inDialog"
);
const
char
*
body
=
cJSON_GetObjectCstr
(
msg
,
"body"
);
const
char
*
body
=
cJSON_GetObjectCstr
(
msg
,
"body"
);
switch_bool_t
is_dialog
=
indialog
&&
(
indialog
->
type
==
cJSON_True
||
(
indialog
->
type
==
cJSON_String
&&
switch_true
(
indialog
->
valuestring
)));
switch_bool_t
is_dialog
=
indialog
&&
(
indialog
->
type
==
cJSON_True
||
(
indialog
->
type
==
cJSON_String
&&
switch_true
(
indialog
->
valuestring
)));
if
(
!
zstr
(
to
))
{
if
(
!
zstr
(
to
))
{
if
(
strchr
(
to
,
'+'
))
{
if
(
strchr
(
to
,
'+'
))
{
pproto
=
strdup
(
to
);
pproto
=
strdup
(
to
);
...
@@ -2591,6 +2591,12 @@ static switch_bool_t verto__info_func(const char *method, cJSON *params, jsock_t
...
@@ -2591,6 +2591,12 @@ static switch_bool_t verto__info_func(const char *method, cJSON *params, jsock_t
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"verto_profile"
,
jsock
->
profile
->
name
);
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"verto_profile"
,
jsock
->
profile
->
name
);
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"verto_jsock_uuid"
,
jsock
->
uuid_str
);
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"verto_jsock_uuid"
,
jsock
->
uuid_str
);
for
(
i
=
msg
->
child
;
i
;
i
=
i
->
next
)
{
if
(
!
zstr
(
i
->
string
)
&&
!
zstr
(
i
->
valuestring
)
&&
(
!
strncasecmp
(
i
->
string
,
"from_"
,
5
)
||
!
strncasecmp
(
i
->
string
,
"to_"
,
3
)))
{
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
i
->
string
,
i
->
valuestring
);
}
}
if
(
is_dialog
)
{
if
(
is_dialog
)
{
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"call_id"
,
call_id
);
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"call_id"
,
call_id
);
}
}
...
@@ -4098,12 +4104,13 @@ static switch_status_t chat_send(switch_event_t *message_event)
...
@@ -4098,12 +4104,13 @@ static switch_status_t chat_send(switch_event_t *message_event)
const
char
*
body
=
switch_event_get_body
(
message_event
);
const
char
*
body
=
switch_event_get_body
(
message_event
);
const
char
*
call_id
=
switch_event_get_header
(
message_event
,
"call_id"
);
const
char
*
call_id
=
switch_event_get_header
(
message_event
,
"call_id"
);
DUMP_EVENT
(
message_event
);
//
DUMP_EVENT(message_event);
if
(
!
zstr
(
to
)
&&
!
zstr
(
body
)
&&
!
zstr
(
from
))
{
if
(
!
zstr
(
to
)
&&
!
zstr
(
body
)
&&
!
zstr
(
from
))
{
cJSON
*
obj
=
NULL
,
*
msg
=
NULL
,
*
params
=
NULL
;
cJSON
*
obj
=
NULL
,
*
msg
=
NULL
,
*
params
=
NULL
;
switch_event_header_t
*
eh
;
obj
=
jrpc_new_req
(
"verto.info"
,
call_id
,
&
params
);
obj
=
jrpc_new_req
(
"verto.info"
,
call_id
,
&
params
);
msg
=
json_add_child_obj
(
params
,
"msg"
,
NULL
);
msg
=
json_add_child_obj
(
params
,
"msg"
,
NULL
);
...
@@ -4111,10 +4118,17 @@ static switch_status_t chat_send(switch_event_t *message_event)
...
@@ -4111,10 +4118,17 @@ static switch_status_t chat_send(switch_event_t *message_event)
cJSON_AddItemToObject
(
msg
,
"to"
,
cJSON_CreateString
(
to
));
cJSON_AddItemToObject
(
msg
,
"to"
,
cJSON_CreateString
(
to
));
cJSON_AddItemToObject
(
msg
,
"body"
,
cJSON_CreateString
(
body
));
cJSON_AddItemToObject
(
msg
,
"body"
,
cJSON_CreateString
(
body
));
for
(
eh
=
message_event
->
headers
;
eh
;
eh
=
eh
->
next
)
{
if
((
!
strncasecmp
(
eh
->
name
,
"from_"
,
5
)
||
!
strncasecmp
(
eh
->
name
,
"to_"
,
3
)))
{
cJSON_AddItemToObject
(
msg
,
eh
->
name
,
cJSON_CreateString
(
eh
->
value
));
}
}
verto_send_chat
(
to
,
call_id
,
obj
);
verto_send_chat
(
to
,
call_id
,
obj
);
cJSON_Delete
(
obj
);
cJSON_Delete
(
obj
);
}
else
{
}
else
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"INVALID EVENT
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"INVALID EVENT
\n
"
);
DUMP_EVENT
(
message_event
);
status
=
SWITCH_STATUS_FALSE
;
status
=
SWITCH_STATUS_FALSE
;
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论