Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
ab3f42c9
提交
ab3f42c9
authored
5月 26, 2006
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update
git-svn-id:
http://svn.freeswitch.org/svn/freeswitch/trunk@1508
d0543943-73ff-0310-b7d9-9358b9ac24b2
上级
75c0ab62
隐藏空白字符变更
内嵌
并排
正在显示
12 个修改的文件
包含
126 行增加
和
67 行删除
+126
-67
freeswitch.xml
conf/freeswitch.xml
+6
-0
switch_caller.h
src/include/switch_caller.h
+13
-10
mod_bridgecall.c
src/mod/applications/mod_bridgecall/mod_bridgecall.c
+1
-0
mod_dialplan_xml.c
src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c
+73
-44
mod_dingaling.c
src/mod/endpoints/mod_dingaling/mod_dingaling.c
+1
-0
mod_exosip.c
src/mod/endpoints/mod_exosip/mod_exosip.c
+1
-0
mod_iax.c
src/mod/endpoints/mod_iax/mod_iax.c
+2
-1
mod_portaudio.c
src/mod/endpoints/mod_portaudio/mod_portaudio.c
+1
-0
mod_wanpipe.c
src/mod/endpoints/mod_wanpipe/mod_wanpipe.c
+1
-0
mod_woomera.c
src/mod/endpoints/mod_woomera/mod_woomera.c
+1
-0
mod_spidermonkey.c
src/mod/languages/mod_spidermonkey/mod_spidermonkey.c
+5
-2
switch_caller.c
src/switch_caller.c
+21
-10
没有找到文件。
conf/freeswitch.xml
浏览文件 @
ab3f42c9
...
@@ -261,6 +261,12 @@
...
@@ -261,6 +261,12 @@
<action
application=
"bridge"
data=
"exosip/888@66.250.68.194"
/>
<action
application=
"bridge"
data=
"exosip/888@66.250.68.194"
/>
</condition>
</condition>
</extension>
</extension>
<!-- if the destination is an exact match on the extension name
you do not need any regex in the condition -->
<extension
name=
"999"
>
<condition><action
application=
"bridge"
data=
"exosip/888@66.250.68.194"
/></condition>
</extension>
<!-- extensions starting with 4, all the numbers after 4 form a numeric filename
<!-- extensions starting with 4, all the numbers after 4 form a numeric filename
continue=true means keep looking for more extensions to match
continue=true means keep looking for more extensions to match
*NOTE* The entire dialplan is parsed ONCE when the call starts
*NOTE* The entire dialplan is parsed ONCE when the call starts
...
...
src/include/switch_caller.h
浏览文件 @
ab3f42c9
...
@@ -60,6 +60,8 @@ BEGIN_EXTERN_C
...
@@ -60,6 +60,8 @@ BEGIN_EXTERN_C
/*! \brief Call Specific Data
/*! \brief Call Specific Data
*/
*/
struct
switch_caller_profile
{
struct
switch_caller_profile
{
/*! The Call's User Name */
char
*
username
;
/*! The name of the dialplan */
/*! The name of the dialplan */
char
*
dialplan
;
char
*
dialplan
;
/*! Caller ID Name */
/*! Caller ID Name */
...
@@ -161,16 +163,17 @@ SWITCH_DECLARE(char *) switch_caller_get_field_by_name(switch_caller_profile_t *
...
@@ -161,16 +163,17 @@ SWITCH_DECLARE(char *) switch_caller_get_field_by_name(switch_caller_profile_t *
\return a new profile object allocated from the session's memory pool
\return a new profile object allocated from the session's memory pool
*/
*/
SWITCH_DECLARE
(
switch_caller_profile_t
*
)
switch_caller_profile_new
(
switch_memory_pool_t
*
pool
,
SWITCH_DECLARE
(
switch_caller_profile_t
*
)
switch_caller_profile_new
(
switch_memory_pool_t
*
pool
,
char
*
dialplan
,
char
*
username
,
char
*
caller_id_name
,
char
*
dialplan
,
char
*
caller_id_number
,
char
*
caller_id_name
,
char
*
network_addr
,
char
*
caller_id_number
,
char
*
ani
,
char
*
network_addr
,
char
*
ani2
,
char
*
ani
,
char
*
rdnis
,
char
*
ani2
,
char
*
source
,
char
*
rdnis
,
char
*
context
,
char
*
source
,
char
*
destination_number
);
char
*
context
,
char
*
destination_number
);
/*!
/*!
\brief Clone an existing caller profile object
\brief Clone an existing caller profile object
...
...
src/mod/applications/mod_bridgecall/mod_bridgecall.c
浏览文件 @
ab3f42c9
...
@@ -56,6 +56,7 @@ static void audio_bridge_function(switch_core_session_t *session, char *data)
...
@@ -56,6 +56,7 @@ static void audio_bridge_function(switch_core_session_t *session, char *data)
caller_caller_profile
=
switch_channel_get_caller_profile
(
caller_channel
);
caller_caller_profile
=
switch_channel_get_caller_profile
(
caller_channel
);
caller_profile
=
switch_caller_profile_new
(
switch_core_session_get_pool
(
session
),
caller_profile
=
switch_caller_profile_new
(
switch_core_session_get_pool
(
session
),
caller_caller_profile
->
username
,
caller_caller_profile
->
dialplan
,
caller_caller_profile
->
dialplan
,
caller_caller_profile
->
caller_id_name
,
caller_caller_profile
->
caller_id_name
,
caller_caller_profile
->
caller_id_number
,
caller_caller_profile
->
caller_id_number
,
...
...
src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c
浏览文件 @
ab3f42c9
...
@@ -122,13 +122,74 @@ static void perform_substitution(pcre *re, int match_count, char *data, char *fi
...
@@ -122,13 +122,74 @@ static void perform_substitution(pcre *re, int match_count, char *data, char *fi
substituted
[
y
++
]
=
'\0'
;
substituted
[
y
++
]
=
'\0'
;
}
}
static
int
parse_exten
(
switch_core_session_t
*
session
,
switch_xml_t
xexten
,
switch_caller_extension_t
**
extension
)
{
switch_xml_t
xcond
,
xaction
;
switch_caller_profile_t
*
caller_profile
;
switch_channel_t
*
channel
;
char
*
exten_name
=
(
char
*
)
switch_xml_attr_soft
(
xexten
,
"name"
);
int
proceed
=
0
;
channel
=
switch_core_session_get_channel
(
session
);
caller_profile
=
switch_channel_get_caller_profile
(
channel
);
for
(
xcond
=
switch_xml_child
(
xexten
,
"condition"
);
xcond
;
xcond
=
xcond
->
next
)
{
char
*
field
=
NULL
;
char
*
expression
=
NULL
;
char
*
field_data
=
NULL
;
pcre
*
re
=
NULL
;
int
ovector
[
30
];
field
=
(
char
*
)
switch_xml_attr
(
xcond
,
"field"
);
expression
=
(
char
*
)
switch_xml_attr_soft
(
xcond
,
"expression"
);
if
(
field
)
{
field_data
=
switch_caller_get_field_by_name
(
caller_profile
,
field
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"test conditions %s(%s) =~ /%s/
\n
"
,
field
,
field_data
,
expression
);
if
(
!
(
proceed
=
perform_regex
(
channel
,
field_data
,
expression
,
&
re
,
ovector
,
sizeof
(
ovector
)
/
sizeof
(
ovector
[
0
]))))
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"Regex mismatch
\n
"
);
break
;
}
assert
(
re
!=
NULL
);
}
for
(
xaction
=
switch_xml_child
(
xcond
,
"action"
);
xaction
;
xaction
=
xaction
->
next
)
{
char
*
application
=
(
char
*
)
switch_xml_attr_soft
(
xaction
,
"application"
);
char
*
data
=
(
char
*
)
switch_xml_attr_soft
(
xaction
,
"data"
);
char
substituted
[
1024
]
=
""
;
char
*
app_data
=
NULL
;
if
(
field
&&
strchr
(
expression
,
'('
))
{
perform_substitution
(
re
,
proceed
,
data
,
field_data
,
substituted
,
sizeof
(
substituted
),
ovector
);
app_data
=
substituted
;
}
else
{
app_data
=
data
;
}
if
(
!*
extension
)
{
if
((
*
extension
=
switch_caller_extension_new
(
session
,
exten_name
,
caller_profile
->
destination_number
))
==
0
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_CRIT
,
"memory error!
\n
"
);
return
0
;
}
}
switch_caller_extension_add_application
(
session
,
*
extension
,
application
,
app_data
);
}
cleanre
(
re
);
}
return
proceed
;
}
static
switch_caller_extension_t
*
dialplan_hunt
(
switch_core_session_t
*
session
)
static
switch_caller_extension_t
*
dialplan_hunt
(
switch_core_session_t
*
session
)
{
{
switch_caller_profile_t
*
caller_profile
;
switch_caller_profile_t
*
caller_profile
;
switch_caller_extension_t
*
extension
=
NULL
;
switch_caller_extension_t
*
extension
=
NULL
;
switch_channel_t
*
channel
;
switch_channel_t
*
channel
;
char
*
exten_name
=
NULL
;
switch_xml_t
cfg
,
xml
,
xcontext
,
xexten
;
switch_xml_t
cfg
,
xml
,
xcontext
,
xexten
,
xaction
,
xcond
;
char
*
context
=
NULL
;
char
*
context
=
NULL
;
char
params
[
1024
];
char
params
[
1024
];
...
@@ -143,7 +204,7 @@ static switch_caller_extension_t *dialplan_hunt(switch_core_session_t *session)
...
@@ -143,7 +204,7 @@ static switch_caller_extension_t *dialplan_hunt(switch_core_session_t *session)
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_INFO
,
"Processing %s->%s!
\n
"
,
caller_profile
->
caller_id_name
,
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_INFO
,
"Processing %s->%s!
\n
"
,
caller_profile
->
caller_id_name
,
caller_profile
->
destination_number
);
caller_profile
->
destination_number
);
snprintf
(
params
,
sizeof
(
params
),
"
dest=%s"
,
caller_profile
->
destination_number
);
snprintf
(
params
,
sizeof
(
params
),
"
context=%s&dest=%s"
,
caller_profile
->
context
,
caller_profile
->
destination_number
);
if
(
switch_xml_locate
(
"dialplan"
,
NULL
,
NULL
,
NULL
,
&
xml
,
&
cfg
,
params
)
!=
SWITCH_STATUS_SUCCESS
)
{
if
(
switch_xml_locate
(
"dialplan"
,
NULL
,
NULL
,
NULL
,
&
xml
,
&
cfg
,
params
)
!=
SWITCH_STATUS_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"open of dialplan failed
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"open of dialplan failed
\n
"
);
...
@@ -159,55 +220,23 @@ static switch_caller_extension_t *dialplan_hunt(switch_core_session_t *session)
...
@@ -159,55 +220,23 @@ static switch_caller_extension_t *dialplan_hunt(switch_core_session_t *session)
}
}
}
}
for
(
xexten
=
switch_xml_child
(
xcontext
,
"extension"
);
xexten
;
xexten
=
xexten
->
next
)
{
if
(
!
(
xexten
=
switch_xml_find_child
(
xcontext
,
"extension"
,
"name"
,
caller_profile
->
destination_number
)))
{
xexten
=
switch_xml_child
(
xcontext
,
"extension"
);
}
while
(
xexten
)
{
int
proceed
=
0
;
int
proceed
=
0
;
char
*
cont
=
(
char
*
)
switch_xml_attr_soft
(
xexten
,
"continue"
);
char
*
cont
=
(
char
*
)
switch_xml_attr_soft
(
xexten
,
"continue"
);
for
(
xcond
=
switch_xml_child
(
xexten
,
"condition"
);
xcond
;
xcond
=
xcond
->
next
)
{
proceed
=
parse_exten
(
session
,
xexten
,
&
extension
);
char
*
field
=
(
char
*
)
switch_xml_attr_soft
(
xcond
,
"field"
);
char
*
expression
=
(
char
*
)
switch_xml_attr_soft
(
xcond
,
"expression"
);
char
*
field_data
=
switch_caller_get_field_by_name
(
caller_profile
,
field
);
pcre
*
re
=
NULL
;
int
ovector
[
30
];
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"test conditions %s(%s) =~ /%s/
\n
"
,
field
,
field_data
,
expression
);
if
(
!
(
proceed
=
perform_regex
(
channel
,
field_data
,
expression
,
&
re
,
ovector
,
sizeof
(
ovector
)
/
sizeof
(
ovector
[
0
]))))
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"Regex mismatch
\n
"
);
break
;
}
assert
(
re
!=
NULL
);
for
(
xaction
=
switch_xml_child
(
xcond
,
"action"
);
xaction
;
xaction
=
xaction
->
next
)
{
//printf("ASS %s %d\n", (char *) switch_xml_attr_soft(xexten, "name"), proceed);
char
*
application
=
(
char
*
)
switch_xml_attr_soft
(
xaction
,
"application"
);
char
*
data
=
(
char
*
)
switch_xml_attr_soft
(
xaction
,
"data"
);
char
substituted
[
1024
]
=
""
;
char
*
app_data
=
NULL
;
if
(
strchr
(
expression
,
'('
))
{
perform_substitution
(
re
,
proceed
,
data
,
field_data
,
substituted
,
sizeof
(
substituted
),
ovector
);
app_data
=
substituted
;
}
else
{
app_data
=
data
;
}
if
(
!
extension
)
{
if
((
extension
=
switch_caller_extension_new
(
session
,
exten_name
,
caller_profile
->
destination_number
))
==
0
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_CRIT
,
"memory error!
\n
"
);
return
NULL
;
}
}
switch_caller_extension_add_application
(
session
,
extension
,
application
,
app_data
);
}
cleanre
(
re
);
}
if
(
proceed
&&
!
switch_true
(
cont
))
{
if
(
proceed
&&
!
switch_true
(
cont
))
{
break
;
break
;
}
}
xexten
=
xexten
->
next
;
}
}
...
...
src/mod/endpoints/mod_dingaling/mod_dingaling.c
浏览文件 @
ab3f42c9
...
@@ -1633,6 +1633,7 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi
...
@@ -1633,6 +1633,7 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi
ldl_session_get_id
(
dlsession
),
cid_name
,
cid_num
,
exten
);
ldl_session_get_id
(
dlsession
),
cid_name
,
cid_num
,
exten
);
if
((
tech_pvt
->
caller_profile
=
switch_caller_profile_new
(
switch_core_session_get_pool
(
session
),
if
((
tech_pvt
->
caller_profile
=
switch_caller_profile_new
(
switch_core_session_get_pool
(
session
),
profile
->
login
,
profile
->
dialplan
,
profile
->
dialplan
,
cid_name
,
cid_name
,
cid_num
,
cid_num
,
...
...
src/mod/endpoints/mod_exosip/mod_exosip.c
浏览文件 @
ab3f42c9
...
@@ -1197,6 +1197,7 @@ static switch_status_t exosip_create_call(eXosip_event_t * event)
...
@@ -1197,6 +1197,7 @@ static switch_status_t exosip_create_call(eXosip_event_t * event)
}
}
if
((
tech_pvt
->
caller_profile
=
switch_caller_profile_new
(
switch_core_session_get_pool
(
session
),
if
((
tech_pvt
->
caller_profile
=
switch_caller_profile_new
(
switch_core_session_get_pool
(
session
),
username
,
globals
.
dialplan
,
globals
.
dialplan
,
displayname
,
displayname
,
username
,
username
,
...
...
src/mod/endpoints/mod_iax/mod_iax.c
浏览文件 @
ab3f42c9
...
@@ -999,6 +999,7 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_runtime(void)
...
@@ -999,6 +999,7 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_runtime(void)
if
((
tech_pvt
->
caller_profile
=
switch_caller_profile_new
(
switch_core_session_get_pool
(
session
),
if
((
tech_pvt
->
caller_profile
=
switch_caller_profile_new
(
switch_core_session_get_pool
(
session
),
iaxevent
->
ies
.
username
,
globals
.
dialplan
,
globals
.
dialplan
,
iaxevent
->
ies
.
calling_name
,
iaxevent
->
ies
.
calling_name
,
iaxevent
->
ies
.
calling_number
,
iaxevent
->
ies
.
calling_number
,
...
@@ -1007,7 +1008,7 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_runtime(void)
...
@@ -1007,7 +1008,7 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_runtime(void)
NULL
,
NULL
,
NULL
,
NULL
,
(
char
*
)
modname
,
(
char
*
)
modname
,
NULL
,
iaxevent
->
ies
.
called_context
,
iaxevent
->
ies
.
called_number
))
!=
0
)
{
iaxevent
->
ies
.
called_number
))
!=
0
)
{
char
name
[
128
];
char
name
[
128
];
snprintf
(
name
,
sizeof
(
name
),
"IAX/%s-%04x"
,
tech_pvt
->
caller_profile
->
destination_number
,
snprintf
(
name
,
sizeof
(
name
),
"IAX/%s-%04x"
,
tech_pvt
->
caller_profile
->
destination_number
,
...
...
src/mod/endpoints/mod_portaudio/mod_portaudio.c
浏览文件 @
ab3f42c9
...
@@ -823,6 +823,7 @@ static switch_status_t place_call(char *dest, switch_stream_handle_t *stream)
...
@@ -823,6 +823,7 @@ static switch_status_t place_call(char *dest, switch_stream_handle_t *stream)
}
}
if
((
tech_pvt
->
caller_profile
=
switch_caller_profile_new
(
switch_core_session_get_pool
(
session
),
if
((
tech_pvt
->
caller_profile
=
switch_caller_profile_new
(
switch_core_session_get_pool
(
session
),
NULL
,
globals
.
dialplan
,
globals
.
dialplan
,
globals
.
cid_name
,
globals
.
cid_name
,
globals
.
cid_num
,
NULL
,
NULL
,
NULL
,
NULL
,
(
char
*
)
modname
,
NULL
,
dest
))
!=
0
)
{
globals
.
cid_num
,
NULL
,
NULL
,
NULL
,
NULL
,
(
char
*
)
modname
,
NULL
,
dest
))
!=
0
)
{
...
...
src/mod/endpoints/mod_wanpipe/mod_wanpipe.c
浏览文件 @
ab3f42c9
...
@@ -1128,6 +1128,7 @@ static int on_ring(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri
...
@@ -1128,6 +1128,7 @@ static int on_ring(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri
}
}
if
((
tech_pvt
->
caller_profile
=
switch_caller_profile_new
(
switch_core_session_get_pool
(
session
),
if
((
tech_pvt
->
caller_profile
=
switch_caller_profile_new
(
switch_core_session_get_pool
(
session
),
NULL
,
globals
.
dialplan
,
globals
.
dialplan
,
"FreeSWITCH"
,
"FreeSWITCH"
,
event
->
ring
.
callingnum
,
event
->
ring
.
callingnum
,
...
...
src/mod/endpoints/mod_woomera/mod_woomera.c
浏览文件 @
ab3f42c9
...
@@ -1065,6 +1065,7 @@ static void *woomera_channel_thread_run(switch_thread_t *thread, void *obj)
...
@@ -1065,6 +1065,7 @@ static void *woomera_channel_thread_run(switch_thread_t *thread, void *obj)
ip
=
woomera_message_header
(
&
wmsg
,
"Remote-Address"
);
ip
=
woomera_message_header
(
&
wmsg
,
"Remote-Address"
);
if
((
tech_pvt
->
caller_profile
=
switch_caller_profile_new
(
switch_core_session_get_pool
(
session
),
if
((
tech_pvt
->
caller_profile
=
switch_caller_profile_new
(
switch_core_session_get_pool
(
session
),
NULL
,
tech_pvt
->
profile
->
dialplan
,
tech_pvt
->
profile
->
dialplan
,
cid_name
,
cid_num
,
ip
,
NULL
,
NULL
,
NULL
,
(
char
*
)
modname
,
NULL
,
exten
))
!=
0
)
{
cid_name
,
cid_num
,
ip
,
NULL
,
NULL
,
NULL
,
(
char
*
)
modname
,
NULL
,
exten
))
!=
0
)
{
char
name
[
128
];
char
name
[
128
];
...
...
src/mod/languages/mod_spidermonkey/mod_spidermonkey.c
浏览文件 @
ab3f42c9
...
@@ -988,7 +988,7 @@ static JSBool session_construct(JSContext *cx, JSObject *obj, uintN argc, jsval
...
@@ -988,7 +988,7 @@ static JSBool session_construct(JSContext *cx, JSObject *obj, uintN argc, jsval
char
*
ani2
=
""
;
char
*
ani2
=
""
;
char
*
rdnis
=
""
;
char
*
rdnis
=
""
;
char
*
context
=
""
;
char
*
context
=
""
;
char
*
username
=
NULL
;
*
rval
=
BOOLEAN_TO_JSVAL
(
JS_FALSE
);
*
rval
=
BOOLEAN_TO_JSVAL
(
JS_FALSE
);
if
(
JS_ValueToObject
(
cx
,
argv
[
0
],
&
session_obj
))
{
if
(
JS_ValueToObject
(
cx
,
argv
[
0
],
&
session_obj
))
{
...
@@ -1025,6 +1025,9 @@ static JSBool session_construct(JSContext *cx, JSObject *obj, uintN argc, jsval
...
@@ -1025,6 +1025,9 @@ static JSBool session_construct(JSContext *cx, JSObject *obj, uintN argc, jsval
if
(
argc
>
10
)
{
if
(
argc
>
10
)
{
rdnis
=
JS_GetStringBytes
(
JS_ValueToString
(
cx
,
argv
[
10
]));
rdnis
=
JS_GetStringBytes
(
JS_ValueToString
(
cx
,
argv
[
10
]));
}
}
if
(
argc
>
11
)
{
username
=
JS_GetStringBytes
(
JS_ValueToString
(
cx
,
argv
[
11
]));
}
if
(
switch_core_new_memory_pool
(
&
pool
)
!=
SWITCH_STATUS_SUCCESS
)
{
if
(
switch_core_new_memory_pool
(
&
pool
)
!=
SWITCH_STATUS_SUCCESS
)
{
...
@@ -1032,7 +1035,7 @@ static JSBool session_construct(JSContext *cx, JSObject *obj, uintN argc, jsval
...
@@ -1032,7 +1035,7 @@ static JSBool session_construct(JSContext *cx, JSObject *obj, uintN argc, jsval
return
JS_FALSE
;
return
JS_FALSE
;
}
}
caller_profile
=
switch_caller_profile_new
(
pool
,
dialplan
,
cid_name
,
cid_num
,
network_addr
,
ani
,
ani2
,
rdnis
,
(
char
*
)
modname
,
context
,
dest
);
caller_profile
=
switch_caller_profile_new
(
pool
,
username
,
dialplan
,
cid_name
,
cid_num
,
network_addr
,
ani
,
ani2
,
rdnis
,
(
char
*
)
modname
,
context
,
dest
);
if
(
switch_core_session_outgoing_channel
(
session
,
channel_type
,
caller_profile
,
&
peer_session
,
pool
)
==
SWITCH_STATUS_SUCCESS
)
{
if
(
switch_core_session_outgoing_channel
(
session
,
channel_type
,
caller_profile
,
&
peer_session
,
pool
)
==
SWITCH_STATUS_SUCCESS
)
{
jss
=
switch_core_session_alloc
(
peer_session
,
sizeof
(
*
jss
));
jss
=
switch_core_session_alloc
(
peer_session
,
sizeof
(
*
jss
));
jss
->
session
=
peer_session
;
jss
->
session
=
peer_session
;
...
...
src/switch_caller.c
浏览文件 @
ab3f42c9
...
@@ -33,16 +33,17 @@
...
@@ -33,16 +33,17 @@
#include <switch_caller.h>
#include <switch_caller.h>
SWITCH_DECLARE
(
switch_caller_profile_t
*
)
switch_caller_profile_new
(
switch_memory_pool_t
*
pool
,
SWITCH_DECLARE
(
switch_caller_profile_t
*
)
switch_caller_profile_new
(
switch_memory_pool_t
*
pool
,
char
*
dialplan
,
char
*
username
,
char
*
caller_id_name
,
char
*
dialplan
,
char
*
caller_id_number
,
char
*
caller_id_name
,
char
*
network_addr
,
char
*
caller_id_number
,
char
*
ani
,
char
*
network_addr
,
char
*
ani2
,
char
*
ani
,
char
*
rdnis
,
char
*
ani2
,
char
*
source
,
char
*
rdnis
,
char
*
context
,
char
*
source
,
char
*
destination_number
)
char
*
context
,
char
*
destination_number
)
{
{
...
@@ -52,6 +53,7 @@ SWITCH_DECLARE(switch_caller_profile_t *) switch_caller_profile_new(switch_memor
...
@@ -52,6 +53,7 @@ SWITCH_DECLARE(switch_caller_profile_t *) switch_caller_profile_new(switch_memor
if
(
!
context
)
{
if
(
!
context
)
{
context
=
"default"
;
context
=
"default"
;
}
}
profile
->
username
=
switch_core_strdup
(
pool
,
username
);
profile
->
dialplan
=
switch_core_strdup
(
pool
,
dialplan
);
profile
->
dialplan
=
switch_core_strdup
(
pool
,
dialplan
);
profile
->
caller_id_name
=
switch_core_strdup
(
pool
,
caller_id_name
);
profile
->
caller_id_name
=
switch_core_strdup
(
pool
,
caller_id_name
);
profile
->
caller_id_number
=
switch_core_strdup
(
pool
,
caller_id_number
);
profile
->
caller_id_number
=
switch_core_strdup
(
pool
,
caller_id_number
);
...
@@ -73,6 +75,7 @@ SWITCH_DECLARE(switch_caller_profile_t *) switch_caller_profile_clone(switch_cor
...
@@ -73,6 +75,7 @@ SWITCH_DECLARE(switch_caller_profile_t *) switch_caller_profile_clone(switch_cor
{
{
switch_caller_profile_t
*
profile
=
NULL
;
switch_caller_profile_t
*
profile
=
NULL
;
if
((
profile
=
switch_core_session_alloc
(
session
,
sizeof
(
switch_caller_profile_t
)))
!=
0
)
{
if
((
profile
=
switch_core_session_alloc
(
session
,
sizeof
(
switch_caller_profile_t
)))
!=
0
)
{
profile
->
username
=
switch_core_session_strdup
(
session
,
tocopy
->
username
);
profile
->
dialplan
=
switch_core_session_strdup
(
session
,
tocopy
->
dialplan
);
profile
->
dialplan
=
switch_core_session_strdup
(
session
,
tocopy
->
dialplan
);
profile
->
caller_id_name
=
switch_core_session_strdup
(
session
,
tocopy
->
caller_id_name
);
profile
->
caller_id_name
=
switch_core_session_strdup
(
session
,
tocopy
->
caller_id_name
);
profile
->
ani
=
switch_core_session_strdup
(
session
,
tocopy
->
ani
);
profile
->
ani
=
switch_core_session_strdup
(
session
,
tocopy
->
ani
);
...
@@ -95,6 +98,9 @@ SWITCH_DECLARE(char *) switch_caller_get_field_by_name(switch_caller_profile_t *
...
@@ -95,6 +98,9 @@ SWITCH_DECLARE(char *) switch_caller_get_field_by_name(switch_caller_profile_t *
if
(
!
strcasecmp
(
name
,
"dialplan"
))
{
if
(
!
strcasecmp
(
name
,
"dialplan"
))
{
return
caller_profile
->
dialplan
;
return
caller_profile
->
dialplan
;
}
}
if
(
!
strcasecmp
(
name
,
"username"
))
{
return
caller_profile
->
username
;
}
if
(
!
strcasecmp
(
name
,
"caller_id_name"
))
{
if
(
!
strcasecmp
(
name
,
"caller_id_name"
))
{
return
caller_profile
->
caller_id_name
;
return
caller_profile
->
caller_id_name
;
}
}
...
@@ -136,6 +142,11 @@ SWITCH_DECLARE(void) switch_caller_profile_event_set_data(switch_caller_profile_
...
@@ -136,6 +142,11 @@ SWITCH_DECLARE(void) switch_caller_profile_event_set_data(switch_caller_profile_
{
{
char
header_name
[
1024
];
char
header_name
[
1024
];
if
(
caller_profile
->
username
)
{
snprintf
(
header_name
,
sizeof
(
header_name
),
"%s-Username"
,
prefix
);
switch_event_add_header
(
event
,
SWITCH_STACK_BOTTOM
,
header_name
,
caller_profile
->
username
);
}
if
(
caller_profile
->
dialplan
)
{
if
(
caller_profile
->
dialplan
)
{
snprintf
(
header_name
,
sizeof
(
header_name
),
"%s-Dialplan"
,
prefix
);
snprintf
(
header_name
,
sizeof
(
header_name
),
"%s-Dialplan"
,
prefix
);
switch_event_add_header
(
event
,
SWITCH_STACK_BOTTOM
,
header_name
,
caller_profile
->
dialplan
);
switch_event_add_header
(
event
,
SWITCH_STACK_BOTTOM
,
header_name
,
caller_profile
->
dialplan
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论