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
6c22d4b3
Commit
6c22d4b3
authored
8 years ago
by
zuul
Committed by
Gerrit Code Review
8 years ago
Browse files
Options
Downloads
Plain Diff
Merge "core: Show streams in "core show channel"."
parents
10302fa6
f58aefba
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
include/asterisk/stream.h
+11
-0
11 additions, 0 deletions
include/asterisk/stream.h
main/cli.c
+19
-0
19 additions, 0 deletions
main/cli.c
main/stream.c
+18
-0
18 additions, 0 deletions
main/stream.c
with
48 additions
and
0 deletions
include/asterisk/stream.h
+
11
−
0
View file @
6c22d4b3
...
@@ -190,6 +190,17 @@ enum ast_stream_state ast_stream_get_state(const struct ast_stream *stream);
...
@@ -190,6 +190,17 @@ enum ast_stream_state ast_stream_get_state(const struct ast_stream *stream);
*/
*/
void
ast_stream_set_state
(
struct
ast_stream
*
stream
,
enum
ast_stream_state
state
);
void
ast_stream_set_state
(
struct
ast_stream
*
stream
,
enum
ast_stream_state
state
);
/*!
* \brief Convert the state of a stream into a string
*
* \param state The stream state
*
* \return The state of the stream in string format
*
* \since 15
*/
const
char
*
ast_stream_state2str
(
enum
ast_stream_state
state
);
/*!
/*!
* \brief Get the position of the stream in the topology
* \brief Get the position of the stream in the topology
*
*
...
...
This diff is collapsed.
Click to expand it.
main/cli.c
+
19
−
0
View file @
6c22d4b3
...
@@ -61,6 +61,7 @@
...
@@ -61,6 +61,7 @@
#include
"asterisk/stasis_channels.h"
#include
"asterisk/stasis_channels.h"
#include
"asterisk/stasis_bridges.h"
#include
"asterisk/stasis_bridges.h"
#include
"asterisk/vector.h"
#include
"asterisk/vector.h"
#include
"asterisk/stream.h"
/*!
/*!
* \brief List of restrictions per user.
* \brief List of restrictions per user.
...
@@ -1542,6 +1543,7 @@ static char *handle_showchan(struct ast_cli_entry *e, int cmd, struct ast_cli_ar
...
@@ -1542,6 +1543,7 @@ static char *handle_showchan(struct ast_cli_entry *e, int cmd, struct ast_cli_ar
struct
ast_bridge
*
bridge
;
struct
ast_bridge
*
bridge
;
ast_callid
callid
;
ast_callid
callid
;
char
callid_buf
[
32
];
char
callid_buf
[
32
];
int
stream_num
;
switch
(
cmd
)
{
switch
(
cmd
)
{
case
CLI_INIT
:
case
CLI_INIT
:
...
@@ -1668,6 +1670,7 @@ static char *handle_showchan(struct ast_cli_entry *e, int cmd, struct ast_cli_ar
...
@@ -1668,6 +1670,7 @@ static char *handle_showchan(struct ast_cli_entry *e, int cmd, struct ast_cli_ar
S_OR
(
ast_channel_data
(
chan
),
"(Empty)"
),
S_OR
(
ast_channel_data
(
chan
),
"(Empty)"
),
S_OR
(
callid_buf
,
"(None)"
)
S_OR
(
callid_buf
,
"(None)"
)
);
);
ast_str_append
(
&
output
,
0
,
" Variables:
\n
"
);
ast_str_append
(
&
output
,
0
,
" Variables:
\n
"
);
AST_LIST_TRAVERSE
(
ast_channel_varshead
(
chan
),
var
,
entries
)
{
AST_LIST_TRAVERSE
(
ast_channel_varshead
(
chan
),
var
,
entries
)
{
...
@@ -1679,6 +1682,22 @@ static char *handle_showchan(struct ast_cli_entry *e, int cmd, struct ast_cli_ar
...
@@ -1679,6 +1682,22 @@ static char *handle_showchan(struct ast_cli_entry *e, int cmd, struct ast_cli_ar
ast_str_append
(
&
output
,
0
,
" CDR Variables:
\n
%s
\n
"
,
ast_str_buffer
(
obuf
));
ast_str_append
(
&
output
,
0
,
" CDR Variables:
\n
%s
\n
"
,
ast_str_buffer
(
obuf
));
}
}
ast_str_append
(
&
output
,
0
,
" -- Streams --
\n
"
);
for
(
stream_num
=
0
;
stream_num
<
ast_stream_topology_get_count
(
ast_channel_get_stream_topology
(
chan
));
stream_num
++
)
{
struct
ast_stream
*
stream
=
ast_stream_topology_get_stream
(
ast_channel_get_stream_topology
(
chan
),
stream_num
);
ast_str_append
(
&
output
,
0
,
"Name: %s
\n
"
" Type: %s
\n
"
" State: %s
\n
"
" Formats: %s
\n
"
,
ast_stream_get_name
(
stream
),
ast_codec_media_type2str
(
ast_stream_get_type
(
stream
)),
ast_stream_state2str
(
ast_stream_get_state
(
stream
)),
ast_format_cap_get_names
(
ast_stream_get_formats
(
stream
),
&
codec_buf
)
);
}
ast_channel_unlock
(
chan
);
ast_channel_unlock
(
chan
);
ast_cli
(
a
->
fd
,
"%s"
,
ast_str_buffer
(
output
));
ast_cli
(
a
->
fd
,
"%s"
,
ast_str_buffer
(
output
));
...
...
This diff is collapsed.
Click to expand it.
main/stream.c
+
18
−
0
View file @
6c22d4b3
...
@@ -168,6 +168,24 @@ void ast_stream_set_state(struct ast_stream *stream, enum ast_stream_state state
...
@@ -168,6 +168,24 @@ void ast_stream_set_state(struct ast_stream *stream, enum ast_stream_state state
stream
->
state
=
state
;
stream
->
state
=
state
;
}
}
const
char
*
ast_stream_state2str
(
enum
ast_stream_state
state
)
{
switch
(
state
)
{
case
AST_STREAM_STATE_REMOVED
:
return
"removed"
;
case
AST_STREAM_STATE_SENDRECV
:
return
"sendrecv"
;
case
AST_STREAM_STATE_SENDONLY
:
return
"sendonly"
;
case
AST_STREAM_STATE_RECVONLY
:
return
"recvonly"
;
case
AST_STREAM_STATE_INACTIVE
:
return
"inactive"
;
default:
return
"<unknown>"
;
}
}
int
ast_stream_get_position
(
const
struct
ast_stream
*
stream
)
int
ast_stream_get_position
(
const
struct
ast_stream
*
stream
)
{
{
ast_assert
(
stream
!=
NULL
);
ast_assert
(
stream
!=
NULL
);
...
...
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