Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
3fbd9e21
提交
3fbd9e21
authored
6月 11, 2010
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
MODAPP-433
上级
22569d4a
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
64 行增加
和
22 行删除
+64
-22
switch_event.h
src/include/switch_event.h
+1
-1
switch_event.c
src/switch_event.c
+13
-2
switch_ivr_originate.c
src/switch_ivr_originate.c
+50
-19
没有找到文件。
src/include/switch_event.h
浏览文件 @
3fbd9e21
...
...
@@ -199,7 +199,7 @@ SWITCH_DECLARE(void) switch_event_destroy(switch_event_t **event);
\return SWITCH_STATUS_SUCCESS if the event was duplicated
*/
SWITCH_DECLARE
(
switch_status_t
)
switch_event_dup
(
switch_event_t
**
event
,
switch_event_t
*
todup
);
SWITCH_DECLARE
(
void
)
switch_event_merge
(
switch_event_t
*
event
,
switch_event_t
*
tomerge
);
/*!
\brief Fire an event with full arguement list
\param file the calling file
...
...
src/switch_event.c
浏览文件 @
3fbd9e21
...
...
@@ -655,7 +655,7 @@ SWITCH_DECLARE(switch_status_t) switch_event_create_subclass_detailed(const char
memset
(
*
event
,
0
,
sizeof
(
switch_event_t
));
if
(
event_id
==
SWITCH_EVENT_REQUEST_PARAMS
)
{
if
(
event_id
==
SWITCH_EVENT_REQUEST_PARAMS
||
event_id
==
SWITCH_EVENT_CHANNEL_DATA
)
{
(
*
event
)
->
flags
|=
EF_UNIQ_HEADERS
;
}
...
...
@@ -892,6 +892,17 @@ SWITCH_DECLARE(void) switch_event_destroy(switch_event_t **event)
}
SWITCH_DECLARE
(
void
)
switch_event_merge
(
switch_event_t
*
event
,
switch_event_t
*
tomerge
)
{
switch_event_header_t
*
hp
;
switch_assert
(
tomerge
&&
event
);
for
(
hp
=
tomerge
->
headers
;
hp
;
hp
=
hp
->
next
)
{
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
hp
->
name
,
hp
->
value
);
}
}
SWITCH_DECLARE
(
switch_status_t
)
switch_event_dup
(
switch_event_t
**
event
,
switch_event_t
*
todup
)
{
switch_event_header_t
*
hp
;
...
...
@@ -903,7 +914,7 @@ SWITCH_DECLARE(switch_status_t) switch_event_dup(switch_event_t **event, switch_
(
*
event
)
->
event_id
=
todup
->
event_id
;
(
*
event
)
->
event_user_data
=
todup
->
event_user_data
;
(
*
event
)
->
bind_user_data
=
todup
->
bind_user_data
;
(
*
event
)
->
flags
=
todup
->
flags
;
for
(
hp
=
todup
->
headers
;
hp
;
hp
=
hp
->
next
)
{
if
(
todup
->
subclass_name
&&
!
strcmp
(
hp
->
name
,
"Event-Subclass"
))
{
continue
;
...
...
src/switch_ivr_originate.c
浏览文件 @
3fbd9e21
...
...
@@ -2293,9 +2293,11 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
char
*
vdata
;
const
char
*
current_variable
;
char
variable_buffer
[
512
]
=
""
;
switch_event_t
*
local_var_event
=
NULL
,
*
originate_var_event
=
NULL
;
end
=
NULL
;
chan_type
=
peer_names
[
i
];
while
(
chan_type
&&
*
chan_type
&&
*
chan_type
==
' '
)
{
chan_type
++
;
}
...
...
@@ -2486,15 +2488,52 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
current_variable
=
NULL
;
switch_event_add_header_string
(
var_event
,
SWITCH_STACK_BOTTOM
,
"originate_early_media"
,
oglobals
.
early_ok
?
"true"
:
"false"
);
if
((
reason
=
switch_core_session_outgoing_channel
(
oglobals
.
session
,
var_event
,
chan_type
,
new_profile
,
&
new_session
,
NULL
,
myflags
,
cancel_cause
))
!=
SWITCH_CAUSE_SUCCESS
)
{
if
(
vdata
)
{
char
*
var_array
[
1024
]
=
{
0
};
int
var_count
=
0
;
switch_event_create_plain
(
&
local_var_event
,
SWITCH_EVENT_CHANNEL_DATA
);
if
((
var_count
=
switch_separate_string
(
vdata
,
'|'
,
var_array
,
(
sizeof
(
var_array
)
/
sizeof
(
var_array
[
0
])))))
{
int
x
=
0
;
for
(
x
=
0
;
x
<
var_count
;
x
++
)
{
char
*
inner_var_array
[
2
]
=
{
0
};
int
inner_var_count
;
if
((
inner_var_count
=
switch_separate_string
(
var_array
[
x
],
'='
,
inner_var_array
,
(
sizeof
(
inner_var_array
)
/
sizeof
(
inner_var_array
[
0
]))))
==
2
)
{
switch_event_add_header_string
(
local_var_event
,
SWITCH_STACK_BOTTOM
,
inner_var_array
[
0
],
inner_var_array
[
1
]);
}
}
}
}
/* make a special var event with mixture of the {} and the [] vars to pass down as global vars to the outgoing channel
so if something like the user channel does another originate our options will be passed down properly
*/
switch_event_dup
(
&
originate_var_event
,
var_event
);
if
(
local_var_event
)
{
switch_event_merge
(
originate_var_event
,
local_var_event
);
}
reason
=
switch_core_session_outgoing_channel
(
oglobals
.
session
,
originate_var_event
,
chan_type
,
new_profile
,
&
new_session
,
NULL
,
myflags
,
cancel_cause
);
switch_event_destroy
(
&
originate_var_event
);
if
(
reason
!=
SWITCH_CAUSE_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_ERROR
,
"Cannot create outgoing channel of type [%s] cause: [%s]
\n
"
,
chan_type
,
switch_channel_cause2str
(
reason
));
if
(
local_var_event
)
switch_event_destroy
(
&
local_var_event
);
continue
;
}
if
(
switch_core_session_read_lock
(
new_session
)
!=
SWITCH_STATUS_SUCCESS
)
{
status
=
SWITCH_STATUS_FALSE
;
if
(
local_var_event
)
switch_event_destroy
(
&
local_var_event
);
goto
done
;
}
...
...
@@ -2523,22 +2562,13 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
}
}
if
(
vdata
)
{
char
*
var_array
[
1024
]
=
{
0
};
int
var_count
=
0
;
if
((
var_count
=
switch_separate_string
(
vdata
,
'|'
,
var_array
,
(
sizeof
(
var_array
)
/
sizeof
(
var_array
[
0
])))))
{
int
x
=
0
;
for
(
x
=
0
;
x
<
var_count
;
x
++
)
{
char
*
inner_var_array
[
2
]
=
{
0
};
int
inner_var_count
;
if
((
inner_var_count
=
switch_separate_string
(
var_array
[
x
],
'='
,
inner_var_array
,
(
sizeof
(
inner_var_array
)
/
sizeof
(
inner_var_array
[
0
]))))
==
2
)
{
switch_channel_set_variable
(
originate_status
[
i
].
peer_channel
,
inner_var_array
[
0
],
inner_var_array
[
1
]);
}
}
/* copy local originate vars to the channel */
if
(
local_var_event
)
{
switch_event_header_t
*
header
;
for
(
header
=
local_var_event
->
headers
;
header
;
header
=
header
->
next
)
{
switch_channel_set_variable
(
originate_status
[
i
].
peer_channel
,
header
->
name
,
header
->
value
);
}
switch_event_destroy
(
&
local_var_event
);
}
if
(
!
local_clobber
)
{
...
...
@@ -2573,13 +2603,14 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
if
((
vvar
=
switch_channel_get_variable
(
originate_status
[
i
].
peer_channel
,
"leg_timeout"
)))
{
int
val
=
atoi
(
vvar
);
if
(
val
>
0
)
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_DEBUG
,
"%s Setting leg timeout to %d
\n
"
,
switch_channel_get_name
(
originate_status
[
i
].
peer_channel
),
val
);
originate_status
[
i
].
per_channel_timelimit_sec
=
(
uint32_t
)
val
;
}
}
if
((
vvar
=
switch_channel_get_variable
(
originate_status
[
i
].
peer_channel
,
"leg_progress_timeout"
)))
{
int
val
=
atoi
(
vvar
);
if
(
val
>
0
)
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论