Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
jami-daemon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
jami-daemon
Commits
b2659c41
Commit
b2659c41
authored
2 years ago
by
Adrien Béraud
Browse files
Options
Downloads
Patches
Plain Diff
sip: cleanup
Change-Id: I34bd8943520ed45238bae2fbfc3b71606ef5df8f
parent
4647f509
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/connectivity/sip_utils.cpp
+6
-9
6 additions, 9 deletions
src/connectivity/sip_utils.cpp
with
6 additions
and
9 deletions
src/connectivity/sip_utils.cpp
+
6
−
9
View file @
b2659c41
...
...
@@ -47,6 +47,8 @@ using namespace std::literals;
namespace
jami
{
namespace
sip_utils
{
constexpr
pj_str_t
USER_AGENT_STR
=
CONST_PJ_STR
(
"User-Agent"
);
std
::
string
PjsipErrorCategory
::
message
(
int
condition
)
const
{
...
...
@@ -205,23 +207,19 @@ addUserAgentHeader(const std::string& userAgent, pjsip_tx_data* tdata)
return
;
auto
pjUserAgent
=
CONST_PJ_STR
(
userAgent
);
constexpr
pj_str_t
STR_USER_AGENT
=
CONST_PJ_STR
(
"User-Agent"
);
// Do nothing if user-agent header is present.
if
(
pjsip_msg_find_hdr_by_name
(
tdata
->
msg
,
&
STR_
USER_AGENT
,
nullptr
)
!=
nullptr
)
{
if
(
pjsip_msg_find_hdr_by_name
(
tdata
->
msg
,
&
USER_AGENT
_STR
,
nullptr
)
!=
nullptr
)
{
return
;
}
// Add Header
auto
hdr
=
reinterpret_cast
<
pjsip_hdr
*>
(
pjsip_user_agent_hdr_create
(
tdata
->
pool
,
&
STR_
USER_AGENT
,
&
pjUserAgent
));
pjsip_user_agent_hdr_create
(
tdata
->
pool
,
&
USER_AGENT
_STR
,
&
pjUserAgent
));
if
(
hdr
!=
nullptr
)
{
JAMI_DBG
(
"Add header to SIP message:
\"
%.*s: %.*s
\"
"
,
(
int
)
hdr
->
name
.
slen
,
hdr
->
name
.
ptr
,
(
int
)
pjUserAgent
.
slen
,
pjUserAgent
.
ptr
);
JAMI_LOG
(
"Add header to SIP message:
\"
{:s}: {:s}
\"
"
,
sip_utils
::
as_view
(
hdr
->
name
),
userAgent
);
pjsip_msg_add_hdr
(
tdata
->
msg
,
hdr
);
}
}
...
...
@@ -234,7 +232,6 @@ getPeerUserAgent(const pjsip_rx_data* rdata)
return
{};
}
constexpr
auto
USER_AGENT_STR
=
CONST_PJ_STR
(
"User-Agent"
);
if
(
auto
uaHdr
=
(
pjsip_generic_string_hdr
*
)
pjsip_msg_find_hdr_by_name
(
rdata
->
msg_info
.
msg
,
&
USER_AGENT_STR
,
nullptr
))
{
...
...
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