DevSteven Services

Signalling

P-Early-Media on 183 Session Progress in Asterisk

Early media is the audio a caller hears before the call is answered: ringback, announcements, IVR prompts. Mobile cores only play or forward it when the 183 response carries a matching P-Early-Media header. Stock chan_sip never sends one.

The problem

RFC 5009 defines P-Early-Media, used by IMS networks to authorise early media in each direction. Without it on the 183, the network may cut the media, drop the announcement or play nothing at all, and the caller hears silence until the call is answered.

What we change

A new sip.conf option, pearlymedia, adds the header to the 183 Session Progress reply of an incoming call, with the value you set. It accepts any string, but the remote side will only act on these:

sendrecvAsterisk will send RTP in early media and also expects RTP back
sendonlyAsterisk will send RTP in early media but expects none back
recvonlyAsterisk will not send RTP but expects RTP back
noneDo not exchange RTP in early media
noHeader is not sent (default)

The values describe what the remote party should do. Asterisk itself always behaves as sendrecv, so incoming RTP can still be processed in the dialplan.

; sip.conf
[mobile-core]
type=peer
pearlymedia=sendrecv

On the wire

SIP/2.0 183 Session Progress
Via: SIP/2.0/UDP 192.0.2.10:5060;branch=z9hG4bK7a1
P-Early-Media: sendrecv
Content-Type: application/sdp

Other headers

Because the mechanism is a generic "add this header to this response", other custom SIP headers that an interconnect requires can be added the same way.

Stackchan_sip on Asterisk 16 LTS
StandardRFC 5009
SinceVersion 3.3.2

Related

Need this on your platform? Tell us the Asterisk version and the interconnect, and we reply within 24 hours.

Request a quote