Add support for ICE/STUN/TURN in res_rtp_asterisk and chan_sip.
[asterisk/asterisk.git] / res / pjproject / pjsip-apps / src / pocketpj / PocketPJDlg.h
1 // PocketPJDlg.h : header file
2 //
3
4 #if !defined(AFX_POCKETPJDLG_H__DF5F90C9_E72B_4557_9126_AFE75A3ADE9D__INCLUDED_)
5 #define AFX_POCKETPJDLG_H__DF5F90C9_E72B_4557_9126_AFE75A3ADE9D__INCLUDED_
6
7 #if _MSC_VER >= 1000
8 #pragma once
9 #endif // _MSC_VER >= 1000
10
11 #include "SettingsDlg.h"
12 #include "PopUpWnd.h"
13 #include <pjsua-lib/pjsua.h>
14
15
16 /////////////////////////////////////////////////////////////////////////////
17 // CPocketPJDlg dialog
18
19 class CPocketPJDlg : public CDialog
20 {
21 // Construction
22 public:
23         CPocketPJDlg(CWnd* pParent = NULL);     // standard constructor
24
25         void OnPopUpButton(int btnNo);
26         void OnIncomingCall();
27
28 // Dialog Data
29         //{{AFX_DATA(CPocketPJDlg)
30         enum { IDD = IDD_POCKETPJ_DIALOG };
31         CEdit   m_Url;
32         CListCtrl       m_BuddyList;
33         CStatic m_BtnUrlAction;
34         CStatic m_BtnAcc;
35         CStatic m_AccId;
36         //}}AFX_DATA
37
38         // ClassWizard generated virtual function overrides
39         //{{AFX_VIRTUAL(CPocketPJDlg)
40         protected:
41         virtual void DoDataExchange(CDataExchange* pDX);        // DDX/DDV support
42         //}}AFX_VIRTUAL
43
44
45 // Implementation
46 protected:
47         HICON m_hIcon;
48
49         // Generated message map functions
50         //{{AFX_MSG(CPocketPJDlg)
51         virtual BOOL OnInitDialog();
52         afx_msg void OnBtnAcc();
53         afx_msg void OnBtnAction();
54         afx_msg void OnSettings();
55         afx_msg void OnUriCall();
56         afx_msg void OnTimer(UINT nIDEvent);
57         afx_msg void OnUriAddBuddy();
58         afx_msg void OnUriDelBuddy();
59         afx_msg void OnAccOnline();
60         afx_msg void OnAccInvisible();
61         afx_msg void OnClickBuddyList(NMHDR* pNMHDR, LRESULT* pResult);
62         //}}AFX_MSG
63         DECLARE_MESSAGE_MAP()
64
65 private:
66         enum PopUpType
67         {
68             POPUP_REGISTRATION,
69             POPUP_CALL,
70
71             POPUP_MAX_TYPE
72         };
73         enum PopUpElement
74         {
75             POPUP_EL_TITLE1,
76             POPUP_EL_TITLE2,
77             POPUP_EL_TITLE3,
78             POPUP_EL_BUTTON1,
79             POPUP_EL_BUTTON2,
80         };
81         CPopUpWnd       *m_PopUp;
82         int             m_PopUpCount;
83         BOOL            m_PopUpState[POPUP_MAX_TYPE];
84         CPopUpContent   m_PopUpContent[POPUP_MAX_TYPE];
85
86         void PopUp_Show(PopUpType type, 
87                         const CString& title1,
88                         const CString& title2,
89                         const CString& title3,
90                         const CString& btn1,
91                         const CString& btn2,
92                         unsigned userData);
93         void PopUp_Modify(PopUpType type,
94                           PopUpElement el,
95                           const CString& text);
96         void PopUp_Hide(PopUpType type);
97
98 private:
99         CPocketPJSettings m_Cfg;
100
101         void Error(const CString &title, pj_status_t rc);
102         BOOL Restart();
103         void OnOK();
104         int  FindBuddyInCfg(const CString &uri);
105         int  FindBuddyInPjsua(const CString &uri);
106         void RedrawBuddyList();
107
108 private:
109         pjsua_acc_id    m_PjsuaAccId;
110
111         void OnRegState();
112         void OnCallState();
113
114         // pjsua callbacks
115         static void on_call_state(pjsua_call_id call_id, pjsip_event *e);
116         static void on_call_media_state(pjsua_call_id call_id);
117         static void on_incoming_call(pjsua_acc_id acc_id, pjsua_call_id call_id,
118                              pjsip_rx_data *rdata);
119         static void on_reg_state(pjsua_acc_id acc_id);
120         static void on_buddy_state(pjsua_buddy_id buddy_id);
121         static void on_pager(pjsua_call_id call_id, const pj_str_t *from, 
122                      const pj_str_t *to, const pj_str_t *contact,
123                      const pj_str_t *mime_type, const pj_str_t *text);
124 };
125
126 //{{AFX_INSERT_LOCATION}}
127 // Microsoft eMbedded Visual C++ will insert additional declarations immediately before the previous line.
128
129 #endif // !defined(AFX_POCKETPJDLG_H__DF5F90C9_E72B_4557_9126_AFE75A3ADE9D__INCLUDED_)