Changeset 4757 for pjproject/trunk/pjsip-apps/src/pygui/chat.py
- Timestamp:
- Feb 21, 2014 7:53:31 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip-apps/src/pygui/chat.py
r4704 r4757 141 141 142 142 # send via call, if any, or buddy 143 sender= None143 target = None 144 144 if self._callList[idx] and self._callList[idx].connected: 145 sender= self._callList[idx]145 target = self._callList[idx] 146 146 else: 147 sender= self._buddyList[idx]148 assert( sender)147 target = self._buddyList[idx] 148 assert(target) 149 149 150 150 try: 151 sender.sendTypingIndication(type_ind_param)151 target.sendTypingIndication(type_ind_param) 152 152 except: 153 153 pass … … 163 163 164 164 # send via call, if any, or buddy 165 sender= None165 target = None 166 166 if self._callList[idx] and self._callList[idx].connected: 167 sender= self._callList[idx]167 target = self._callList[idx] 168 168 else: 169 sender= self._buddyList[idx]170 assert( sender)169 target = self._buddyList[idx] 170 assert(target) 171 171 172 172 try: 173 sender.sendInstantMessage(send_im_param)173 target.sendInstantMessage(send_im_param) 174 174 except: 175 175 # error will be handled via Account::onInstantMessageStatus() … … 303 303 elif info.state == pj.PJSIP_INV_STATE_CONFIRMED: 304 304 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 309 325 elif info.state == pj.PJSIP_INV_STATE_DISCONNECTED: 310 326 if info.lastStatusCode/100 != 2: … … 325 341 if not self.isPrivate(): 326 342 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) 327 382 328 383
Note: See TracChangeset
for help on using the changeset viewer.