Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
6dd1264d
提交
6dd1264d
authored
9月 02, 2011
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add support for global nameseace in chat interface to bind to unhandled messages
上级
d0308aae
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
61 行增加
和
23 行删除
+61
-23
mod_dingaling.c
src/mod/endpoints/mod_dingaling/mod_dingaling.c
+8
-1
sofia_presence.c
src/mod/endpoints/mod_sofia/sofia_presence.c
+13
-4
switch_core.c
src/switch_core.c
+0
-18
switch_loadable_module.c
src/switch_loadable_module.c
+40
-0
没有找到文件。
src/mod/endpoints/mod_dingaling/mod_dingaling.c
浏览文件 @
6dd1264d
...
...
@@ -2876,6 +2876,8 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi
char
*
proto
=
MDL_CHAT_PROTO
;
char
*
pproto
=
NULL
,
*
ffrom
=
NULL
;
char
*
hint
;
int
got_proto
=
0
;
#ifdef AUTO_REPLY
if
(
profile
->
auto_reply
)
{
ldl_handle_send_msg
(
handle
,
...
...
@@ -2890,6 +2892,7 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi
*
to
++
=
'\0'
;
}
proto
=
pproto
;
got_proto
++
;
}
hint
=
from
;
...
...
@@ -2902,10 +2905,14 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi
from
=
ffrom
;
}
if
(
strcasecmp
(
proto
,
MDL_CHAT_PROTO
))
{
/* yes no ! on purpose */
if
(
strcasecmp
(
proto
,
MDL_CHAT_PROTO
))
{
/* yes no ! on purpose */
switch_core_chat_send
(
proto
,
MDL_CHAT_PROTO
,
from
,
to
,
subject
,
switch_str_nil
(
msg
),
NULL
,
hint
);
}
if
(
!
got_proto
)
{
switch_core_chat_send
(
"GLOBAL"
,
MDL_CHAT_PROTO
,
from
,
to
,
subject
,
switch_str_nil
(
msg
),
NULL
,
hint
);
}
switch_safe_free
(
pproto
);
switch_safe_free
(
ffrom
);
}
...
...
src/mod/endpoints/mod_sofia/sofia_presence.c
浏览文件 @
6dd1264d
...
...
@@ -131,7 +131,7 @@ switch_status_t sofia_presence_chat_send(const char *proto, const char *from, co
if
(
!
prof
||
!
(
profile
=
sofia_glue_find_profile
(
prof
)))
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Chat proto [%s]
\n
from [%s]
\n
to [%s]
\n
%s
\n
Invalid Profile %s
\n
"
,
proto
,
from
,
to
,
"Chat proto [%s]
\n
from [%s]
\n
to [%s]
\n
%s
\n
Invalid Profile %s
\n
"
,
proto
,
from
,
to
,
body
?
body
:
"[no body]"
,
prof
?
prof
:
"NULL"
);
goto
end
;
}
...
...
@@ -233,7 +233,7 @@ switch_status_t sofia_presence_chat_send(const char *proto, const char *from, co
}
/* if this cries, add contact here too, change the 1 to 0 and omit the safe_free */
msg_nh
=
nua_handle
(
profile
->
nua
,
NULL
,
TAG_IF
(
dst
->
route_uri
,
NUTAG_PROXY
(
dst
->
route_uri
)),
TAG_IF
(
dst
->
route
,
SIPTAG_ROUTE_STR
(
dst
->
route
)),
...
...
@@ -2891,6 +2891,7 @@ void sofia_presence_handle_sip_i_message(int status,
char
*
p
;
char
*
full_from
;
char
proto
[
512
]
=
SOFIA_CHAT_PROTO
;
int
got_proto
=
0
;
full_from
=
sip_header_as_string
(
nh
->
nh_home
,
(
void
*
)
sip
->
sip_from
);
...
...
@@ -2904,11 +2905,12 @@ void sofia_presence_handle_sip_i_message(int status,
*
p
=
'@'
;
}
}
got_proto
++
;
}
else
{
to_addr
=
switch_mprintf
(
"%s@%s"
,
to_user
,
to_host
);
}
from_addr
=
switch_mprintf
(
"%s
@%s"
,
from_user
,
from_host
);
from_addr
=
switch_mprintf
(
"%s
/%s@%s"
,
profile
->
name
,
from_user
,
from_host
);
if
(
sofia_test_pflag
(
profile
,
PFLAG_IN_DIALOG_CHAT
))
{
sofia_presence_set_hash_key
(
hash_key
,
sizeof
(
hash_key
),
sip
);
...
...
@@ -2932,8 +2934,15 @@ void sofia_presence_handle_sip_i_message(int status,
}
}
}
else
{
switch_core_chat_send
(
proto
,
SOFIA_CHAT_PROTO
,
from_addr
,
to_addr
,
""
,
msg
,
NULL
,
full_from
);
if
(
strcasecmp
(
proto
,
SOFIA_CHAT_PROTO
))
{
switch_core_chat_send
(
proto
,
SOFIA_CHAT_PROTO
,
from_addr
,
to_addr
,
""
,
msg
,
NULL
,
full_from
);
}
}
if
(
!
got_proto
)
{
switch_core_chat_send
(
"GLOBAL"
,
SOFIA_CHAT_PROTO
,
from_addr
,
to_addr
,
""
,
msg
,
NULL
,
full_from
);
}
switch_safe_free
(
to_addr
);
switch_safe_free
(
from_addr
);
if
(
full_from
)
{
...
...
src/switch_core.c
浏览文件 @
6dd1264d
...
...
@@ -2191,24 +2191,6 @@ SWITCH_DECLARE(switch_status_t) switch_core_destroy(void)
return
switch_test_flag
((
&
runtime
),
SCF_RESTART
)
?
SWITCH_STATUS_RESTART
:
SWITCH_STATUS_SUCCESS
;
}
SWITCH_DECLARE
(
switch_status_t
)
switch_core_chat_send
(
const
char
*
name
,
const
char
*
proto
,
const
char
*
from
,
const
char
*
to
,
const
char
*
subject
,
const
char
*
body
,
const
char
*
type
,
const
char
*
hint
)
{
switch_chat_interface_t
*
ci
;
switch_status_t
status
;
if
(
!
name
||
!
(
ci
=
switch_loadable_module_get_chat_interface
(
name
))
||
!
ci
->
chat_send
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Invalid Chat Interface [%s]!
\n
"
,
name
);
return
SWITCH_STATUS_FALSE
;
}
status
=
ci
->
chat_send
(
proto
,
from
,
to
,
subject
,
body
,
type
,
hint
);
UNPROTECT_INTERFACE
(
ci
);
return
status
;
}
SWITCH_DECLARE
(
switch_status_t
)
switch_core_management_exec
(
char
*
relative_oid
,
switch_management_action_t
action
,
char
*
data
,
switch_size_t
datalen
)
{
const
switch_management_interface_t
*
ptr
;
...
...
src/switch_loadable_module.c
浏览文件 @
6dd1264d
...
...
@@ -468,6 +468,46 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable
}
SWITCH_DECLARE
(
switch_status_t
)
switch_core_chat_send
(
const
char
*
name
,
const
char
*
proto
,
const
char
*
from
,
const
char
*
to
,
const
char
*
subject
,
const
char
*
body
,
const
char
*
type
,
const
char
*
hint
)
{
switch_chat_interface_t
*
ci
;
switch_status_t
status
=
SWITCH_STATUS_FALSE
;
switch_hash_index_t
*
hi
;
const
void
*
var
;
void
*
val
;
if
(
!
name
)
{
return
SWITCH_STATUS_FALSE
;
}
if
(
!
strcasecmp
(
name
,
"GLOBAL"
))
{
switch_mutex_lock
(
loadable_modules
.
mutex
);
for
(
hi
=
switch_hash_first
(
NULL
,
loadable_modules
.
chat_hash
);
hi
;
hi
=
switch_hash_next
(
hi
))
{
switch_hash_this
(
hi
,
&
var
,
NULL
,
&
val
);
if
((
ci
=
(
switch_chat_interface_t
*
)
val
))
{
if
(
ci
->
chat_send
&&
!
strncasecmp
(
ci
->
interface_name
,
"GLOBAL_"
,
7
))
{
if
((
status
=
ci
->
chat_send
(
proto
,
from
,
to
,
subject
,
body
,
type
,
hint
))
!=
SWITCH_STATUS_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Chat Interface Error [%s]!
\n
"
,
name
);
break
;
}
}
}
}
switch_mutex_unlock
(
loadable_modules
.
mutex
);
}
else
{
if
(
!
(
ci
=
switch_loadable_module_get_chat_interface
(
name
))
||
!
ci
->
chat_send
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Invalid chat interface [%s]!
\n
"
,
name
);
return
SWITCH_STATUS_FALSE
;
}
status
=
ci
->
chat_send
(
proto
,
from
,
to
,
subject
,
body
,
type
,
hint
);
UNPROTECT_INTERFACE
(
ci
);
}
return
status
;
}
static
switch_status_t
switch_loadable_module_unprocess
(
switch_loadable_module_t
*
old_module
)
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论