def __init__(self, global_config, body, done_cb, portrange): uaO = UA(global_config, event_cb = self.recvEvent, nh_address = ('127.0.0.1', 5060), \ conn_cbs = (self.connected,), disc_cbs = (self.disconnected,), fail_cbs = (self.disconnected,), \ dead_cbs = (self.alldone,)) uaO.godead_timeout = 10 uaO.compact_sip = self.compact_sip event = CCEventTry((SipCallId(), SipCiscoGUID(), self.cli, self.cld, body, \ None, 'Alice Smith')) uaO.recvEvent(event) self.done_cb = done_cb self.portrange = portrange
def __init__(self, tccfg): self.tccfg = tccfg if tccfg.cli != None: self.cli = tccfg.cli uaO = UA(tccfg.global_config, event_cb = self.recvEvent, nh_address = tccfg.nh_address, \ conn_cbs = (self.connected,), disc_cbs = (self.disconnected,), fail_cbs = (self.disconnected,), \ dead_cbs = (self.alldone,), ltag = gen_test_tag()) uaO.godead_timeout = self.godead_timeout uaO.compact_sip = self.compact_sip self.call_id = SipCallId(body=gen_test_cid()) event = CCEventTry((self.call_id, SipCiscoGUID(), self.cli, self.cld, tccfg.body, \ None, 'Alice Smith')) self.run(uaO, event)
def answer(self, global_config, body, req, sip_t): in_body = req.getBody() in_body.parse() if not checkhostport(in_body, self.portrange, self.atype): self.nerrs += 1 raise ValueError('Bob(%s): hostport validation has failed' % str(self.__class__)) # New dialog uaA = UA(global_config, self.recvEvent, disc_cbs = (self.disconnected,), \ fail_cbs = (self.disconnected,), dead_cbs = (self.alldone,)) uaA.godead_timeout = 10 uaA.compact_sip = self.compact_sip Timeout(self.ring, self.ring_ival, 1, uaA) self.body = body return uaA.recvRequest(req, sip_t)
def answer(self, global_config, body, req, sip_t): if self.connect_done or self.disconnect_done: return in_body = req.getBody() in_body.parse() cres, why = self.tccfg.checkhostport(in_body) if not cres: self.nerrs += 1 raise ValueError('%s: class %s: hostport validation has failed (%s): %s:\n%s' % \ (self.my_name(), str(self.__class__), self.atype, why, in_body)) # New dialog uaA = UA(global_config, self.recvEvent, disc_cbs = (self.disconnected,), \ fail_cbs = (self.disconnected,), dead_cbs = (self.alldone,)) uaA.godead_timeout = self.godead_timeout uaA.compact_sip = self.compact_sip Timeout(self.ring, self.ring_ival, 1, uaA) self.body = body self.call_id = req.getHFBody('call-id') return self.complete_answer(uaA, req, sip_t)
def __init__(self, global_config, body, done_cb, portrange, atype = 'IP4', \ cli = None): self.atype = atype if cli != None: self.cli = cli if atype == 'IP4': nh_address = self.nh_address4 else: nh_address = self.nh_address6 uaO = UA(global_config, event_cb = self.recvEvent, nh_address = nh_address, \ conn_cbs = (self.connected,), disc_cbs = (self.disconnected,), fail_cbs = (self.disconnected,), \ dead_cbs = (self.alldone,)) uaO.godead_timeout = 10 uaO.compact_sip = self.compact_sip event = CCEventTry((SipCallId(), SipCiscoGUID(), self.cli, self.cld, body, \ None, 'Alice Smith')) self.done_cb = done_cb self.portrange = portrange self.run(uaO, event)