Skip to content

Support P-Early-Media header

Hemlata requested to merge earlymedia into devel

Changes :

Uci params are introduced to enable or disable the feature.
asterisk.sip0.early_media='sendrecv'   //sendrecv,sendonly,recvonly,none are the supported values
1- If Call is started  with uci config early_media = 'sendrecv/sendonly/recvonly' , invite should have P-Early-Media=supported  header  

2- If Call i started with early_media ='none' , No  P-Early-Media should be present in the invite

3- If a outgoing invite is responded with 180/183 ,  P-Early-Media should be present in 18X,  no  P-Early-Media is present in 200Ok or Bye .

4 -Incoming invite with P-Early-Media should be responded with 18x response with P-Early-Media (and configured settings)  ( sdp is added if earlymedia to play )

3 - Update /200 request should contain header  in the dialog if early_media = 'sendrecv/sendonly/recvonly' 

4 - Prack/200 should contain the header in the dialog  if early_media = 'sendrecv/sendonly/recvonly' 

6-  If Invite contains Content-Disposition header with value early-session ,then P-Early-Media is not included . 

7- If an Invalid value in config is set for early_media ,  'sendrecv ' is used.

8  If early_media not present in config , by default  'sendrecv' is used.

9 - for an outgoing call,  early_media = 'sendrecv/sendonly/recvonly' and there is SDP in 180/183  with P-Early-Media header (before 200 OK to INVITE) , the  remote ringback tone is played out.

10 - If the 180/183 response for a outgoing does not contain sdp ,  local ringback tone is played ( tested by changing local ringback to busy and it ignores remote ringback tone )

Description : When feature is enabled using uci set asterisk.sip0.early_media='sendrecv/sendonly/recvonly' Invite from sip0 will contain the P-Early-Media: supported header, response from callee can ignore or send early media in 18X response with P-Early-Media header with direction parameters.200 Ok and Ack for the Invite does not contain the header.

The Prack and Update in the dialog also contain the Header in both request and 2xx response.

Local /Remote ringback :

If 18X doesnt have sdp and no P-Early-Media header ,we pass AST_CONTROL_RINGING which plays out the ringback tone since we dont have any media setup done but in case of 18X contains sdp and P-Early-Media header, the sdp negotiation is done and we move to AST_CONTROL_PROGRESS ,where remote media is played out.

Tested with BT ims server ,Since the pcap are encrypted i am attaching console logs. OutGoing_earlymedia_logs.txt

Incoming_EarlyMedia_Logs.txt

Please provide comments.

Edited by Hemlata

Merge request reports