Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(1)  |  Call(1)  |  Derive(0)  |  Import(0)

        def usrlocAddContact(aor, co):
	if aor.lower().startswith("sip:"):
		aor = aor[4:]
	elif aor.lower().startwith("sips:"):
		aor = aor[5:]
	now = time.time()
	cco = copy.deepcopy(co)
	co = cco
	while cco is not None:
		if cco.expires is None:
			cco.expires = int(now + int(Config.DEFAULT_EXPIRES))
			cco.expires = int(now + int(cco.expires))
		cco = cco.next
	if not hasattr(Config, "usrloc"):
		Log.logDebug("Helper.usrlocAddContact(): initiating usrloc dict", 5)
		Config.usrloc = {}
	Log.logDebug("Helper.usrlocAddContact(): adding Contact(s) for AOR '" + str(aor) + "'", 4)
	if Config.usrloc.has_key(aor):
		uco = Config.usrloc[aor]
		ucop = None
		hit = False
		while uco is not None:
			if co.uri == uco.uri:
				Log.logDebug("Helper.usrlocAddContact(): replacing existing Contact in AOR list", 4)
				if ucop is not None:
					ucop.next = co
				co.next = uco.next
				hit = True
			ucop = uco
			uco = uco.next
		if not hit:
			Log.logDebug("Helper.usrlocAddContact(): appending Contact to the AOR list", 4)
			if ucop is not None:
				ucop.next = co
				raise Exception("Helper.usrlocAddContact(): usrloc previous not set")
		Log.logDebug("Helper.usrlocAddContact(): adding Contact(s) for new AOR", 4)
		Config.usrloc[aor] = co

src/s/f/sftf-HEAD/Transaction.py   sftf(Download)
							cco.expires = int(Config.DEFAULT_EXPIRES)
					cco = cco.next
				Helper.usrlocAddContact(touri.create(), co)
				reply.setHeaderValue("Contact", co.create())