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
33b0de00
Commit
33b0de00
authored
Apr 15, 2010
by
Alexandre Savard
Browse files
Merge branch 'm_savard'
parents
a38aada5
40cdb895
Changes
7
Hide whitespace changes
Inline
Side-by-side
sflphone-client-gnome/src/config/accountconfigdialog.c
View file @
33b0de00
...
...
@@ -54,7 +54,7 @@ GtkWidget * entryID;
GtkWidget
*
entryAlias
;
GtkWidget
*
protocolComboBox
;
GtkWidget
*
entryUsername
;
GtkWidget
*
entry
DomainName
;
GtkWidget
*
entry
RouteSet
;
GtkWidget
*
entryHostname
;
GtkWidget
*
entryPassword
;
GtkWidget
*
entryMailbox
;
...
...
@@ -240,7 +240,7 @@ static GtkWidget* create_basic_tab (account_t **a) {
gchar
*
curAccountType
=
"SIP"
;
gchar
*
curAlias
=
""
;
gchar
*
curUsername
=
""
;
gchar
*
cur
DomainName
=
""
;
gchar
*
cur
RouteSet
=
""
;
gchar
*
curHostname
=
""
;
gchar
*
curPassword
=
""
;
/* TODO: add curProxy, and add boxes for Proxy support */
...
...
@@ -262,7 +262,7 @@ static GtkWidget* create_basic_tab (account_t **a) {
curHostname
=
g_hash_table_lookup
(
currentAccount
->
properties
,
ACCOUNT_HOSTNAME
);
curPassword
=
g_hash_table_lookup
(
currentAccount
->
properties
,
ACCOUNT_PASSWORD
);
curUsername
=
g_hash_table_lookup
(
currentAccount
->
properties
,
ACCOUNT_USERNAME
);
cur
DomainName
=
g_hash_table_lookup
(
currentAccount
->
properties
,
ACCOUNT_
DOMAIN
);
cur
RouteSet
=
g_hash_table_lookup
(
currentAccount
->
properties
,
ACCOUNT_
ROUTE
);
curMailbox
=
g_hash_table_lookup
(
currentAccount
->
properties
,
ACCOUNT_MAILBOX
);
curUseragent
=
g_hash_table_lookup
(
currentAccount
->
properties
,
ACCOUNT_USERAGENT
);
}
...
...
@@ -348,17 +348,20 @@ static GtkWidget* create_basic_tab (account_t **a) {
g_signal_connect
(
G_OBJECT
(
entryUsername
),
"changed"
,
G_CALLBACK
(
update_credential_cb
),
NULL
);
g_object_set_data
(
G_OBJECT
(
entryUsername
),
"column"
,
GINT_TO_POINTER
(
COLUMN_CREDENTIAL_USERNAME
));
// Domain name can be update only for SIP account
// Route set can be update only for SIP account
// TODO: uncomment this code and implement route
/*
if(strcmp(curAccountType, "SIP") == 0) {
row++;
label
=
gtk_label_new_with_mnemonic
(
_
(
"_
Domain nam
e (optional)"
));
label = gtk_label_new_with_mnemonic(_("_
Rout
e (optional)"));
gtk_table_attach(GTK_TABLE( table ), label, 0, 1, row, row+1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_misc_set_alignment(GTK_MISC (label), 0, 0.5);
entry
DomainName
=
gtk_entry_new
();
gtk_label_set_mnemonic_widget
(
GTK_LABEL
(
label
),
entry
DomainName
);
gtk_entry_set_text
(
GTK_ENTRY
(
entry
DomainName
),
curDomainName
);
gtk_table_attach
(
GTK_TABLE
(
table
),
entry
DomainName
,
1
,
2
,
row
,
row
+
1
,
GTK_EXPAND
|
GTK_FILL
,
GTK_EXPAND
|
GTK_FILL
,
0
,
0
);
entry
RouteSet
= gtk_entry_new();
gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry
RouteSet
);
gtk_entry_set_text(GTK_ENTRY(entry
RouteSet), curRouteSet
);
gtk_table_attach (GTK_TABLE(table), entry
RouteSet
, 1, 2, row, row+1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
}
*/
row
++
;
label
=
gtk_label_new_with_mnemonic
(
_
(
"_Password"
));
...
...
@@ -1336,8 +1339,8 @@ void show_account_window (account_t * a) {
g_strdup
((
gchar
*
)
gtk_entry_get_text
(
GTK_ENTRY
(
entryUsername
))));
if
(
strcmp
(
proto
,
"SIP"
)
==
0
)
{
g_hash_table_replace
(
currentAccount
->
properties
,
g_strdup
(
ACCOUNT_
DOMAIN
),
g_strdup
((
gchar
*
)
gtk_entry_get_text
(
GTK_ENTRY
(
entry
DomainName
))));
g_strdup
(
ACCOUNT_
ROUTE
),
g_strdup
((
gchar
*
)
gtk_entry_get_text
(
GTK_ENTRY
(
entry
RouteSet
))));
}
g_hash_table_replace
(
currentAccount
->
properties
,
...
...
sflphone-client-gnome/src/sflphone_const.h
View file @
33b0de00
...
...
@@ -65,7 +65,7 @@
#define ACCOUNT_DTMF_TYPE "Account.dtmfType"
#define ACCOUNT_HOSTNAME "hostname"
#define ACCOUNT_USERNAME "username"
#define ACCOUNT_
DOMAIN
"
domainname
"
#define ACCOUNT_
ROUTE
"
routeset
"
#define ACCOUNT_PASSWORD "password"
#define ACCOUNT_AUTHENTICATION_USERNAME "authenticationUsername"
#define ACCOUNT_REALM "realm"
...
...
sflphone-common/src/account.h
View file @
33b0de00
...
...
@@ -69,7 +69,7 @@ typedef enum RegistrationState {
#define HOSTNAME "hostname"
#define USERNAME "username"
#define
DOMAINNAME
"
domainname
"
#define
ROUTESET
"
routeset
"
#define AUTHENTICATION_USERNAME "authenticationUsername"
#define PASSWORD "password"
#define REALM "realm"
...
...
sflphone-common/src/managerimpl.cpp
View file @
33b0de00
...
...
@@ -3148,8 +3148,8 @@ std::map<std::string, std::string> ManagerImpl::getAccountDetails (
accountID
,
HOSTNAME
)));
a
.
insert
(
std
::
pair
<
std
::
string
,
std
::
string
>
(
USERNAME
,
getConfigString
(
accountID
,
USERNAME
)));
a
.
insert
(
std
::
pair
<
std
::
string
,
std
::
string
>
(
DOMAINNAME
,
getConfigString
(
accountID
,
DOMAINNAME
)));
a
.
insert
(
std
::
pair
<
std
::
string
,
std
::
string
>
(
ROUTESET
,
getConfigString
(
accountID
,
ROUTESET
)));
a
.
insert
(
std
::
pair
<
std
::
string
,
std
::
string
>
(
PASSWORD
,
getConfigString
(
accountID
,
PASSWORD
)));
a
.
insert
(
std
::
pair
<
std
::
string
,
std
::
string
>
(
REALM
,
getConfigString
(
...
...
@@ -3393,7 +3393,7 @@ void ManagerImpl::setAccountDetails (const std::string& accountID,
map_cpy
=
details
;
std
::
string
username
;
std
::
string
domain
;
std
::
string
routeset
;
std
::
string
authenticationName
;
std
::
string
password
;
std
::
string
realm
;
...
...
@@ -3408,12 +3408,12 @@ void ManagerImpl::setAccountDetails (const std::string& accountID,
username
=
iter
->
second
;
}
if
((
iter
=
map_cpy
.
find
(
DOMAINNAME
))
!=
map_cpy
.
end
())
{
domain
=
iter
->
second
;
_error
(
"
DOMAINNAME
is %s"
,
domain
.
c_str
());
if
((
iter
=
map_cpy
.
find
(
ROUTESET
))
!=
map_cpy
.
end
())
{
routeset
=
iter
->
second
;
_error
(
"
ROUTESET
is %s"
,
routeset
.
c_str
());
}
else
{
_error
(
"
DOMAINNAME
is empty"
);
_error
(
"
ROUTESET
is empty"
);
}
if
((
iter
=
map_cpy
.
find
(
PASSWORD
))
!=
map_cpy
.
end
())
{
...
...
@@ -3431,7 +3431,7 @@ void ManagerImpl::setAccountDetails (const std::string& accountID,
setConfig
(
accountID
,
REALM
,
realm
);
setConfig
(
accountID
,
USERAGENT
,
ua_name
);
setConfig
(
accountID
,
USERNAME
,
username
);
setConfig
(
accountID
,
DOMAINNAME
,
domain
);
setConfig
(
accountID
,
ROUTESET
,
routeset
);
setConfig
(
accountID
,
AUTHENTICATION_USERNAME
,
authenticationName
);
if
(
!
getMd5CredentialHashing
())
{
...
...
sflphone-common/src/sip/sipaccount.cpp
View file @
33b0de00
...
...
@@ -26,7 +26,7 @@
SIPAccount
::
SIPAccount
(
const
AccountID
&
accountID
)
:
Account
(
accountID
,
"sip"
)
,
_
domainName
(
""
)
,
_
routeSet
(
""
)
,
_regc
(
NULL
)
,
_bRegister
(
false
)
,
_registrationExpire
(
""
)
...
...
@@ -331,7 +331,7 @@ void SIPAccount::loadConfig()
{
// Load primary credential
setUsername
(
Manager
::
instance
().
getConfigString
(
_accountID
,
USERNAME
));
set
DomainName
(
Manager
::
instance
().
getConfigString
(
_accountID
,
DOMAINNAME
));
set
RouteSet
(
Manager
::
instance
().
getConfigString
(
_accountID
,
ROUTESET
));
setPassword
(
Manager
::
instance
().
getConfigString
(
_accountID
,
PASSWORD
));
_authenticationUsername
=
Manager
::
instance
().
getConfigString
(
_accountID
,
AUTHENTICATION_USERNAME
);
_realm
=
Manager
::
instance
().
getConfigString
(
_accountID
,
REALM
);
...
...
@@ -461,9 +461,6 @@ std::string SIPAccount::getFromUri (void)
username
=
getLoginName
();
}
if
(
!
getDomainName
().
empty
())
{
hostname
=
getDomainName
();
}
else
{
// Get machine hostname if not provided
if
(
_hostname
.
empty
())
{
...
...
@@ -507,11 +504,8 @@ std::string SIPAccount::getToUri (const std::string& username)
// Check if hostname is already specified
if
(
username
.
find
(
"@"
)
==
std
::
string
::
npos
)
{
// hostname not specified
if
(
getDomainName
().
empty
())
// hostname not specified
hostname
=
_hostname
;
else
hostname
=
getDomainName
();
}
int
len
=
pj_ansi_snprintf
(
uri
,
PJSIP_MAX_URL_SIZE
,
...
...
@@ -532,6 +526,7 @@ std::string SIPAccount::getServerUri (void)
std
::
string
scheme
;
std
::
string
transport
;
std
::
string
hostname
=
_hostname
;
// UDP does not require the transport specification
...
...
@@ -544,10 +539,9 @@ std::string SIPAccount::getServerUri (void)
}
int
len
=
pj_ansi_snprintf
(
uri
,
PJSIP_MAX_URL_SIZE
,
"<%s%s%s>"
,
scheme
.
c_str
(),
_
hostname
.
c_str
(),
hostname
.
c_str
(),
transport
.
c_str
());
return
std
::
string
(
uri
,
len
);
...
...
sflphone-common/src/sip/sipaccount.h
View file @
33b0de00
...
...
@@ -64,14 +64,14 @@ class SIPAccount : public Account
virtual
~
SIPAccount
();
/**
* Set
domain
to appears in sip messages for this account
* Set
route header
to appears in sip messages for this account
*/
void
set
DomainName
(
std
::
string
domain
)
{
_domainName
=
domain
;
}
void
set
RouteSet
(
std
::
string
route
)
{
_routeSet
=
route
;
}
/**
* Get
domain name
to appear in sip messages for this account
* Get
route header
to appear in sip messages for this account
*/
std
::
string
get
DomainName
(
void
)
{
return
_
domainName
;
}
std
::
string
get
RouteSet
(
void
)
{
return
_
routeSet
;
}
/**
* Special setVoIPLink which increment SipVoIPLink's number of client.
...
...
@@ -363,7 +363,7 @@ class SIPAccount : public Account
*/
std
::
string
getLoginName
(
void
);
std
::
string
_
domainName
;
std
::
string
_
routeSet
;
// The pjsip client registration information
...
...
sflphone-common/src/sip/sipvoiplink.cpp
View file @
33b0de00
...
...
@@ -563,7 +563,6 @@ int SIPVoIPLink::sendRegister (AccountID id)
std
::
string
srvUri
=
account
->
getServerUri
();
std
::
string
address
=
findLocalAddressFromUri
(
srvUri
,
account
->
getAccountTransport
());
int
port
=
findLocalPortFromUri
(
srvUri
,
account
->
getAccountTransport
());
std
::
stringstream
ss
;
...
...
@@ -579,20 +578,43 @@ int SIPVoIPLink::sendRegister (AccountID id)
contactUri
.
c_str
());
pj_str_t
pjFrom
;
pj_cstr
(
&
pjFrom
,
fromUri
.
c_str
());
pj_str_t
pjContact
;
pj_cstr
(
&
pjContact
,
contactUri
.
c_str
());
pj_str_t
pjSrv
;
pj_cstr
(
&
pjSrv
,
srvUri
.
c_str
());
// Initializes registration
// Set Route for registration passing throught one or several proxies
status
=
pjsip_regc_init
(
regc
,
&
pjSrv
,
&
pjFrom
,
&
pjFrom
,
1
,
&
pjContact
,
expire_value
);
/*
if(!(account->getDomainName().empty())) {
_error("Set route with %s", account->getHostname().c_str());
pjsip_route_hdr *route_set = pjsip_route_hdr_create(_pool);
pjsip_route_hdr *routing = pjsip_route_hdr_create(_pool);
pjsip_sip_uri *url = pjsip_sip_uri_create(_pool, 0);
routing->name_addr.uri = (pjsip_uri*)url;
pj_strdup2(_pool, &url->host, account->getHostname().c_str());
pj_list_push_back(&route_set, pjsip_hdr_clone(_pool, routing));
status = pjsip_regc_init (regc, &pjSrv, &pjFrom, &pjFrom, 1, &pjContact, expire_value);
pjsip_regc_set_route_set(regc, route_set);
}
else {
status = pjsip_regc_init (regc, &pjSrv, &pjFrom, &pjFrom, 1, &pjContact, expire_value);
}
*/
if
(
status
!=
PJ_SUCCESS
)
{
_debug
(
"UserAgent: Unable to initialize account %d in sendRegister"
,
status
);
_mutexSIP
.
leaveMutex
();
...
...
@@ -613,9 +635,10 @@ int SIPVoIPLink::sendRegister (AccountID id)
h
=
pjsip_generic_string_hdr_create
(
_pool
,
&
STR_USER_AGENT
,
&
useragent
);
pj_list_push_back
(
&
hdr_list
,
(
pjsip_hdr
*
)
h
);
// pj_list_push_back (&hdr_list, (pjsip_hdr*) routing);
pjsip_regc_add_headers
(
regc
,
&
hdr_list
);
status
=
pjsip_regc_register
(
regc
,
PJ_TRUE
,
&
tdata
);
if
(
status
!=
PJ_SUCCESS
)
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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