1#if defined(HAVE_CONFIG_H)
14#define RESIPROCATE_SUBSYSTEM resip::Subsystem::SDP
48 mDtmfPayload = rhs.mDtmfPayload;
62 mDtmfPayload.
parse(pb);
75 static Mime type(
"application",
"dtmf-relay");
94 mButton = rhs.mButton;
95 mDuration = rhs.mDuration;
101DtmfPayloadContents::DtmfPayload::isValidButton(
const char c)
103 static const char permittedChars[] =
"ABCD*#";
104 if(c >=
'0' && c <=
'9')
108 if(strchr(permittedChars, c) != NULL)
112 WarningLog(<<
"Not a valid DTMF button: " << c);
122 pb.
data(val, anchor);
125 ErrLog(<<
"first key must be Signal, found: " << val);
131 pb.
data(val, anchor);
134 ErrLog(<<
"signal string [" << val <<
"], size = " << val.
size());
137 const char& _button = val[0];
138 if(!isValidButton(_button))
147 pb.
data(val, anchor);
150 ErrLog(<<
"second key must be Duration, found: " << val);
157 StackLog(<<
"Duration = " << _duration);
158 if(_duration < 20 || _duration > 5000)
160 ErrLog(<<
"Invalid duration: " << _duration);
165 mDuration = _duration;
172 unsigned short eventCode = 0;
173 if(mButton >=
'0' && mButton <=
'9')
175 eventCode = mButton -
'0';
177 else if(mButton ==
'*')
181 else if(mButton ==
'#')
185 else if(mButton >=
'A' && mButton <=
'D')
187 eventCode = 12 + mButton -
'A';
#define WarningLog(args_)
#define resip_assert(x)
This file needs to work for both C and C++ code.
Base class for all SIP body types.
Contents & operator=(const Contents &rhs)
Assignment operator.
An alternative to std::string, encapsulates an arbitrary buffer of bytes.
size_type size() const noexcept
Returns the number of bytes in this Data.
unsigned short getEventCode() const
obtain representation of the button as event code
void parse(ParseBuffer &pb)
EncodeStream & encode(EncodeStream &) const
DtmfPayload & operator=(const DtmfPayload &rhs)
virtual Contents * clone() const
duplicate an DtmfPayloadContents object
static const Mime & getStaticType()
virtual EncodeStream & encodeParsed(EncodeStream &str) const
DtmfPayloadContents & operator=(const DtmfPayloadContents &rhs)
virtual void parse(ParseBuffer &pb)
virtual ~DtmfPayloadContents()
Represents the "media-type" element in the RFC 3261 grammar.
Provides string-parsing functionality with protection from buffer overflow.
CurrentPosition skipWhitespace()
CurrentPosition skipToChars(const char *cs)
const Data & getContext() const
CurrentPosition skipToOneOf(const char *cs)
CurrentPosition skipChar()
void data(Data &data, const char *start) const
make the passed in data share memory with the buffer (uses Data::Share)
BaseException used to indicate parse failures.
static const char * EQUALS
dcm! – add UnusedChecking(_enum) below;
bool isEqualNoCase(const Data &left, const Data &right)
void skipEol(ParseBuffer &pb)