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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
jami-daemon
Commits
f02ce985
Commit
f02ce985
authored
4 years ago
by
Ming Rui Zhang
Committed by
Sébastien Blin
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
sip: handle sip OPTIONS incoming request in dialog
GitLab:
#532
Change-Id: I8d972c7f3d546ae1a396947f4b0df5f2df86aa7f
parent
370212bc
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/sip/sipvoiplink.cpp
+35
-6
35 additions, 6 deletions
src/sip/sipvoiplink.cpp
with
35 additions
and
6 deletions
src/sip/sipvoiplink.cpp
+
35
−
6
View file @
f02ce985
...
@@ -95,13 +95,25 @@ static std::shared_ptr<SIPCall> getCallFromInvite(pjsip_inv_session* inv);
...
@@ -95,13 +95,25 @@ static std::shared_ptr<SIPCall> getCallFromInvite(pjsip_inv_session* inv);
static
void
processInviteResponseHelper
(
pjsip_inv_session
*
inv
,
pjsip_event
*
e
);
static
void
processInviteResponseHelper
(
pjsip_inv_session
*
inv
,
pjsip_event
*
e
);
#endif
#endif
static
void
static
pj_bool_t
handleIncomingOptions
(
pjsip_rx_data
*
rdata
)
handleIncomingOptions
(
pjsip_rx_data
*
rdata
)
{
{
pjsip_tx_data
*
tdata
;
pjsip_tx_data
*
tdata
;
if
(
pjsip_endpt_create_response
(
endpt_
,
rdata
,
PJSIP_SC_OK
,
NULL
,
&
tdata
)
!=
PJ_SUCCESS
)
auto
dlg
=
pjsip_rdata_get_dlg
(
rdata
);
return
;
if
(
dlg
)
{
JAMI_INFO
(
"Processing in-dialog option request"
);
if
(
pjsip_dlg_create_response
(
dlg
,
rdata
,
PJSIP_SC_OK
,
NULL
,
&
tdata
)
!=
PJ_SUCCESS
)
{
JAMI_ERR
(
"Failed to create in-dialog response for option request"
);
return
PJ_FALSE
;
}
}
else
{
JAMI_INFO
(
"Processing out-of-dialog option request"
);
if
(
pjsip_endpt_create_response
(
endpt_
,
rdata
,
PJSIP_SC_OK
,
NULL
,
&
tdata
)
!=
PJ_SUCCESS
)
{
JAMI_ERR
(
"Failed to create out-of-dialog response for option request"
);
return
PJ_FALSE
;
}
}
#define ADD_HDR(hdr) \
#define ADD_HDR(hdr) \
do { \
do { \
...
@@ -116,11 +128,27 @@ handleIncomingOptions(pjsip_rx_data* rdata)
...
@@ -116,11 +128,27 @@ handleIncomingOptions(pjsip_rx_data* rdata)
ADD_CAP
(
PJSIP_H_SUPPORTED
);
ADD_CAP
(
PJSIP_H_SUPPORTED
);
ADD_HDR
(
pjsip_evsub_get_allow_events_hdr
(
NULL
));
ADD_HDR
(
pjsip_evsub_get_allow_events_hdr
(
NULL
));
if
(
dlg
)
{
if
(
pjsip_dlg_send_response
(
dlg
,
pjsip_rdata_get_tsx
(
rdata
),
tdata
)
!=
PJ_SUCCESS
)
{
JAMI_ERR
(
"Failed to send in-dialog response for option request"
);
return
PJ_FALSE
;
}
JAMI_INFO
(
"Sent in-dialog response for option request"
);
return
PJ_TRUE
;
}
pjsip_response_addr
res_addr
;
pjsip_response_addr
res_addr
;
pjsip_get_response_addr
(
tdata
->
pool
,
rdata
,
&
res_addr
);
pjsip_get_response_addr
(
tdata
->
pool
,
rdata
,
&
res_addr
);
if
(
pjsip_endpt_send_response
(
endpt_
,
&
res_addr
,
tdata
,
NULL
,
NULL
)
!=
PJ_SUCCESS
)
if
(
pjsip_endpt_send_response
(
endpt_
,
&
res_addr
,
tdata
,
NULL
,
NULL
)
!=
PJ_SUCCESS
)
{
pjsip_tx_data_dec_ref
(
tdata
);
pjsip_tx_data_dec_ref
(
tdata
);
JAMI_ERR
(
"Failed to send out-of-dialog response for option request"
);
return
PJ_FALSE
;
}
JAMI_INFO
(
"Sent out-of-dialog response for option request"
);
return
PJ_TRUE
;
}
}
// return PJ_FALSE so that eventually other modules will handle these requests
// return PJ_FALSE so that eventually other modules will handle these requests
...
@@ -327,8 +355,7 @@ transaction_request_cb(pjsip_rx_data* rdata)
...
@@ -327,8 +355,7 @@ transaction_request_cb(pjsip_rx_data* rdata)
return
PJ_FALSE
;
return
PJ_FALSE
;
}
else
if
(
method
->
id
==
PJSIP_OPTIONS_METHOD
)
{
}
else
if
(
method
->
id
==
PJSIP_OPTIONS_METHOD
)
{
handleIncomingOptions
(
rdata
);
return
handleIncomingOptions
(
rdata
);
return
PJ_FALSE
;
}
else
if
(
method
->
id
!=
PJSIP_INVITE_METHOD
&&
method
->
id
!=
PJSIP_ACK_METHOD
)
{
}
else
if
(
method
->
id
!=
PJSIP_INVITE_METHOD
&&
method
->
id
!=
PJSIP_ACK_METHOD
)
{
try_respond_stateless
(
endpt_
,
rdata
,
PJSIP_SC_METHOD_NOT_ALLOWED
,
NULL
,
NULL
,
NULL
);
try_respond_stateless
(
endpt_
,
rdata
,
PJSIP_SC_METHOD_NOT_ALLOWED
,
NULL
,
NULL
,
NULL
);
return
PJ_FALSE
;
return
PJ_FALSE
;
...
@@ -1279,6 +1306,8 @@ transaction_state_changed_cb(pjsip_inv_session* inv, pjsip_transaction* tsx, pjs
...
@@ -1279,6 +1306,8 @@ transaction_state_changed_cb(pjsip_inv_session* inv, pjsip_transaction* tsx, pjs
onRequestInfo
(
inv
,
rdata
,
msg
,
*
call
);
onRequestInfo
(
inv
,
rdata
,
msg
,
*
call
);
else
if
(
methodName
==
"NOTIFY"
)
else
if
(
methodName
==
"NOTIFY"
)
onRequestNotify
(
inv
,
rdata
,
msg
,
*
call
);
onRequestNotify
(
inv
,
rdata
,
msg
,
*
call
);
else
if
(
methodName
==
"OPTIONS"
)
handleIncomingOptions
(
rdata
);
else
if
(
methodName
==
"MESSAGE"
)
{
else
if
(
methodName
==
"MESSAGE"
)
{
if
(
msg
->
body
)
if
(
msg
->
body
)
runOnMainThread
([
call
,
m
=
im
::
parseSipMessage
(
msg
)]()
mutable
{
runOnMainThread
([
call
,
m
=
im
::
parseSipMessage
(
msg
)]()
mutable
{
...
...
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