Subversion Repositories tpanel

Rev

Rev 141 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 141 Rev 144
Line 84... Line 84...
84
        bool sendPrivate(bool state);               //<! Enables or disables the privacy feature on the phone (do not disturb).
84
        bool sendPrivate(bool state);               //<! Enables or disables the privacy feature on the phone (do not disturb).
85
        bool redial();                              //<! Redial last number
85
        bool redial();                              //<! Redial last number
86
        bool transfer(int id, const std::string& num);  //<! transfer the current call
86
        bool transfer(int id, const std::string& num);  //<! transfer the current call
87
        bool setDTMFduration(uint_t ms);            //<! Set the DTMF duration in ms.
87
        bool setDTMFduration(uint_t ms);            //<! Set the DTMF duration in ms.
88
        bool getPrivate() { return mDoNotDisturb; } //<! Returns the current private mode.
88
        bool getPrivate() { return mDoNotDisturb; } //<! Returns the current private mode.
-
 
89
        bool sendIM(const std::string& target, const std::string& msg); //<! Send an IM to somebody or to the peer of the current call
-
 
90
        size_t getNumberMessages() { return mMessages.size(); }
89
 
91
 
90
    protected:
92
    protected:
91
        void runRinger();                           //<! Plays a ring tone if a call is coming.
93
        void runRinger();                           //<! Plays a ring tone if a call is coming.
92
 
94
 
93
        static void _log_call(int level, const char *data, int len);
95
        static void _log_call(int level, const char *data, int len);
Line 106... Line 108...
106
        static void ring_stop(pjsua_call_id call_id);
108
        static void ring_stop(pjsua_call_id call_id);
107
        static pj_bool_t find_next_call(void);
109
        static pj_bool_t find_next_call(void);
108
        static void call_timeout_callback(pj_timer_heap_t *timer_heap, struct pj_timer_entry *entry);
110
        static void call_timeout_callback(pj_timer_heap_t *timer_heap, struct pj_timer_entry *entry);
109
        static void on_playfile_done(pjmedia_port *port, void *usr_data);
111
        static void on_playfile_done(pjmedia_port *port, void *usr_data);
110
        static void hangup_timeout_callback(pj_timer_heap_t *timer_heap, struct pj_timer_entry *entry);
112
        static void hangup_timeout_callback(pj_timer_heap_t *timer_heap, struct pj_timer_entry *entry);
-
 
113
        static void on_pager2(pjsua_call_id call_id, const pj_str_t *from,
-
 
114
                              const pj_str_t *to, const pj_str_t *contact,
-
 
115
                              const pj_str_t *mime_type, const pj_str_t *body,
-
 
116
                              pjsip_rx_data *rdata, pjsua_acc_id acc_id);
-
 
117
        static void on_buddy_state(pjsua_buddy_id buddy_id);
-
 
118
        static void on_buddy_evsub_state(pjsua_buddy_id buddy_id, pjsip_evsub *sub, pjsip_event *event);
-
 
119
        static void on_mwi_info(pjsua_acc_id acc_id, pjsua_mwi_info *mwi_info);
111
 
120
 
112
    private:
121
    private:
-
 
122
        typedef struct _uri_t
-
 
123
        {
-
 
124
            std::string name;           //!< The name coming in double quotes (optional)
-
 
125
            std::string scheme;         //!< The scheme (e.g. sip)
-
 
126
            std::string user;           //!< The user name / telephone number
-
 
127
            std::string server;         //!< The IP address or FQDN of the server
-
 
128
            int port;                   //!< An optional port number
-
 
129
        }_uri_t;
-
 
130
 
113
        static pjsip_module mod_default_handler;
131
        static pjsip_module mod_default_handler;
114
 
132
 
115
        int getNumberCalls();
133
        int getNumberCalls();
116
        pjsua_call_id getActiveCall();
134
        pjsua_call_id getActiveCall();
117
        void setSIPState(SIP_STATE_t s, pjsua_call_id id) { if (id >= 0 && id < PJSUA_MAX_CALLS) mSIPState[id] = s; }
135
        void setSIPState(SIP_STATE_t s, pjsua_call_id id) { if (id >= 0 && id < PJSUA_MAX_CALLS) mSIPState[id] = s; }
118
 
136
 
119
        static void sendConnectionStatus(SIP_STATE_t state, int id);
137
        static void sendConnectionStatus(SIP_STATE_t state, int id);
120
        static void init_ringtone_player();
138
        static void init_ringtone_player();
121
        static pj_status_t start_ring_tone();
139
        static pj_status_t start_ring_tone();
122
        static pj_status_t stop_ring_tone();
140
        static pj_status_t stop_ring_tone();
-
 
141
        static pjsua_buddy_id addBuddy(const std::string& rsipurl);
-
 
142
        static _uri_t parseUri(const std::string& uri);
123
 
143
 
124
        int mLine{0};
144
        int mLine{0};
125
        bool mRegistered{false};
145
        bool mRegistered{false};
126
        SIP_STATE_t mSIPState[PJSUA_MAX_CALLS];
146
        SIP_STATE_t mSIPState[PJSUA_MAX_CALLS];
127
        pjsua_acc_id mAccountID{0};
147
        pjsua_acc_id mAccountID{0};
128
        std::string mLastCall;
148
        std::string mLastCall;
129
        uint_t mDTMFduration{PJSUA_CALL_SEND_DTMF_DURATION_DEFAULT};
149
        uint_t mDTMFduration{PJSUA_CALL_SEND_DTMF_DURATION_DEFAULT};
130
        bool mDoNotDisturb{false};
150
        bool mDoNotDisturb{false};
-
 
151
        std::vector<std::string>mMessages;      // Holds all received messages
131
 
152
 
132
        static TSIPClient *mMyself;
153
        static TSIPClient *mMyself;
133
        static pjsua_call_id mCurrentCall;
154
        static pjsua_call_id mCurrentCall;
134
        static std::atomic<bool> mRefreshRun;
155
        static std::atomic<bool> mRefreshRun;
135
        static bool mPhoneRingInit;
156
        static bool mPhoneRingInit;