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
b568bb9e
Commit
b568bb9e
authored
16 years ago
by
Emmanuel Milou
Browse files
Options
Downloads
Plain Diff
Merge branch 'yun-pjsip' of
ssh://milou@192.168.1.203/home/yun/release/sflphone
into sip_dev
parents
1c6049a3
fd7593e4
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/sipvoiplink.cpp
+3
-0
3 additions, 0 deletions
src/sipvoiplink.cpp
src/sipvoiplink.h
+2
-0
2 additions, 0 deletions
src/sipvoiplink.h
src/useragent.cpp
+42
-18
42 additions, 18 deletions
src/useragent.cpp
with
47 additions
and
18 deletions
src/sipvoiplink.cpp
+
3
−
0
View file @
b568bb9e
...
...
@@ -184,6 +184,9 @@ SIPVoIPLink::sendUnregister()
{
_debug
(
"SEND UNREGISTER for account %s
\n
"
,
getAccountID
().
c_str
());
if
(
!
_bRegister
)
return
true
;
_bRegister
=
false
;
Manager
::
instance
().
getUserAgent
()
->
removeAccount
(
_regc
);
...
...
This diff is collapsed.
Click to expand it.
src/sipvoiplink.h
+
2
−
0
View file @
b568bb9e
...
...
@@ -214,6 +214,8 @@ class SIPVoIPLink : public VoIPLink
bool
isRegister
()
{
return
_bRegister
;}
void
setRegister
(
bool
result
)
{
_bRegister
=
result
;}
public
:
/**
...
...
This diff is collapsed.
Click to expand it.
src/useragent.cpp
+
42
−
18
View file @
b568bb9e
...
...
@@ -17,6 +17,9 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include
<string>
#include
<iostream>
#include
"manager.h"
...
...
@@ -110,8 +113,6 @@ pj_status_t UserAgent::sipInit() {
_debug
(
"UserAgent: Unable to check NAT setting
\n
"
);
return
false
;
// hoho we can't use the random sip port too...
}
}
else
{
//FIXME! check port number availability
}
_localPort
=
port
;
...
...
@@ -120,18 +121,27 @@ pj_status_t UserAgent::sipInit() {
stunServerResolve
();
_localExternAddress
=
Manager
::
instance
().
getFirewallAddress
();
_localExternPort
=
Manager
::
instance
().
getFirewallPort
();
errPjsip
=
createUDPServer
();
if
(
errPjsip
!=
0
)
{
_debug
(
"UserAgent: Could not initialize SIP listener on port %d
\n
"
,
port
);
return
errPjsip
;
}
}
else
{
_localExternAddress
=
_localIPAddress
;
_localExternPort
=
_localPort
;
}
errPjsip
=
createUDPServer
();
if
(
errPjsip
!=
0
)
{
_debug
(
"UserAgent: Could not initialize SIP listener on port %d
\n
"
,
port
);
port
=
RANDOM_SIP_PORT
;
_debug
(
"UserAgent: SIP failed to listen on port %d
\n
"
,
port
);
_debug
(
"UserAgent: Could not initialize SIP listener on port %d
\n
"
,
_localExternPort
);
_localExternPort
=
_localPort
=
RANDOM_SIP_PORT
;
_debug
(
"UserAgent: Try to initialize SIP listener on port %d
\n
"
,
_localExternPort
);
errPjsip
=
createUDPServer
();
if
(
errPjsip
!=
0
)
{
_debug
(
"UserAgent: Fail to initialize SIP listener on port %d
\n
"
,
_localExternPort
);
return
errPjsip
;
}
}
}
_debug
(
"UserAgent: SIP Init -- listening on port %d
\n
"
,
_localExternPort
);
// Initialize transaction layer
...
...
@@ -486,8 +496,17 @@ pj_status_t UserAgent::stunServerResolve() {
stun_status
=
PJ_EPENDING
;
// Init STUN socket
size_t
pos
=
_stunServer
.
find
(
':'
);
if
(
pos
==
std
::
string
::
npos
)
{
pj_strdup2
(
_pool
,
&
stun_adr
,
_stunServer
.
data
());
stun_status
=
pj_sockaddr_in_init
(
&
stun_srv
.
ipv4
,
&
stun_adr
,
(
pj_uint16_t
)
3478
);
}
else
{
std
::
string
serverName
=
_stunServer
.
substr
(
0
,
pos
);
std
::
string
serverPort
=
_stunServer
.
substr
(
pos
+
1
);
int
nPort
=
atoi
(
serverPort
.
data
());
pj_strdup2
(
_pool
,
&
stun_adr
,
serverName
.
data
());
stun_status
=
pj_sockaddr_in_init
(
&
stun_srv
.
ipv4
,
&
stun_adr
,
(
pj_uint16_t
)
nPort
);
}
if
(
stun_status
!=
PJ_SUCCESS
)
{
_debug
(
"UserAgent: Unresolved stun server!
\n
"
);
...
...
@@ -557,6 +576,9 @@ void UserAgent::regc_cb(struct pjsip_regc_cbparam *param) {
SIPVoIPLink
*
voipLink
;
_debug
(
"UserAgent: Account ID is %s, Register result: %d, Status: %d
\n
"
,
id
->
data
(),
param
->
status
,
param
->
code
);
voipLink
=
dynamic_cast
<
SIPVoIPLink
*>
(
Manager
::
instance
().
getAccountLink
(
*
id
));
if
(
!
voipLink
)
return
;
if
(
param
->
status
==
PJ_SUCCESS
)
{
if
(
param
->
code
<
0
||
param
->
code
>=
300
)
{
...
...
@@ -564,18 +586,20 @@ void UserAgent::regc_cb(struct pjsip_regc_cbparam *param) {
* So checking the code for real result
*/
Manager
::
instance
().
getAccountLink
(
*
id
)
->
setRegistrationState
(
VoIPLink
::
Error
);
}
else
voipLink
->
setRegister
(
false
);
}
else
{
// Registration/Unregistration is success
voipLink
=
dynamic_cast
<
SIPVoIPLink
*>
(
Manager
::
instance
().
getAccountLink
(
*
id
));
if
(
!
voipLink
)
return
;
if
(
voipLink
->
isRegister
())
Manager
::
instance
().
getAccountLink
(
*
id
)
->
setRegistrationState
(
VoIPLink
::
Registered
);
else
else
{
Manager
::
instance
().
getAccountLink
(
*
id
)
->
setRegistrationState
(
VoIPLink
::
Unregistered
);
voipLink
->
setRegister
(
false
);
}
}
}
else
{
Manager
::
instance
().
getAccountLink
(
*
id
)
->
setRegistrationState
(
VoIPLink
::
Error
);
voipLink
->
setRegister
(
false
);
}
}
...
...
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