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
9f7579f1
Commit
9f7579f1
authored
18 years ago
by
yanmorin
Browse files
Options
Downloads
Patches
Plain Diff
*** empty log message ***
parent
2953c83c
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/iaxaccount.cpp
+16
-0
16 additions, 0 deletions
src/iaxaccount.cpp
src/iaxvoiplink.cpp
+31
-8
31 additions, 8 deletions
src/iaxvoiplink.cpp
src/iaxvoiplink.h
+14
-0
14 additions, 0 deletions
src/iaxvoiplink.h
with
61 additions
and
8 deletions
src/iaxaccount.cpp
+
16
−
0
View file @
9f7579f1
...
@@ -20,6 +20,10 @@
...
@@ -20,6 +20,10 @@
#include
"iaxvoiplink.h"
#include
"iaxvoiplink.h"
#include
"manager.h"
#include
"manager.h"
#define IAX_HOST "IAX.host"
#define IAX_USER "IAX.user"
#define IAX_PASS "IAX.pass"
IAXAccount
::
IAXAccount
(
const
AccountID
&
accountID
)
IAXAccount
::
IAXAccount
(
const
AccountID
&
accountID
)
:
Account
(
accountID
)
:
Account
(
accountID
)
{
{
...
@@ -45,6 +49,14 @@ bool
...
@@ -45,6 +49,14 @@ bool
IAXAccount
::
registerAccount
()
IAXAccount
::
registerAccount
()
{
{
if
(
_link
&&
!
_registered
)
{
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
();
_registered
=
_link
->
setRegister
();
}
}
return
_registered
;
return
_registered
;
...
@@ -91,6 +103,10 @@ IAXAccount::initConfig(Conf::ConfigTree& config)
...
@@ -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_TYPE
,
"IAX"
,
type_str
));
config
.
addConfigTreeItem
(
section
,
Conf
::
ConfigTreeItem
(
CONFIG_ACCOUNT_ENABLE
,
"1"
,
type_int
));
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
(
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
void
...
...
This diff is collapsed.
Click to expand it.
src/iaxvoiplink.cpp
+
31
−
8
View file @
9f7579f1
...
@@ -21,6 +21,8 @@
...
@@ -21,6 +21,8 @@
#include
"iaxcall.h"
#include
"iaxcall.h"
#include
"eventthread.h"
#include
"eventthread.h"
#include
"manager.h"
#define IAX_SUCCESS 0
#define IAX_SUCCESS 0
#define IAX_FAILURE -1
#define IAX_FAILURE -1
...
@@ -76,6 +78,7 @@ IAXVoIPLink::getEvent()
...
@@ -76,6 +78,7 @@ IAXVoIPLink::getEvent()
iax_event
*
event
=
0
;
iax_event
*
event
=
0
;
IAXCall
*
call
=
0
;
IAXCall
*
call
=
0
;
while
(
(
event
=
iax_get_event
(
0
))
!=
0
)
{
while
(
(
event
=
iax_get_event
(
0
))
!=
0
)
{
_debug
(
"Receive IAX Event: %d
\n
"
,
event
->
etype
);
call
=
iaxFindCallBySession
(
event
->
session
);
call
=
iaxFindCallBySession
(
event
->
session
);
if
(
call
!=
0
)
{
if
(
call
!=
0
)
{
iaxHandleCallEvent
(
event
,
call
);
iaxHandleCallEvent
(
event
,
call
);
...
@@ -83,7 +86,7 @@ IAXVoIPLink::getEvent()
...
@@ -83,7 +86,7 @@ IAXVoIPLink::getEvent()
// in iaxclient, there is many session handling, here, only one
// in iaxclient, there is many session handling, here, only one
iaxHandleRegReply
(
event
);
iaxHandleRegReply
(
event
);
}
else
{
}
else
{
switch
(
e
->
etype
)
{
switch
(
e
vent
->
etype
)
{
case
IAX_EVENT_REGACK
:
case
IAX_EVENT_REGACK
:
case
IAX_EVENT_REGREJ
:
case
IAX_EVENT_REGREJ
:
_debug
(
"Unknown IAX Registration Event
\n
"
);
_debug
(
"Unknown IAX Registration Event
\n
"
);
...
@@ -101,7 +104,7 @@ IAXVoIPLink::getEvent()
...
@@ -101,7 +104,7 @@ IAXVoIPLink::getEvent()
break
;
break
;
default:
default:
_debug
(
"Unknown event type: %d
\n
"
,
event
->
type
);
_debug
(
"Unknown event type: %d
\n
"
,
event
->
e
type
);
}
}
}
}
iax_event_free
(
event
);
iax_event_free
(
event
);
...
@@ -117,7 +120,16 @@ IAXVoIPLink::getEvent()
...
@@ -117,7 +120,16 @@ IAXVoIPLink::getEvent()
bool
bool
IAXVoIPLink
::
setRegister
()
IAXVoIPLink
::
setRegister
()
{
{
bool
result
=
false
;
if
(
_regSession
==
0
)
{
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
// lock
_regSession
=
iax_session_new
();
_regSession
=
iax_session_new
();
...
@@ -127,11 +139,22 @@ IAXVoIPLink::setRegister()
...
@@ -127,11 +139,22 @@ IAXVoIPLink::setRegister()
}
else
{
}
else
{
// refresh
// refresh
// last reg
// 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
bool
...
@@ -164,7 +187,7 @@ IAXVoIPLink::iaxHandleCallEvent(iax_event* event, IAXCall* call)
...
@@ -164,7 +187,7 @@ IAXVoIPLink::iaxHandleCallEvent(iax_event* event, IAXCall* call)
// call should not be 0
// call should not be 0
// note activity?
// note activity?
//
//
switch
(
event
->
type
)
{
switch
(
event
->
e
type
)
{
case
IAX_EVENT_HANGUP
:
case
IAX_EVENT_HANGUP
:
break
;
break
;
...
@@ -195,8 +218,8 @@ IAXVoIPLink::iaxHandleCallEvent(iax_event* event, IAXCall* call)
...
@@ -195,8 +218,8 @@ IAXVoIPLink::iaxHandleCallEvent(iax_event* event, IAXCall* call)
case
IAX_EVENT_URL
:
case
IAX_EVENT_URL
:
break
;
break
;
case
IAX_EVENT_CNG
:
//
case IAX_EVENT_CNG:
??
break
;
//
break;
case
IAX_EVENT_TIMEOUT
:
case
IAX_EVENT_TIMEOUT
:
break
;
break
;
...
@@ -205,7 +228,7 @@ IAXVoIPLink::iaxHandleCallEvent(iax_event* event, IAXCall* call)
...
@@ -205,7 +228,7 @@ IAXVoIPLink::iaxHandleCallEvent(iax_event* event, IAXCall* call)
break
;
break
;
default:
default:
_debug
(
"Unknown event type: %d
\n
"
,
event
->
type
);
_debug
(
"Unknown event type: %d
\n
"
,
event
->
e
type
);
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
src/iaxvoiplink.h
+
14
−
0
View file @
9f7579f1
...
@@ -57,6 +57,11 @@ public:
...
@@ -57,6 +57,11 @@ public:
bool
carryingDTMFdigits
(
const
CallID
&
id
,
char
code
)
{
return
false
;
}
bool
carryingDTMFdigits
(
const
CallID
&
id
,
char
code
)
{
return
false
;
}
bool
sendMessage
(
const
std
::
string
&
to
,
const
std
::
string
&
body
)
{
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
:
private
:
/**
/**
* Find a iaxcall by iax session number
* Find a iaxcall by iax session number
...
@@ -79,7 +84,16 @@ private:
...
@@ -79,7 +84,16 @@ private:
void
iaxHandleRegReply
(
iax_event
*
event
);
void
iaxHandleRegReply
(
iax_event
*
event
);
EventThread
*
_evThread
;
EventThread
*
_evThread
;
/** registration session : 0 if not register */
struct
iax_session
*
_regSession
;
struct
iax_session
*
_regSession
;
/** IAX Host */
std
::
string
_host
;
/** IAX User */
std
::
string
_user
;
/** IAX Password */
std
::
string
_pass
;
};
};
#endif
#endif
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