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
d568177d
Commit
d568177d
authored
9 years ago
by
Matt Jordan
Committed by
Gerrit Code Review
9 years ago
Browse files
Options
Downloads
Plain Diff
Merge "res_pjsip_refer: Prevent sending duplicate headers."
parents
771b9bb4
f536e9b5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
res/res_pjsip_refer.c
+35
-11
35 additions, 11 deletions
res/res_pjsip_refer.c
with
35 additions
and
11 deletions
res/res_pjsip_refer.c
+
35
−
11
View file @
d568177d
...
...
@@ -1087,10 +1087,41 @@ static int refer_incoming_request(struct ast_sip_session *session, pjsip_rx_data
}
}
static
void
refer_outgoing_request
(
struct
ast_sip_session
*
session
,
struct
pjsip_tx_data
*
tdata
)
/*!
* \brief Use the value of a channel variable as the value of a SIP header
*
* This looks up a variable name on a channel, then takes that value and adds
* it to an outgoing SIP request. If the header already exists on the message,
* then no action is taken.
*
* \pre chan is locked.
*
* \param chan The channel on which to find the variable.
* \param var_name The name of the channel variable to use.
* \param header_name The name of the SIP header to add to the outgoing message.
* \param tdata The outgoing SIP message on which to add the header
*/
static
void
add_header_from_channel_var
(
struct
ast_channel
*
chan
,
const
char
*
var_name
,
const
char
*
header_name
,
pjsip_tx_data
*
tdata
)
{
const
char
*
hdr
;
const
char
*
var_value
;
pj_str_t
pj_header_name
;
pjsip_hdr
*
header
;
var_value
=
pbx_builtin_getvar_helper
(
chan
,
var_name
);
if
(
ast_strlen_zero
(
var_value
))
{
return
;
}
pj_cstr
(
&
pj_header_name
,
header_name
);
header
=
pjsip_msg_find_hdr_by_name
(
tdata
->
msg
,
&
pj_header_name
,
NULL
);
if
(
header
)
{
return
;
}
ast_sip_add_header
(
tdata
,
header_name
,
var_value
);
}
static
void
refer_outgoing_request
(
struct
ast_sip_session
*
session
,
struct
pjsip_tx_data
*
tdata
)
{
if
(
pjsip_method_cmp
(
&
tdata
->
msg
->
line
.
req
.
method
,
&
pjsip_invite_method
)
||
!
session
->
channel
||
session
->
inv_session
->
state
!=
PJSIP_INV_STATE_NULL
)
{
...
...
@@ -1098,15 +1129,8 @@ static void refer_outgoing_request(struct ast_sip_session *session, struct pjsip
}
ast_channel_lock
(
session
->
channel
);
hdr
=
pbx_builtin_getvar_helper
(
session
->
channel
,
"SIPREPLACESHDR"
);
if
(
!
ast_strlen_zero
(
hdr
))
{
ast_sip_add_header
(
tdata
,
"Replaces"
,
hdr
);
}
hdr
=
pbx_builtin_getvar_helper
(
session
->
channel
,
"SIPREFERREDBYHDR"
);
if
(
!
ast_strlen_zero
(
hdr
))
{
ast_sip_add_header
(
tdata
,
"Referred-By"
,
hdr
);
}
add_header_from_channel_var
(
session
->
channel
,
"SIPREPLACESHDR"
,
"Replaces"
,
tdata
);
add_header_from_channel_var
(
session
->
channel
,
"SIPREFERREDBYHDR"
,
"Referred-By"
,
tdata
);
ast_channel_unlock
(
session
->
channel
);
}
...
...
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