1 /**
2  * yatesdp.h
3  * This file is part of the YATE Project http://YATE.null.ro
4  *
5  * SDP media handling
6  *
7  * Yet Another Telephony Engine - a fully featured software PBX and IVR
8  * Copyright (C) 2004-2014 Null Team
9  *
10  * This software is distributed under multiple licenses;
11  * see the COPYING file in the main directory for licensing
12  * information for this specific distribution.
13  *
14  * This use of this software may be subject to additional restrictions.
15  * See the LEGAL file in the main directory for details.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20  */
21 
22 #ifndef __YATESDP_H
23 #define __YATESDP_H
24 
25 #ifndef __cplusplus
26 #error C++ is required
27 #endif
28 
29 #include <yatemime.h>
30 #include <yatephone.h>
31 
32 #ifdef _WINDOWS
33 
34 #ifdef LIBYSDP_EXPORTS
35 #define YSDP_API __declspec(dllexport)
36 #else
37 #ifndef LIBYSDP_STATIC
38 #define YSDP_API __declspec(dllimport)
39 #endif
40 #endif
41 
42 #endif /* _WINDOWS */
43 
44 #ifndef YSDP_API
45 #define YSDP_API
46 #endif
47 
48 /**
49  * Holds all Telephony Engine related classes.
50  */
51 namespace TelEngine {
52 
53 class SDPMedia;
54 class SDPSession;
55 class SDPParser;
56 
57 /**
58  * This class holds a single SDP media description
59  * @short SDP media description
60  */
61 class YSDP_API SDPMedia : public NamedList
62 {
63 public:
64     /**
65      * Constructor
66      * @param media Media type name
67      * @param transport Transport name
68      * @param formats Comma separated list of formats
69      * @param rport Optional remote media port
70      * @param lport Optional local media port
71      */
72     SDPMedia(const char* media, const char* transport, const char* formats,
73 	int rport = -1, int lport = -1);
74 
75     /**
76      * Destructor
77      */
78     virtual ~SDPMedia();
79 
80     /**
81      * Check if this media type is audio
82      * @return True if this media describe an audio one
83      */
isAudio()84     inline bool isAudio() const
85 	{ return m_audio; }
86 
87     /**
88      * Check if this media type is video
89      * @return True if this media describe a video one
90      */
isVideo()91     inline bool isVideo() const
92 	{ return m_video; }
93 
94     /**
95      * Check if a media parameter changed
96      * @return True if a media changed
97      */
isModified()98     inline bool isModified() const
99 	{ return m_modified; }
100 
101     /**
102      * Set or reset media parameter changed flag
103      * @param modified The new value of the media parameter changed flag
104      */
105     inline void setModified(bool modified = true)
106 	{ m_modified = modified; }
107 
108     /**
109      * Retrieve the media suffix (built from type)
110      * @return Media suffix
111      */
suffix()112     inline const String& suffix() const
113 	{ return m_suffix; }
114 
115     /**
116      * Check if media is started
117      * @return True if started, false otherwise
118      */
isStarted()119     inline bool isStarted() const
120 	{ return m_id && m_transport && m_format && m_lPort; }
121 
122     /**
123      * Retrieve the media transport name
124      * @return The media transport name
125      */
transport()126     inline const String& transport() const
127 	{ return m_transport; }
128 
129     /**
130      * Retrieve the media id
131      * @return The media id
132      */
id()133     inline const String& id() const
134 	{ return m_id; }
135 
136     /**
137      * Retrieve the current media format
138      * @return The current media format
139      */
format()140     inline const String& format() const
141 	{ return m_format; }
142 
143     /**
144      * Retrieve the formats set for this media
145      * @return Comma separated list of media formats
146      */
formats()147     inline const String& formats() const
148 	{ return m_formats; }
149 
150     /**
151      * Retrieve the remote media port
152      * @return The remote media port
153      */
remotePort()154     inline const String& remotePort() const
155 	{ return m_rPort; }
156 
157     /**
158      * Retrieve the local media port
159      * @return The local media port
160      */
localPort()161     inline const String& localPort() const
162 	{ return m_lPort; }
163 
164     /**
165      * Retrieve rtp payload mappings
166      * @return Rtp payload mappings
167      */
mappings()168     inline const String& mappings() const
169 	{ return m_mappings; }
170 
171     /**
172      * Set rtp payload mappings for this media
173      * @param newMap New rtp payload mappings
174      */
mappings(const char * newMap)175     inline void mappings(const char* newMap)
176 	{ if (newMap) m_mappings = newMap; }
177 
178     /**
179      * Retrieve RFC2833 status or payload of this media
180      * @return RFC2833 status or payload of this media
181      */
rfc2833()182     inline const String& rfc2833() const
183 	{ return m_rfc2833; }
184 
185     /**
186      * Set RFC2833 status or payload of this media
187      * @param payload SDP numeric payload to set.
188      *  Set it to a negative value to reset RFC2833
189      */
rfc2833(int payload)190     inline void rfc2833(int payload)
191 	{
192 	    if (payload >= 0)
193 		m_rfc2833 = payload;
194 	    else
195 		m_rfc2833 = String::boolText(false);
196 	}
197 
198     /**
199      * Retrieve remote crypto description
200      * @return Remote crypto description
201      */
remoteCrypto()202     inline const String& remoteCrypto() const
203 	{ return m_rCrypto; }
204 
205     /**
206      * Retrieve local crypto description
207      * @return Local crypto description
208      */
localCrypto()209     inline const String& localCrypto() const
210 	{ return m_lCrypto; }
211 
212     /**
213      * Check if this media is securable
214      * @return True if this media is securable
215      */
securable()216     inline bool securable() const
217 	{ return m_securable; }
218 
219     /**
220      * Compare this media with another one
221      * @param other The media to compare with
222      * @param ignorePort Ignore differences caused only by port number
223      * @param checkStarted Check started related parameters: true when media should be kept if started and matched
224      * @return True if both media have the same formats, transport and remote port
225      */
226     bool sameAs(const SDPMedia* other, bool ignorePort = false, bool checkStarted = false) const;
227 
228     /**
229      * Check if local part of this media changed
230      * @return True if local part of this media changed
231      */
localChanged()232     inline bool localChanged() const
233 	{ return m_localChanged; }
234 
235     /**
236      * Set or reset local media changed flag
237      * @param chg The new value for local media changed flag
238      */
239     inline void setLocalChanged(bool chg = false)
240 	{ m_localChanged = chg; }
241 
242     /**
243      * Retrieve a formats list from this media
244      * @return Comma separated list of media formats (from formats list,
245      *  current format or a default G711, 'alaw,mulaw', list
246      */
247     const char* fmtList() const;
248 
249     /**
250      * Update this media from formats and ports
251      * @param formats New media formats
252      * @param rport Optional remote media port
253      * @param lport Optional local media port
254      * @param force Force updating formats even if incompatible with old ones
255      * @return True if media changed
256      */
257     bool update(const char* formats, int rport = -1, int lport = -1, bool force = false);
258 
259     /**
260      * Update from a chan.rtp message (rtp id and local port)
261      * @param msg The list of parameters
262      * @param pickFormat True to update media format(s) from the list
263      */
264     void update(const NamedList& msg, bool pickFormat);
265 
266     /**
267      * Add or replace a parameter by name and value, set the modified flag
268      * @param name Parameter name
269      * @param value Parameter value
270      * @param append True to append, false to replace
271      */
272     void parameter(const char* name, const char* value, bool append);
273 
274     /**
275      * Add or replace a parameter, set the modified flag
276      * @param param The parameter
277      * @param append True to append, false to replace
278      */
279     void parameter(NamedString* param, bool append);
280 
281     /**
282      * Set a new crypto description, set the modified flag if changed.
283      * Reset the media securable flag if the remote crypto is empty
284      * @param desc The new crypto description
285      * @param remote True to set the remote crypto, false to set the local one
286      */
287     void crypto(const char* desc, bool remote);
288 
289     /**
290      * Put this net media in a parameter list
291      * @param msg Destination list
292      * @param putPort True to add remote media port
293      */
294     void putMedia(NamedList& msg, bool putPort = true);
295 
296     /**
297      * Copy RTP related data from old media
298      * @param other Source media
299      */
300     void keepRtp(const SDPMedia& other);
301 
302     /**
303      * Retrieve format mapping to payload
304      * @param mappings Mappings list
305      * @param fmt Format name
306      * @return -1:incorrect mapping value, -2:format not found, payload number otherwise (>=0)
307      */
308     static int payloadMapping(const String& mappings, const String& fmt);
309 
310 private:
311     bool m_audio;
312     bool m_video;
313     bool m_modified;
314     bool m_securable;
315     // local rtp data changed flag
316     bool m_localChanged;
317     // suffix used for this type
318     String m_suffix;
319     // transport protocol
320     String m_transport;
321     // list of supported format names
322     String m_formats;
323     // format used for sending data
324     String m_format;
325     // id of the local media channel
326     String m_id;
327     // remote media port
328     String m_rPort;
329     // mappings of RTP payloads
330     String m_mappings;
331     // local media port
332     String m_lPort;
333     // payload for telephone/event
334     String m_rfc2833;
335     // remote security descriptor
336     String m_rCrypto;
337     // local security descriptor
338     String m_lCrypto;
339 };
340 
341 
342 /**
343  * This class holds RTP/SDP data for multiple media types
344  * NOTE: The SDPParser pointer held by this class is assumed to be non NULL
345  * @short A holder for a SDP session
346  */
347 class YSDP_API SDPSession
348 {
349 public:
350     /**
351      * RTP media status enumeration
352      */
353     enum {
354 	MediaMissing,
355 	MediaStarted,
356 	MediaMuted
357     };
358 
359     /**
360      * Constructor
361      * @param parser The SDP parser whose data this object will use
362      */
363     SDPSession(SDPParser* parser);
364 
365     /**
366      * Constructor
367      * @param parser The SDP parser whose data this object will use
368      * @param params SDP session parameters
369      */
370     SDPSession(SDPParser* parser, NamedList& params);
371 
372     /**
373      * Destructor. Reset the object
374      */
375     virtual ~SDPSession();
376 
377     /**
378      * Get RTP local host
379      * @return RTP local host
380      */
getHost()381     inline const String& getHost() const
382 	{ return m_host; }
383 
384     /**
385      * Get local RTP address
386      * @return Local RTP address (external or local)
387      */
getRtpAddr()388     inline const String& getRtpAddr() const
389 	{ return m_externalAddr ? m_externalAddr : m_rtpLocalAddr; }
390 
391     /**
392      * Set a new media list
393      * @param media New media list
394      * @param preserveExisting Try to preserve existing started media
395      * @return True if media changed
396      */
397     bool setMedia(ObjList* media, bool preserveExisting = false);
398 
399     /**
400      * Put specified media parameters into a list of parameters
401      * @param msg Destination list
402      * @param media List of SDP media information
403      * @param putPort True to add the media port
404      */
405     static void putMedia(NamedList& msg, ObjList* media, bool putPort = true);
406 
407     /**
408      * Put session media parameters into a list of parameters
409      * @param msg Destination list
410      * @param putPort True to add the media port
411      */
412     inline void putMedia(NamedList& msg, bool putPort = true)
413 	{ putMedia(msg,m_rtpMedia,putPort); }
414 
415     /**
416      * Retrieve a single media description
417      * @param name Name of the media to retrieve
418      * @return Pointer to media descriptor, NULL if no such media set
419      */
getMedia(const String & name)420     SDPMedia* getMedia(const String& name) const
421 	{ return m_rtpMedia ? static_cast<SDPMedia*>((*m_rtpMedia)[name]) : 0; }
422 
423     /**
424      * Update the RFC 2833 availability and payload
425      * @param value String to get payload or availability
426      */
427     void setRfc2833(const String& value);
428 
429     /**
430      * Update the RFC 2833 availability and payload
431      * @param value Pointer to string to get payload or availability
432      */
setRfc2833(const String * value)433     inline void setRfc2833(const String* value)
434 	{ if (value) setRfc2833(*value); }
435 
436     /**
437      * Build and dispatch a chan.rtp message for a given media. Update media on success
438      * @param media The media to use
439      * @param addr Remote RTP address
440      * @param start True to request RTP start
441      * @param pick True to update local parameters (other then media) from returned message
442      * @param context Pointer to user provided context, optional
443      * @return True if the message was succesfully handled
444      */
445     bool dispatchRtp(SDPMedia* media, const char* addr,	bool start, bool pick, RefObject* context = 0);
446 
447     /**
448      * Calls dispatchRtp() for each media in the list
449      * Update it on success. Remove it on failure
450      * @param addr Remote RTP address
451      * @param start True to request RTP start
452      * @param context Pointer to user provided context, optional
453      * @return True if the message was succesfully handled for at least one media
454      */
455     bool dispatchRtp(const char* addr, bool start, RefObject* context = 0);
456 
457     /**
458      * Try to start RTP (calls dispatchRtp()) for each media in the list
459      * @param context Pointer to user provided context, optional
460      * @return True if at least one media was started
461      */
462     bool startRtp(RefObject* context = 0);
463 
464     /**
465      * Update from parameters and optionally build a default SDP.
466      * @param params List of parameters to update from
467      * @param defaults Build a default SDP from parser formats if no media is found in params
468      * @return True if media changed
469      */
470     bool updateSDP(const NamedList& params, bool defaults = true);
471 
472     /**
473      * Update RTP/SDP data from parameters
474      * @param params List of parameters to update from
475      * @return True if media or local address changed
476      */
477     bool updateRtpSDP(const NamedList& params);
478 
479     /**
480      * Creates a SDP body from transport address and list of media descriptors
481      * @param addr The address to set. Use own host if empty
482      * @param mediaList Optional media list. Use own list if the given one is 0
483      * @return MimeSdpBody pointer or 0 if there is no media to set
484      */
485     MimeSdpBody* createSDP(const char* addr, ObjList* mediaList = 0);
486 
487     /**
488      * Creates a SDP body for current media status
489      * @return MimeSdpBody pointer or 0 if media is missing
490      */
491     MimeSdpBody* createSDP();
492 
493     /**
494      * Creates a SDP from RTP address data present in message.
495      * Use the raw SDP if present.
496      * @param msg The list of parameters
497      * @param update True to update RTP/SDP data if raw SDP is not found in the list
498      * @param allowEmptyAddr Allow empty address in parameters (default: false)
499      * @return MimeSdpBody pointer or 0
500      */
501     MimeSdpBody* createPasstroughSDP(NamedList& msg, bool update = true,
502 	bool allowEmptyAddr = false);
503 
504     /**
505      * Creates a set of unstarted external RTP channels from remote addr and
506      *  builds SDP from them
507      * @param addr Remote RTP address used when dispatching the chan.rtp message
508      * @param msg List of parameters used to update data
509      * @return MimeSdpBody pointer or 0
510      */
createRtpSDP(const char * addr,const NamedList & msg)511     inline MimeSdpBody* createRtpSDP(const char* addr, const NamedList& msg)
512 	{ updateSDP(msg); return createRtpSDP(addr,false); }
513 
514     /**
515      * Creates a set of RTP channels from address and media info and builds SDP from them
516      * @param addr Remote RTP address used when dispatching the chan.rtp message
517      * @param start True to create a started RTP
518      * @return MimeSdpBody pointer or 0
519      */
createRtpSDP(const char * addr,bool start)520     inline MimeSdpBody* createRtpSDP(const char* addr, bool start)
521 	{ return dispatchRtp(addr,start) ? createSDP(getRtpAddr()) : 0; }
522 
523     /**
524      * Creates a set of started external RTP channels from remote addr and
525      *  builds SDP from them
526      * @param start True to create a started RTP
527      * @return MimeSdpBody pointer or 0
528      */
createRtpSDP(bool start)529     inline MimeSdpBody* createRtpSDP(bool start)
530 	{
531 	    if (m_rtpAddr.null()) {
532 		m_mediaStatus = MediaMuted;
533 		return createSDP(0);
534 	    }
535 	    return createRtpSDP(m_rtpAddr,start);
536 	}
537 
538     /**
539      * Update media format lists from parameters
540      * @param msg Parameter list
541      * @param changeMedia True to update media list if required
542      */
543     void updateFormats(const NamedList& msg, bool changeMedia = false);
544 
545     /**
546      * Add raw SDP forwarding parameter from body if SDP forward is enabled
547      * @param msg Destination list
548      * @param body Mime body to process
549      * @return True if the parameter was added
550      */
551     bool addSdpParams(NamedList& msg, const MimeBody* body);
552 
553     /**
554      * Add raw SDP forwarding parameter if SDP forward is enabled
555      * @param msg Destination list
556      * @param rawSdp The raw sdp content
557      * @return True if the parameter was added
558      */
559     bool addSdpParams(NamedList& msg, const String& rawSdp);
560 
561     /**
562      * Add RTP forwarding parameters to a message (media and address)
563      * @param msg Destination list
564      * @param natAddr Optional NAT address if detected
565      * @param body Pointer to the body to extract raw SDP from
566      * @param force True to override RTP forward flag
567      * @param allowEmptyAddr Allow empty address in parameters (default: false)
568      * @return True if RTP data was added. Media is always added if present and
569      *  remote address is not empty
570      */
571     bool addRtpParams(NamedList& msg, const String& natAddr = String::empty(),
572 	const MimeBody* body = 0, bool force = false, bool allowEmptyAddr = false);
573 
574     /**
575      * Reset this object to default values
576      * @param all True to reset all parameters including configuration
577      */
578     virtual void resetSdp(bool all = true);
579 
580     /**
581      * Build a chan.rtp message and populate with media information
582      * @param media The media list
583      * @param addr Remote RTP address
584      * @param start True to request RTP start
585      * @param context Pointer to reference counted user provided context
586      * @return The message with media information, NULL if media or addr are missing
587      */
588     virtual Message* buildChanRtp(SDPMedia* media, const char* addr, bool start, RefObject* context);
589 
590     /**
591      * Build a chan.rtp message without media information
592      * @param context Pointer to reference counted user provided context
593      * @return The message with user data set but no media information
594      */
595     virtual Message* buildChanRtp(RefObject* context) = 0;
596 
597     /**
598      * Check if local RTP data changed for at least one media
599      * @return True if local RTP data changed for at least one media
600      */
601     bool localRtpChanged() const;
602 
603     /**
604      * Set or reset the local RTP data changed flag for all media
605      * @param chg The new value for local RTP data changed flag of all media
606      */
607     void setLocalRtpChanged(bool chg = false);
608 
609     /**
610      * Update RTP/SDP data from parameters
611      * @param params Parameter list
612      * @param rtpAddr String to be filled with rtp address from the list
613      * @param oldList Optional existing media list (found media will be removed
614      *  from it and added to the returned list
615      * @param allowEmptyAddr Allow empty address in parameters (default: false)
616      * @return List of media or 0 if not found or rtpAddr is empty
617      */
618     static ObjList* updateRtpSDP(const NamedList& params, String& rtpAddr,
619 	ObjList* oldList = 0, bool allowEmptyAddr = false);
620 
621 protected:
622     /**
623      * Media changed notification.
624      * This method is called when setting new media and an old one changed
625      * @param media Old media that changed
626      */
627     virtual void mediaChanged(const SDPMedia& media);
628 
629     /**
630      * Dispatch rtp notification.
631      * This method is called before dispatching the message.
632      * Clear the message to stop dispatch
633      * @param msg Message to dispatch
634      * @param media Media for which the message is going to be dispatched
635      */
636     virtual void dispatchingRtp(Message*& msg, SDPMedia* media);
637 
638     /**
639      * Set data used in debug
640      * @param enabler The DebugEnabler to use (0 to to use the parser)
641      * @param ptr Pointer to print, 0 to use the session pointer
642      * @param traceId Trace ID to use for debugging
643      */
644     void setSdpDebug(DebugEnabler* enabler = 0, void* ptr = 0, const String& traceId = String::empty());
645 
646     /**
647      * Print current media to output
648      * @param reason Reason to print
649      */
650     void printRtpMedia(const char* reason);
651 
652     /**
653      * Set extra parameters for formats
654      * @param list List of parameters
655      * @param out True if session is outgoing, false otherwise
656      */
657     void setFormatsExtra(const NamedList& list, bool out);
658 
659     SDPParser* m_parser;
660     int m_mediaStatus;
661     bool m_rtpForward;                   // Forward RTP flag
662     bool m_sdpForward;                   // Forward SDP (only if RTP is forwarded)
663     String m_originAddr;                 // Our SDP origin address
664     String m_externalAddr;               // Our external IP address, possibly outside of a NAT
665     String m_rtpAddr;                    // Remote RTP address
666     String m_rtpLocalAddr;               // Local RTP address
667     String m_rtpNatAddr;                 // Advertised local IP in sdp (override any local IP)
668     ObjList* m_rtpMedia;                 // List of media descriptors
669     int m_sdpSession;                    // Unique SDP session number
670     int m_sdpVersion;                    // SDP version number, incremented each time we generate a new SDP
671     unsigned int m_sdpHash;              // SDP content hash
672     String m_host;
673     bool m_secure;
674     int m_rfc2833;                       // Payload of RFC 2833 for remote party
675     bool m_ipv6;                         // IPv6 support
676     NamedList m_amrExtra;                // Extra AMR codec parameters
677 
678 private:
679     // Add extra AMR params to fmtp line
680     void addFmtpAmrExtra(String& buf, const String* fmtp);
681 
682     DebugEnabler* m_enabler;             // Debug enabler used for output
683     void* m_ptr;                         // Pointer to show in debug messages
684     String m_traceId;
685 };
686 
687 /**
688  * This class holds a SDP parser and additional data used by SDP objects
689  * @short A SDP parser
690  */
691 class YSDP_API SDPParser : public DebugEnabler, public Mutex
692 {
693     friend class SDPSession;
694 
695 public:
696     /**
697      * Constructor
698      * @param dbgName Debug name of this parser
699      * @param sessName Name of the session in SDP
700      * @param fmts Default media formats
701      */
702     inline SDPParser(const char* dbgName, const char* sessName, const char* fmts = "alaw,mulaw")
703 	: Mutex(true,"SDPParser"),
704 	  m_rfc2833(101),
705 	  m_sdpForward(false), m_secure(false), m_ignorePort(false),
706 	  m_sessionName(sessName), m_audioFormats(fmts),
707 	  m_codecs(""), m_hacks("")
708 	{ debugName(dbgName); }
709 
710     /**
711      * Get the formats list
712      * This method is thread safe
713      * @param buf String to be filled with comma separated list of formats
714      */
getAudioFormats(String & buf)715     inline void getAudioFormats(String& buf)
716 	{ Lock lock(this); buf = m_audioFormats; }
717 
718     /**
719      * Get the RFC 2833 offer payload
720      * @return Payload for RFC 2883 telephony events, negative if not offered
721      */
rfc2833()722     inline int rfc2833() const
723 	{ return m_rfc2833; }
724 
725     /**
726      * Get the secure offer flag
727      * @return True if SDES descriptors for SRTP will be offered
728      */
secure()729     inline bool secure() const
730 	{ return m_secure; }
731 
732     /**
733      * Get the SDP forward flag
734      * @return True if raw SDP should be added to RTP forward offer
735      */
sdpForward()736     inline bool sdpForward() const
737 	{ return m_sdpForward; }
738 
739     /**
740      * Get the RTP port change ignore flag
741      * @return True if a port change should not cause an offer change
742      */
ignorePort()743     inline bool ignorePort() const
744 	{ return m_ignorePort; }
745 
746     /**
747      * Parse a received SDP body
748      * This method is thread safe
749      * @param sdp Received SDP body
750      * @param addr Remote address
751      * @param oldMedia Optional list of existing media (an already existing media
752      *  will be moved to returned list)
753      * @param media Optional expected media type. If not empty this will be the
754      *  only media type returned (if found)
755      * @param force Force updating formats even if incompatible with old ones
756      * @return List of SDPMedia objects, may be NULL
757      */
758     ObjList* parse(const MimeSdpBody& sdp, String& addr, ObjList* oldMedia = 0,
759 	const String& media = String::empty(), bool force = false);
760 
761     /**
762      * Parse a received SDP body, returns NULL if SDP is not present
763      * This method is thread safe
764      * @param sdp Pointer to received SDP body
765      * @param addr Remote address
766      * @param oldMedia Optional list of existing media (an already existing media
767      *  will be moved to returned list)
768      * @param media Optional expected media type. If not empty this will be the
769      *  only media type returned (if found)
770      * @param force Force updating formats even if incompatible with old ones
771      * @return List of SDPMedia objects, may be NULL
772      */
773     inline ObjList* parse(const MimeSdpBody* sdp, String& addr, ObjList* oldMedia = 0,
774 	const String& media = String::empty(), bool force = false)
775 	{ return sdp ? parse(*sdp,addr,oldMedia,media,force) : 0; }
776 
777     /**
778      * Update configuration. This method should be called after a configuration file is loaded
779      * @param codecs List of supported codecs
780      * @param hacks List of hacks
781      * @param general List of general settings
782      */
783     void initialize(const NamedList* codecs, const NamedList* hacks, const NamedList* general = 0);
784 
785     /**
786      * Yate Payloads for the AV profile
787      */
788     static const TokenDict s_payloads[];
789 
790     /**
791      * SDP Payloads for the AV profile
792      */
793     static const TokenDict s_rtpmap[];
794 
795 private:
796     int m_rfc2833;                       // RFC 2833 payload offered to remote
797     bool m_sdpForward;                   // Include raw SDP for forwarding
798     bool m_secure;                       // Offer SRTP
799     bool m_ignorePort;                   // Ignore port only changes in SDP
800     String m_sessionName;
801     String m_audioFormats;               // Default audio formats to be advertised to remote party
802     NamedList m_codecs;                  // Codecs configuration list
803     NamedList m_hacks;                   // Various potentially standard breaking settings
804 };
805 
806 }; // namespace TelEngine
807 
808 #endif /* __YATESDP_H */
809 
810 /* vi: set ts=8 sw=4 sts=4 noet: */
811