]> git.ipfire.org Git - thirdparty/freeswitch.git/blame - fscomm/call.h
[Build-System] Update libks and signalwire-c requirements to 2.0
[thirdparty/freeswitch.git] / fscomm / call.h
CommitLineData
721c391a
BW
1/*
2 * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
6e7d5d08 3 * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
721c391a
BW
4 *
5 * Version: MPL 1.1
6 *
7 * The contents of this file are subject to the Mozilla Public License Version
8 * 1.1 (the "License"); you may not use this file except in compliance with
9 * the License. You may obtain a copy of the License at
10 * http://www.mozilla.org/MPL/
11 *
12 * Software distributed under the License is distributed on an "AS IS" basis,
13 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
14 * for the specific language governing rights and limitations under the
15 * License.
16 *
17 * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
18 *
19 * The Initial Developer of the Original Code is
20 * Anthony Minessale II <anthm@freeswitch.org>
21 * Portions created by the Initial Developer are Copyright (C)
22 * the Initial Developer. All Rights Reserved.
23 *
24 * Contributor(s):
25 *
26 * Joao Mesquita <jmesquita@freeswitch.org>
27 *
28 */
29#ifndef CALL_H
30#define CALL_H
31
32#include <QtCore>
33#include <QString>
9952b6ef 34#include <switch.h>
1b919f2c 35#include "channel.h"
721c391a
BW
36
37typedef enum {
58298f99
JM
38 FSCOMM_CALL_STATE_RINGING = 0,
39 FSCOMM_CALL_STATE_TRYING = 1,
6abe882e 40 FSCOMM_CALL_STATE_ANSWERED = 2,
fab8e0d5
JM
41 FSCOMM_CALL_STATE_FAILED = 3,
42 FSCOMM_CALL_STATE_TRANSFER = 4
58298f99 43} fscomm_call_state_t;
721c391a
BW
44
45typedef enum {
58298f99
JM
46 FSCOMM_CALL_DIRECTION_INBOUND = 0,
47 FSCOMM_CALL_DIRECTION_OUTBOUND = 1
48} fscomm_call_direction_t;
721c391a 49
0ecda2f0 50class Call {
721c391a 51public:
0ecda2f0 52 Call();
1b919f2c 53 /* Needs rework */
d3bb72db
JM
54 QString getCidName(void) { return (_direction == FSCOMM_CALL_DIRECTION_INBOUND) ? _otherLegChannel.data()->getCidName() : _channel.data()->getCidName(); }
55 QString getCidNumber(void) { return (_direction == FSCOMM_CALL_DIRECTION_INBOUND) ? _otherLegChannel.data()->getCidNumber() : _channel.data()->getCidNumber(); }
1b919f2c
JM
56 QString getDestinationNumber(void) { return _otherLegChannel.data()->getDestinationNumber(); }
57
58 void setChannel(QSharedPointer<Channel> channel) { _channel = channel; }
59 QSharedPointer<Channel> getChannel() { return _channel; }
60 void setOtherLegChannel(QSharedPointer<Channel> channel) { _otherLegChannel = channel; }
61 QSharedPointer<Channel> getOtherLegChannel() { return _otherLegChannel; }
62
63 QString getUuid(void) { return _channel.data()->getUuid(); }
64 QString getOtherLegUuid(void) { return _otherLegChannel.data()->getUuid(); }
65 void setCallDirection(fscomm_call_direction_t dir) { _direction = dir; }
66 int getCallID(void) { return _channel.data()->getPaCallId(); }
58298f99
JM
67 fscomm_call_direction_t getDirection() { return _direction; }
68 fscomm_call_state_t getState() { return _state; }
69 void setState(fscomm_call_state_t state) { _state = state; }
d3bb72db
JM
70 void setCause(QString cause) { _cause = cause; qDebug()<<cause; }
71 QString getCause() { return _cause; qDebug() << _cause; }
9952b6ef
JM
72 void setActive(bool isActive) { _isActive = isActive; }
73 bool isActive() { return _isActive == true; }
74 switch_status_t toggleRecord(bool);
d3bb72db 75 switch_status_t toggleHold(bool);
be510fac 76 void sendDTMF(QString digit);
3ed45189 77 void setAnsweredEpoch(qulonglong time) { _answeredEpoch = time/1000000; }
8a3001e6 78 QTime getCurrentStateTime();
721c391a 79
fab8e0d5
JM
80 /*bool transfer();*/
81
721c391a 82private:
1b919f2c
JM
83 QSharedPointer<Channel> _channel; /* This should be our portaudio channel */
84 QSharedPointer<Channel> _otherLegChannel;
85
6abe882e 86 QString _cause;
58298f99 87 fscomm_call_direction_t _direction;
1b919f2c 88
9952b6ef
JM
89 bool _isActive;
90 QString _recording_filename;
58298f99 91 fscomm_call_state_t _state;
3ed45189 92 qulonglong _answeredEpoch;
721c391a
BW
93};
94
95Q_DECLARE_METATYPE(Call)
96
97#endif // CALL_H