reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
DtmfPayloadContents.hxx
Go to the documentation of this file.
1#if !defined(RESIP_DTMFPAYLOADCONTENTS_HXX)
2#define RESIP_DTMFPAYLOADCONTENTS_HXX
3
5#include "rutil/Data.hxx"
6#include "rutil/HashMap.hxx"
8
9namespace resip
10{
11
12/* Provides a way to handle the application/dtmf-relay
13 content-type from SIP INFO messages.
14 Attempts to adhere to the IETF draft
15 draft-kaplan-dispatch-info-dtmf-package-00
16*/
17
19{
20
21 public:
22
24 {
25 public:
26 DtmfPayload(char button, int duration);
27
28 DtmfPayload() : mButton(0), mDuration(0) {}
29 DtmfPayload(const DtmfPayload& rhs);
31
32 void parse(ParseBuffer& pb);
34
39 char getButton() const { return mButton; }
40
48 unsigned short getEventCode() const;
49
54 int getDuration() const { return mDuration; }
55
56 private:
57 char mButton; // ASCII representation of the DTMF button
58 int mDuration; // milliseconds
59
60 static bool isValidButton(const char c);
61
62 friend class DtmfPayloadContents;
63 };
64
67 virtual ~DtmfPayloadContents();
68
70
75 virtual Contents* clone() const;
76
81 DtmfPayload& dtmfPayload() {checkParsed(); return mDtmfPayload;}
82 const DtmfPayload& dtmfPayload() const {checkParsed(); return mDtmfPayload;}
84 virtual void parse(ParseBuffer& pb);
85 static const Mime& getStaticType() ;
86
87 static bool init();
88
89 private:
90 DtmfPayloadContents(const Data& data, const Mime& contentTypes);
91 DtmfPayload mDtmfPayload;
92};
93
95
96}
97
98
99#endif
100
101/* ====================================================================
102 *
103 * Copyright 2014 Daniel Pocock http://danielpocock.com All rights reserved.
104 *
105 * Redistribution and use in source and binary forms, with or without
106 * modification, are permitted provided that the following conditions
107 * are met:
108 *
109 * 1. Redistributions of source code must retain the above copyright
110 * notice, this list of conditions and the following disclaimer.
111 *
112 * 2. Redistributions in binary form must reproduce the above copyright
113 * notice, this list of conditions and the following disclaimer in
114 * the documentation and/or other materials provided with the
115 * distribution.
116 *
117 * 3. Neither the name of the author(s) nor the names of any contributors
118 * may be used to endorse or promote products derived from this software
119 * without specific prior written permission.
120 *
121 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTORS "AS IS" AND
122 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
123 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
124 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTORS BE LIABLE
125 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
126 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
127 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
128 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
129 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
130 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
131 * SUCH DAMAGE.
132 *
133 * ====================================================================
134 *
135 *
136 */
137
Wraps your platform's implementation of hash_map, hash_multimap, and hash_set.
Base class for all SIP body types.
Definition Contents.hxx:51
An alternative to std::string, encapsulates an arbitrary buffer of bytes.
Definition Data.hxx:90
char getButton() const
obtain representation of the button as a character
int getDuration() const
obtain duration in milliseconds
unsigned short getEventCode() const
obtain representation of the button as event code
EncodeStream & encode(EncodeStream &) const
DtmfPayload & operator=(const DtmfPayload &rhs)
virtual Contents * clone() const
duplicate an DtmfPayloadContents object
const DtmfPayload & dtmfPayload() const
static const Mime & getStaticType()
virtual EncodeStream & encodeParsed(EncodeStream &str) const
DtmfPayloadContents & operator=(const DtmfPayloadContents &rhs)
DtmfPayload & dtmfPayload()
get the parsed payload
virtual void parse(ParseBuffer &pb)
void checkParsed() const
Represents the "media-type" element in the RFC 3261 grammar.
Definition Mime.hxx:20
Provides string-parsing functionality with protection from buffer overflow.
dcm! – add UnusedChecking(_enum) below;
static bool invokeDtmfPayloadContentsInit
#define EncodeStream
void list()
Definition userAdmin.cxx:66