Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
49e7b1bb
提交
49e7b1bb
authored
5月 04, 2006
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update
git-svn-id:
http://svn.freeswitch.org/svn/freeswitch/trunk@1344
d0543943-73ff-0310-b7d9-9358b9ac24b2
上级
2546187c
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
91 行增加
和
15 行删除
+91
-15
libdingaling.c
libs/libdingaling/src/libdingaling.c
+34
-3
libdingaling.h
libs/libdingaling/src/libdingaling.h
+16
-0
mod_dingaling.c
src/mod/endpoints/mod_dingaling/mod_dingaling.c
+41
-12
没有找到文件。
libs/libdingaling/src/libdingaling.c
浏览文件 @
49e7b1bb
...
...
@@ -125,6 +125,7 @@ struct ldl_session {
ldl_candidate_t
candidates
[
LDL_MAX_CANDIDATES
];
unsigned
int
candidate_len
;
apr_pool_t
*
pool
;
apr_hash_t
*
variables
;
apr_time_t
created
;
void
*
private_data
;
};
...
...
@@ -170,6 +171,16 @@ static unsigned int next_id(void)
}
char
*
ldl_session_get_value
(
ldl_session_t
*
session
,
char
*
key
)
{
return
apr_hash_get
(
session
->
variables
,
key
,
APR_HASH_KEY_STRING
);
}
void
ldl_session_set_value
(
ldl_session_t
*
session
,
char
*
key
,
char
*
val
)
{
apr_hash_set
(
session
->
variables
,
apr_pstrdup
(
session
->
pool
,
key
),
APR_HASH_KEY_STRING
,
apr_pstrdup
(
session
->
pool
,
val
));
}
char
*
ldl_session_get_id
(
ldl_session_t
*
session
)
{
return
session
->
id
;
...
...
@@ -223,8 +234,10 @@ ldl_status ldl_session_create(ldl_session_t **session_p, ldl_handle_t *handle, c
session
->
handle
=
handle
;
session
->
created
=
apr_time_now
();
session
->
state
=
LDL_STATE_NEW
;
session
->
variables
=
apr_hash_make
(
session
->
pool
);
*
session_p
=
session
;
if
(
globals
.
debug
)
{
globals
.
logger
(
DL_LOG_DEBUG
,
"Created Session %s
\n
"
,
id
);
}
...
...
@@ -305,7 +318,11 @@ static ldl_status parse_session_code(ldl_handle_t *handle, char *id, char *from,
tag
=
iks_child
(
xml
);
while
(
tag
)
{
if
(
!
strcasecmp
(
iks_name
(
tag
),
"candidate"
)
&&
session
->
candidate_len
<
LDL_MAX_CANDIDATES
)
{
if
(
!
strcasecmp
(
type
,
"info_element"
))
{
char
*
name
=
iks_find_attrib
(
tag
,
"name"
);
char
*
value
=
iks_find_attrib
(
tag
,
"value"
);
ldl_session_set_value
(
session
,
name
,
value
);
}
else
if
(
!
strcasecmp
(
iks_name
(
tag
),
"candidate"
)
&&
session
->
candidate_len
<
LDL_MAX_CANDIDATES
)
{
char
*
key
;
double
pref
=
0
.
0
;
int
index
=
-
1
;
...
...
@@ -812,7 +829,8 @@ static ldl_status new_session_iq(ldl_session_t *session, iks **iqp, iks **sessp,
iks
*
iq
,
*
sess
;
unsigned
int
myid
;
char
idbuf
[
80
];
apr_hash_index_t
*
hi
;
myid
=
next_id
();
snprintf
(
idbuf
,
sizeof
(
idbuf
),
"%u"
,
myid
);
iq
=
iks_new
(
"iq"
);
...
...
@@ -827,6 +845,19 @@ static ldl_status new_session_iq(ldl_session_t *session, iks **iqp, iks **sessp,
iks_insert_attrib
(
sess
,
"type"
,
type
);
iks_insert_attrib
(
sess
,
"id"
,
session
->
id
);
iks_insert_attrib
(
sess
,
"initiator"
,
session
->
initiator
?
session
->
initiator
:
session
->
them
);
for
(
hi
=
apr_hash_first
(
session
->
pool
,
session
->
variables
);
hi
;
hi
=
apr_hash_next
(
hi
))
{
void
*
val
=
NULL
;
const
void
*
key
=
NULL
;
apr_hash_this
(
hi
,
&
key
,
NULL
,
&
val
);
if
(
val
)
{
iks
*
var
=
iks_insert
(
sess
,
"info_element"
);
iks_insert_attrib
(
var
,
"xmlns"
,
"http://www.freeswitch.org/jie"
);
iks_insert_attrib
(
var
,
"name"
,
(
char
*
)
key
);
iks_insert_attrib
(
var
,
"value"
,
(
char
*
)
val
);
}
}
*
sessp
=
sess
;
*
iqp
=
iq
;
*
id
=
myid
;
...
...
libs/libdingaling/src/libdingaling.h
浏览文件 @
49e7b1bb
...
...
@@ -191,6 +191,22 @@ typedef void (*ldl_logger_t)(char *file, const char *func, int line, int level,
*/
ldl_status
ldl_session_destroy
(
ldl_session_t
**
session_p
);
/*!
\brief Get a value from a session
\param session the session
\param key the key to look up
\return the value
*/
char
*
ldl_session_get_value
(
ldl_session_t
*
session
,
char
*
key
);
/*!
\brief Set a value on a session
\param session the session
\param key the key to set
\param val the value of the key
*/
void
ldl_session_set_value
(
ldl_session_t
*
session
,
char
*
key
,
char
*
val
);
/*!
\brief Create a Jingle Session
\param session_p pointer to reference the session
...
...
src/mod/endpoints/mod_dingaling/mod_dingaling.c
浏览文件 @
49e7b1bb
...
...
@@ -143,6 +143,7 @@ struct private_object {
switch_time_t
next_cand
;
char
*
stun_ip
;
char
*
recip
;
char
*
dnis
;
uint16_t
stun_port
;
};
...
...
@@ -1065,10 +1066,9 @@ static switch_status_t channel_outgoing_channel(switch_core_session_t *session,
char
idbuf
[
1024
];
char
*
full_id
;
char
sess_id
[
11
]
=
""
;
char
workspace
[
1024
];
char
*
dnis
=
NULL
;
char
workspace
[
1024
]
=
""
;
switch_copy_string
(
workspace
,
outbound_profile
->
destination_number
,
sizeof
(
workspace
));
profile_name
=
workspace
;
if
((
callto
=
strchr
(
profile_name
,
'/'
)))
{
...
...
@@ -1079,6 +1079,9 @@ static switch_status_t channel_outgoing_channel(switch_core_session_t *session,
return
SWITCH_STATUS_GENERR
;
}
if
((
dnis
=
strchr
(
profile_name
,
':'
)))
{
*
dnis
++
=
'\0'
;
}
if
((
mdl_profile
=
switch_core_hash_find
(
globals
.
profile_hash
,
profile_name
)))
{
if
(
!
ldl_handle_ready
(
mdl_profile
->
handle
))
{
...
...
@@ -1109,6 +1112,7 @@ static switch_status_t channel_outgoing_channel(switch_core_session_t *session,
tech_pvt
->
codec_index
=
-
1
;
tech_pvt
->
local_port
=
switch_rtp_request_port
();
tech_pvt
->
recip
=
switch_core_session_strdup
(
*
new_session
,
full_id
);
tech_pvt
->
dnis
=
switch_core_session_strdup
(
*
new_session
,
dnis
);
}
else
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_CRIT
,
"Hey where is my memory pool?
\n
"
);
switch_core_session_destroy
(
new_session
);
...
...
@@ -1138,6 +1142,9 @@ static switch_status_t channel_outgoing_channel(switch_core_session_t *session,
ldl_session_create
(
&
dlsession
,
mdl_profile
->
handle
,
sess_id
,
full_id
,
mdl_profile
->
login
);
tech_pvt
->
profile
=
mdl_profile
;
ldl_session_set_private
(
dlsession
,
*
new_session
);
ldl_session_set_value
(
dlsession
,
"dnis"
,
dnis
);
ldl_session_set_value
(
dlsession
,
"caller_id_name"
,
outbound_profile
->
caller_id_name
);
ldl_session_set_value
(
dlsession
,
"caller_id_number"
,
outbound_profile
->
caller_id_number
);
tech_pvt
->
dlsession
=
dlsession
;
get_codecs
(
tech_pvt
);
//tech_pvt->desc_id = ldl_session_describe(dlsession, NULL, 0, LDL_DESCRIPTION_INITIATE);
...
...
@@ -1516,6 +1523,11 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi
return
LDL_STATUS_FALSE
;
}
if
((
session
=
switch_core_session_request
(
&
channel_endpoint_interface
,
NULL
))
!=
0
)
{
char
*
exten
;
char
*
context
;
char
*
cid_name
;
char
*
cid_num
;
switch_core_session_add_stream
(
session
,
NULL
);
if
((
tech_pvt
=
(
struct
private_object
*
)
switch_core_session_alloc
(
session
,
sizeof
(
struct
private_object
)))
!=
0
)
{
memset
(
tech_pvt
,
0
,
sizeof
(
*
tech_pvt
));
...
...
@@ -1537,17 +1549,33 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"Creating a session for %s
\n
"
,
ldl_session_get_id
(
dlsession
));
if
(
!
(
exten
=
ldl_session_get_value
(
dlsession
,
"dnis"
)))
{
exten
=
profile
->
exten
;
}
if
(
!
(
context
=
ldl_session_get_value
(
dlsession
,
"context"
)))
{
context
=
profile
->
context
;
}
if
(
!
(
cid_name
=
ldl_session_get_value
(
dlsession
,
"caller_id_name"
)))
{
cid_name
=
tech_pvt
->
recip
;
}
if
(
!
(
cid_num
=
ldl_session_get_value
(
dlsession
,
"caller_id_number"
)))
{
cid_num
=
tech_pvt
->
recip
;
}
if
((
tech_pvt
->
caller_profile
=
switch_caller_profile_new
(
switch_core_session_get_pool
(
session
),
profile
->
dialplan
,
ldl_session_get_caller
(
dlsession
)
,
ldl_session_get_caller
(
dlsession
)
,
cid_name
,
cid_num
,
ldl_session_get_ip
(
dlsession
),
NULL
,
NULL
,
NULL
,
ldl_session_get_value
(
dlsession
,
"ani"
)
,
ldl_session_get_value
(
dlsession
,
"ani2"
)
,
ldl_session_get_value
(
dlsession
,
"rdnis"
)
,
(
char
*
)
modname
,
profile
->
context
,
profile
->
exten
))
!=
0
)
{
context
,
exten
))
!=
0
)
{
char
name
[
128
];
snprintf
(
name
,
sizeof
(
name
),
"DingaLing/%s-%04x"
,
tech_pvt
->
caller_profile
->
destination_number
,
rand
()
&
0xffff
);
...
...
@@ -1697,11 +1725,12 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi
return
LDL_STATUS_FALSE
;
}
}
tech_pvt
->
remote_ip
=
switch_core_session_strdup
(
session
,
candidates
[
x
].
address
);
ldl_session_set_ip
(
dlsession
,
tech_pvt
->
remote_ip
);
tech_pvt
->
remote_port
=
candidates
[
x
].
port
;
tech_pvt
->
remote_user
=
switch_core_session_strdup
(
session
,
candidates
[
x
].
username
);
if
(
!
switch_test_flag
(
tech_pvt
,
TFLAG_OUTBOUND
))
{
do_candidates
(
tech_pvt
,
0
);
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论