summaryrefslogtreecommitdiff
path: root/Plugins/jingle/libjingle_callclient.h
blob: c85dee0352262f70a5a7f198e77b298a4e175d4b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/*
 * Jingle call example
 * Copyright 2004--2005, Google Inc.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#ifndef __CALLCLIENT_H__
#define __CALLCLIENT_H__


namespace talk_base {
	class Thread;
	class NetworkManager;
}

namespace cricket {
	class PortAllocator;
	class PhoneSessionClient;
	class Receiver;
	class Call;
	class SessionManagerTask;
}

#define MSG_MAKE_CALL_TO 11
#define MSG_ANSWER_CALL 12
#define MSG_DROP_CALL 13
#define MSG_INCOMING_MSG 14
#define MSG_TIMER 15
#define MSG_REPLY_MSG 16
#define TERMINATE_ALL 17


class ReplyMessageData : public talk_base::MessageData {
public:
	buzz::XmlElement *oldStanza;
	buzz::XmlElement *newStanza;
};



class CallClient : public sigslot::has_slots<>, public talk_base::MessageHandler {
public:
	CallClient(DATA *aData);
	virtual ~CallClient();

	void OnConnect();
	void OnDisconnect();

	void MakeCallTo(HANDLE hContact);
	void AnswerCall(int id);
	void DropCall(int id);
	void OnSignalingReady();

	virtual void OnMessage(talk_base::Message *pmsg);

private:
	DATA *data;

	bool signaling;
	bool needSignal;

	void StartSignaling();
	void StopSignaling();

	cricket::PhoneSessionClient *phone_client_;

	void NofifyState(cricket::Call* call, cricket::Session* session, int state);

	void OnCallCreate(cricket::Call* call);
	void OnCallDestroy(cricket::Call* call);
	void OnSessionState(cricket::Call* call, cricket::Session* session, cricket::Session::State state);
};


#endif // __CALLCLIENT_H__