Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
savoirfairelinux
jami-daemon
Commits
bf28b8a9
Commit
bf28b8a9
authored
Apr 23, 2012
by
Tristan Matthews
Browse files
Merge branch 'sipregistration' of
git+ssh://git.sflphone.org/var/repos/sflphone/git/sflphone
parents
7db69f10
90cc0a5e
Changes
5
Hide whitespace changes
Inline
Side-by-side
daemon/src/managerimpl.cpp
View file @
bf28b8a9
...
...
@@ -226,7 +226,6 @@ bool ManagerImpl::outgoingCall(const std::string& account_id,
try
{
Call
*
call
=
getAccountLink
(
account_id
)
->
newOutgoingCall
(
call_id
,
to_cleaned
);
switchCall
(
call_id
);
call
->
setConfId
(
conf_id
);
}
catch
(
const
VoipLinkException
&
e
)
{
...
...
daemon/src/sip/sipaccount.cpp
View file @
bf28b8a9
...
...
@@ -98,6 +98,7 @@ SIPAccount::SIPAccount(const std::string& accountID)
,
registrationStateDetailed_
()
,
keepAliveTimer_
()
,
link_
(
SIPVoIPLink
::
instance
())
,
receivedParameter_
()
{}
void
SIPAccount
::
serialize
(
Conf
::
YamlEmitter
&
emitter
)
...
...
daemon/src/sip/sipaccount.h
View file @
bf28b8a9
...
...
@@ -497,6 +497,14 @@ class SIPAccount : public Account {
return
zrtpHelloHash_
;
}
void
setReceivedParameter
(
std
::
string
received
)
{
receivedParameter_
=
received
;
}
std
::
string
getReceivedParameter
()
{
return
receivedParameter_
;
}
/**
* Timer used to periodically send re-register request based
* on the "Expire" sip header (or the "expire" Contact parameter)
...
...
@@ -720,6 +728,11 @@ class SIPAccount : public Account {
* Voice over IP Link contains a listener thread and calls
*/
SIPVoIPLink
*
link_
;
/**
* Received via parameters
*/
std
::
string
receivedParameter_
;
};
#endif
daemon/src/sip/sipvoiplink.cpp
View file @
bf28b8a9
...
...
@@ -515,6 +515,9 @@ void SIPVoIPLink::sendRegister(Account *a)
std
::
string
contact
(
account
->
getContactHeader
());
pj_str_t
pjContact
=
pj_str
((
char
*
)
contact
.
c_str
());
std
::
string
received
(
account
->
getReceivedParameter
());
pj_str_t
pjReceived
=
pj_str
((
char
*
)
received
.
c_str
());
if
(
pjsip_regc_init
(
regc
,
&
pjSrv
,
&
pjFrom
,
&
pjFrom
,
1
,
&
pjContact
,
account
->
getRegistrationExpire
())
!=
PJ_SUCCESS
)
throw
VoipLinkException
(
"Unable to initialize account registration structure"
);
...
...
@@ -1560,6 +1563,18 @@ void update_contact_header(pjsip_regc_cbparam *param, SIPAccount *account)
pj_pool_release
(
pool
);
}
static
void
looksForReceivedParameter
(
pjsip_regc_cbparam
*
param
,
SIPAccount
*
account
)
{
pj_str_t
receivedValue
=
param
->
rdata
->
msg_info
.
via
->
recvd_param
;
std
::
string
publicIpFromReceived
=
""
;
ERROR
(
"looksForReceivedParameter"
);
if
(
receivedValue
.
slen
)
{
publicIpFromReceived
=
std
::
string
(
receivedValue
.
ptr
,
receivedValue
.
slen
);
DEBUG
(
"Cool received received parameter... uhhh?, the value is %s"
,
publicIpFromReceived
.
c_str
());
account
->
setReceivedParameter
(
publicIpFromReceived
);
}
}
void
registration_cb
(
pjsip_regc_cbparam
*
param
)
{
if
(
param
==
NULL
)
{
...
...
@@ -1599,6 +1614,7 @@ void registration_cb(pjsip_regc_cbparam *param)
if
(
param
->
code
<
0
||
param
->
code
>=
300
)
{
switch
(
param
->
code
)
{
case
606
:
looksForReceivedParameter
(
param
,
account
);
account
->
setRegistrationState
(
ErrorNotAcceptable
);
break
;
...
...
gnome/src/actions.c
View file @
bf28b8a9
...
...
@@ -752,7 +752,7 @@ static void place_direct_call(const callable_obj_t * c)
static
int
place_registered_call
(
callable_obj_t
*
c
)
{
account_t
*
curre
nt
=
NULL
;
account_t
*
accou
nt
=
NULL
;
if
(
c
->
_state
!=
CALL_STATE_DIALING
)
return
-
1
;
...
...
@@ -760,51 +760,54 @@ static int place_registered_call(callable_obj_t * c)
if
(
!*
c
->
_peer_number
)
return
-
1
;
// No longer usefull
/*
if (account_list_get_size() == 0) {
notify_no_accounts();
sflphone_fail(c);
return -1;
}
*/
/*
if (account_list_get_by_state(ACCOUNT_STATE_REGISTERED) == NULL) {
DEBUG("Actions: No registered account, cannot make a call");
notify_no_registered_accounts();
sflphone_fail(c);
return -1;
}
*/
DEBUG
(
"Actions: Get account for this call"
);
if
(
strlen
(
c
->
_accountID
)
!=
0
)
{
DEBUG
(
"Actions: Account %s already set for this call"
,
c
->
_accountID
);
curre
nt
=
account_list_get_by_id
(
c
->
_accountID
);
accou
nt
=
account_list_get_by_id
(
c
->
_accountID
);
}
else
{
DEBUG
(
"Actions: No account set for this call, use first of the list"
);
curre
nt
=
account_list_get_current
();
accou
nt
=
account_list_get_current
();
}
if
(
curre
nt
==
NULL
)
{
if
(
accou
nt
==
NULL
)
{
DEBUG
(
"Actions: Unexpected condition: account_t is NULL in %s at %d for accountID %s"
,
__FILE__
,
__LINE__
,
c
->
_accountID
);
return
-
1
;
}
gpointer
status
=
g_hash_table_lookup
(
curre
nt
->
properties
,
"Status"
);
gpointer
status
=
g_hash_table_lookup
(
accou
nt
->
properties
,
"Status"
);
if
(
utf8_case_equal
(
status
,
"REGISTERED"
))
{
/* The call is made with the current account */
// free memory for previous account id and get a new one
g_free
(
c
->
_accountID
);
c
->
_accountID
=
g_strdup
(
curre
nt
->
accountID
);
c
->
_accountID
=
g_strdup
(
accou
nt
->
accountID
);
dbus_place_call
(
c
);
}
else
{
/* Place the call with the first registered account
* and switch the current account.
* If we are here, we can be sure that there is at least one.
*/
curre
nt
=
account_list_get_by_state
(
ACCOUNT_STATE_REGISTERED
);
accou
nt
=
account_list_get_by_state
(
ACCOUNT_STATE_REGISTERED
);
g_free
(
c
->
_accountID
);
c
->
_accountID
=
g_strdup
(
curre
nt
->
accountID
);
c
->
_accountID
=
g_strdup
(
accou
nt
->
accountID
);
dbus_place_call
(
c
);
notify_current_account
(
curre
nt
);
notify_current_account
(
accou
nt
);
}
c
->
_history_state
=
g_strdup
(
OUTGOING_STRING
);
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment