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
ada92ae8
Commit
ada92ae8
authored
13 years ago
by
Tristan Matthews
Browse files
Options
Downloads
Patches
Plain Diff
* #9665: siptransport: fixed udp_transport_start calls
parent
265d9748
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
daemon/src/sip/siptransport.cpp
+23
-22
23 additions, 22 deletions
daemon/src/sip/siptransport.cpp
daemon/src/sip/siptransport.h
+2
-1
2 additions, 1 deletion
daemon/src/sip/siptransport.h
with
25 additions
and
23 deletions
daemon/src/sip/siptransport.cpp
+
23
−
22
View file @
ada92ae8
...
...
@@ -43,6 +43,7 @@
#include
<sys/types.h>
#include
<sys/socket.h>
#include
<sys/ioctl.h>
#include
<unistd.h>
#include
<linux/if.h>
#include
"siptransport.h"
...
...
@@ -372,28 +373,21 @@ void SipTransport::createDefaultSipUdpTransport()
localUDPTransport_
=
account
->
transport_
;
}
pjsip_transport
*
SipTransport
::
createUdpTransport
(
std
::
string
interface
,
unsigned
int
port
)
pjsip_transport
*
SipTransport
::
createUdpTransport
(
const
std
::
string
&
interface
,
unsigned
int
port
)
{
// init socket to bind this transport to
pj_sockaddr_in
bound_addr
;
pj_bzero
(
&
bound_addr
,
sizeof
(
bound_addr
));
pj_uint16_t
listeningPort
=
(
pj_uint16_t
)
port
;
bound_addr
.
sin_port
=
pj_htons
(
listeningPort
);
bound_addr
.
sin_family
=
PJ_AF_INET
;
DEBUG
(
"SipTransport: Create UDP transport on %s:%d"
,
interface
.
c_str
(),
port
);
// determine the ip address for this transport
static
const
char
*
const
DEFAULT_INTERFACE
=
"default"
;
std
::
string
listeningAddress
;
if
(
interface
==
DEFAULT_INTERFACE
)
{
if
(
interface
==
DEFAULT_INTERFACE
)
listeningAddress
=
getSIPLocalIP
();
bound_addr
.
sin_addr
.
s_addr
=
pj_htonl
(
PJ_INADDR_ANY
);
}
else
{
else
listeningAddress
=
getInterfaceAddrFromName
(
interface
);
bound_addr
.
sin_addr
=
pj_inet_addr2
(
listeningAddress
.
c_str
());
}
if
(
listeningAddress
.
empty
())
{
ERROR
(
"SipTransport: Could not determine ip address for this transport"
);
...
...
@@ -405,20 +399,27 @@ pjsip_transport *SipTransport::createUdpTransport(std::string interface, unsigne
return
NULL
;
}
DEBUG
(
"SipTransport: Listening address %s, listening port %d"
,
listeningAddress
.
c_str
(),
listeningPort
);
// The published address for this transport
const
pjsip_host_port
a_name
=
{
pj_str
((
char
*
)
listeningAddress
.
c_str
()),
listeningPort
};
pj_sockaddr
boundAddr
;
pj_str_t
udpString
;
pj_cstr
(
&
udpString
,
listeningAddress
.
c_str
());
pj_sockaddr_parse
(
pj_AF_UNSPEC
(),
0
,
&
udpString
,
&
boundAddr
);
pj_status_t
status
;
pjsip_transport
*
transport
=
NULL
;
pj_status_t
status
=
pjsip_udp_transport_start
(
endpt_
,
&
bound_addr
,
&
a_name
,
1
,
&
transport
);
if
(
boundAddr
.
addr
.
sa_family
==
pj_AF_INET
())
{
status
=
pjsip_udp_transport_start
(
endpt_
,
&
boundAddr
.
ipv4
,
NULL
,
1
,
&
transport
);
if
(
status
!=
PJ_SUCCESS
)
{
ERROR
(
"Failed to create IPv4 UDP transport"
);
return
NULL
;
}
}
else
if
(
boundAddr
.
addr
.
sa_family
==
pj_AF_INET6
())
{
status
=
pjsip_udp_transport_start6
(
endpt_
,
&
boundAddr
.
ipv6
,
NULL
,
1
,
&
transport
);
if
(
status
!=
PJ_SUCCESS
)
{
ERROR
(
"
SipTransport: Could not
create UDP transport
for port %u"
,
port
);
ERROR
(
"
Failed to
create
IPv6
UDP transport
"
);
return
NULL
;
}
}
DEBUG
(
"SipTransport: Listening address %s, listening port %d"
,
listeningAddress
.
c_str
(),
listeningPort
);
// dump debug information to stdout
pjsip_tpmgr_dump_transports
(
pjsip_endpt_get_tpmgr
(
endpt_
));
transportMap_
[
listeningPort
]
=
transport
;
...
...
This diff is collapsed.
Click to expand it.
daemon/src/sip/siptransport.h
+
2
−
1
View file @
ada92ae8
...
...
@@ -117,7 +117,8 @@ class SipTransport {
* Create SIP UDP transport from account's setting
* @param account The account for which a transport must be created.
*/
pjsip_transport
*
createUdpTransport
(
std
::
string
interface
,
unsigned
int
port
);
pjsip_transport
*
createUdpTransport
(
const
std
::
string
&
interface
,
unsigned
int
port
);
/**
* Initialize the transport selector
...
...
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