Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
asterisk
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Voice
asterisk
Commits
16fa1cbb
Commit
16fa1cbb
authored
9 years ago
by
Joshua Colp
Committed by
Gerrit Code Review
9 years ago
Browse files
Options
Downloads
Plain Diff
Merge "ParkAndAnnounce: Add variable inheritance" into 13
parents
49b13d56
fbf720db
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
res/parking/parking_applications.c
+65
-0
65 additions, 0 deletions
res/parking/parking_applications.c
with
65 additions
and
0 deletions
res/parking/parking_applications.c
+
65
−
0
View file @
16fa1cbb
...
...
@@ -694,6 +694,68 @@ static struct park_announce_subscription_data *park_announce_subscription_data_c
return
pa_data
;
}
/*! \internal
* \brief Gathers inheritable channel variables from a channel by name.
*
* \param oh outgoing helper struct we are bestowing inheritable variables to
* \param channel_id name or uniqueID of the channel to inherit variables from
*
* \return Nothing
*/
static
void
inherit_channel_vars_from_id
(
struct
outgoing_helper
*
oh
,
const
char
*
channel_id
)
{
struct
ast_channel
*
chan
=
ast_channel_get_by_name
(
channel_id
);
struct
ast_var_t
*
current
;
struct
ast_variable
*
newvar
;
const
char
*
varname
;
int
vartype
;
if
(
!
chan
)
{
/* Already gone */
return
;
}
ast_channel_lock
(
chan
);
AST_LIST_TRAVERSE
(
ast_channel_varshead
((
struct
ast_channel
*
)
chan
),
current
,
entries
)
{
varname
=
ast_var_full_name
(
current
);
if
(
!
varname
)
{
continue
;
}
vartype
=
0
;
if
(
varname
[
0
]
==
'_'
)
{
vartype
=
1
;
if
(
varname
[
1
]
==
'_'
)
{
vartype
=
2
;
}
}
switch
(
vartype
)
{
case
1
:
newvar
=
ast_variable_new
(
&
varname
[
1
],
ast_var_value
(
current
),
""
);
break
;
case
2
:
newvar
=
ast_variable_new
(
varname
,
ast_var_value
(
current
),
""
);
break
;
default:
continue
;
}
if
(
newvar
)
{
ast_debug
(
1
,
"Inheriting variable %s from %s.
\n
"
,
newvar
->
name
,
ast_channel_name
(
chan
));
if
(
oh
->
vars
)
{
newvar
->
next
=
oh
->
vars
;
oh
->
vars
=
newvar
;
}
}
}
ast_channel_unlock
(
chan
);
ast_channel_cleanup
(
chan
);
}
static
void
announce_to_dial
(
char
*
dial_string
,
char
*
announce_string
,
int
parkingspace
,
struct
ast_channel_snapshot
*
parkee_snapshot
)
{
struct
ast_channel
*
dchan
;
...
...
@@ -715,6 +777,9 @@ static void announce_to_dial(char *dial_string, char *announce_string, int parki
snprintf
(
buf
,
sizeof
(
buf
),
"%d"
,
parkingspace
);
oh
.
vars
=
ast_variable_new
(
"_PARKEDAT"
,
buf
,
""
);
inherit_channel_vars_from_id
(
&
oh
,
parkee_snapshot
->
uniqueid
);
dchan
=
__ast_request_and_dial
(
dial_tech
,
cap_slin
,
NULL
,
NULL
,
dial_string
,
30000
,
&
outstate
,
parkee_snapshot
->
caller_number
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment