Compare calls from one Asterisk to second Asterisk

Hi, I want to compare the active calls in 1 Asterisk (orginator) with a second asterisk (terminator), what is the best/easy way to do this?


What do you wish to compare?
Total number of calls, Total number of calls for a particular extension… …?

Yes, I had problems putting a concrete implementation on the virtual method compare!

However, one other possibility is that the OP wants to associate CDRs, or something similar, between the two machines, and “compare” was a poor translation.

I want to compare live calls, like if a channel from Asterisk 1 is active in Asterisk 2, if the call in Asterisk 2 is not a active channel(running call) in Asterisk 1, i need to drop it, so its almost like a LRM (dipping)
tks for the help!

I still don’t understand.

I would suggest something like this assuming you have a SIP trunk between Asterisk 1 (Originator) and Asterisk 2(Terminator).

(1) Create one channel variable with some uniqueID for a call on Asterisk 1 and pass this uniqueID in SIP header when forwarding call to Asterisk 2
(2) Store value of SIP header with uniqueID in a channel variable on Asterisk 2.

(3) Write a script (in your preferred language) to compare active channels on Asterisk 1 and Asterisk 2 using AMI and check the uniqueID present on one Asterisk server is available on other or not. If not then hangup the channel (using AMI).