engine/sdp: CODECS override for the codecs we offer and accept
KPN's interconnect gateway transcodes every caller up: a G.711-only fixed-line INVITE reached the phone offering PCMA, PCMU, AMR and AMR-WB (bench call 2026-09-08), so the AMR-WB-only build rang and the narrowband path — the one the Telia field report hit with 488 — cannot be reached on the air through KPN by any caller. CODECS=<list> (comma-separated over AMR-WB, AMR/AMR-NB, PCMA, PCMU) makes the list both the codecs offered on an outgoing call and the acceptance preference for an inbound offer, in that order: CODECS=PCMA takes G.711 A-law out of the mixed offer above, CODECS=PCMA,PCMU sends a G.711-only offer toward the network. Unset, nothing changes — the default offer bytes and the AMR-WB > AMR > PCMA > PCMU preference stay pinned. The daemon logs an active override at startup.
This commit is contained in:
parent
452634683c
commit
37ec8660b7
6 changed files with 270 additions and 67 deletions
|
|
@ -571,6 +571,15 @@ public:
|
|||
precond_ = EnvOr("PRECOND", "0") == "1";
|
||||
ealgOffer_ = EnvOr("EALG", "aes-cbc");
|
||||
mediaBin_ = ResolveMediaBin();
|
||||
// CODECS: restrict + reorder the codecs we offer and accept (bench
|
||||
// knob — a gateway that transcodes every caller up to AMR-WB never
|
||||
// lets the narrowband path run otherwise). Empty = defaults.
|
||||
codecs_ = imsd::sdp::ParseCodecList(EnvOr("CODECS", ""));
|
||||
if (!codecs_.empty()) {
|
||||
std::string list;
|
||||
for (const auto& c : codecs_) list += (list.empty() ? "" : ",") + c;
|
||||
Log(std::format("CODECS override active: {}", list));
|
||||
}
|
||||
// EMERGENCY_NUMBERS: comma-separated additions to the builtin
|
||||
// 112/911 (a lab core's advertised short code, carrier extras).
|
||||
std::string extra = EnvOr("EMERGENCY_NUMBERS", "");
|
||||
|
|
@ -688,6 +697,7 @@ private:
|
|||
int pcscfPort_ = 5060;
|
||||
int rtpPort_ = 50004;
|
||||
bool precond_ = false;
|
||||
std::vector<std::string> codecs_; // CODECS override; empty = defaults
|
||||
|
||||
// registration
|
||||
imsd::msg::Context ctx_;
|
||||
|
|
@ -1138,7 +1148,7 @@ private:
|
|||
Log(std::format("EMERGENCY dial ({}): urn:service:sos over the live registration, "
|
||||
"fallback plain INVITE — stage 1, no emergency registration/PDN; "
|
||||
"carrier-side behavior UNVERIFIED", c.number));
|
||||
call_.emplace(ctx_, rng_, c.uni, c.number, rtpPort_, precond_, emergency);
|
||||
call_.emplace(ctx_, rng_, c.uni, c.number, rtpPort_, precond_, emergency, codecs_);
|
||||
CallInfo info{c.uni, c.number, "dialing", "outgoing", NowEpoch(), 0};
|
||||
PostAdded(info);
|
||||
bool ok = Execute(call_->Start());
|
||||
|
|
@ -1198,7 +1208,7 @@ private:
|
|||
}
|
||||
std::string uni = std::format("ims-call-{}", ++callSeq_);
|
||||
DumpRaw("imsd-invite-in.raw", msg);
|
||||
call_.emplace(ctx_, rng_, uni, imsd::engine::IncomingInvite{msg}, rtpPort_);
|
||||
call_.emplace(ctx_, rng_, uni, imsd::engine::IncomingInvite{msg}, rtpPort_, codecs_);
|
||||
callReply_ = reply_;
|
||||
Log(std::format("incoming call {} from {}", uni, call_->Number()));
|
||||
// Validate the offer BEFORE the UI hears of the call. A refused
|
||||
|
|
|
|||
Loading…
Reference in a new issue