def recvRequest(self, req): if req.getMethod() == 'INVITE': self.ua.global_config['_sip_tm'].sendResponse(req.genResponse(491, \ 'Request Pending', server = self.ua.local_ua), lossemul = self.ua.uas_lossemul) return None elif req.getMethod() == 'BYE': self.ua.sendUasResponse(487, 'Request Terminated') self.ua.global_config['_sip_tm'].sendResponse(req.genResponse(200, 'OK', \ server = self.ua.local_ua), lossemul = self.ua.uas_lossemul) #print 'BYE received in the Updating state, going to the Disconnected state' event = CCEventDisconnect(rtime = req.rtime, origin = self.ua.origin) try: event.reason = req.getHFBody('reason') except: pass self.ua.equeue.append(event) self.ua.cancelCreditTimer() self.ua.disconnect_ts = req.rtime return (UaStateDisconnected, self.ua.disc_cbs, req.rtime, self.ua.origin) elif req.getMethod() == 'REFER': if req.countHFs('refer-to') == 0: self.ua.global_config['_sip_tm'].sendResponse(req.genResponse(400, 'Bad Request', server = self.ua.local_ua), lossemul = self.ua.uas_lossemul) return None self.ua.sendUasResponse(487, 'Request Terminated') self.ua.global_config['_sip_tm'].sendResponse(req.genResponse(202, 'Accepted', \ server = self.ua.local_ua), lossemul = self.ua.uas_lossemul) also = req.getHFBody('refer-to').getCopy() self.ua.equeue.append(CCEventDisconnect(also, rtime = req.rtime, origin = self.ua.origin)) self.ua.cancelCreditTimer() self.ua.disconnect_ts = req.rtime return (UaStateDisconnected, self.ua.disc_cbs, req.rtime, self.ua.origin) #print 'wrong request %s in the state Updating' % req.getMethod() return None
def recvRequest(self, req): if req.getMethod() == 'BYE': self.ua.sendUasResponse(487, 'Request Terminated') self.ua.global_config['_sip_tm'].sendResponse( req.genResponse(200, 'OK', server=self.ua.local_ua), lossemul=self.ua.uas_lossemul) #print 'BYE received in the Ringing state, going to the Disconnected state' if req.countHFs('also') > 0: also = req.getHFBody('also').getCopy() else: also = None event = CCEventDisconnect(also, rtime=req.rtime, origin=self.ua.origin) try: event.reason = req.getHFBody('reason') except: pass self.ua.equeue.append(event) if self.ua.expire_timer != None: self.ua.expire_timer.cancel() self.ua.expire_timer = None self.ua.disconnect_ts = req.rtime return (UaStateDisconnected, self.ua.disc_cbs, req.rtime, self.ua.origin) return None
def cancel(self, rtime, req): self.ua.disconnect_ts = rtime self.ua.changeState((UaStateDisconnected, self.ua.disc_cbs, rtime, self.ua.origin)) event = CCEventDisconnect(rtime = rtime, origin = self.ua.origin) if req != None: try: event.reason = req.getHFBody('reason') except: pass self.ua.emitEvent(event)
def cancel(self, rtime, req): self.ua.disconnect_ts = rtime self.ua.changeState( (UaStateDisconnected, self.ua.disc_cbs, rtime, self.ua.origin)) event = CCEventDisconnect(rtime=rtime, origin=self.ua.origin) if req != None: try: event.reason = req.getHFBody('reason') except: pass self.ua.emitEvent(event)
def cancel(self, rtime, req): req = self.ua.genRequest('BYE') self.ua.lCSeq += 1 self.ua.global_config['_sip_tm'].newTransaction(req, \ laddress = self.ua.source_address, compact = self.ua.compact_sip) self.ua.cancelCreditTimer() self.ua.disconnect_ts = rtime self.ua.changeState((UaStateDisconnected, self.ua.disc_cbs, rtime, self.ua.origin)) event = CCEventDisconnect(rtime = rtime, origin = self.ua.origin) if req != None: try: event.reason = req.getHFBody('reason') except: pass self.ua.emitEvent(event)
def cancel(self, rtime, req): req = self.ua.genRequest('BYE') self.ua.lCSeq += 1 self.ua.global_config['_sip_tm'].newTransaction(req, \ laddress = self.ua.source_address, compact = self.ua.compact_sip) self.ua.cancelCreditTimer() self.ua.disconnect_ts = rtime self.ua.changeState( (UaStateDisconnected, self.ua.disc_cbs, rtime, self.ua.origin)) event = CCEventDisconnect(rtime=rtime, origin=self.ua.origin) if req != None: try: event.reason = req.getHFBody('reason') except: pass self.ua.emitEvent(event)
def recvRequest(self, req): if req.getMethod() == 'INVITE': self.ua.global_config['_sip_tm'].sendResponse(req.genResponse(491, 'Request Pending', server = self.ua.local_ua)) return None elif req.getMethod() == 'BYE': self.ua.global_config['_sip_tm'].cancelTransaction(self.ua.tr) self.ua.global_config['_sip_tm'].sendResponse(req.genResponse(200, 'OK', server = self.ua.local_ua)) #print 'BYE received in the Updating state, going to the Disconnected state' event = CCEventDisconnect(rtime = req.rtime, origin = self.ua.origin) try: event.reason = req.getHFBody('reason') except: pass self.ua.equeue.append(event) self.ua.cancelCreditTimer() self.ua.disconnect_ts = req.rtime return (UaStateDisconnected, self.ua.disc_cbs, req.rtime, self.ua.origin) #print 'wrong request %s in the state Updating' % req.getMethod() return None
def recvRequest(self, req): if req.getMethod() == 'INVITE': self.ua.global_config['_sip_tm'].sendResponse(req.genResponse(491, \ 'Request Pending', server = self.ua.local_ua), lossemul = self.ua.uas_lossemul) return None elif req.getMethod() == 'BYE': self.ua.sendUasResponse(487, 'Request Terminated') self.ua.global_config['_sip_tm'].sendResponse(req.genResponse(200, 'OK', \ server = self.ua.local_ua), lossemul = self.ua.uas_lossemul) #print 'BYE received in the Updating state, going to the Disconnected state' event = CCEventDisconnect(rtime=req.rtime, origin=self.ua.origin) try: event.reason = req.getHFBody('reason') except: pass self.ua.equeue.append(event) self.ua.cancelCreditTimer() self.ua.disconnect_ts = req.rtime return (UaStateDisconnected, self.ua.disc_cbs, req.rtime, self.ua.origin) elif req.getMethod() == 'REFER': if req.countHFs('refer-to') == 0: self.ua.global_config['_sip_tm'].sendResponse( req.genResponse(400, 'Bad Request', server=self.ua.local_ua), lossemul=self.ua.uas_lossemul) return None self.ua.sendUasResponse(487, 'Request Terminated') self.ua.global_config['_sip_tm'].sendResponse(req.genResponse(202, 'Accepted', \ server = self.ua.local_ua), lossemul = self.ua.uas_lossemul) also = req.getHFBody('refer-to').getCopy() self.ua.equeue.append( CCEventDisconnect(also, rtime=req.rtime, origin=self.ua.origin)) self.ua.cancelCreditTimer() self.ua.disconnect_ts = req.rtime return (UaStateDisconnected, self.ua.disc_cbs, req.rtime, self.ua.origin) #print 'wrong request %s in the state Updating' % req.getMethod() return None
def recvRequest(self, req): if req.getMethod() == 'BYE': self.ua.sendUasResponse(487, 'Request Terminated') self.ua.global_config['_sip_tm'].sendResponse(req.genResponse(200, 'OK', server = self.ua.local_ua), lossemul = self.ua.uas_lossemul) #print 'BYE received in the Ringing state, going to the Disconnected state' if req.countHFs('also') > 0: also = req.getHFBody('also').getCopy() else: also = None event = CCEventDisconnect(also, rtime = req.rtime, origin = self.ua.origin) try: event.reason = req.getHFBody('reason') except: pass self.ua.equeue.append(event) if self.ua.expire_timer != None: self.ua.expire_timer.cancel() self.ua.expire_timer = None self.ua.disconnect_ts = req.rtime return (UaStateDisconnected, self.ua.disc_cbs, req.rtime, self.ua.origin) return None
def recvRequest(self, req): if req.getMethod() == 'INVITE': self.ua.global_config['_sip_tm'].sendResponse( req.genResponse(491, 'Request Pending', server=self.ua.local_ua)) return None elif req.getMethod() == 'BYE': self.ua.global_config['_sip_tm'].cancelTransaction(self.ua.tr) self.ua.global_config['_sip_tm'].sendResponse( req.genResponse(200, 'OK', server=self.ua.local_ua)) #print 'BYE received in the Updating state, going to the Disconnected state' event = CCEventDisconnect(rtime=req.rtime, origin=self.ua.origin) try: event.reason = req.getHFBody('reason') except: pass self.ua.equeue.append(event) self.ua.cancelCreditTimer() self.ua.disconnect_ts = req.rtime return (UaStateDisconnected, self.ua.disc_cbs, req.rtime, self.ua.origin) #print 'wrong request %s in the state Updating' % req.getMethod() return None