180 vs 183 in API

I use asterisk as an auto-caller via the API.
When I call a disconnected number, I get 183 Session Progress, and the API receives a Ringing notification. This does not allow me to distinguish between a disconnected and non-disconnected number. I want to receive a Ringing in the API only when I receive a 180 Ringing response, how do I do this?

I use chan_sip. Asterisk 18.7.1

You haven’t actually stated what API you are using.

API
Version 7.0.0 , implementation ARI4Java · GitHub

GitHub

ARI4Java

Okay, that’s ARI. There is no event currently for 183 Session Progress. I don’t think it should show up as ringing, but I could be mistaken. Without code changes it’s unlikely you could make it behave differently.

You are trying to read more into the SIP intermediate responses than the SIP specification allows. If it isn’t distinguished in the final responses, SIP basically doesn’t provide any guaranteed way of doing this.

Also, I’m a little concerned that this is about cold calling random numbers.

Thanks for the reply. These numbers are not random, and we do not bother any of the users with our auto-call. According to the SIP protocol, I thought that asterisk should distinguish 180 RINGING from 183 Session Progress, since these answers are in the protocol.

Asterisk does distinguish them; it’s just ARI that maybe does not. Although they are in the protocol, they do not indicate the difference between number valid and number invalid.

My friend, after looking at the trace, I saw that the SIP protocol gives the status of the disconnected number. And I realized that I need to understand how asterisk generates the statutes of a completed call. Is there any documentation on this issue?

The HANGUPCAUSE function can be used to access the final SIP status code.

To a first approximation, Asterisk translates SIP statuses to ISDN cause codes, according to RFC 3398, and then does the reverse mapping when hanging up a SIP call. There are exceptions. The process is lossy.

Good afternoon. The question is closed. Many thanks to everyone who participated in this topic. Your answers helped to discard non-working options. I couldn’t solve this problem with asterisk. Asterisk doesn’t seem to be able to distinguish between such calls. Therefore, we used a forced hang-up signal for disconnected numbers.