- Timestamp:
- Dec 4, 2013 2:46:42 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/branches/projects/pjsua2/pjsip-apps/src/pygui/call.py
r4663 r4671 38 38 High level Python Call object, derived from pjsua2's Call object. 39 39 """ 40 def __init__(self, app, acc, callId): 41 pj.Call.__init__(self, acc, callId) 42 self.app = app 40 def __init__(self, acc, peer_uri='', chat=None, call_id = pj.PJSUA_INVALID_ID): 41 pj.Call.__init__(self, acc, call_id) 43 42 self.acc = acc 44 self.uri = '' 45 self.randId = random.randint(1, 9999) 43 self.peerUri = peer_uri 44 self.chat = chat 45 self.connected = False 46 46 47 def statusText(self):48 uri = ''49 status = '?'50 if self.isActive():51 ci = self.getInfo()52 status = ci.stateText53 uri = ci.remoteURI54 else:55 status = '- not established -'56 return uri, status57 58 47 def onCallState(self, prm): 59 ci = self.getInfo() 60 if ci.state == pj.PJSIP_INV_STATE_DISCONNECTED: 61 iid = str(self.randId) 62 self.acc.callList.remove(self) 63 self.app.tv.delete( (iid,) ) 64 del self 65 else: 66 self.app.updateCall(self.acc) 67 48 ci = self.getInfo() 49 self.connected = ci.state == pj.PJSIP_INV_STATE_CONFIRMED 50 if self.chat: 51 self.chat.updateCallState(self, ci) 52 53 def onInstantMessage(self, prm): 54 # chat instance should have been initalized 55 if not self.chat: return 56 57 self.chat.addMessage(self.peerUri, prm.msgBody) 58 self.chat.showWindow() 59 60 def onInstantMessageStatus(self, prm): 61 if prm.code/100 == 2: return 62 # chat instance should have been initalized 63 if not self.chat: return 64 65 self.chat.addMessage(None, "Failed sending message to '%s' (%d): %s" % (self.peerUri, prm.code, prm.reason)) 66 67 def onTypingIndication(self, prm): 68 # chat instance should have been initalized 69 if not self.chat: return 70 71 self.chat.setTypingIndication(self.peerUri, prm.isTyping) 72 68 73 if __name__ == '__main__': 69 74 application.main()
Note: See TracChangeset
for help on using the changeset viewer.