Add new clearmode codec support for data calls

This new codec will get handled like RFC4040 in yrtpchan, ysipchan
and will just be handled as alaw audio in zapcard/DAHDI.

The zapcard code will set the udi bearer cap to any calls with the
clearmode format (which would get sent via SIP/SDP).
This commit is contained in:
Manawyrm 2023-09-19 15:48:47 +00:00 committed by Harald Welte
parent cb016b244f
commit 6fa07fb632
7 changed files with 28 additions and 7 deletions

View File

@ -521,6 +521,9 @@
; alaw: bool: Companded-only G711 a-law (PCMU/8000)
;alaw=default
; clearmode: bool: Transparent 64kbit/s B channel (RFC4040)
;clearmode=default
; gsm: bool: European GSM 06.10 (GSM/8000)
;gsm=default

View File

@ -44,6 +44,7 @@ static const FormatInfo s_formats[] = {
FormatInfo("ilbc30", 50, 30000),
// FormatInfo("speex", 0),
FormatInfo("g729", 10, 10000),
FormatInfo("clearmode", 80, 20000, "data", 0, 1, false),
FormatInfo("plain", 0, 0, "text", 0),
FormatInfo("raw", 0, 0, "data", 0),
};

View File

@ -37,6 +37,7 @@ static Rfc2833 s_rfc2833;
const TokenDict SDPParser::s_payloads[] = {
{ "mulaw", 0 },
{ "alaw", 8 },
{ "clearmode", 97 },
{ "gsm", 3 },
{ "lpc10", 7 },
{ "2*slin", 10 },
@ -99,6 +100,7 @@ const TokenDict SDPParser::s_rtpmap[] = {
{ "MPA/90000", 14 },
{ "iLBC/8000", 98 },
{ "AMR/8000", 96 },
{ "CLEARMODE/8000", 97 },
{ "AMR-WB/16000", 99 },
{ "SPEEX/8000", 102 },
{ "SPEEX/16000", 103 },

View File

@ -1665,9 +1665,21 @@ bool ISDNQ931Call::sendSetup(SignallingMessage* sigMsg)
m_data.m_transferCapability = sigMsg->params().getValue(YSTRING("transfer-cap"), "speech");
m_data.m_transferMode = "circuit";
m_data.m_transferRate = "64kbit";
m_data.m_format = sigMsg->params().getValue(YSTRING("format"),q931()->format());
if (0xffff == lookup(m_data.m_format,Q931Parser::s_dict_bearerProto1,0xffff))
m_data.m_format = "alaw";
const char *formats = sigMsg->params().getValue(YSTRING("formats"), "");
if (formats && strcmp(formats, "clearmode") == 0)
{
m_data.m_format = "clearmode";
m_data.m_transferCapability = "udi";
}
else
{
m_data.m_format = sigMsg->params().getValue(YSTRING("format"),q931()->format());
if (0xffff == lookup(m_data.m_format,Q931Parser::s_dict_bearerProto1,0xffff))
m_data.m_format = "alaw";
}
m_data.processBearerCaps(msg,true);
// ChannelID
if (!m_circuit)

View File

@ -1225,6 +1225,7 @@ bool SigChannel::startCall(Message& msg, SigTrunk* trunk)
sigMsg->params().addParam("callername",msg.getValue("callername"));
sigMsg->params().copyParam(msg,"circuits");
sigMsg->params().copyParam(msg,"format");
sigMsg->params().copyParam(msg,"formats");
sigMsg->params().copyParam(msg,"callernumtype");
sigMsg->params().copyParam(msg,"callernumplan");
if (msg.getValue("privacy") && msg.getBoolValue("privacy",true))

View File

@ -981,10 +981,11 @@ static TokenDict s_types[] = {
#undef MAKE_NAME
static TokenDict s_formats[] = {
{"slin", ZapDevice::Slin},
{"default", ZapDevice::Default},
{"mulaw", ZapDevice::Mulaw},
{"alaw", ZapDevice::Alaw},
{"slin", ZapDevice::Slin},
{"default", ZapDevice::Default},
{"mulaw", ZapDevice::Mulaw},
{"alaw", ZapDevice::Alaw},
{"clearmode", ZapDevice::Alaw},
{0,0}
};
#ifdef HAVE_ZAP

View File

@ -38,6 +38,7 @@ namespace { // anonymous
static TokenDict dict_payloads[] = {
{ "mulaw", 0 },
{ "alaw", 8 },
{ "clearmode", 97 },
{ "gsm", 3 },
{ "lpc10", 7 },
{ "2*slin", 10 },