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
3baf3e36
Commit
3baf3e36
authored
Apr 14, 2008
by
Emmanuel Milou
Browse files
nothing
parent
87a17f39
Changes
11
Hide whitespace changes
Inline
Side-by-side
sflphone-gtk/src/configwindow.c
View file @
3baf3e36
...
@@ -657,7 +657,6 @@ enable_account(GtkCellRendererToggle *rend , gchar* path, gpointer data )
...
@@ -657,7 +657,6 @@ enable_account(GtkCellRendererToggle *rend , gchar* path, gpointer data )
// Modify account state
// Modify account state
g_hash_table_replace
(
acc
->
properties
,
g_strdup
(
ACCOUNT_ENABLED
)
,
g_strdup
((
enable
==
1
)
?
"TRUE"
:
"FALSE"
));
g_hash_table_replace
(
acc
->
properties
,
g_strdup
(
ACCOUNT_ENABLED
)
,
g_strdup
((
enable
==
1
)
?
"TRUE"
:
"FALSE"
));
//dbus_set_account_details(acc);
dbus_send_register
(
acc
->
accountID
,
enable
);
dbus_send_register
(
acc
->
accountID
,
enable
);
}
}
...
...
src/Makefile.am
View file @
3baf3e36
...
@@ -44,6 +44,7 @@ sflphoned_CXXFLAGS = -DPREFIX=\"$(prefix)\" -DPROGSHAREDIR=\"${datadir}/sflphone
...
@@ -44,6 +44,7 @@ sflphoned_CXXFLAGS = -DPREFIX=\"$(prefix)\" -DPROGSHAREDIR=\"${datadir}/sflphone
sflphoned_LDADD
=
./libsflphone.la
$(SFLPHONE_LIBS)
$(ZEROCONFLIB)
$(LIB_DNSSD)
$(IAX_LIBS)
$(EXOSIP_LIBS)
$(ALSAFLAG)
sflphoned_LDADD
=
./libsflphone.la
$(SFLPHONE_LIBS)
$(ZEROCONFLIB)
$(LIB_DNSSD)
$(IAX_LIBS)
$(EXOSIP_LIBS)
$(ALSAFLAG)
AM_CPPFLAGS
=
-I
$(top_srcdir)
/include
-I
$(top_srcdir)
/libs
$(libccext2_CFLAGS)
$(libccgnu2_CFLAGS)
$(IAX_CFLAGS)
$(USER_INCLUDES)
$(libdbuscpp_CFLAGS)
\
AM_CPPFLAGS
=
-I
$(top_srcdir)
/include
-I
$(top_srcdir)
/libs
$(libccext2_CFLAGS)
$(libccgnu2_CFLAGS)
$(IAX_CFLAGS)
$(USER_INCLUDES)
$(libdbuscpp_CFLAGS)
\
-DCODECS_DIR
=
\"
"
$(sflcodecdir)
"
\"
-DCODECS_DIR
=
\"
"
$(sflcodecdir)
"
\"
-DENABLE_TRACE
# libsflphone_la_LDFLAGS= -version-info 0:1:0
# libsflphone_la_LDFLAGS= -version-info 0:1:0
...
...
src/eventthread.cpp
View file @
3baf3e36
...
@@ -25,6 +25,7 @@ EventThread::EventThread (VoIPLink* link) : Thread ()
...
@@ -25,6 +25,7 @@ EventThread::EventThread (VoIPLink* link) : Thread ()
{
{
_linkthread
=
link
;
_linkthread
=
link
;
setCancel
(
cancelDeferred
);
setCancel
(
cancelDeferred
);
stopIt
=
false
;
}
}
EventThread
::~
EventThread
(
void
)
EventThread
::~
EventThread
(
void
)
...
@@ -38,9 +39,27 @@ EventThread::~EventThread (void)
...
@@ -38,9 +39,27 @@ EventThread::~EventThread (void)
void
void
EventThread
::
run
(
void
)
EventThread
::
run
(
void
)
{
{
while
(
!
testCancel
())
{
stopIt
=
false
;
while
(
!
stopIt
)
{
_linkthread
->
getEvent
();
_linkthread
->
getEvent
();
}
}
}
}
void
EventThread
::
stop
(
void
)
{
stopIt
=
true
;
}
void
EventThread
::
startLoop
(
void
)
{
stopIt
=
false
;
//start();
}
bool
EventThread
::
isStopped
(
void
)
{
return
stopIt
;
}
src/eventthread.h
View file @
3baf3e36
...
@@ -36,10 +36,14 @@ public:
...
@@ -36,10 +36,14 @@ public:
~
EventThread
(
void
);
~
EventThread
(
void
);
virtual
void
run
();
virtual
void
run
();
virtual
void
stop
();
virtual
void
startLoop
();
bool
isStopped
();
private:
private:
/** VoIPLink is the object being called by getEvents() method */
/** VoIPLink is the object being called by getEvents() method */
VoIPLink
*
_linkthread
;
VoIPLink
*
_linkthread
;
bool
stopIt
;
};
};
#endif // __EVENT_THREAD_H__
#endif // __EVENT_THREAD_H__
src/managerimpl.cpp
View file @
3baf3e36
...
@@ -440,7 +440,6 @@ ManagerImpl::initRegisterAccounts()
...
@@ -440,7 +440,6 @@ ManagerImpl::initRegisterAccounts()
if
(
iter
->
second
)
{
if
(
iter
->
second
)
{
iter
->
second
->
loadConfig
();
iter
->
second
->
loadConfig
();
if
(
iter
->
second
->
isEnabled
()
)
{
if
(
iter
->
second
->
isEnabled
()
)
{
_debug
(
"Init register accounts
\n
"
);
// NOW
// NOW
iter
->
second
->
registerVoIPLink
();
iter
->
second
->
registerVoIPLink
();
iter
->
second
->
loadContacts
();
iter
->
second
->
loadContacts
();
...
@@ -789,6 +788,7 @@ ManagerImpl::startVoiceMessageNotification(const AccountID& accountId, const std
...
@@ -789,6 +788,7 @@ ManagerImpl::startVoiceMessageNotification(const AccountID& accountId, const std
void
void
ManagerImpl
::
stopVoiceMessageNotification
(
const
AccountID
&
accountId
)
ManagerImpl
::
stopVoiceMessageNotification
(
const
AccountID
&
accountId
)
{
{
// TODO : do not notify when no messages
if
(
_dbus
)
_dbus
->
getCallManager
()
->
voiceMailNotify
(
accountId
,
0
);
if
(
_dbus
)
_dbus
->
getCallManager
()
->
voiceMailNotify
(
accountId
,
0
);
}
}
...
@@ -817,12 +817,22 @@ ManagerImpl::registrationFailed(const AccountID& accountid)
...
@@ -817,12 +817,22 @@ ManagerImpl::registrationFailed(const AccountID& accountid)
{
{
Account
*
acc
=
getAccount
(
accountid
);
Account
*
acc
=
getAccount
(
accountid
);
if
(
acc
)
{
if
(
acc
)
{
//acc->setState(false);
_debug
(
"REGISTRATION FAILED
\n
"
);
_debug
(
"REGISTRATION FAILED
\n
"
);
if
(
_dbus
)
_dbus
->
getConfigurationManager
()
->
accountsChanged
();
if
(
_dbus
)
_dbus
->
getConfigurationManager
()
->
accountsChanged
();
}
}
}
}
//THREAD=VoIP
void
ManagerImpl
::
registrationTrying
(
const
AccountID
&
accountid
)
{
Account
*
acc
=
getAccount
(
accountid
);
if
(
acc
)
{
_debug
(
"REGISTRATION TRYING
\n
"
);
if
(
_dbus
)
_dbus
->
getConfigurationManager
()
->
accountsChanged
();
}
}
/**
/**
* Multi Thread
* Multi Thread
*/
*/
...
@@ -2117,26 +2127,36 @@ ManagerImpl::sendRegister( const ::DBus::String& accountID , bool expire )
...
@@ -2117,26 +2127,36 @@ ManagerImpl::sendRegister( const ::DBus::String& accountID , bool expire )
{
{
// Update the active field
// Update the active field
setConfig
(
accountID
,
CONFIG_ACCOUNT_ENABLE
,
expire
);
setConfig
(
accountID
,
CONFIG_ACCOUNT_ENABLE
,
expire
);
Account
*
acc
=
getAccount
(
accountID
);
Account
*
acc
=
getAccount
(
accountID
);
acc
->
loadConfig
();
acc
->
loadConfig
();
if
(
acc
->
isEnabled
())
{
// Test on the value freshly updated
if
(
acc
->
isEnabled
()
)
{
// As we don't support multiple SIP account, we have to unregister everything before
AccountMap
::
iterator
iter
=
_accountMap
.
begin
();
while
(
iter
!=
_accountMap
.
end
()
)
{
if
(
iter
->
second
)
{
setConfig
(
iter
->
first
,
CONFIG_ACCOUNT_ENABLE
,
false
);
iter
->
second
->
unregisterVoIPLink
();
}
iter
++
;
}
// Verify we aren't already registered, then register
// Verify we aren't already registered, then register
if
(
acc
->
getRegistrationState
()
!=
VoIPLink
::
Registered
)
{
//if (acc->getRegistrationState() != VoIPLink::Registered) {
_debug
(
"SET ACCOUNTS DETAILS - non registered - > registered
\n
"
);
_debug
(
"Send register for account %s
\n
"
,
accountID
.
c_str
());
setConfig
(
accountID
,
CONFIG_ACCOUNT_ENABLE
,
true
);
acc
->
registerVoIPLink
();
acc
->
registerVoIPLink
();
}
//
}
}
else
{
}
else
{
// Verify we are already registered, then unregister
// Verify we are already registered, then unregister
if
(
acc
->
getRegistrationState
()
==
VoIPLink
::
Registered
)
{
if
(
acc
->
getRegistrationState
()
==
VoIPLink
::
Registered
)
{
_debug
(
"S
ET ACCOUNTS DETAILS - registered - > non registered
\n
"
);
_debug
(
"S
end unregister for account %s
\n
"
,
accountID
.
c_str
()
);
acc
->
unregisterVoIPLink
();
acc
->
unregisterVoIPLink
();
//unregisterAccount(accountID);
}
}
}
}
}
}
void
void
ManagerImpl
::
addAccount
(
const
std
::
map
<
::
DBus
::
String
,
::
DBus
::
String
>&
details
)
ManagerImpl
::
addAccount
(
const
std
::
map
<
::
DBus
::
String
,
::
DBus
::
String
>&
details
)
{
{
...
@@ -2288,6 +2308,22 @@ ManagerImpl::associateCallToAccount(const CallID& callID, const AccountID& accou
...
@@ -2288,6 +2308,22 @@ ManagerImpl::associateCallToAccount(const CallID& callID, const AccountID& accou
}
}
}
}
AccountID
ManagerImpl
::
getAccountFromEvent
(
std
::
string
authname
)
{
AccountID
id
;
AccountMap
::
iterator
iter
=
_accountMap
.
begin
();
while
(
iter
!=
_accountMap
.
end
()
){
if
(
iter
->
second
!=
NULL
){
id
=
iter
->
first
;
if
(
getConfigString
(
id
,
SIP_AUTH_NAME
)
==
authname
)
return
id
;
}
}
return
NULL
;
}
AccountID
AccountID
ManagerImpl
::
getAccountFromCall
(
const
CallID
&
callID
)
ManagerImpl
::
getAccountFromCall
(
const
CallID
&
callID
)
{
{
...
...
src/managerimpl.h
View file @
3baf3e36
...
@@ -208,6 +208,8 @@ public:
...
@@ -208,6 +208,8 @@ public:
void
unregistrationSucceed
(
const
AccountID
&
accountId
);
void
unregistrationSucceed
(
const
AccountID
&
accountId
);
/** Notify the user that registration failed */
/** Notify the user that registration failed */
void
registrationFailed
(
const
AccountID
&
accountId
);
void
registrationFailed
(
const
AccountID
&
accountId
);
/** Notify the user that registration is trying */
void
registrationTrying
(
const
AccountID
&
accountId
);
void
sendRegister
(
const
AccountID
&
accountId
,
bool
expire
);
void
sendRegister
(
const
AccountID
&
accountId
,
bool
expire
);
// configuration function requests
// configuration function requests
...
@@ -498,6 +500,10 @@ public:
...
@@ -498,6 +500,10 @@ public:
*/
*/
bool
isCurrentCall
(
const
CallID
&
callId
);
bool
isCurrentCall
(
const
CallID
&
callId
);
/**
* Map accounts parameters ( authname - hostname ) to an account ID
*/
AccountID
getAccountFromEvent
(
std
::
string
authname
);
private:
private:
/**
/**
* Create .PROGNAME directory in home user and create
* Create .PROGNAME directory in home user and create
...
...
src/sipaccount.cpp
View file @
3baf3e36
...
@@ -38,16 +38,17 @@ SIPAccount::~SIPAccount()
...
@@ -38,16 +38,17 @@ SIPAccount::~SIPAccount()
void
void
SIPAccount
::
registerVoIPLink
()
SIPAccount
::
registerVoIPLink
()
{
{
_debug
(
"SIPAccount: register account %s
\n
"
,
getAccountID
().
c_str
());
_link
->
setFullName
(
Manager
::
instance
().
getConfigString
(
_accountID
,
SIP_FULL_NAME
));
_link
->
setFullName
(
Manager
::
instance
().
getConfigString
(
_accountID
,
SIP_FULL_NAME
));
_link
->
setHostName
(
Manager
::
instance
().
getConfigString
(
_accountID
,
SIP_HOST_PART
));
_link
->
setHostName
(
Manager
::
instance
().
getConfigString
(
_accountID
,
SIP_HOST_PART
));
int
useStun
=
Manager
::
instance
().
getConfigInt
(
_accountID
,
SIP_USE_STUN
);
int
useStun
=
Manager
::
instance
().
getConfigInt
(
_accountID
,
SIP_USE_STUN
);
//_link->setAccountID( getAccountID() );
SIPVoIPLink
*
thislink
=
dynamic_cast
<
SIPVoIPLink
*>
(
_link
);
SIPVoIPLink
*
thislink
=
dynamic_cast
<
SIPVoIPLink
*>
(
_link
);
thislink
->
setStunServer
(
Manager
::
instance
().
getConfigString
(
_accountID
,
SIP_STUN_SERVER
));
thislink
->
setStunServer
(
Manager
::
instance
().
getConfigString
(
_accountID
,
SIP_STUN_SERVER
));
thislink
->
setUseStun
(
useStun
!=
0
?
true
:
false
);
thislink
->
setUseStun
(
useStun
!=
0
?
true
:
false
);
_link
->
init
();
_link
->
init
();
// Stuff needed for SIP registration.
// Stuff needed for SIP registration.
thislink
->
setProxy
(
Manager
::
instance
().
getConfigString
(
_accountID
,
SIP_PROXY
));
thislink
->
setProxy
(
Manager
::
instance
().
getConfigString
(
_accountID
,
SIP_PROXY
));
thislink
->
setUserPart
(
Manager
::
instance
().
getConfigString
(
_accountID
,
SIP_USER_PART
));
thislink
->
setUserPart
(
Manager
::
instance
().
getConfigString
(
_accountID
,
SIP_USER_PART
));
...
@@ -59,7 +60,9 @@ SIPAccount::registerVoIPLink()
...
@@ -59,7 +60,9 @@ SIPAccount::registerVoIPLink()
void
void
SIPAccount
::
unregisterVoIPLink
()
SIPAccount
::
unregisterVoIPLink
()
{
{
_debug
(
"SIPAccount: unregister account %s
\n
"
,
getAccountID
().
c_str
());
_link
->
sendUnregister
();
_link
->
sendUnregister
();
_debug
(
"Terminate SIP account
\n
"
);
_link
->
terminate
();
_link
->
terminate
();
}
}
...
...
src/sipvoiplink.cpp
View file @
3baf3e36
...
@@ -24,6 +24,7 @@
...
@@ -24,6 +24,7 @@
#include
"eventthread.h"
#include
"eventthread.h"
#include
"sipcall.h"
#include
"sipcall.h"
#include
<sstream>
// for ostringstream
#include
<sstream>
// for ostringstream
#include
"sipaccount.h"
#include
"manager.h"
#include
"manager.h"
#include
"user_cfg.h"
// SIGNALISATION / PULSE #define
#include
"user_cfg.h"
// SIGNALISATION / PULSE #define
...
@@ -56,6 +57,7 @@ SIPVoIPLink::SIPVoIPLink(const AccountID& accountID)
...
@@ -56,6 +57,7 @@ SIPVoIPLink::SIPVoIPLink(const AccountID& accountID)
:
VoIPLink
(
accountID
),
_localExternAddress
(
""
)
:
VoIPLink
(
accountID
),
_localExternAddress
(
""
)
{
{
_evThread
=
new
EventThread
(
this
);
_evThread
=
new
EventThread
(
this
);
_initDone
=
false
;
_nMsgVoicemail
=
0
;
_nMsgVoicemail
=
0
;
_eXosipRegID
=
EXOSIP_ERROR_STD
;
_eXosipRegID
=
EXOSIP_ERROR_STD
;
...
@@ -76,6 +78,7 @@ SIPVoIPLink::~SIPVoIPLink()
...
@@ -76,6 +78,7 @@ SIPVoIPLink::~SIPVoIPLink()
bool
bool
SIPVoIPLink
::
init
()
SIPVoIPLink
::
init
()
{
{
_debug
(
"INIT DONE : %d
\n
"
,
_initDone
);
if
(
!
_initDone
)
{
if
(
!
_initDone
)
{
if
(
0
!=
eXosip_init
())
{
if
(
0
!=
eXosip_init
())
{
_debug
(
"! SIP Failure: Could not initialize eXosip
\n
"
);
_debug
(
"! SIP Failure: Could not initialize eXosip
\n
"
);
...
@@ -149,18 +152,18 @@ SIPVoIPLink::init()
...
@@ -149,18 +152,18 @@ SIPVoIPLink::init()
return
true
;
return
true
;
}
}
void
void
SIPVoIPLink
::
terminate
()
SIPVoIPLink
::
terminate
()
{
{
_debug
(
"Terminate before
\n
"
);
terminateSIPCall
();
terminateSIPCall
();
_debug
(
"Terminate after
\n
"
);
if
(
_initDone
)
{
if
(
_initDone
)
{
// TODO The next line makes the daemon crash on
// TODO The next line makes the daemon crash on
// account delete if at least one account is registered.
// account delete if at least one account is registered.
// It should called only when the last account
// It should called only when the last account
// is deleted/unregistered.
// is deleted/unregistered.
//eXosip_quit();
//
eXosip_quit();
_initDone
=
false
;
_initDone
=
false
;
}
}
}
}
...
@@ -168,6 +171,7 @@ SIPVoIPLink::terminate()
...
@@ -168,6 +171,7 @@ SIPVoIPLink::terminate()
void
void
SIPVoIPLink
::
terminateSIPCall
()
SIPVoIPLink
::
terminateSIPCall
()
{
{
ost
::
MutexLock
m
(
_callMapMutex
);
ost
::
MutexLock
m
(
_callMapMutex
);
CallMap
::
iterator
iter
=
_callMap
.
begin
();
CallMap
::
iterator
iter
=
_callMap
.
begin
();
SIPCall
*
call
;
SIPCall
*
call
;
...
@@ -213,18 +217,17 @@ void
...
@@ -213,18 +217,17 @@ void
SIPVoIPLink
::
getEvent
()
SIPVoIPLink
::
getEvent
()
{
{
char
*
tmp2
;
char
*
tmp2
;
const
char
*
localport
=
""
+
_localPort
;
eXosip_event_t
*
event
=
eXosip_event_wait
(
0
,
50
);
eXosip_event_t
*
event
=
eXosip_event_wait
(
0
,
50
);
eXosip_lock
();
eXosip_lock
();
eXosip_automatic_action
();
eXosip_automatic_action
();
eXosip_unlock
();
eXosip_unlock
();
if
(
event
==
NULL
)
{
if
(
event
==
NULL
)
{
return
;
return
;
}
}
_debugMid
(
"> SIP Event: [cdt=%4d:%4d:%4d] type=#%03d %s = "
,
event
->
cid
,
event
->
did
,
event
->
tid
,
event
->
type
,
event
->
textinfo
);
switch
(
event
->
type
)
{
switch
(
event
->
type
)
{
/* REGISTER related events */
/* REGISTER related events */
case
EXOSIP_REGISTRATION_NEW
:
/** 00 < announce new registration. */
case
EXOSIP_REGISTRATION_NEW
:
/** 00 < announce new registration. */
_debugMid
(
" !EXOSIP_REGISTRATION_NEW event is not implemented
\n
"
);
_debugMid
(
" !EXOSIP_REGISTRATION_NEW event is not implemented
\n
"
);
...
@@ -232,18 +235,18 @@ SIPVoIPLink::getEvent()
...
@@ -232,18 +235,18 @@ SIPVoIPLink::getEvent()
case
EXOSIP_REGISTRATION_SUCCESS
:
/** 01 < user is successfully registred. */
case
EXOSIP_REGISTRATION_SUCCESS
:
/** 01 < user is successfully registred. */
_debugMid
(
" !EXOSIP_REGISTRATION_SUCCESS
\n
"
);
_debugMid
(
" !EXOSIP_REGISTRATION_SUCCESS
\n
"
);
if
(
_eXosipRegID
==
EXOSIP_ERROR_STD
){
if
(
_eXosipRegID
==
EXOSIP_ERROR_STD
){
_debug
(
"Successfully Unregister account ID = %s
\n
"
,
getAccountID
().
c_str
());
setRegistrationState
(
Unregistered
);
setRegistrationState
(
Unregistered
);
Manager
::
instance
().
unregistrationSucceed
(
getAccountID
()
);
if
(
_evThread
)
_evThread
->
stop
(
);
}
}
else
{
else
{
_debug
(
"Successfully Register account ID = %s
\n
"
,
getAccountID
().
c_str
());
setRegistrationState
(
Registered
);
setRegistrationState
(
Registered
);
Manager
::
instance
().
registrationSucceed
(
getAccountID
());
}
}
break
;
break
;
case
EXOSIP_REGISTRATION_FAILURE
:
/** 02 < user is not registred. */
case
EXOSIP_REGISTRATION_FAILURE
:
/** 02 < user is not registred. */
setRegistrationState
(
Error
,
"SIP registration failure."
);
setRegistrationState
(
Error
,
"SIP registration failure."
);
_debugMid
(
" !EXOSIP_REGISTRATION_FAILURE
\n
"
);
_debugMid
(
" !EXOSIP_REGISTRATION_FAILURE
\n
"
);
//Manager::instance().registrationFailed(getAccountID());
break
;
break
;
case
EXOSIP_REGISTRATION_REFRESHED
:
/** 03 < registration has been refreshed. */
case
EXOSIP_REGISTRATION_REFRESHED
:
/** 03 < registration has been refreshed. */
_debugMid
(
" !EXOSIP_REGISTRATION_REFRESHED event is not implemented
\n
"
);
_debugMid
(
" !EXOSIP_REGISTRATION_REFRESHED event is not implemented
\n
"
);
...
@@ -448,7 +451,6 @@ SIPVoIPLink::getEvent()
...
@@ -448,7 +451,6 @@ SIPVoIPLink::getEvent()
bool
bool
SIPVoIPLink
::
sendRegister
()
SIPVoIPLink
::
sendRegister
()
{
{
_debug
(
"SEND REGISTER
\n
"
);
if
(
_eXosipRegID
!=
EXOSIP_ERROR_STD
)
{
if
(
_eXosipRegID
!=
EXOSIP_ERROR_STD
)
{
Manager
::
instance
().
displayError
(
"! SIP Error: Registration already sent. Try to unregister"
);
Manager
::
instance
().
displayError
(
"! SIP Error: Registration already sent. Try to unregister"
);
...
@@ -507,9 +509,9 @@ SIPVoIPLink::sendRegister()
...
@@ -507,9 +509,9 @@ SIPVoIPLink::sendRegister()
eXosip_unlock
();
eXosip_unlock
();
return
false
;
return
false
;
}
}
eXosip_unlock
();
setRegistrationState
(
Trying
);
setRegistrationState
(
Trying
);
eXosip_unlock
();
return
true
;
return
true
;
}
}
...
@@ -520,6 +522,12 @@ SIPVoIPLink::SIPFromHeader(const std::string& userpart, const std::string& hostp
...
@@ -520,6 +522,12 @@ SIPVoIPLink::SIPFromHeader(const std::string& userpart, const std::string& hostp
return
(
"
\"
"
+
getFullName
()
+
"
\"
"
+
" <sip:"
+
userpart
+
"@"
+
hostpart
+
">"
);
return
(
"
\"
"
+
getFullName
()
+
"
\"
"
+
" <sip:"
+
userpart
+
"@"
+
hostpart
+
">"
);
}
}
std
::
string
SIPVoIPLink
::
SIPFromHeaderAlternate
(
const
std
::
string
&
userpart
,
const
std
::
string
&
hostpart
)
{
return
(
"<sip:"
+
userpart
+
"@"
+
hostpart
+
">"
);
}
bool
bool
SIPVoIPLink
::
sendSIPAuthentification
()
SIPVoIPLink
::
sendSIPAuthentification
()
{
{
...
@@ -547,7 +555,7 @@ SIPVoIPLink::sendSIPAuthentification()
...
@@ -547,7 +555,7 @@ SIPVoIPLink::sendSIPAuthentification()
bool
bool
SIPVoIPLink
::
sendUnregister
()
SIPVoIPLink
::
sendUnregister
()
{
{
_debug
(
"SEND UNREGISTER
\n
"
);
_debug
(
"SEND UNREGISTER
for account %s
\n
"
,
getAccountID
().
c_str
()
);
if
(
_eXosipRegID
==
EXOSIP_ERROR_STD
)
return
false
;
if
(
_eXosipRegID
==
EXOSIP_ERROR_STD
)
return
false
;
int
eXosipErr
=
EXOSIP_ERROR_NO
;
int
eXosipErr
=
EXOSIP_ERROR_NO
;
osip_message_t
*
reg
=
NULL
;
osip_message_t
*
reg
=
NULL
;
...
@@ -572,8 +580,8 @@ SIPVoIPLink::sendUnregister()
...
@@ -572,8 +580,8 @@ SIPVoIPLink::sendUnregister()
if
(
eXosipErr
==
EXOSIP_ERROR_STD
)
{
if
(
eXosipErr
==
EXOSIP_ERROR_STD
)
{
_debug
(
"! SIP Failure: Unable to send registration (unregister)
\n
"
);
_debug
(
"! SIP Failure: Unable to send registration (unregister)
\n
"
);
}
}
eXosip_unlock
();
_eXosipRegID
=
EXOSIP_ERROR_STD
;
_eXosipRegID
=
EXOSIP_ERROR_STD
;
eXosip_unlock
();
return
true
;
return
true
;
}
}
...
@@ -1517,6 +1525,7 @@ SIPVoIPLink::SIPCallReleased(eXosip_event_t *event)
...
@@ -1517,6 +1525,7 @@ SIPVoIPLink::SIPCallReleased(eXosip_event_t *event)
if
(
!
call
)
{
return
;
}
if
(
!
call
)
{
return
;
}
// if we are here.. something when wrong before...
// if we are here.. something when wrong before...
_debug
(
"SIP call release
\n
"
);
CallID
id
=
call
->
getCallId
();
CallID
id
=
call
->
getCallId
();
Manager
::
instance
().
callFailure
(
id
);
Manager
::
instance
().
callFailure
(
id
);
removeCall
(
id
);
removeCall
(
id
);
...
@@ -1535,7 +1544,6 @@ SIPVoIPLink::SIPMessageNew(eXosip_event_t *event)
...
@@ -1535,7 +1544,6 @@ SIPVoIPLink::SIPMessageNew(eXosip_event_t *event)
}
}
// Voice message
// Voice message
else
if
(
MSG_IS_NOTIFY
(
event
->
request
)){
else
if
(
MSG_IS_NOTIFY
(
event
->
request
)){
_debug
(
" > NOTIFY Voice message
\n
"
);
int
ii
;
int
ii
;
osip_body_t
*
body
=
NULL
;
osip_body_t
*
body
=
NULL
;
// Get the message body
// Get the message body
...
@@ -1565,6 +1573,7 @@ SIPVoIPLink::SIPMessageNew(eXosip_event_t *event)
...
@@ -1565,6 +1573,7 @@ SIPVoIPLink::SIPMessageNew(eXosip_event_t *event)
// Set the number of voice-message
// Set the number of voice-message
int
msgVoicemail
=
atoi
(
nb_msg
.
data
());
int
msgVoicemail
=
atoi
(
nb_msg
.
data
());
_debug
(
" > NOTIFY -> %i voice message for account %s
\n
"
,
msgVoicemail
,
getAccountID
().
c_str
());
if
(
msgVoicemail
!=
0
)
{
if
(
msgVoicemail
!=
0
)
{
// If there is at least one voice-message, start notification
// If there is at least one voice-message, start notification
...
...
src/sipvoiplink.h
View file @
3baf3e36
...
@@ -24,13 +24,13 @@
...
@@ -24,13 +24,13 @@
#include
<string>
#include
<string>
#include
<eXosip2/eXosip.h>
#include
<eXosip2/eXosip.h>
#include
"audio/audiortp.h"
#include
"audio/audiortp.h"
#include
<osip2/osip_mt.h>
class
EventThread
;
class
EventThread
;
class
SIPCall
;
class
SIPCall
;
/**
/**
* Specific VoIPLink for SIP (SIP core for incoming and outgoing events)
* Specific VoIPLink for SIP (SIP core for incoming and outgoing events)
* @author Yan Morin <yan.morin@gmail.com>
*/
*/
class
SIPVoIPLink
:
public
VoIPLink
class
SIPVoIPLink
:
public
VoIPLink
...
@@ -113,6 +113,7 @@ private:
...
@@ -113,6 +113,7 @@ private:
* @return SIP URI for from Header
* @return SIP URI for from Header
*/
*/
std
::
string
SIPFromHeader
(
const
std
::
string
&
userpart
,
const
std
::
string
&
hostpart
);
std
::
string
SIPFromHeader
(
const
std
::
string
&
userpart
,
const
std
::
string
&
hostpart
);
std
::
string
SIPFromHeaderAlternate
(
const
std
::
string
&
userpart
,
const
std
::
string
&
hostpart
);
/**
/**
* Build a sip address with the number that you want to call
* Build a sip address with the number that you want to call
...
@@ -242,8 +243,6 @@ private:
...
@@ -242,8 +243,6 @@ private:
/** To build sdp when call is off-hold */
/** To build sdp when call is off-hold */
int
sdp_off_hold_call
(
sdp_message_t
*
sdp
);
int
sdp_off_hold_call
(
sdp_message_t
*
sdp
);
/** EventThread get every incoming events */
/** EventThread get every incoming events */
EventThread
*
_evThread
;