コード例 #1
0
                    print '-' * 70
                    print_exc(file=sys.stdout)
                    print '-' * 70
                    print data
                    print '-' * 70
                    sys.stdout.flush()
                    self.l1rcache[checksum] = (None, None, None)
                    return
                if not cbody.asterisk:
                    curl = cbody.getUrl()
                    if check1918(
                            curl.host
                    ) or curl.port == 0 or curl.host == '255.255.255.255':
                        curl.host, curl.port = address
                        req.nated = True
            req.setSource(address)
            self.incomingRequest(req, checksum, tids, server)

    # 1. Client transaction methods
    def newTransaction(self, msg, resp_cb = None, laddress = None, userv = None, \
      cb_ifver = 1, compact = False):
        t = SipTransaction()
        t.rtime = time()
        t.compact = compact
        t.method = msg.getMethod()
        t.cb_ifver = cb_ifver
        t.tid = msg.getTId(True, True)
        if self.tclient.has_key(t.tid):
            raise ValueError(
                'BUG: Attempt to initiate transaction with the same TID as existing one!!!'
            )
コード例 #2
0
            req.rtime = rtime
            via0 = req.getHFBody('via')
            ahost, aport = via0.getAddr()
            rhost, rport = address
            if self.nat_traversal and rport != aport and check1918(ahost):
                req.nated = True
            if ahost != rhost:
                via0.params['received'] = rhost
            if via0.params.has_key('rport') or req.nated:
                via0.params['rport'] = str(rport)
            if self.nat_traversal and req.countHFs('contact') > 0 and req.countHFs('via') == 1:
                curl = req.getHFBody('contact').getUrl()
                if check1918(curl.host):
                    curl.host, curl.port = address
                    req.nated = True
            req.setSource(address)
            self.incomingRequest(req, checksum, tids)

    # 1. Client transaction methods
    def newTransaction(self, msg, resp_cb = None):
        t = SipTransaction()
        t.tid = msg.getTId(True, True)
        if self.tclient.has_key(t.tid):
            raise ValueError('BUG: Attempt to initiate transaction with the same TID as existing one!!!')
        t.tout = 0.5
        t.fcode = None
        t.data = str(msg)
        t.address = msg.getTarget()
        try:
            t.expires = msg.getHFBody('expires').getNum()
            if t.expires <= 0: