Lost CDR Uniqueid

hi, have the next issue i have a macro app this app is execute when the user hit *1 for get information about the call.

when the user execute the *1 i get a UNIQUEID but when the user hangup the call in the cdr i get a diferent UNIQUEID how i can have the same uniqueid ?

For example if user from asterisk call a user in the avaya and the user from asterisk hit *1 i get the same uniqueid in the macro app and the cdr but when user from avaya call a user in the asterisk and the avaya user hit *1 the uniqueid in the macro is not the same of the cdr.

Macro
[macro-test]
exten => s,n,Set(channel=${CDR(channel)})
exten => s,n,Set(dstchannel=${CDR(dstchannel)})
exten => s,n,Set(account=${CDR(accountcode)})
exten => s,n,Set(sname=${SYSTEMNAME})
exten => s,n,Set(getuid=${UNIQUEID})

You won’t get the same uniqueid in that case.

Asterisk is a B2BUA - a back-to-back user agent. Each two-party call consists of two channels, each with their own uniqueid. When you set getuid, you are going to get the UNIQUEID of whatever channel invoked the Macro - which may or may not be the caller.

You should be able to use the function MASTER_CHANNEL to get access to the channel (caller) that created the outbound channel (callee). Note that when invoked on the inbound channel (caller), that function will set getuid to nothing, so you’ll need to check if getuid has a value and, if not, use your existing Set of UNIQUEID.

ok, thanks where i can find the documentation about the master_channel

Type “core show function MASTER_CHANNEL” a the CLI prompt.

core show function MASTER_CHANNEL is not showing example

-= Info about function ‘MASTER_CHANNEL’ =-

[Synopsis]
Gets or sets variables on the master channel

[Description]
Allows access to the channel which created the current channel, if any. If the
channel is already a master channel, then accesses local channel variables.

[Syntax]
Not available

[Arguments]
Not available

[See Also]
Not available

I would expect it to work the same as GLOBAL(): http://the-asterisk-book.com/1.6/funktionen-global.html

Thnaks for time and help, i use the Cel information for get the uniqueid i create a table trigger for handling the information