| 98 | {{{media_create()}}}:: |
| 99 | 1. The semantic has changed: |
| 100 | - previously this function is always called everytime we want to send offer |
| 101 | - now this function is only called once when the transport needs to be created. Meaning once before call, and once the session is woken up after call hold. When media is already created and the application wants to send offer, it will just call {{{encode_sdp()}}} below without re-creating the media. |
| 102 | 1. The syntax has changed: |
| 103 | - ''local_sdp'' parameter is removed. Local SDP should be populated in {{{encode_sdp()}}} instead. This is to make it consistent since SDP can be created without re-creating media. |
| 104 | |
| 105 | '''New:''' {{{encode_sdp()}}}:: |
| 106 | 1. This function is used to modify local SDP with transport info. It can be called for different purposes below. |
| 107 | 1. '''generating initial offer''': this happens for outgoing calls, right after {{{media_create()}}} is called. The transport must initialize local SDP with default values (for ICE: include all candidates. For SRTP: include all crypto options). Normally it does not need to modify it's state. |
| 108 | 1. '''generating initial answer''': this happens for incoming calls, also right after {{{media_create()}}} is called. The transport must inspect the remote SDP '''and'''' update the transport according to the info in remote SDP '''and''' update local SDP to be sent as answer. For example: disable the feature if remote SDP doesn't contain the required attributes. |
| 109 | 1. '''generating subsequent offer''': this happens when local endpoint sends UPDATE or re-INVITE. In this case, the transport '''MUST NOT''' modify it's state, and rather just encode it's current state in the local SDP. |
| 110 | 1. '''generating subsequent answer''': this happens when we receive UPDATE or re-INVITE. The processing is similar to ''generating initial answer'' above. |
| 111 | |
| 112 | {{{media_start()}}}:: |
| 113 | 1. The syntax has changed: |
| 114 | - the local SDP is now ''const''. This is because it's useless to modify the local SDP there since the SDP has already been negotiated. |
| 115 | |
| 116 | |
| 117 | == Bug == |
| 118 | |
| 119 | With the new framework, there's still a bug. The offer/answer RFC says that if UPDATE or re-INVITE fails, the media should remain unchanged, i.e. it falls back to use the previously successfully negotiated media. |
| 120 | |
| 121 | That's not possible with the framework above, for the '''generating subsequent answer''' case above. Solving this is currently not possible with ICE, since that requires creating a new/fresh ''ice_strans'' everytime we receive updated offer, just in case the offer/answer fails so that we can revert back to old ''ice_strans''. |
| 122 | |