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
b1f46c2a
Commit
b1f46c2a
authored
7 years ago
by
Jenkins2
Committed by
Gerrit Code Review
7 years ago
Browse files
Options
Downloads
Plain Diff
Merge "chan_pjsip: Fix PJSIP_MEDIA_OFFER dialplan function read."
parents
41bd01c8
11ec2945
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
channels/pjsip/dialplan_functions.c
+21
-14
21 additions, 14 deletions
channels/pjsip/dialplan_functions.c
with
21 additions
and
14 deletions
channels/pjsip/dialplan_functions.c
+
21
−
14
View file @
b1f46c2a
...
@@ -927,36 +927,40 @@ int pjsip_acf_dial_contacts_read(struct ast_channel *chan, const char *cmd, char
...
@@ -927,36 +927,40 @@ int pjsip_acf_dial_contacts_read(struct ast_channel *chan, const char *cmd, char
static
int
media_offer_read_av
(
struct
ast_sip_session
*
session
,
char
*
buf
,
static
int
media_offer_read_av
(
struct
ast_sip_session
*
session
,
char
*
buf
,
size_t
len
,
enum
ast_media_type
media_type
)
size_t
len
,
enum
ast_media_type
media_type
)
{
{
int
i
,
size
=
0
;
int
idx
;
size_t
accum
=
0
;
for
(
i
=
0
;
i
<
ast_format_cap_count
(
session
->
req_caps
);
i
++
)
{
/* Note: buf is not terminated while the string is being built. */
struct
ast_format
*
fmt
=
ast_format_cap_get_format
(
session
->
req_caps
,
i
);
for
(
idx
=
0
;
idx
<
ast_format_cap_count
(
session
->
req_caps
);
++
idx
)
{
struct
ast_format
*
fmt
;
size_t
size
;
fmt
=
ast_format_cap_get_format
(
session
->
req_caps
,
idx
);
if
(
ast_format_get_type
(
fmt
)
!=
media_type
)
{
if
(
ast_format_get_type
(
fmt
)
!=
media_type
)
{
ao2_ref
(
fmt
,
-
1
);
ao2_ref
(
fmt
,
-
1
);
continue
;
continue
;
}
}
/*
a
dd one
since we'll include a comma
*/
/*
A
dd one
for a comma or terminator
*/
size
=
strlen
(
ast_format_get_name
(
fmt
))
+
1
;
size
=
strlen
(
ast_format_get_name
(
fmt
))
+
1
;
if
(
len
<
size
)
{
if
(
len
<
size
)
{
ao2_ref
(
fmt
,
-
1
);
ao2_ref
(
fmt
,
-
1
);
break
;
break
;
}
}
len
-=
size
;
/* no reason to use strncat here since we have already ensured buf has
enough space, so strcat can be safely used */
strcat
(
buf
,
ast_format_get_name
(
fmt
));
strcat
(
buf
,
","
);
/* Append the format name */
strcpy
(
buf
+
accum
,
ast_format_get_name
(
fmt
));
/* Safe */
ao2_ref
(
fmt
,
-
1
);
ao2_ref
(
fmt
,
-
1
);
}
if
(
size
)
{
accum
+=
size
;
/* remove the extra comma */
len
-=
size
;
buf
[
strlen
(
buf
)
-
1
]
=
'\0'
;
/* The last comma on the built string will be set to the terminator. */
buf
[
accum
-
1
]
=
','
;
}
}
/* Remove the trailing comma or terminate an empty buffer. */
buf
[
accum
?
accum
-
1
:
0
]
=
'\0'
;
return
0
;
return
0
;
}
}
...
@@ -996,6 +1000,9 @@ int pjsip_acf_media_offer_read(struct ast_channel *chan, const char *cmd, char *
...
@@ -996,6 +1000,9 @@ int pjsip_acf_media_offer_read(struct ast_channel *chan, const char *cmd, char *
return
media_offer_read_av
(
channel
->
session
,
buf
,
len
,
AST_MEDIA_TYPE_AUDIO
);
return
media_offer_read_av
(
channel
->
session
,
buf
,
len
,
AST_MEDIA_TYPE_AUDIO
);
}
else
if
(
!
strcmp
(
data
,
"video"
))
{
}
else
if
(
!
strcmp
(
data
,
"video"
))
{
return
media_offer_read_av
(
channel
->
session
,
buf
,
len
,
AST_MEDIA_TYPE_VIDEO
);
return
media_offer_read_av
(
channel
->
session
,
buf
,
len
,
AST_MEDIA_TYPE_VIDEO
);
}
else
{
/* Ensure that the buffer is empty */
buf
[
0
]
=
'\0'
;
}
}
return
0
;
return
0
;
...
...
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