Search code examples
luafreeswitch

Get session variable using session uuid


How am i able to get session variable using just session uuid (using lua).

So for example, we have session of leg_a (when someone connect sip phone). When other side answers, we will be within other session (session of leg_b).

Using just,

session:getVariable("variable_name") 

will not help in that case because session refers to the current session.

How am i able to use lua to get variable name when i know session uuid. (so i can get other sessions variable, even we are within current session which is different)

Is there some kind of function where I am able to provide two parameteres, variable name and session uuid?


Solution

  • you need to execute the API call uuid_getvar.

    value = api:execute("uuid_getvar", "UUID VARNAME"); 
    

    (I forgot how to concatenate strings in Lua, but you should get the idea)