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
9f7579f1
Commit
9f7579f1
authored
Jul 26, 2006
by
yanmorin
Browse files
*** empty log message ***
parent
2953c83c
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/iaxaccount.cpp
View file @
9f7579f1
...
...
@@ -20,6 +20,10 @@
#include
"iaxvoiplink.h"
#include
"manager.h"
#define IAX_HOST "IAX.host"
#define IAX_USER "IAX.user"
#define IAX_PASS "IAX.pass"
IAXAccount
::
IAXAccount
(
const
AccountID
&
accountID
)
:
Account
(
accountID
)
{
...
...
@@ -45,6 +49,14 @@ bool
IAXAccount
::
registerAccount
()
{
if
(
_link
&&
!
_registered
)
{
init
();
unregisterAccount
();
IAXVoIPLink
*
tmplink
=
dynamic_cast
<
IAXVoIPLink
*>
(
_link
);
if
(
tmplink
)
{
tmplink
->
setHost
(
Manager
::
instance
().
getConfigString
(
_accountID
,
IAX_HOST
));
tmplink
->
setUser
(
Manager
::
instance
().
getConfigString
(
_accountID
,
IAX_USER
));
tmplink
->
setPass
(
Manager
::
instance
().
getConfigString
(
_accountID
,
IAX_PASS
));
}
_registered
=
_link
->
setRegister
();
}
return
_registered
;
...
...
@@ -91,6 +103,10 @@ IAXAccount::initConfig(Conf::ConfigTree& config)
config
.
addConfigTreeItem
(
section
,
Conf
::
ConfigTreeItem
(
CONFIG_ACCOUNT_TYPE
,
"IAX"
,
type_str
));
config
.
addConfigTreeItem
(
section
,
Conf
::
ConfigTreeItem
(
CONFIG_ACCOUNT_ENABLE
,
"1"
,
type_int
));
config
.
addConfigTreeItem
(
section
,
Conf
::
ConfigTreeItem
(
CONFIG_ACCOUNT_AUTO_REGISTER
,
"1"
,
type_int
));
config
.
addConfigTreeItem
(
section
,
Conf
::
ConfigTreeItem
(
IAX_HOST
,
""
,
type_str
));
config
.
addConfigTreeItem
(
section
,
Conf
::
ConfigTreeItem
(
IAX_USER
,
""
,
type_str
));
config
.
addConfigTreeItem
(
section
,
Conf
::
ConfigTreeItem
(
IAX_PASS
,
""
,
type_str
));
}
void
...
...
src/iaxvoiplink.cpp
View file @
9f7579f1
...
...
@@ -21,6 +21,8 @@
#include
"iaxcall.h"
#include
"eventthread.h"
#include
"manager.h"
#define IAX_SUCCESS 0
#define IAX_FAILURE -1
...
...
@@ -76,6 +78,7 @@ IAXVoIPLink::getEvent()
iax_event
*
event
=
0
;
IAXCall
*
call
=
0
;
while
(
(
event
=
iax_get_event
(
0
))
!=
0
)
{
_debug
(
"Receive IAX Event: %d
\n
"
,
event
->
etype
);
call
=
iaxFindCallBySession
(
event
->
session
);
if
(
call
!=
0
)
{
iaxHandleCallEvent
(
event
,
call
);
...
...
@@ -83,7 +86,7 @@ IAXVoIPLink::getEvent()
// in iaxclient, there is many session handling, here, only one
iaxHandleRegReply
(
event
);
}
else
{
switch
(
e
->
etype
)
{
switch
(
e
vent
->
etype
)
{
case
IAX_EVENT_REGACK
:
case
IAX_EVENT_REGREJ
:
_debug
(
"Unknown IAX Registration Event
\n
"
);
...
...
@@ -101,7 +104,7 @@ IAXVoIPLink::getEvent()
break
;
default:
_debug
(
"Unknown event type: %d
\n
"
,
event
->
type
);
_debug
(
"Unknown event type: %d
\n
"
,
event
->
e
type
);
}
}
iax_event_free
(
event
);
...
...
@@ -117,7 +120,16 @@ IAXVoIPLink::getEvent()
bool
IAXVoIPLink
::
setRegister
()
{
bool
result
=
false
;
if
(
_regSession
==
0
)
{
if
(
_host
.
empty
())
{
Manager
::
instance
().
displayConfigError
(
"Fill host field for IAX Account"
);
return
false
;
}
if
(
_user
.
empty
())
{
Manager
::
instance
().
displayConfigError
(
"Fill user field for IAX Account"
);
return
false
;
}
// lock
_regSession
=
iax_session_new
();
...
...
@@ -127,11 +139,22 @@ IAXVoIPLink::setRegister()
}
else
{
// refresh
// last reg
char
host
[
_host
.
length
()
+
1
];
strcpy
(
host
,
_host
.
c_str
());
char
user
[
_user
.
length
()
+
1
];
strcpy
(
user
,
_user
.
c_str
());
char
pass
[
_pass
.
length
()
+
1
];
strcpy
(
pass
,
_pass
.
c_str
());
//iax_register don't use const char*
_debug
(
"Sending registration to %s with user %s
\n
"
,
host
,
user
);
iax_register
(
_regSession
,
host
,
user
,
pass
,
300
);
result
=
true
;
}
// unlock
// unlock
}
return
false
;
return
result
;
}
bool
...
...
@@ -164,7 +187,7 @@ IAXVoIPLink::iaxHandleCallEvent(iax_event* event, IAXCall* call)
// call should not be 0
// note activity?
//
switch
(
event
->
type
)
{
switch
(
event
->
e
type
)
{
case
IAX_EVENT_HANGUP
:
break
;
...
...
@@ -195,8 +218,8 @@ IAXVoIPLink::iaxHandleCallEvent(iax_event* event, IAXCall* call)
case
IAX_EVENT_URL
:
break
;
case
IAX_EVENT_CNG
:
break
;
//
case IAX_EVENT_CNG:
??
//
break;
case
IAX_EVENT_TIMEOUT
:
break
;
...
...
@@ -205,7 +228,7 @@ IAXVoIPLink::iaxHandleCallEvent(iax_event* event, IAXCall* call)
break
;
default:
_debug
(
"Unknown event type: %d
\n
"
,
event
->
type
);
_debug
(
"Unknown event type: %d
\n
"
,
event
->
e
type
);
}
}
...
...
src/iaxvoiplink.h
View file @
9f7579f1
...
...
@@ -57,6 +57,11 @@ public:
bool
carryingDTMFdigits
(
const
CallID
&
id
,
char
code
)
{
return
false
;
}
bool
sendMessage
(
const
std
::
string
&
to
,
const
std
::
string
&
body
)
{
return
false
;
}
public:
// iaxvoiplink only
void
setHost
(
const
std
::
string
&
host
)
{
_host
=
host
;
}
void
setUser
(
const
std
::
string
&
user
)
{
_user
=
user
;
}
void
setPass
(
const
std
::
string
&
pass
)
{
_pass
=
pass
;
}
private:
/**
* Find a iaxcall by iax session number
...
...
@@ -79,7 +84,16 @@ private:
void
iaxHandleRegReply
(
iax_event
*
event
);
EventThread
*
_evThread
;
/** registration session : 0 if not register */
struct
iax_session
*
_regSession
;
/** IAX Host */
std
::
string
_host
;
/** IAX User */
std
::
string
_user
;
/** IAX Password */
std
::
string
_pass
;
};
#endif
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