Changeset 4757 for pjproject


Ignore:
Timestamp:
Feb 21, 2014 7:53:31 AM (10 years ago)
Author:
nanang
Message:

Re #1708: Fixed missing conference port connection setups for audio conferencing.

Location:
pjproject/trunk/pjsip-apps/src/pygui
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip-apps/src/pygui/call.py

    r4704 r4757  
    7171                                        self.chat.addMessage(None, "'%s' sets call active" % (self.peerUri)) 
    7272                                        self.onhold = False 
     73                if self.chat: 
     74                        self.chat.updateCallMediaState(self, ci) 
    7375                         
    7476        def onInstantMessage(self, prm): 
  • pjproject/trunk/pjsip-apps/src/pygui/chat.py

    r4704 r4757  
    141141                                 
    142142                        # send via call, if any, or buddy 
    143                         sender = None 
     143                        target = None 
    144144                        if self._callList[idx] and self._callList[idx].connected: 
    145                                 sender = self._callList[idx] 
     145                                target = self._callList[idx] 
    146146                        else: 
    147                                 sender = self._buddyList[idx] 
    148                         assert(sender) 
     147                                target = self._buddyList[idx] 
     148                        assert(target) 
    149149                                 
    150150                        try: 
    151                                 sender.sendTypingIndication(type_ind_param) 
     151                                target.sendTypingIndication(type_ind_param) 
    152152                        except: 
    153153                                pass 
     
    163163                                 
    164164                        # send via call, if any, or buddy 
    165                         sender = None 
     165                        target = None 
    166166                        if self._callList[idx] and self._callList[idx].connected: 
    167                                 sender = self._callList[idx] 
     167                                target = self._callList[idx] 
    168168                        else: 
    169                                 sender = self._buddyList[idx] 
    170                         assert(sender) 
     169                                target = self._buddyList[idx] 
     170                        assert(target) 
    171171                         
    172172                        try: 
    173                                 sender.sendInstantMessage(send_im_param) 
     173                                target.sendInstantMessage(send_im_param) 
    174174                        except: 
    175175                                # error will be handled via Account::onInstantMessageStatus() 
     
    303303                elif info.state == pj.PJSIP_INV_STATE_CONFIRMED: 
    304304                        self._gui.audioUpdateState(thecall.peerUri, gui.AudioState.CONNECTED) 
    305                         med_idx = self._getActiveMediaIdx(thecall) 
    306                         si = thecall.getStreamInfo(med_idx) 
    307                         stats_str = "Audio codec: %s/%s\n..." % (si.codecName, si.codecClockRate) 
    308                         self._gui.audioSetStatsText(thecall.peerUri, stats_str) 
     305                        if not self.isPrivate(): 
     306                                # inform peer about conference participants 
     307                                conf_welcome_str  = '\n---\n' 
     308                                conf_welcome_str += 'Welcome to the conference, participants:\n' 
     309                                conf_welcome_str += '%s (host)\n' % (self._acc.cfg.idUri) 
     310                                for p in self._participantList: 
     311                                        conf_welcome_str += '%s\n' % (str(p)) 
     312                                conf_welcome_str += '---\n' 
     313                                send_im_param = pj.SendInstantMessageParam() 
     314                                send_im_param.content = conf_welcome_str 
     315                                try: 
     316                                        thecall.sendInstantMessage(send_im_param) 
     317                                except: 
     318                                        pass 
     319                                         
     320                                # inform others, including self 
     321                                msg = "[Conf manager] %s has joined" % (thecall.peerUri) 
     322                                self.addMessage(None, msg) 
     323                                self._sendInstantMessage(msg, thecall.peerUri) 
     324                                 
    309325                elif info.state == pj.PJSIP_INV_STATE_DISCONNECTED: 
    310326                        if info.lastStatusCode/100 != 2: 
     
    325341                        if not self.isPrivate(): 
    326342                                self.kickParticipant(ParseSipUri(thecall.peerUri)) 
     343                                 
     344                                # inform others, including self 
     345                                msg = "[Conf manager] %s has left" % (thecall.peerUri) 
     346                                self.addMessage(None, msg) 
     347                                self._sendInstantMessage(msg, thecall.peerUri) 
     348 
     349        def updateCallMediaState(self, thecall, info = None): 
     350                # info is optional here, just to avoid calling getInfo() twice (in the caller and here) 
     351                if not info: info = thecall.getInfo() 
     352                 
     353                med_idx = self._getActiveMediaIdx(thecall) 
     354                if (med_idx < 0): 
     355                        self._gui.audioSetStatsText(thecall.peerUri, 'No active media') 
     356                        return 
     357 
     358                si = thecall.getStreamInfo(med_idx) 
     359                dir_str = '' 
     360                if si.dir == 0: 
     361                        dir_str = 'inactive' 
     362                else: 
     363                        if si.dir & pj.PJMEDIA_DIR_ENCODING: 
     364                                dir_str += 'send ' 
     365                        if si.dir & pj.PJMEDIA_DIR_DECODING: 
     366                                dir_str += 'receive ' 
     367                stats_str  = "Direction   : %s\n" % (dir_str) 
     368                stats_str += "Audio codec : %s (%sHz)" % (si.codecName, si.codecClockRate) 
     369                self._gui.audioSetStatsText(thecall.peerUri, stats_str) 
     370                m = pj.AudioMedia.typecastFromMedia(thecall.getMedia(med_idx)) 
     371                 
     372                # make conference 
     373                for c in self._callList: 
     374                        if c == thecall: 
     375                                continue 
     376                        med_idx = self._getActiveMediaIdx(c) 
     377                        if med_idx < 0: 
     378                                continue 
     379                        mm = pj.AudioMedia.typecastFromMedia(c.getMedia(med_idx)) 
     380                        m.startTransmit(mm) 
     381                        mm.startTransmit(m) 
    327382 
    328383                         
  • pjproject/trunk/pjsip-apps/src/pygui/chatgui.py

    r4704 r4757  
    258258                 
    259259                # stat 
    260                 self.stat = tk.Text(self._callFrame, width=10, height=2, bg='lightgray', relief=tk.FLAT, font=("Arial", "9")) 
     260                self.stat = tk.Text(self._callFrame, width=10, height=2, bg='lightgray', relief=tk.FLAT, font=("Courier", "9")) 
    261261                self.stat.insert(tk.END, 'stat here') 
    262262                self.stat.pack(side=tk.BOTTOM, fill=tk.BOTH, expand=1) 
Note: See TracChangeset for help on using the changeset viewer.