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
47a36280
Commit
47a36280
authored
Jan 6, 2015
by
Adrien Béraud
Committed by
Emmanuel Lepage Vallée
Jan 6, 2015
Browse files
Options
Downloads
Patches
Plain Diff
ringdht: handle more URI formats and error cases
Refs #63196 Change-Id: Ic40fed01c69582a1764af2faeea426a8a5d5133a
parent
af21a14b
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
daemon/src/managerimpl.cpp
+4
-5
4 additions, 5 deletions
daemon/src/managerimpl.cpp
daemon/src/ringdht/ringaccount.cpp
+18
-7
18 additions, 7 deletions
daemon/src/ringdht/ringaccount.cpp
with
22 additions
and
12 deletions
daemon/src/managerimpl.cpp
+
4
−
5
View file @
47a36280
...
...
@@ -396,16 +396,15 @@ ManagerImpl::outgoingCall(const std::string& preferred_account_id,
}
switchCall
(
call
);
call
->
setConfId
(
conf_id
);
}
catch
(
const
VoipLinkException
&
e
)
{
callFailure
(
call_id
);
SFL_ERR
(
"%s"
,
e
.
what
());
return
false
;
}
catch
(
ost
::
Socket
*
)
{
callFailure
(
call_id
);
SFL_ERR
(
"Could not bind socket"
);
return
false
;
}
catch
(
const
std
::
exception
&
e
)
{
callFailure
(
call_id
);
SFL_ERR
(
"%s"
,
e
.
what
());
return
false
;
}
return
true
;
}
...
...
This diff is collapsed.
Click to expand it.
daemon/src/ringdht/ringaccount.cpp
+
18
−
7
View file @
47a36280
...
...
@@ -70,7 +70,7 @@
#include
<array>
#include
<memory>
#include
<sstream>
#include
<c
stdlib
>
#include
<c
ctype
>
static
constexpr
int
ICE_COMPONENTS
{
5
};
static
constexpr
int
ICE_COMP_SIP_TRANSPORT
{
4
};
...
...
@@ -129,10 +129,18 @@ std::shared_ptr<SIPCall>
RingAccount
::
newOutgoingCall
(
const
std
::
string
&
id
,
const
std
::
string
&
toUrl
)
{
auto
dhtf
=
toUrl
.
find
(
"ring:"
);
dhtf
=
(
dhtf
==
std
::
string
::
npos
)
?
0
:
dhtf
+
5
;
if
(
dhtf
!=
std
::
string
::
npos
)
{
dhtf
=
dhtf
+
5
;
}
else
{
dhtf
=
toUrl
.
find
(
"sip:"
);
dhtf
=
(
dhtf
==
std
::
string
::
npos
)
?
0
:
dhtf
+
4
;
}
if
(
toUrl
.
length
()
-
dhtf
<
40
)
throw
std
::
invalid_argument
(
"id must be a ring infohash"
);
const
std
::
string
toUri
=
toUrl
.
substr
(
dhtf
,
40
);
if
(
std
::
find_if_not
(
toUri
.
cbegin
(),
toUri
.
cend
(),
::
isxdigit
)
!=
toUri
.
cend
())
throw
std
::
invalid_argument
(
"id must be a ring infohash"
);
SFL_DBG
(
"Calling DHT peer %s"
,
toUri
.
c_str
());
auto
call
=
Manager
::
instance
().
callFactory
.
newCall
<
SIPCall
,
RingAccount
>
(
*
this
,
id
,
Call
::
OUTGOING
);
...
...
@@ -146,6 +154,7 @@ RingAccount::newOutgoingCall(const std::string& id, const std::string& toUrl)
return
call
;
}
call
->
setState
(
Call
::
INACTIVE
);
call
->
setConnectionState
(
Call
::
TRYING
);
auto
shared
=
shared_from_this
();
...
...
@@ -163,11 +172,11 @@ RingAccount::newOutgoingCall(const std::string& id, const std::string& toUrl)
},
[
callkey
,
callvid
,
call
,
shared
](
bool
ok
){
auto
&
this_
=
*
std
::
static_pointer_cast
<
RingAccount
>
(
shared
).
get
();
this_
.
dht_
.
cancelPut
(
callkey
,
callvid
);
if
(
ok
)
call
->
setConnectionState
(
Call
::
PROGRESSING
);
else
if
(
!
ok
)
{
call
->
setConnectionState
(
Call
::
DISCONNECTED
);
Manager
::
instance
().
callFailure
(
call
->
getCallId
());
}
this_
.
dht_
.
cancelPut
(
callkey
,
callvid
);
}
);
...
...
@@ -189,6 +198,7 @@ RingAccount::newOutgoingCall(const std::string& id, const std::string& toUrl)
ice
->
start
(
v
->
data
);
if
(
call
->
waitForIceNegotiation
(
ICE_NEGOTIATION_TIMEOUT
)
<=
0
)
{
call
->
setConnectionState
(
Call
::
DISCONNECTED
);
Manager
::
instance
().
callFailure
(
call
->
getCallId
());
return
false
;
}
call
->
setConnectionState
(
Call
::
PROGRESSING
);
...
...
@@ -612,7 +622,7 @@ void RingAccount::doRegister()
for
(
const
auto
&
v
:
vals
)
{
try
{
if
(
v
->
recipient
!=
this_
.
dht_
.
getId
()
||
v
->
type
!=
this_
.
ICE_ANNOUCEMENT_TYPE
.
id
)
{
SFL_
WARN
(
"Ignoring non encrypted or bad type value %s."
,
v
->
toString
().
c_str
());
SFL_
DBG
(
"Ignoring non encrypted or bad type value %s."
,
v
->
toString
().
c_str
());
continue
;
}
if
(
v
->
owner
.
getId
()
==
this_
.
dht_
.
getId
())
...
...
@@ -647,6 +657,7 @@ void RingAccount::doRegister()
if
(
!
ok
||
call
->
waitForIceNegotiation
(
ICE_NEGOTIATION_TIMEOUT
)
<=
0
)
{
SFL_WARN
(
"nego failed"
);
call
->
setConnectionState
(
Call
::
DISCONNECTED
);
Manager
::
instance
().
callFailure
(
call
->
getCallId
());
}
else
{
SFL_WARN
(
"nego succeeded"
);
call
->
setConnectionState
(
Call
::
PROGRESSING
);
...
...
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
sign in
to comment