How to carry value from one context to other context

Hi Guys thanks for the support I always get from you all.

I am working on inbound flow where I fetch some value from db and want to use that value in other context, I tried to do with global variable

Like I defined

[bookingcount]
same => n(other),Set(GLOBAL(globprd)=${product})

then I used this variable in other context

[bookingroute]
exten => 1,n,MYSQL(Query r ${connid} SELECT id fro WHERE UniqueueId=’${UNIQUEID}’ and prdname=’${globprd}’ )

I am not sure but having bit doubt probably this variable pickup value of other records while I check with multiple calls.

Global variables can get updated by any channels.
You should be using local variable in your case and not the global variable.

Thanks but what about the value in next context…As I will assign value in one context and will carry this value in other context to use there only??

Channel specific dialplan variables exist for as long as the channel exists, unless you explicitly change them or set them to empty.

1 Like

ok cool so local variable is channel variable or these are seperate??

They are the same thing, everyone just refers to them as channel variables in documentation and such.

Thanks a lot… will check and bother you guys in case any issue