How to get the value of Call-Id from AMI events

We are using asterisk 20.x. Please help us to understand the below points,

Can we use the value of Call-Id (which is available in SIP communications ) to uniquely identify a particular call session. If yes, how can we get this Call-Id as well from AMI Events? Any additional details need to be configured in dialplan or other configuration files ?

Please help

Call ID is not enough to uniquely identify a session in SIP, although I can’t think of any situation with Asterisk where that would matter.

I’d expect you would need to actively read it.

1 Like

Uniquely identify… for what purpose? What are you actually trying to achieve with it?

1 Like

The scenario was, we are using asterisk to get real time audio streams of both caller and callee. Then this realtime audio streams will be sent to an external service or system to generate the corresponding transcripts. There may be a set of other call sessions happening in parallel. So we are trying to identify from which call session, a particular audio streams are getting generated. So that external service can put the corresponding real time transcripts in the same bucket (for a particular call session).

If we use the extension number/caller phone number as the key for keeping the transcripts, then there is a chance to get these transcripts added to a wrong bucket ( in the case of the same caller and callee are making the call at the second time or third time).

So, to uniquely identify each call session, which field or property can be used as a “session Id”.

Please help

Asterisk provides a channel uniqueid, which is internally how it uniquely identifies things. You could get the SIP Call-ID as you’ve mentioned. It’s up to you.

Thanks for the details.

To get the call-id as part of AMI events, should we add any configuration in dialplans or any other configuration files ?

Please help.

AMI provides the Getvar action[1] to get a dialplan variable or function. This could be used to the get Call-ID using CHANNEL[2]. Or an event emitted in the dialplan using UserEvent[3] with it. If you have not spent time looking through the AMI actions, dialplan functions, and applications it is highly advantageous to do so - as many things exist and can be put together.

[1] Getvar - Asterisk Documentation
[2] CHANNEL - Asterisk Documentation
[3] UserEvent - Asterisk Documentation

Thanks for the details.

This would be really helpful.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.