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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
jami-daemon
Commits
872b98df
Commit
872b98df
authored
16 years ago
by
Jérémy Quentin
Browse files
Options
Downloads
Patches
Plain Diff
Call and Automate fusion done and seems to work.
parent
f879204a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
sflphone_kde/CMakeLists.txt
+1
-2
1 addition, 2 deletions
sflphone_kde/CMakeLists.txt
sflphone_kde/Call.cpp
+156
-9
156 additions, 9 deletions
sflphone_kde/Call.cpp
sflphone_kde/Call.h
+77
-6
77 additions, 6 deletions
sflphone_kde/Call.h
with
234 additions
and
17 deletions
sflphone_kde/CMakeLists.txt
+
1
−
2
View file @
872b98df
...
...
@@ -13,8 +13,7 @@ SET(
main.cpp
sflphone_const.cpp
Account.cpp
AccountList.cpp
Automate.cpp
AccountList.cpp
Call.cpp
CallList.cpp
configurationmanager_interface.cpp
...
...
This diff is collapsed.
Click to expand it.
sflphone_kde/Call.cpp
+
156
−
9
View file @
872b98df
#include
"Call.h"
#include
"callmanager_interface_p.h"
#include
"callmanager_interface_singleton.h"
#include
"SFLPhone.h"
Call
::
Call
(
call_state
startState
,
QString
callId
)
const
call_state
Call
::
stateMap
[
11
][
5
]
=
{
this
->
automate
=
new
Automate
(
startState
);
this
->
id
=
callId
;
// ACCEPT REFUSE TRANSFER HOLD RECORD
/*INCOMING */
{
CALL_STATE_CURRENT
,
CALL_STATE_OVER
,
CALL_STATE_OVER
,
CALL_STATE_HOLD
,
CALL_STATE_INCOMING
},
/*RINGING */
{
CALL_STATE_ERROR
,
CALL_STATE_OVER
,
CALL_STATE_ERROR
,
CALL_STATE_ERROR
,
CALL_STATE_RINGING
},
/*CURRENT */
{
CALL_STATE_ERROR
,
CALL_STATE_OVER
,
CALL_STATE_TRANSFER
,
CALL_STATE_HOLD
,
CALL_STATE_CURRENT
},
/*DIALING */
{
CALL_STATE_RINGING
,
CALL_STATE_OVER
,
CALL_STATE_ERROR
,
CALL_STATE_ERROR
,
CALL_STATE_DIALING
},
/*HOLD */
{
CALL_STATE_ERROR
,
CALL_STATE_OVER
,
CALL_STATE_TRANSFER_HOLD
,
CALL_STATE_CURRENT
,
CALL_STATE_HOLD
},
/*FAILURE */
{
CALL_STATE_ERROR
,
CALL_STATE_OVER
,
CALL_STATE_ERROR
,
CALL_STATE_ERROR
,
CALL_STATE_ERROR
},
/*BUSY */
{
CALL_STATE_ERROR
,
CALL_STATE_OVER
,
CALL_STATE_ERROR
,
CALL_STATE_ERROR
,
CALL_STATE_ERROR
},
/*TRANSFER */
{
CALL_STATE_OVER
,
CALL_STATE_OVER
,
CALL_STATE_CURRENT
,
CALL_STATE_TRANSFER_HOLD
,
CALL_STATE_TRANSFER
},
/*TRANSFER_HOLD */
{
CALL_STATE_OVER
,
CALL_STATE_OVER
,
CALL_STATE_HOLD
,
CALL_STATE_TRANSFER
,
CALL_STATE_TRANSFER_HOLD
},
/*OVER */
{
CALL_STATE_ERROR
,
CALL_STATE_ERROR
,
CALL_STATE_ERROR
,
CALL_STATE_ERROR
,
CALL_STATE_ERROR
},
/*ERROR */
{
CALL_STATE_ERROR
,
CALL_STATE_ERROR
,
CALL_STATE_ERROR
,
CALL_STATE_ERROR
,
CALL_STATE_ERROR
}
};
const
function
Call
::
functionMap
[
11
][
5
]
=
{
// ACCEPT REFUSE TRANSFER HOLD RECORD
/*INCOMING */
{
&
Call
::
accept
,
&
Call
::
refuse
,
&
Call
::
acceptTransf
,
&
Call
::
acceptHold
,
&
Call
::
switchRecord
},
/*RINGING */
{
&
Call
::
nothing
,
&
Call
::
hangUp
,
&
Call
::
nothing
,
&
Call
::
nothing
,
&
Call
::
switchRecord
},
/*CURRENT */
{
&
Call
::
nothing
,
&
Call
::
hangUp
,
&
Call
::
nothing
,
&
Call
::
hold
,
&
Call
::
setRecord
},
/*DIALING */
{
&
Call
::
call
,
&
Call
::
nothing
,
&
Call
::
nothing
,
&
Call
::
nothing
,
&
Call
::
switchRecord
},
/*HOLD */
{
&
Call
::
nothing
,
&
Call
::
hangUp
,
&
Call
::
nothing
,
&
Call
::
unhold
,
&
Call
::
setRecord
},
/*FAILURE */
{
&
Call
::
nothing
,
&
Call
::
hangUp
,
&
Call
::
nothing
,
&
Call
::
nothing
,
&
Call
::
nothing
},
/*BUSY */
{
&
Call
::
nothing
,
&
Call
::
hangUp
,
&
Call
::
nothing
,
&
Call
::
nothing
,
&
Call
::
nothing
},
/*TRANSFERT */
{
&
Call
::
transfer
,
&
Call
::
hangUp
,
&
Call
::
nothing
,
&
Call
::
hold
,
&
Call
::
setRecord
},
/*TRANSFERT_HOLD */
{
&
Call
::
transfer
,
&
Call
::
hangUp
,
&
Call
::
nothing
,
&
Call
::
unhold
,
&
Call
::
setRecord
},
/*OVER */
{
&
Call
::
nothing
,
&
Call
::
nothing
,
&
Call
::
nothing
,
&
Call
::
nothing
,
&
Call
::
nothing
},
/*ERROR */
{
&
Call
::
nothing
,
&
Call
::
nothing
,
&
Call
::
nothing
,
&
Call
::
nothing
,
&
Call
::
nothing
}
};
Call
::
Call
(
call_state
startState
,
QString
callId
)
{
this
->
callId
=
callId
;
this
->
item
=
new
QListWidgetItem
(
""
);
this
->
recording
=
false
;
this
->
currentState
=
startState
;
}
Call
::
Call
(
call_state
startState
,
QString
callId
,
QString
from
,
Account
&
account
)
{
this
->
automate
=
new
Automate
(
startState
);
this
->
id
=
callId
;
this
->
callId
=
callId
;
this
->
item
=
new
QListWidgetItem
(
from
);
this
->
account
=
&
account
;
this
->
recording
=
false
;
this
->
currentState
=
startState
;
}
Call
::~
Call
()
{
delete
item
;
delete
automate
;
}
Call
*
Call
::
buildDialingCall
(
QString
callId
)
...
...
@@ -41,15 +79,124 @@ QListWidgetItem * Call::getItem()
call_state
Call
::
getState
()
const
{
return
automate
->
getC
urrentState
()
;
return
c
urrentState
;
}
call_state
Call
::
action
(
call_action
action
,
QString
number
)
{
return
automate
->
action
(
action
,
id
,
number
);
call_state
previousState
=
currentState
;
//execute the action associated with this transition
(
this
->*
(
functionMap
[
currentState
][
action
]))(
number
);
//update the state
currentState
=
stateMap
[
currentState
][
action
];
qDebug
()
<<
"Calling action "
<<
action
<<
" on call with state "
<<
previousState
<<
". Become "
<<
currentState
;
//return the new state
return
currentState
;
}
QString
Call
::
getCallId
()
{
return
id
;
return
callId
;
}
call_state
Call
::
getCurrentState
()
const
{
return
currentState
;
}
/*************************************************
************* Automate functions *************
*************************************************/
void
Call
::
nothing
(
QString
number
)
{
}
void
Call
::
accept
(
QString
number
)
{
CallManagerInterface
&
callManager
=
CallManagerInterfaceSingleton
::
getInstance
();
qDebug
()
<<
"Accepting call. callId : "
<<
callId
;
callManager
.
accept
(
callId
);
}
void
Call
::
refuse
(
QString
number
)
{
CallManagerInterface
&
callManager
=
CallManagerInterfaceSingleton
::
getInstance
();
qDebug
()
<<
"Refusing call. callId : "
<<
callId
;
callManager
.
refuse
(
callId
);
}
void
Call
::
acceptTransf
(
QString
number
)
{
CallManagerInterface
&
callManager
=
CallManagerInterfaceSingleton
::
getInstance
();
qDebug
()
<<
"Accepting call and transfering it to number : "
<<
number
<<
". callId : "
<<
callId
;
callManager
.
accept
(
callId
);
callManager
.
transfert
(
callId
,
number
);
}
void
Call
::
acceptHold
(
QString
number
)
{
CallManagerInterface
&
callManager
=
CallManagerInterfaceSingleton
::
getInstance
();
qDebug
()
<<
"Accepting call and holding it. callId : "
<<
callId
;
callManager
.
accept
(
callId
);
callManager
.
hold
(
callId
);
}
void
Call
::
hangUp
(
QString
number
)
{
CallManagerInterface
&
callManager
=
CallManagerInterfaceSingleton
::
getInstance
();
qDebug
()
<<
"Hanging up call. callId : "
<<
callId
;
callManager
.
hangUp
(
callId
);
}
void
Call
::
hold
(
QString
number
)
{
CallManagerInterface
&
callManager
=
CallManagerInterfaceSingleton
::
getInstance
();
qDebug
()
<<
"Holding call. callId : "
<<
callId
;
callManager
.
hold
(
callId
);
}
void
Call
::
call
(
QString
number
)
{
CallManagerInterface
&
callManager
=
CallManagerInterfaceSingleton
::
getInstance
();
QString
account
=
SFLPhone
::
firstAccount
();
qDebug
()
<<
"Calling "
<<
number
<<
" with account "
<<
account
<<
". callId : "
<<
callId
;
callManager
.
placeCall
(
account
,
callId
,
number
);
}
void
Call
::
transfer
(
QString
number
)
{
CallManagerInterface
&
callManager
=
CallManagerInterfaceSingleton
::
getInstance
();
QString
account
=
SFLPhone
::
firstAccount
();
qDebug
()
<<
"Transfering call to number : "
<<
number
<<
". callId : "
<<
callId
;
callManager
.
transfert
(
callId
,
number
);
}
void
Call
::
unhold
(
QString
number
)
{
CallManagerInterface
&
callManager
=
CallManagerInterfaceSingleton
::
getInstance
();
qDebug
()
<<
"Unholding call. callId : "
<<
callId
;
callManager
.
unhold
(
callId
);
}
void
Call
::
switchRecord
(
QString
number
)
{
qDebug
()
<<
"Switching record state for call automate. callId : "
<<
callId
;
recording
=
!
recording
;
}
void
Call
::
setRecord
(
QString
number
)
{
CallManagerInterface
&
callManager
=
CallManagerInterfaceSingleton
::
getInstance
();
qDebug
()
<<
"Setting record for call. callId : "
<<
callId
;
callManager
.
unhold
(
callId
);
}
This diff is collapsed.
Click to expand it.
sflphone_kde/Call.h
+
77
−
6
View file @
872b98df
#ifndef CALL_H
#define CALL_H
#include
<QtGui>
#include
"Account.h"
#include
"Automate.h"
//#include "Account.h"
//typedef call_state;
/** @enum call_state_t
* This enum have all the states a call can take.
*/
typedef
enum
{
/** Ringing incoming call */
CALL_STATE_INCOMING
,
/** Ringing outgoing call */
CALL_STATE_RINGING
,
/** Call to which the user can speak and hear */
CALL_STATE_CURRENT
,
/** Call which numbers are being added by the user */
CALL_STATE_DIALING
,
/** Call is on hold */
CALL_STATE_HOLD
,
/** Call has failed */
CALL_STATE_FAILURE
,
/** Call is busy */
CALL_STATE_BUSY
,
/** Call is being transfered. During this state, the user can enter the new number. */
CALL_STATE_TRANSFER
,
/** Call is on hold for transfer */
CALL_STATE_TRANSFER_HOLD
,
/** Call is over and should not be used */
CALL_STATE_OVER
,
/** This state should never be reached */
CALL_STATE_ERROR
}
call_state
;
//class Automate;
/** @enum call_action
* This enum have all the actions you can make on a call.
*/
typedef
enum
{
/** Green button, accept or new call or place call or place transfer */
CALL_ACTION_ACCEPT
,
/** Red button, refuse or hang up */
CALL_ACTION_REFUSE
,
/** Blue button, put into or out of transfer mode where you can type transfer number */
CALL_ACTION_TRANSFER
,
/** Blue-green button, hold or unhold the call */
CALL_ACTION_HOLD
,
/** Record button, enable or disable recording */
CALL_ACTION_RECORD
}
call_action
;
class
Call
;
typedef
void
(
Call
::*
function
)(
QString
number
);
class
Call
{
private:
//Call attributes
Account
*
account
;
QString
i
d
;
QString
callI
d
;
QString
from
;
QString
to
;
// HistoryState * historyState;
QTime
start
;
QTime
stop
;
QListWidgetItem
*
item
;
Automate
*
automate
;
//Automate * automate;
//Automate attributes
static
const
call_state
stateMap
[
11
][
5
];
static
const
function
functionMap
[
11
][
5
];
call_state
currentState
;
bool
recording
;
Call
(
call_state
startState
,
QString
callId
);
Call
(
call_state
startState
,
QString
callId
,
QString
from
,
Account
&
account
);
//Automate functions
void
nothing
(
QString
number
);
void
accept
(
QString
number
);
void
refuse
(
QString
number
);
void
acceptTransf
(
QString
number
);
void
acceptHold
(
QString
number
);
void
hangUp
(
QString
number
);
void
hold
(
QString
number
);
void
call
(
QString
number
);
void
transfer
(
QString
number
);
void
unhold
(
QString
number
);
void
switchRecord
(
QString
number
);
void
setRecord
(
QString
number
);
public:
...
...
@@ -31,6 +101,7 @@ public:
call_state
getState
()
const
;
QString
getCallId
();
call_state
action
(
call_action
action
,
QString
number
=
NULL
);
call_state
getCurrentState
()
const
;
};
...
...
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