MT#7679 xavp:get() function

mr3.4.1
Victor Seva 11 years ago
parent 16cc950d5c
commit 60e271a3cc

@ -141,6 +141,15 @@ NGCPXAvp_MT = {
end
end
function NGCPXAvp:all(key)
if key then
local t = sr.xavp.get(self.name, 0, 0)
if t then
return t[key];
end
end
end
function NGCPXAvp:clean(key)
if key then
local id = string.format("$xavp(%s[0]=>%s)", self.name, key)

@ -83,6 +83,14 @@ TestNGCPXAvp = {} --class
assertItemsEquals(xavp("testid"), "1")
end
function TestNGCPXAvp:test_xavp_get_all()
xavp = NGCPXAvp:new("caller", "peer", vals)
sr.pv.sets("$xavp(caller_peer=>testid)", "value")
assertEquals(xavp("testid"), "value")
sr.pv.sets("$xavp(caller_peer=>testid)", "1")
assertItemsEquals(xavp:all("testid"), {"1", "value"})
end
function TestNGCPXAvp:test_xavp_set()
local xavp = NGCPXAvp:new("caller", "peer", vals)
local vals = {1,"2",3,nil}

Loading…
Cancel
Save