summaryrefslogtreecommitdiff
path: root/pjsip-apps/src/activex-pjsua/activex-pjsuaCP.h
diff options
context:
space:
mode:
Diffstat (limited to 'pjsip-apps/src/activex-pjsua/activex-pjsuaCP.h')
-rw-r--r--pjsip-apps/src/activex-pjsua/activex-pjsuaCP.h151
1 files changed, 151 insertions, 0 deletions
diff --git a/pjsip-apps/src/activex-pjsua/activex-pjsuaCP.h b/pjsip-apps/src/activex-pjsua/activex-pjsuaCP.h
new file mode 100644
index 00000000..db150156
--- /dev/null
+++ b/pjsip-apps/src/activex-pjsua/activex-pjsuaCP.h
@@ -0,0 +1,151 @@
+#ifndef _ACTIVEXPJSUACP_H_
+#define _ACTIVEXPJSUACP_H_
+
+//#import "C:\project\pjproject\pjsip-apps\src\activex-pjsua\activex-pjsua.tlb" raw_interfaces_only, raw_native_types, no_namespace, named_guids //"Import typelib"
+template <class T>
+class CProxy_IPjsuaEvents : public IConnectionPointImpl<T, &DIID__IPjsuaEvents, CComDynamicUnkArray>
+{
+ //Warning this class may be recreated by the wizard.
+public:
+ VOID Fire_OnCallState(INT call_index, Pjsua_Call_Info * pInfo)
+ {
+ T* pT = static_cast<T*>(this);
+ int nConnectionIndex;
+ CComVariant* pvars = new CComVariant[2];
+ int nConnections = m_vec.GetSize();
+ HRESULT hr;
+
+ IRecordInfo *pRI = NULL;
+ hr = GetRecordInfoFromGuids( LIBID_ACTIVEPJSUALib,
+ 1, 0,
+ 0,
+ IID_Pjsua_Call_Info,
+ &pRI );
+ assert(SUCCEEDED(hr));
+
+ pvars[1] = call_index;
+
+ VARIANT v;
+ memset(&v, 0, sizeof(v));
+ v.vt = VT_RECORD;
+ v.pRecInfo = pRI;
+ v.pvRecord = pInfo;
+
+ pvars[0] = v;
+
+ for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
+ {
+ pT->Lock();
+ CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
+ pT->Unlock();
+ IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
+ if (pDispatch != NULL)
+ {
+
+ DISPPARAMS disp = { pvars, NULL, 2, 0 };
+ hr = pDispatch->Invoke(0x1, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL);
+ }
+ }
+ delete[] pvars;
+
+ }
+ VOID Fire_OnRegState(INT acc_index)
+ {
+ T* pT = static_cast<T*>(this);
+ int nConnectionIndex;
+ CComVariant* pvars = new CComVariant[1];
+ int nConnections = m_vec.GetSize();
+
+ for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
+ {
+ pT->Lock();
+ CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
+ pT->Unlock();
+ IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
+ if (pDispatch != NULL)
+ {
+ pvars[0] = acc_index;
+ DISPPARAMS disp = { pvars, NULL, 1, 0 };
+ pDispatch->Invoke(0x2, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL);
+ }
+ }
+ delete[] pvars;
+
+ }
+ VOID Fire_OnBuddyState(INT buddy_index)
+ {
+ T* pT = static_cast<T*>(this);
+ int nConnectionIndex;
+ CComVariant* pvars = new CComVariant[1];
+ int nConnections = m_vec.GetSize();
+
+ for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
+ {
+ pT->Lock();
+ CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
+ pT->Unlock();
+ IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
+ if (pDispatch != NULL)
+ {
+ pvars[0] = buddy_index;
+ DISPPARAMS disp = { pvars, NULL, 1, 0 };
+ pDispatch->Invoke(0x3, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL);
+ }
+ }
+ delete[] pvars;
+
+ }
+ VOID Fire_OnIncomingPager(INT call_index, BSTR fromUri, BSTR toURI, BSTR pagerText)
+ {
+ T* pT = static_cast<T*>(this);
+ int nConnectionIndex;
+ CComVariant* pvars = new CComVariant[4];
+ int nConnections = m_vec.GetSize();
+
+ for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
+ {
+ pT->Lock();
+ CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
+ pT->Unlock();
+ IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
+ if (pDispatch != NULL)
+ {
+ pvars[3] = call_index;
+ pvars[2] = fromUri;
+ pvars[1] = toURI;
+ pvars[0] = pagerText;
+ DISPPARAMS disp = { pvars, NULL, 4, 0 };
+ pDispatch->Invoke(0x4, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL);
+ }
+ }
+ delete[] pvars;
+
+ }
+ VOID Fire_OnTypingIndication(INT call_index, BSTR fromUri, BSTR toURI, INT isTyping)
+ {
+ T* pT = static_cast<T*>(this);
+ int nConnectionIndex;
+ CComVariant* pvars = new CComVariant[4];
+ int nConnections = m_vec.GetSize();
+
+ for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
+ {
+ pT->Lock();
+ CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
+ pT->Unlock();
+ IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
+ if (pDispatch != NULL)
+ {
+ pvars[3] = call_index;
+ pvars[2] = fromUri;
+ pvars[1] = toURI;
+ pvars[0] = isTyping;
+ DISPPARAMS disp = { pvars, NULL, 4, 0 };
+ pDispatch->Invoke(0x5, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL);
+ }
+ }
+ delete[] pvars;
+
+ }
+};
+#endif \ No newline at end of file