Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
savoirfairelinux
jami-daemon
Commits
721a9d4c
Commit
721a9d4c
authored
Aug 22, 2013
by
Tristan Matthews
Browse files
* #28675: sip: sipcall shouldn't know about sipaccount
parent
ef8c6565
Changes
4
Hide whitespace changes
Inline
Side-by-side
daemon/src/call.h
View file @
721a9d4c
...
...
@@ -230,10 +230,6 @@ class Call : public Recordable {
virtual
bool
toggleRecording
();
protected:
/** Associate account ID */
std
::
string
accountID_
;
private:
std
::
string
getTypeStr
()
const
;
/** Protect every attribute that can be changed by two threads */
...
...
@@ -259,6 +255,9 @@ class Call : public Recordable {
/** Type of the call */
CallType
type_
;
/** Associate account ID */
std
::
string
accountID_
;
/** Disconnected/Progressing/Trying/Ringing/Connected */
ConnectionState
connectionState_
;
...
...
daemon/src/sip/sipcall.cpp
View file @
721a9d4c
...
...
@@ -33,7 +33,6 @@
#include "sipcall.h"
#include "sip_utils.h"
#include "sipaccount.h"
#include "logger.h" // for _debug
#include "sdp.h"
#include "manager.h"
...
...
@@ -57,6 +56,7 @@ SIPCall::SIPCall(const std::string& id, Call::CallType type,
#endif
,
pool_
(
pj_pool_create
(
&
caching_pool
->
factory
,
id
.
c_str
(),
INITIAL_SIZE
,
INCREMENT_SIZE
,
NULL
))
,
local_sdp_
(
new
Sdp
(
pool_
))
,
contactHeader_
()
{}
SIPCall
::~
SIPCall
()
...
...
@@ -65,6 +65,11 @@ SIPCall::~SIPCall()
pj_pool_release
(
pool_
);
}
void
SIPCall
::
setContactHeader
(
const
std
::
string
&
contact
)
{
contactHeader_
=
contact
;
}
void
SIPCall
::
answer
()
{
pjsip_tx_data
*
tdata
;
...
...
@@ -75,13 +80,9 @@ void SIPCall::answer()
if
(
pjsip_inv_answer
(
inv
,
PJSIP_SC_OK
,
NULL
,
!
inv
->
neg
?
local_sdp_
->
getLocalSdpSession
()
:
NULL
,
&
tdata
)
!=
PJ_SUCCESS
)
throw
std
::
runtime_error
(
"Could not init invite request answer (200 OK)"
);
SIPAccount
*
account
=
Manager
::
instance
().
getSipAccount
(
accountID_
);
if
(
account
==
NULL
)
throw
std
::
runtime_error
(
"Could not find account for this call"
);
// contactStr must stay in scope as long as tdata
const
std
::
string
contactStr
(
account
->
getC
ontactHeader
())
;
sip_utils
::
addContactHeader
(
contact
Str
,
tdata
);
if
(
not
c
ontactHeader
_
.
empty
())
sip_utils
::
addContactHeader
(
contact
Header_
,
tdata
);
if
(
pjsip_inv_send_msg
(
inv
,
tdata
)
!=
PJ_SUCCESS
)
throw
std
::
runtime_error
(
"Could not send invite request answer (200 OK)"
);
...
...
daemon/src/sip/sipcall.h
View file @
721a9d4c
...
...
@@ -108,6 +108,8 @@ class SIPCall : public Call {
*/
pjsip_inv_session
*
inv
;
void
setContactHeader
(
const
std
::
string
&
contact
);
private:
// override of Call::getDetails
std
::
map
<
std
::
string
,
std
::
string
>
...
...
@@ -140,6 +142,8 @@ class SIPCall : public Call {
* The SDP session
*/
Sdp
*
local_sdp_
;
std
::
string
contactHeader_
;
};
#endif // __SIPCALL_H__
daemon/src/sip/sipvoiplink.cpp
View file @
721a9d4c
...
...
@@ -1020,16 +1020,22 @@ SIPVoIPLink::answer(Call *call)
return
;
SIPCall
*
sipCall
=
static_cast
<
SIPCall
*>
(
call
);
SIPAccount
*
account
=
Manager
::
instance
().
getSipAccount
(
sipCall
->
getAccountId
());
if
(
!
account
)
{
ERROR
(
"Could not find account %s"
,
sipCall
->
getAccountId
().
c_str
());
return
;
}
if
(
!
sipCall
->
inv
->
neg
)
{
WARN
(
"Negotiator is NULL, we've received an INVITE without an SDP"
);
pjmedia_sdp_session
*
dummy
=
0
;
sdp_create_offer_cb
(
sipCall
->
inv
,
&
dummy
);
SIPAccount
*
account
=
Manager
::
instance
().
getSipAccount
(
sipCall
->
getAccountId
());
if
(
account
and
account
->
isStunEnabled
())
if
(
account
->
isStunEnabled
())
updateSDPFromSTUN
(
*
sipCall
,
*
account
,
SIPVoIPLink
::
instance
()
->
sipTransport
);
}
call
->
answer
();
sipCall
->
setContactHeader
(
account
->
getContactHeader
());
sipCall
->
answer
();
}
namespace
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment