Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
8597842a
提交
8597842a
authored
5月 07, 2012
作者:
Giovanni Maruzzelli
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
skypopen: hook up to mod_sms, spawning a thread for servicing chatmessage
上级
2557e962
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
70 行增加
和
2 行删除
+70
-2
mod_skypopen.c
src/mod/endpoints/mod_skypopen/mod_skypopen.c
+69
-2
skypopen_protocol.c
src/mod/endpoints/mod_skypopen/skypopen_protocol.c
+1
-0
没有找到文件。
src/mod/endpoints/mod_skypopen/mod_skypopen.c
浏览文件 @
8597842a
...
...
@@ -2201,6 +2201,44 @@ int dtmf_received(private_t *tech_pvt, char *value)
return
0
;
}
void
*
SWITCH_THREAD_FUNC
skypopen_do_mod_sms_thread
(
switch_thread_t
*
thread
,
void
*
obj
)
{
switch_event_t
*
event
;
event
=
obj
;
switch_core_chat_send
(
"GLOBAL"
,
event
);
/* mod_sms */
return
event
;
}
int
start_mod_sms_thread
(
private_t
*
tech_pvt
,
switch_event_t
*
event
)
{
switch_threadattr_t
*
mod_sms_thread_thd_attr
=
NULL
;
switch_thread_t
*
mod_sms_thread
;
switch_threadattr_create
(
&
mod_sms_thread_thd_attr
,
skypopen_module_pool
);
switch_threadattr_detach_set
(
mod_sms_thread_thd_attr
,
0
);
switch_threadattr_stacksize_set
(
mod_sms_thread_thd_attr
,
SWITCH_THREAD_STACKSIZE
);
if
(
switch_thread_create
(
&
mod_sms_thread
,
mod_sms_thread_thd_attr
,
skypopen_do_mod_sms_thread
,
event
,
skypopen_module_pool
)
==
SWITCH_STATUS_SUCCESS
)
{
DEBUGA_SKYPE
(
"started mod_sms_thread thread.
\n
"
,
SKYPOPEN_P_LOG
);
}
else
{
ERRORA
(
"failed to start mod_sms_thread thread.
\n
"
,
SKYPOPEN_P_LOG
);
return
-
1
;
}
if
(
mod_sms_thread
==
NULL
)
{
WARNINGA
(
"mod_sms_thread exited
\n
"
,
SKYPOPEN_P_LOG
);
return
-
1
;
}
return
0
;
}
int
start_audio_threads
(
private_t
*
tech_pvt
)
{
switch_threadattr_t
*
tcp_srv_thread_thd_attr
=
NULL
;
...
...
@@ -2984,7 +3022,7 @@ int incoming_chatmessage(private_t *tech_pvt, int which)
/* mod_sms end */
switch_event_add_body
(
event
,
"%s"
,
tech_pvt
->
chatmessages
[
which
].
body
);
//switch_core_chat_send("GLOBAL", event); /* mod_sms */
if
(
session
)
{
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"during-call"
,
"true"
);
if
(
switch_core_session_queue_event
(
session
,
&
event
)
!=
SWITCH_STATUS_SUCCESS
)
{
...
...
@@ -3026,7 +3064,36 @@ int incoming_chatmessage(private_t *tech_pvt, int which)
if
(
session
)
{
switch_core_session_rwunlock
(
session
);
}
memset
(
&
tech_pvt
->
chatmessages
[
which
],
'\0'
,
sizeof
(
&
tech_pvt
->
chatmessages
[
which
]));
if
(
switch_event_create
(
&
event
,
SWITCH_EVENT_MESSAGE
)
==
SWITCH_STATUS_SUCCESS
)
{
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"proto"
,
SKYPE_CHAT_PROTO
);
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"login"
,
tech_pvt
->
name
);
//switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "hint", tech_pvt->chatmessages[which].from_dispname);
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"from"
,
tech_pvt
->
chatmessages
[
which
].
from_handle
);
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"subject"
,
"SIMPLE MESSAGE"
);
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"chatname"
,
tech_pvt
->
chatmessages
[
which
].
chatname
);
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"id"
,
tech_pvt
->
chatmessages
[
which
].
id
);
/* mod_sms begin */
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"to"
,
tech_pvt
->
skype_user
);
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"hint"
,
tech_pvt
->
name
);
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"to_proto"
,
SKYPE_CHAT_PROTO
);
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"from_user"
,
tech_pvt
->
chatmessages
[
which
].
from_handle
);
//switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from_host", "from_host");
//switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from_full", "from_full");
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"to_user"
,
tech_pvt
->
name
);
//switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "to_host", "to_host");
/* mod_sms end */
switch_event_add_body
(
event
,
"%s"
,
tech_pvt
->
chatmessages
[
which
].
body
);
//switch_core_chat_send("GLOBAL", event); /* mod_sms */
start_mod_sms_thread
(
tech_pvt
,
event
);
//usleep(20000);
}
else
{
ERRORA
(
"cannot create event on interface %s. WHY?????
\n
"
,
SKYPOPEN_P_LOG
,
tech_pvt
->
name
);
}
return
0
;
}
...
...
src/mod/endpoints/mod_skypopen/skypopen_protocol.c
浏览文件 @
8597842a
...
...
@@ -478,6 +478,7 @@ int skypopen_signaling_read(private_t *tech_pvt)
tech_pvt
->
chatmessages
[
i
].
from_handle
,
tech_pvt
->
chatmessages
[
i
].
from_dispname
,
tech_pvt
->
chatmessages
[
i
].
body
);
if
(
strcmp
(
tech_pvt
->
chatmessages
[
i
].
from_handle
,
tech_pvt
->
skype_user
))
{
//if the message was not sent by myself
incoming_chatmessage
(
tech_pvt
,
i
);
memset
(
&
tech_pvt
->
chatmessages
[
i
],
'\0'
,
sizeof
(
&
tech_pvt
->
chatmessages
[
i
]));
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论