mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 08:40:38 +00:00
fixed replaceEndpoint offer single codec that callee does not support (#1131)
This commit is contained in:
@@ -2354,10 +2354,32 @@ Duration=${duration} `
|
||||
// Destroy previous ep if it's still running.
|
||||
if (this.ep?.connected) this.ep.destroy();
|
||||
|
||||
this.ep = await this.ms.createEndpoint({remoteSdp: this.dlg.remote.sdp});
|
||||
/* Codec negotiation issue explanation:
|
||||
*
|
||||
* Problem scenario:
|
||||
* 1. Initial negotiation:
|
||||
* - FreeSWITCH → SBC: offers multiple codecs (PCMU, PCMA, G722)
|
||||
* - SBC → Callee: passes all codecs (PCMU, PCMA, G722)
|
||||
* - Callee → SBC: responds with PCMA (its supported codec)
|
||||
* - SBC → FreeSWITCH: responds with PCMU (after transcoding)
|
||||
*
|
||||
* 2. After endpoint replacement:
|
||||
* - If we only offer PCMU in the new endpoint
|
||||
* - FreeSWITCH → SBC: offers only PCMU
|
||||
* - SBC → Callee: offers only PCMU
|
||||
* - Call fails: Callee rejects since it only supports PCMA
|
||||
*
|
||||
* Solution:
|
||||
* Always have FreeSWITCH offer multiple codecs to the SBC, don't pass remote sdp here to ensure
|
||||
* the SBC can reoffer the same codecs that the callee originally accepted.
|
||||
* This prevents call failures during media renegotiation.
|
||||
*/
|
||||
|
||||
this.ep = await this.ms.createEndpoint();
|
||||
this._configMsEndpoint();
|
||||
|
||||
await this.dlg.modify(this.ep.local.sdp);
|
||||
const sdp = await this.dlg.modify(this.ep.local.sdp);
|
||||
await this.ep.modify(sdp);
|
||||
this.logger.debug('CallSession:replaceEndpoint completed');
|
||||
return this.ep;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user