The concept of "early media" can sometimes confuse those new to telephony. RFC 3960 defines it this way:
Early media refers to media (e.g., audio and video) that is exchanged before a particular session is accepted by the called user. Within a dialog, early media occurs from the moment the initial INVITE is sent until the User Agent Server (UAS) generates a final response. It may be unidirectional or bidirectional, and can be generated by the caller, the callee, or both.
The expression "early media" seems to be quite SIP-oriented but the concept of early media is not. Everyone who has ever used a telephone and heard a ring signal or a busy signal is familiar with the concept of early media. Circuit-switched telephony used the term 'supervision' to indicate start of billing and beginning of the telephony session (connection). In simple terms:
Early media is the exchange of information before establishment of a connection
The best way to illustrate that is by looking at a traditional telephone call where party A calls party B:
Another good example is what happens on a busy signal. Using the same parties from the previous example:
The busy signal is an audible signal - a form of audio media if you will - that lets the calling party know that the call has not gone through. It is an unconnected call, but it still had sound. In a case of per-call billing, this call would not be billed (usually) because it was never connected. The same holds true for calls that are ring/no answer. It even holds true for calls to disconnected numbers where you hear the Special Information Tones (SIT) and a recorded message.
On an inbound call you can execute pre_answer to trigger early media. After this you can do ringback, play a file or whatever.
FreeSWITCH has many options for handling early media. The one to use will depend greatly on your needs. By default FreeSWITCH "listens" for early media and acts accordingly. You may also ignore early media altogether. Finally, there is new hybrid functionality that can offer some of the benefits of both listening to and ignoring early media.
In the default mode, a call attempt is "successful" if it returns early media. Conversely, if the call does not return early media at all or returns some specific error then the call attempt is not successful. Consider some examples:
As you can see, there is a difference between successfully attempting a call and successfully connecting a call.
In some cases you don't care whether the call attempt was successful - you simply need to know if the call was connected or not. In those cases, it is possible to ignore early media when dialing.
If you want block early media from remote end then
Without ignore_early_media, the originate will be considered success when it gets early media.
You can ignore ring ready (180) but still "react" when receiving a 183 with media:
ignore_early_media=ring_ready works the same way as ignore_early_media=true, but it also sends 180 to the inbound leg when the first 183 is caught.
As of FreeSWITCH 1.0.3, a new method is available: monitoring early media. As its name implies, it does not ignore early media outright, nor does it assume any early media is a successful call attempt. See:
Stub - more to come