diff options
author | pescuma <pescuma@c086bb3d-8645-0410-b8da-73a8550f86e7> | 2010-01-17 22:16:02 +0000 |
---|---|---|
committer | pescuma <pescuma@c086bb3d-8645-0410-b8da-73a8550f86e7> | 2010-01-17 22:16:02 +0000 |
commit | 9bcf44d21b3a7588a267e98573396dbf2deceb12 (patch) | |
tree | b6b1f7c20d985faa61048b594224bcc6e0e5c722 /Protocols/SIP/SIPClient.h | |
parent | 838f03d71305a62e2372f6999d4aaf096c6a2145 (diff) |
sip: start of client plugins code
git-svn-id: http://pescuma.googlecode.com/svn/trunk/Miranda@209 c086bb3d-8645-0410-b8da-73a8550f86e7
Diffstat (limited to 'Protocols/SIP/SIPClient.h')
-rw-r--r-- | Protocols/SIP/SIPClient.h | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/Protocols/SIP/SIPClient.h b/Protocols/SIP/SIPClient.h new file mode 100644 index 0000000..275d032 --- /dev/null +++ b/Protocols/SIP/SIPClient.h @@ -0,0 +1,87 @@ +/*
+Copyright (C) 2009 Ricardo Pescuma Domenecci
+
+This is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this file; see the file license.txt. If
+not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.
+*/
+
+#ifndef __SIPCLIENT_H__
+#define __SIPCLIENT_H__
+
+
+class SIPClient
+{
+private:
+ HANDLE hNetlibUser;
+ bool hasToDestroy;
+
+public:
+ struct ta {
+ pjsua_transport_id transport_id;
+ pjsua_acc_id acc_id;
+ int port;
+ };
+
+ ta udp;
+ ta tcp;
+ ta tls;
+
+ SIPClientCallback callback;
+ void *callback_param;
+
+ char name[512];
+ TCHAR username[16];
+ TCHAR host[256];
+
+ CRITICAL_SECTION cs;
+ std::vector<SIPEvent> events;
+
+ SIPClient(SIP_REGISTRATION *reg);
+ virtual ~SIPClient();
+
+ void on_incoming_call(pjsua_call_id call_id);
+ void on_call_state(pjsua_call_id call_id, const pjsua_call_info &info);
+ bool on_call_media_state_sync(pjsua_call_id call_id, const pjsua_call_info &info);
+ void on_call_media_state(pjsua_call_id call_id);
+
+ pjsua_call_id Call(const TCHAR *username, const TCHAR *host, int port, int protocol);
+ int DropCall(pjsua_call_id call_id);
+ int HoldCall(pjsua_call_id call_id);
+ int AnswerCall(pjsua_call_id call_id);
+ int SendDTMF(pjsua_call_id call_id, TCHAR dtmf);
+
+ int Connect(int udp_port, int tcp_port, int tls_port);
+ void Disconnect();
+
+private:
+ void Trace(TCHAR *fmt, ...);
+ void Info(TCHAR *fmt, ...);
+ void Error(TCHAR *fmt, ...);
+ void Error(pj_status_t status, TCHAR *fmt, ...);
+ void ShowMessage(int type, TCHAR *fmt, va_list args);
+
+ void RegisterTransport(pjsip_transport_type_e type, int port, ta *ta);
+
+ void ConfigureDevices();
+ void BuildURI(TCHAR *out, int outSize, const TCHAR *user, const TCHAR *host, int port, int protocol);
+ void CleanupURI(TCHAR *out, int outSize, const TCHAR *url);
+
+ void NotifyCall(pjsua_call_id call_id, int state, const TCHAR *name = NULL, const TCHAR *uri = NULL);
+};
+
+
+
+
+#endif // __SIPCLIENT_H__
|