OPAL  Version 3.10.10
sippdu.h
Go to the documentation of this file.
1 /*
2  * sippdu.h
3  *
4  * Session Initiation Protocol PDU support.
5  *
6  * Open Phone Abstraction Library (OPAL)
7  * Formally known as the Open H323 project.
8  *
9  * Copyright (c) 2002 Equivalence Pty. Ltd.
10  *
11  * The contents of this file are subject to the Mozilla Public License
12  * Version 1.0 (the "License"); you may not use this file except in
13  * compliance with the License. You may obtain a copy of the License at
14  * http://www.mozilla.org/MPL/
15  *
16  * Software distributed under the License is distributed on an "AS IS"
17  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
18  * the License for the specific language governing rights and limitations
19  * under the License.
20  *
21  * The Original Code is Open Phone Abstraction Library.
22  *
23  * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
24  *
25  * Contributor(s): ______________________________________.
26  *
27  * $Revision: 29080 $
28  * $Author: rjongbloed $
29  * $Date: 2013-02-12 18:52:05 -0600 (Tue, 12 Feb 2013) $
30  */
31 
32 #ifndef OPAL_SIP_SIPPDU_H
33 #define OPAL_SIP_SIPPDU_H
34 
35 #ifdef P_USE_PRAGMA
36 #pragma interface
37 #endif
38 
39 #include <opal/buildopts.h>
40 
41 #if OPAL_SIP
42 
43 #include <ptclib/mime.h>
44 #include <ptclib/url.h>
45 #include <ptclib/http.h>
46 #include <sip/sdp.h>
47 #include <opal/rtpconn.h>
48 
49 
50 class OpalTransport;
52 class OpalProductInfo;
53 
54 class SIPEndPoint;
55 class SIPConnection;
56 class SIP_PDU;
58 class SIPDialogContext;
59 class SIPMIMEInfo;
60 
61 
63 // SIPURL
64 
70 class SIPURL : public PURL
71 {
72  PCLASSINFO(SIPURL, PURL);
73  public:
74  SIPURL();
75 
77  const PURL & url
78  ) : PURL(url) { }
80  const PURL & url
81  ) { PURL::operator=(url); return *this; }
82 
85  SIPURL(
86  const char * cstr,
87  const char * defaultScheme = NULL
88  );
90  const char * cstr
91  ) { Parse(cstr); return *this; }
92 
95  SIPURL(
96  const PString & str,
97  const char * defaultScheme = NULL
98  );
100  const PString & str
101  ) { Parse(str); return *this; }
102 
112  SIPURL(
113  const PString & name,
114  const OpalTransportAddress & address,
115  WORD listenerPort = 0
116  );
117 
118  SIPURL(
119  const OpalTransportAddress & address,
120  WORD listenerPort = 0
121  );
122  SIPURL & operator=(
123  const OpalTransportAddress & address
124  );
125 
126  SIPURL(
127  const SIPMIMEInfo & mime,
128  const char * name
129  );
130 
139  virtual Comparison Compare(
140  const PObject & obj
141  ) const;
142 
146  PString AsQuotedString() const;
147 
150  PString GetDisplayName(PBoolean useDefault = true) const;
151 
152  void SetDisplayName(const PString & str)
153  {
154  m_displayName = str;
155  }
156 
158  const PStringOptions & GetFieldParameters() const { return m_fieldParameters; }
159  PStringOptions & GetFieldParameters() { return m_fieldParameters; }
160 
164 
167  void SetHostAddress(const OpalTransportAddress & addr);
168 
179  };
180 
186  void Sanitise(
187  UsageContext context
188  );
189 
195  PBoolean AdjustToDNS(
196  PINDEX entry = 0
197  );
198 
200  static PString GenerateTag();
201 
203  void SetTag(
204  const PString & tag = PString::Empty(),
205  bool force = false
206  );
207 
208  protected:
209  void ParseAsAddress(const PString & name, const OpalTransportAddress & _address, WORD listenerPort = 0);
210 
211  // Override from PURL()
212  virtual PBoolean InternalParse(
213  const char * cstr,
214  const char * defaultScheme
215  ) { return ReallyInternalParse(false, cstr, defaultScheme); }
216 
217  bool ReallyInternalParse(
218  bool fromField,
219  const char * cstr,
220  const char * defaultScheme
221  );
222 
223  PString m_displayName;
224  PStringOptions m_fieldParameters;
225 };
226 
227 
228 class SIPURLList : public std::list<SIPURL>
229 {
230  public:
231  bool FromString(
232  const PString & str,
234  bool reversed = false
235  );
236  PString ToString() const;
237  friend ostream & operator<<(ostream & strm, const SIPURLList & urls);
238 };
239 
240 
241 
243 // SIPMIMEInfo
244 
275 class SIPMIMEInfo : public PMIMEInfo
276 {
277  PCLASSINFO(SIPMIMEInfo, PMIMEInfo);
278  public:
279  SIPMIMEInfo(bool compactForm = false);
280 
281  virtual void PrintOn(ostream & strm) const;
282  virtual bool InternalAddMIME(const PString & fieldName, const PString & fieldValue);
283 
284  void SetCompactForm(bool form) { compactForm = form; }
285 
286  PCaselessString GetContentType(bool includeParameters = false) const;
287  void SetContentType(const PString & v);
288 
289  PCaselessString GetContentEncoding() const;
290  void SetContentEncoding(const PString & v);
291 
292  SIPURL GetFrom() const;
293  void SetFrom(const PString & v);
294 
296  void SetPAssertedIdentity(const PString & v);
297 
299  void SetPPreferredIdentity(const PString & v);
300 
301  PString GetAccept() const;
302  void SetAccept(const PString & v);
303 
304  PString GetAcceptEncoding() const;
305  void SetAcceptEncoding(const PString & v);
306 
307  PString GetAcceptLanguage() const;
308  void SetAcceptLanguage(const PString & v);
309 
310  PString GetAllow() const;
311  unsigned GetAllowBitMask() const;
312  void SetAllow(const PString & v);
313 
314  PString GetCallID() const;
315  void SetCallID(const PString & v);
316 
317  SIPURL GetContact() const;
318  bool GetContacts(SIPURLList & contacts) const;
319  void SetContact(const PString & v);
320 
321  PString GetSubject() const;
322  void SetSubject(const PString & v);
323 
324  SIPURL GetTo() const;
325  void SetTo(const PString & v);
326 
327  PString GetVia() const;
328  void SetVia(const PString & v);
329 
330  bool GetViaList(PStringList & v) const;
331  void SetViaList(const PStringList & v);
332 
333  PString GetFirstVia() const;
335 
336  SIPURL GetReferTo() const;
337  void SetReferTo(const PString & r);
338 
339  SIPURL GetReferredBy() const;
340  void SetReferredBy(const PString & r);
341 
342  PINDEX GetContentLength() const;
343  void SetContentLength(PINDEX v);
344  PBoolean IsContentLengthPresent() const;
345 
346  PString GetCSeq() const;
347  void SetCSeq(const PString & v);
348 
349  PString GetDate() const;
350  void SetDate(const PString & v);
351  void SetDate(const PTime & t);
352  void SetDate(void); // set to current date
353 
354  unsigned GetExpires(unsigned dflt = UINT_MAX) const;// returns default value if not found
355  void SetExpires(unsigned v);
356 
357  PINDEX GetMaxForwards() const;
358  void SetMaxForwards(PINDEX v);
359 
360  PINDEX GetMinExpires() const;
361  void SetMinExpires(PINDEX v);
362 
363  PString GetProxyAuthenticate() const;
364  void SetProxyAuthenticate(const PString & v);
365 
366  PString GetRoute() const;
367  bool GetRoute(SIPURLList & proxies) const;
368  void SetRoute(const PString & v);
369  void SetRoute(const SIPURLList & proxies);
370 
371  PString GetRecordRoute() const;
372  bool GetRecordRoute(SIPURLList & proxies, bool reversed) const;
373  void SetRecordRoute(const PString & v);
374  void SetRecordRoute(const SIPURLList & proxies);
375 
376  unsigned GetCSeqIndex() const { return GetCSeq().AsUnsigned(); }
377 
378  PStringSet GetRequire() const;
379  void SetRequire(const PStringSet & v);
380  void AddRequire(const PString & v);
381 
382  PStringSet GetSupported() const;
383  void SetSupported(const PStringSet & v);
384  void AddSupported(const PString & v);
385 
386  PStringSet GetUnsupported() const;
387  void SetUnsupported(const PStringSet & v);
388  void AddUnsupported(const PString & v);
389 
390  PString GetEvent() const;
391  void SetEvent(const PString & v);
392 
393  PCaselessString GetSubscriptionState(PStringToString & info) const;
394  void SetSubscriptionState(const PString & v);
395 
396  PString GetUserAgent() const;
397  void SetUserAgent(const PString & v);
398 
399  PString GetOrganization() const;
400  void SetOrganization(const PString & v);
401 
402  void GetProductInfo(OpalProductInfo & info) const;
403  void SetProductInfo(const PString & ua, const OpalProductInfo & info);
404 
405  PString GetWWWAuthenticate() const;
406  void SetWWWAuthenticate(const PString & v);
407 
408  PString GetSIPIfMatch() const;
409  void SetSIPIfMatch(const PString & v);
410 
411  PString GetSIPETag() const;
412  void SetSIPETag(const PString & v);
413 
414  void GetAlertInfo(PString & info, int & appearance);
415  void SetAlertInfo(const PString & info, int appearance);
416 
417  PString GetCallInfo() const;
418 
419  PString GetAllowEvents() const;
420  void SetAllowEvents(const PString & v);
421 
425  const PString & fieldName,
426  const PString & paramName,
427  const PString & defaultValue = PString::Empty()
428  ) const { return ExtractFieldParameter((*this)(fieldName), paramName, defaultValue); }
429 
435  const PString & fieldName,
436  const PString & paramName,
437  const PString & newValue
438  ) { SetAt(fieldName, InsertFieldParameter((*this)(fieldName), paramName, newValue)); }
439 
442  static PString ExtractFieldParameter(
443  const PString & fieldValue,
444  const PString & paramName,
445  const PString & defaultValue = PString::Empty()
446  );
447 
452  static PString InsertFieldParameter(
453  const PString & fieldValue,
454  const PString & paramName,
455  const PString & newValue
456  );
457 
458  protected:
459  PStringSet GetTokenSet(const char * field) const;
460  void AddTokenSet(const char * field, const PString & token);
461  void SetTokenSet(const char * field, const PStringSet & tokens);
462 
465 };
466 
467 
469 // SIPAuthentication
470 
471 typedef PHTTPClientAuthentication SIPAuthentication;
472 
473 class SIPAuthenticator : public PHTTPClientAuthentication::AuthObject
474 {
475  public:
476  SIPAuthenticator(SIP_PDU & pdu);
477  virtual PMIMEInfo & GetMIME();
478  virtual PString GetURI();
479  virtual PString GetEntityBody();
480  virtual PString GetMethod();
481 
482  protected:
484 };
485 
486 
487 
489 // SIP_PDU
490 
496 class SIP_PDU : public PSafeObject
497 {
498  PCLASSINFO(SIP_PDU, PSafeObject);
499  public:
500  enum Methods {
516  };
517 
518  enum StatusCodes {
523 
529 
532 
538 
570 
578 
583 
585  };
586 
587  static const char * GetStatusCodeDescription(int code);
588  friend ostream & operator<<(ostream & strm, StatusCodes status);
589 
590  SIP_PDU(
592  );
593 
597  SIP_PDU(
598  const SIP_PDU & request,
599  StatusCodes code,
600  const SDPSessionDescription * sdp = NULL
601  );
602 
603  SIP_PDU(const SIP_PDU &);
604  SIP_PDU & operator=(const SIP_PDU &);
605  ~SIP_PDU();
606 
607  void PrintOn(
608  ostream & strm
609  ) const;
610 
611  void InitialiseHeaders(
612  const SIPURL & dest,
613  const SIPURL & to,
614  const SIPURL & from,
615  const PString & callID,
616  unsigned cseq,
617  const PString & via
618  );
619  void InitialiseHeaders(
620  SIPDialogContext & dialog,
621  const PString & via = PString::Empty(),
622  unsigned cseq = 0
623  );
624  void InitialiseHeaders(
625  SIPConnection & connection,
626  const OpalTransport & transport,
627  unsigned cseq = 0
628  );
629  void InitialiseHeaders(
630  const SIP_PDU & request
631  );
632 
637  bool SetRoute(const SIPURLList & routeSet);
638  bool SetRoute(const SIPURL & proxy);
639 
642  void SetAllow(unsigned bitmask);
643 
646  void AdjustVia(OpalTransport & transport);
647 
648  PString CreateVia(
649  SIPEndPoint & endpoint,
650  const OpalTransport & transport
651  );
652 
656  OpalTransport & transport
657  );
658 
661  PBoolean Write(
662  OpalTransport & transport,
663  const OpalTransportAddress & remoteAddress = OpalTransportAddress(),
664  const PString & localInterface = PString::Empty()
665  );
666 
669  bool SendResponse(
670  OpalTransport & transport,
671  StatusCodes code,
672  SIPEndPoint * endpoint = NULL
673  ) const;
674  bool SendResponse(
675  OpalTransport & transport,
676  SIP_PDU & response,
677  SIPEndPoint * endpoint = NULL
678  ) const;
679 
683  PString Build();
684 
685  PString GetTransactionID() const;
686 
687  Methods GetMethod() const { return m_method; }
690  const SIPURL & GetURI() const { return m_uri; }
691  void SetURI(const SIPURL & newuri) { m_uri = newuri; }
692  unsigned GetVersionMajor() const { return m_versionMajor; }
693  unsigned GetVersionMinor() const { return m_versionMinor; }
694  void SetCSeq(unsigned cseq);
695  const PString & GetEntityBody() const { return m_entityBody; }
696  void SetEntityBody(const PString & body) { m_entityBody = body; }
697  void SetEntityBody();
698  const PString & GetInfo() const { return m_info; }
699  void SetInfo(const PString & info) { m_info = info; }
700  const SIPMIMEInfo & GetMIME() const { return m_mime; }
701  SIPMIMEInfo & GetMIME() { return m_mime; }
702  SDPSessionDescription * GetSDP(const OpalMediaFormatList & masterList);
703  void SetSDP(SDPSessionDescription * sdp);
704 
705  protected:
706  Methods m_method; // Request type, ==NumMethods for Response
708  SIPURL m_uri; // display name & URI, no tag
709  unsigned m_versionMajor;
710  unsigned m_versionMinor;
711  PString m_info;
713  PString m_entityBody;
714 
716 
717  mutable PString m_transactionID;
718 };
719 
720 
721 PQUEUE(SIP_PDU_Queue, SIP_PDU);
722 
723 
724 #if PTRACING
725 ostream & operator<<(ostream & strm, SIP_PDU::Methods method);
726 #endif
727 
728 
730 // SIPDialogContext
731 
735 {
736  public:
738  SIPDialogContext(const SIPMIMEInfo & mime);
739 
740  PString AsString() const;
741  bool FromString(
742  const PString & str
743  );
744 
745  const PString & GetCallID() const { return m_callId; }
746  void SetCallID(const PString & id) { m_callId = id; }
747 
748  const SIPURL & GetRequestURI() const { return m_requestURI; }
749  void SetRequestURI(const SIPURL & url) { m_requestURI = url; }
750 
751  const PString & GetLocalTag() const { return m_localTag; }
752  void SetLocalTag(const PString & tag) { m_localTag = tag; }
753 
754  const SIPURL & GetLocalURI() const { return m_localURI; }
755  void SetLocalURI(const SIPURL & url);
756 
757  const PString & GetRemoteTag() const { return m_remoteTag; }
758  void SetRemoteTag(const PString & tag) { m_remoteTag = tag; }
759 
760  const SIPURL & GetRemoteURI() const { return m_remoteURI; }
761  void SetRemoteURI(const SIPURL & url);
762 
763  const SIPURLList & GetRouteSet() const { return m_routeSet; }
764  void SetRouteSet(const PString & str) { m_routeSet.FromString(str); }
765 
766  const SIPURL & GetProxy() const { return m_proxy; }
767  void SetProxy(const SIPURL & proxy, bool addToRouteSet);
768 
769  void Update(OpalTransport & transport, const SIP_PDU & response);
770 
771  unsigned GetNextCSeq();
772  void IncrementCSeq(unsigned inc) { m_lastSentCSeq += inc; }
773 
774  bool IsDuplicateCSeq(unsigned sequenceNumber);
775 
776  bool IsEstablished() const
777  {
778  return !m_callId.IsEmpty() &&
779  !m_requestURI.IsEmpty() &&
780  !m_localTag.IsEmpty() &&
781  !m_remoteTag.IsEmpty();
782  }
783 
785 
786  void SetForking(bool f) { m_forking = f; }
787 
788  protected:
789  PString m_callId;
792  PString m_localTag;
794  PString m_remoteTag;
796  unsigned m_lastSentCSeq;
799  bool m_forking;
801 };
802 
803 
805 
807 {
809  const PString & aor = PString::Empty(),
810  const PString & remote = PString::Empty()
811  );
812 
813  void Normalise(
814  const PString & defaultUser,
815  const PTimeInterval & defaultExpire
816  );
817 
818  PCaselessString m_remoteAddress;
819  PCaselessString m_localAddress;
820  PCaselessString m_proxyAddress;
821  PCaselessString m_addressOfRecord;
822  PCaselessString m_contactAddress;
823  PCaselessString m_interface;
825  PString m_authID;
826  PString m_password;
827  PString m_realm;
828  unsigned m_expire;
829  unsigned m_restoreTime;
830  PTimeInterval m_minRetryTime;
831  PTimeInterval m_maxRetryTime;
832  void * m_userData;
833 };
834 
835 
836 #if PTRACING
837 ostream & operator<<(ostream & strm, const SIPParameters & params);
838 #endif
839 
840 
842 // SIPTransaction
843 
854 class SIPTransaction : public SIP_PDU
855 {
856  PCLASSINFO(SIPTransaction, SIP_PDU);
857  public:
859  Methods method,
860  SIPEndPoint & endpoint,
861  OpalTransport & transport
862  );
867  Methods method,
868  SIPConnection & connection
869  );
870  ~SIPTransaction();
871 
872  /* Under some circumstances a new transaction with all the same parameters
873  but different ID needs to be created, e.g. when get authentication error. */
874  virtual SIPTransaction * CreateDuplicate() const = 0;
875 
876  PBoolean Start();
877  bool IsTrying() const { return m_state == Trying; }
878  bool IsProceeding() const { return m_state == Proceeding; }
879  bool IsInProgress() const { return m_state == Trying || m_state == Proceeding; }
880  bool IsFailed() const { return m_state > Terminated_Success; }
881  bool IsCompleted() const { return m_state >= Completed; }
883  bool IsTerminated() const { return m_state >= Terminated_Success; }
884 
885  void WaitForCompletion();
886  PBoolean Cancel();
887  void Abort();
888 
889  virtual PBoolean OnReceivedResponse(SIP_PDU & response);
890  virtual PBoolean OnCompleted(SIP_PDU & response);
891 
892  OpalTransport & GetTransport() const { return m_transport; }
894  PString GetInterface() const { return m_localInterface; }
895  void SetInterface(const PString & localIf) { m_localInterface = localIf; }
896 
897  static PString GenerateCallID();
898 
899  protected:
900  bool SendPDU(SIP_PDU & pdu);
901  bool ResendCANCEL();
902  void SetParameters(const SIPParameters & params);
903 
904  PDECLARE_NOTIFIER(PTimer, SIPTransaction, OnRetry);
905  PDECLARE_NOTIFIER(PTimer, SIPTransaction, OnTimeout);
906 
907  enum States {
920  };
921  virtual void SetTerminated(States newState);
922 
925  PSafePtr<SIPConnection> m_connection;
926  PTimeInterval m_retryTimeoutMin;
927  PTimeInterval m_retryTimeoutMax;
928 
930  unsigned m_retry;
931  PTimer m_retryTimer;
933  PSyncPoint m_completed;
934 
937 };
938 
939 
940 #define OPAL_PROXY_PARAM "OPAL-proxy"
941 #define OPAL_LOCAL_ID_PARAM "OPAL-local-id"
942 #define OPAL_INTERFACE_PARAM "OPAL-interface"
943 
944 
946 // SIPResponse
947 
951 {
952  PCLASSINFO(SIPResponse, SIPTransaction);
953  public:
954  SIPResponse(
955  SIPEndPoint & endpoint,
956  StatusCodes code
957  );
958 
959  virtual SIPTransaction * CreateDuplicate() const;
960 
961  bool Send(OpalTransport & transport, const SIP_PDU & command);
962 };
963 
964 
966 // SIPInvite
967 
973 class SIPInvite : public SIPTransaction
974 {
975  PCLASSINFO(SIPInvite, SIPTransaction);
976  public:
977  SIPInvite(
978  SIPConnection & connection,
979  const OpalRTPSessionManager & sm
980  );
981 
982  virtual SIPTransaction * CreateDuplicate() const;
983 
984  virtual PBoolean OnReceivedResponse(SIP_PDU & response);
985 
988 
989  protected:
991 };
992 
993 
995 
996 /* This is the ACK request sent when receiving a response to an outgoing
997  * INVITE.
998  */
999 class SIPAck : public SIP_PDU
1000 {
1001  PCLASSINFO(SIPAck, SIP_PDU);
1002  public:
1003  SIPAck(
1004  SIPTransaction & invite,
1005  SIP_PDU & response
1006  );
1007 
1008  virtual SIPTransaction * CreateDuplicate() const;
1009 };
1010 
1011 
1013 
1014 /* This is a BYE request
1015  */
1016 class SIPBye : public SIPTransaction
1017 {
1018  PCLASSINFO(SIPBye, SIPTransaction);
1019 
1020  public:
1021  SIPBye(
1022  SIPEndPoint & ep,
1023  OpalTransport & trans,
1024  SIPDialogContext dialog
1025  );
1026  SIPBye(
1027  SIPConnection & conn
1028  );
1029 
1030  virtual SIPTransaction * CreateDuplicate() const;
1031 };
1032 
1033 
1035 
1037 {
1038  PCLASSINFO(SIPRegister, SIPTransaction);
1039  public:
1056  };
1057 
1059  struct Params : public SIPParameters {
1063  { }
1064 
1065  Params(const Params & param)
1066  : SIPParameters(param)
1069  { }
1070 
1071  PCaselessString & m_registrarAddress; // For backward compatibility
1073  };
1074 
1075  SIPRegister(
1076  SIPEndPoint & endpoint,
1077  OpalTransport & transport,
1078  const PString & callId,
1079  unsigned cseq,
1080  const Params & params
1081  );
1082 
1083  virtual SIPTransaction * CreateDuplicate() const;
1084 };
1085 
1086 
1087 #if PTRACING
1088 ostream & operator<<(ostream & strm, SIPRegister::CompatibilityModes mode);
1089 ostream & operator<<(ostream & strm, const SIPRegister::Params & params);
1090 #endif
1091 
1092 
1094 
1096 {
1097  PCLASSINFO(SIPSubscribe, SIPTransaction);
1098  public:
1105 
1107 
1108  Watcher = 0x8000,
1109 
1113 
1115  };
1117 
1118  class EventPackage : public PCaselessString
1119  {
1120  PCLASSINFO(EventPackage, PCaselessString);
1121  public:
1123  explicit EventPackage(const PString & str) : PCaselessString(str) { }
1124  explicit EventPackage(const char * str) : PCaselessString(str) { }
1125 
1127  EventPackage & operator=(const PString & str) { PCaselessString::operator=(str); return *this; }
1128  EventPackage & operator=(const char * str) { PCaselessString::operator=(str); return *this; }
1129 
1130  bool operator==(PredefinedPackages pkg) const { return Compare(EventPackage(pkg)) == EqualTo; }
1131  bool operator==(const PString & str) const { return Compare(str) == EqualTo; }
1132  bool operator==(const char * cstr) const { return InternalCompare(0, P_MAX_INDEX, cstr) == EqualTo; }
1133  virtual Comparison InternalCompare(PINDEX offset, PINDEX length, const char * cstr) const;
1134 
1135  bool IsWatcher() const;
1136  };
1137 
1146  void * m_userData;
1147  };
1148 
1151  SIPEndPoint & ep,
1152  OpalTransport & trans,
1153  SIP_PDU & notify,
1154  SIP_PDU & response
1155  );
1156 
1157  bool SendResponse(
1158  SIP_PDU::StatusCodes status,
1159  const char * extra = NULL
1160  );
1161 
1167  };
1168 
1169  struct Params : public SIPParameters
1170  {
1173  , m_eventPackage(pkg)
1174  , m_eventList(false)
1175  { }
1176 
1177  Params(const Params & param)
1178  : SIPParameters(param)
1181  , m_eventList(param.m_eventList)
1182  , m_contentType(param.m_contentType)
1184  , m_onNotify(param.m_onNotify)
1185  { }
1186 
1187  PCaselessString & m_agentAddress; // For backward compatibility
1189  bool m_eventList; // Enable RFC4662
1190  PCaselessString m_contentType; // May be \n separated list of types
1191 
1192  PNotifierTemplate<const SubscriptionStatus &> m_onSubcribeStatus;
1193  PNotifierTemplate<NotifyCallbackInfo &> m_onNotify;
1194  };
1195 
1196  SIPSubscribe(
1197  SIPEndPoint & ep,
1198  OpalTransport & trans,
1199  SIPDialogContext & dialog,
1200  const Params & params
1201  );
1202 
1203  virtual SIPTransaction * CreateDuplicate() const;
1204 };
1205 
1206 
1207 #if PTRACING
1208 ostream & operator<<(ostream & strm, const SIPSubscribe::Params & params);
1209 #endif
1210 
1211 
1213 
1214 
1216 
1217 class SIPHandler;
1218 
1220 {
1221 public:
1223  virtual PCaselessString GetContentType() const = 0;
1224  virtual bool ValidateContentType(const PString & type, const SIPMIMEInfo & mime);
1225  virtual bool OnReceivedNOTIFY(SIPHandler & handler, SIP_PDU & request) = 0;
1226  virtual PString OnSendNOTIFY(SIPHandler & /*handler*/, const PObject * /*body*/) { return PString::Empty(); }
1227 };
1228 
1229 
1230 typedef PFactory<SIPEventPackageHandler, SIPEventPackage> SIPEventPackageFactory;
1231 
1232 
1234 
1236 {
1237  PCLASSINFO(SIPNotify, SIPTransaction);
1238  public:
1239  SIPNotify(
1240  SIPEndPoint & ep,
1241  OpalTransport & trans,
1242  SIPDialogContext & dialog,
1243  const SIPEventPackage & eventPackage,
1244  const PString & state,
1245  const PString & body
1246  );
1247 
1248  virtual SIPTransaction * CreateDuplicate() const;
1249 };
1250 
1251 
1253 
1255 {
1256  PCLASSINFO(SIPPublish, SIPTransaction);
1257  public:
1258  SIPPublish(
1259  SIPEndPoint & ep,
1260  OpalTransport & trans,
1261  const PString & id,
1262  const PString & sipIfMatch,
1263  const SIPSubscribe::Params & params,
1264  const PString & body
1265  );
1266 
1267  virtual SIPTransaction * CreateDuplicate() const;
1268 };
1269 
1270 
1272 
1273 class SIPRefer : public SIPTransaction
1274 {
1275  PCLASSINFO(SIPRefer, SIPTransaction);
1276  public:
1277  SIPRefer(
1278  SIPConnection & connection,
1279  const SIPURL & referTo,
1280  const SIPURL & referred_by,
1281  bool referSub
1282  );
1283 
1284  virtual SIPTransaction * CreateDuplicate() const;
1285 };
1286 
1287 
1289 
1290 /* This is not a generic NOTIFY PDU, but the minimal one
1291  * that gets sent when receiving a REFER
1292  */
1294 {
1295  PCLASSINFO(SIPReferNotify, SIPTransaction);
1296  public:
1298  SIPConnection & connection,
1299  StatusCodes code
1300  );
1301 
1302  virtual SIPTransaction * CreateDuplicate() const;
1303 };
1304 
1305 
1307 
1308 /* This is a MESSAGE PDU, with a body
1309  */
1311 {
1312  PCLASSINFO(SIPMessage, SIPTransaction);
1313  public:
1314  struct Params : public SIPParameters
1315  {
1317  : m_contentType("text/plain;charset=UTF-8")
1318  {
1319  m_expire = 5000;
1320  }
1321 
1322  PCaselessString m_contentType;
1323  PString m_id;
1324  PString m_body;
1325  PAtomicInteger::IntegerType m_messageId;
1326  };
1327 
1328  SIPMessage(
1329  SIPEndPoint & ep,
1330  OpalTransport & trans,
1331  const Params & params
1332  );
1333  SIPMessage(
1334  SIPConnection & connection,
1335  const Params & params
1336  );
1337 
1338  virtual SIPTransaction * CreateDuplicate() const;
1339 
1340  const SIPURL & GetLocalAddress() const { return m_localAddress; }
1341 
1342  private:
1343  void Construct(const Params & params);
1344 
1345  SIPURL m_localAddress;
1346 };
1347 
1348 
1350 
1351 /* This is an OPTIONS request
1352  */
1354 {
1355  PCLASSINFO(SIPOptions, SIPTransaction);
1356 
1357  public:
1358  struct Params : public SIPParameters
1359  {
1361  : m_acceptContent("application/sdp, application/media_control+xml, application/dtmf, application/dtmf-relay")
1362  {
1363  }
1364 
1365  PCaselessString m_acceptContent;
1366  PCaselessString m_contentType;
1367  PString m_body;
1368  };
1369 
1370  SIPOptions(
1371  SIPEndPoint & ep,
1372  OpalTransport & trans,
1373  const PString & id,
1374  const Params & params
1375  );
1376  SIPOptions(
1377  SIPConnection & conn,
1378  const Params & params
1379  );
1380 
1381  virtual SIPTransaction * CreateDuplicate() const;
1382 
1383  protected:
1384  void Construct(const Params & params);
1385 };
1386 
1387 
1389 
1390 /* This is an INFO request
1391  */
1392 class SIPInfo : public SIPTransaction
1393 {
1394  PCLASSINFO(SIPInfo, SIPTransaction);
1395 
1396  public:
1397  struct Params
1398  {
1399  Params(const PString & contentType = PString::Empty(),
1400  const PString & body = PString::Empty())
1401  : m_contentType(contentType)
1402  , m_body(body)
1403  {
1404  }
1405 
1406  PCaselessString m_contentType;
1407  PString m_body;
1408  };
1409 
1410  SIPInfo(
1411  SIPConnection & conn,
1412  const Params & params
1413  );
1414 
1415  virtual SIPTransaction * CreateDuplicate() const;
1416 };
1417 
1418 
1420 
1421 /* This is a PING PDU, with a body
1422  */
1423 class SIPPing : public SIPTransaction
1424 {
1425  PCLASSINFO(SIPPing, SIPTransaction);
1426 
1427  public:
1428  SIPPing(
1429  SIPEndPoint & ep,
1430  OpalTransport & trans,
1431  const SIPURL & address
1432  );
1433 
1434  virtual SIPTransaction * CreateDuplicate() const;
1435 };
1436 
1437 
1439 
1440 /* This is a PRACK PDU
1441  */
1442 class SIPPrack : public SIPTransaction
1443 {
1444  PCLASSINFO(SIPPrack, SIPTransaction);
1445 
1446  public:
1447  SIPPrack(
1448  SIPConnection & conn,
1449  const PString & rack
1450  );
1451 
1452  virtual SIPTransaction * CreateDuplicate() const;
1453 };
1454 
1455 
1456 #endif // OPAL_SIP
1457 
1458 #endif // OPAL_SIP_SIPPDU_H
1459 
1460 
1461 // End of File ///////////////////////////////////////////////////////////////
Definition: sippdu.h:1108
PNotifierTemplate< const SubscriptionStatus & > m_onSubcribeStatus
Definition: sippdu.h:1192
static PString ExtractFieldParameter(const PString &fieldValue, const PString &paramName, const PString &defaultValue=PString::Empty())
SIPReferNotify(SIPConnection &connection, StatusCodes code)
void SetUserAgent(const PString &v)
Definition: sippdu.h:1118
bool ReallyInternalParse(bool fromField, const char *cstr, const char *defaultScheme)
PCaselessString m_contactAddress
Definition: sippdu.h:822
SIP_PDU & m_pdu
Definition: sippdu.h:483
PString GetRecordRoute() const
Definition: sippdu.h:70
SIPBye(SIPEndPoint &ep, OpalTransport &trans, SIPDialogContext dialog)
PString GetFieldParameter(const PString &fieldName, const PString &paramName, const PString &defaultValue=PString::Empty()) const
Definition: sippdu.h:424
virtual PString GetMethod()
Definition: sippdu.h:566
PString GetOrganization() const
PTimeInterval m_retryTimeoutMin
Definition: sippdu.h:926
const SIPURL & GetProxy() const
Definition: sippdu.h:766
Definition: sippdu.h:1114
void AdjustVia(OpalTransport &transport)
Definition: sippdu.h:563
SIP_PDU & operator=(const SIP_PDU &)
Definition: sippdu.h:505
Definition: sippdu.h:511
Definition: sippdu.h:582
SIPOptions(SIPEndPoint &ep, OpalTransport &trans, const PString &id, const Params &params)
Methods m_method
Definition: sippdu.h:706
PCaselessString m_interface
Definition: sippdu.h:823
virtual PBoolean OnReceivedResponse(SIP_PDU &response)
void SetFrom(const PString &v)
PString GetAcceptLanguage() const
bool IsInProgress() const
Definition: sippdu.h:879
friend ostream & operator<<(ostream &strm, const SIPURLList &urls)
virtual SIPTransaction * CreateDuplicate() const
Definition: sippdu.h:501
Definition: sippdu.h:1095
void SetMaxForwards(PINDEX v)
unsigned m_restoreTime
Definition: sippdu.h:829
Definition: sippdu.h:950
void SetWWWAuthenticate(const PString &v)
void AddRequire(const PString &v)
unsigned GetVersionMinor() const
Definition: sippdu.h:693
SIPURL GetReferTo() const
PString GetAllowEvents() const
PStringSet GetUnsupported() const
PredefinedPackages
Definition: sippdu.h:1101
void SetEntityBody(const PString &body)
Definition: sippdu.h:696
PQUEUE(SIP_PDU_Queue, SIP_PDU)
Definition: sippdu.h:854
OpalProductInfo m_productInfo
Server product info from registrar if available.
Definition: sippdu.h:1145
Definition: sippdu.h:1310
PBoolean AdjustToDNS(PINDEX entry=0)
SIPMIMEInfo & GetMIME()
Definition: sippdu.h:701
void SetContentEncoding(const PString &v)
PCaselessString & m_registrarAddress
Definition: sippdu.h:1071
PString GetVia() const
void SetSIPIfMatch(const PString &v)
void SetProductInfo(const PString &ua, const OpalProductInfo &info)
Definition: sippdu.h:522
void SetProxyAuthenticate(const PString &v)
SIP_PDU::StatusCodes m_reason
Reason for status change.
Definition: sippdu.h:1144
Definition: sippdu.h:275
bool m_forking
Definition: sippdu.h:799
void ParseAsAddress(const PString &name, const OpalTransportAddress &_address, WORD listenerPort=0)
Definition: sippdu.h:1314
virtual SIPTransaction * CreateDuplicate() const
PTimer m_retryTimer
Definition: sippdu.h:931
virtual SIPTransaction * CreateDuplicate() const
void SetAllow(const PString &v)
void SetProxy(const SIPURL &proxy, bool addToRouteSet)
void SetContentLength(PINDEX v)
Definition: sippdu.h:1016
PString AsQuotedString() const
virtual SIPTransaction * CreateDuplicate() const
NotifyCallbackInfo(SIPEndPoint &ep, OpalTransport &trans, SIP_PDU &notify, SIP_PDU &response)
virtual SIPTransaction * CreateDuplicate() const =0
const PString & GetEntityBody() const
Definition: sippdu.h:695
virtual PBoolean InternalParse(const char *cstr, const char *defaultScheme)
Definition: sippdu.h:212
void SetContentType(const PString &v)
virtual Comparison Compare(const PObject &obj) const
SIPRegister(SIPEndPoint &endpoint, OpalTransport &transport, const PString &callId, unsigned cseq, const Params &params)
virtual void PrintOn(ostream &strm) const
virtual bool ValidateContentType(const PString &type, const SIPMIMEInfo &mime)
Definition: sippdu.h:530
void SetAcceptEncoding(const PString &v)
PString GetAccept() const
OpalTransport & GetTransport() const
Definition: sippdu.h:892
PString GetWWWAuthenticate() const
OpalRTPSessionManager & GetSessionManager()
Definition: sippdu.h:987
Definition: sipcon.h:126
static PString InsertFieldParameter(const PString &fieldValue, const PString &paramName, const PString &newValue)
PTimer m_completionTimer
Definition: sippdu.h:932
SIPAuthenticator(SIP_PDU &pdu)
void SetRequire(const PStringSet &v)
void * m_userData
User data corresponding to this registration.
Definition: sippdu.h:1146
PDECLARE_NOTIFIER(PTimer, SIPTransaction, OnRetry)
virtual SIPTransaction * CreateDuplicate() const
PString m_body
Definition: sippdu.h:1324
bool ResendCANCEL()
bool SendResponse(OpalTransport &transport, StatusCodes code, SIPEndPoint *endpoint=NULL) const
void SetTag(const PString &tag=PString::Empty(), bool force=false)
Set a tag with a new unique ID.
PString m_remoteTag
Definition: sippdu.h:794
bool IsTrying() const
Definition: sippdu.h:877
Definition: sippdu.h:541
StatusCodes m_statusCode
Definition: sippdu.h:707
Definition: transports.h:703
SIP_PDU::StatusCodes Read(OpalTransport &transport)
Definition: rtpconn.h:159
Definition: sippdu.h:507
SIPTransaction(Methods method, SIPEndPoint &endpoint, OpalTransport &transport)
PTimeInterval m_maxRetryTime
Definition: sippdu.h:831
Definition: sippdu.h:1442
Definition: sippdu.h:1104
Definition: sippdu.h:1169
SIPURL m_uri
Definition: sippdu.h:708
EventPackage(PredefinedPackages=NumPredefinedPackages)
Definition: sipep.h:86
const PString & GetInfo() const
Definition: sippdu.h:698
PString GetProxyAuthenticate() const
virtual SIPTransaction * CreateDuplicate() const
Definition: sippdu.h:560
PString GetAcceptEncoding() const
PCaselessString m_contentType
Definition: sippdu.h:1406
PStringOptions & GetFieldParameters()
Definition: sippdu.h:159
Definition: sippdu.h:1103
PString m_realm
Definition: sippdu.h:827
SDPSessionDescription * GetSDP(const OpalMediaFormatList &masterList)
Definition: sippdu.h:580
Definition: sippdu.h:572
PString m_displayName
Definition: sippdu.h:223
Definition: sippdu.h:571
void SetLocalTag(const PString &tag)
Definition: sippdu.h:752
bool operator==(PredefinedPackages pkg) const
Definition: sippdu.h:1130
PCaselessString m_contentType
Definition: sippdu.h:1366
Definition: sippdu.h:531
SIPEndPoint & m_endpoint
Definition: sippdu.h:923
StatusCodes
Definition: sippdu.h:518
Definition: sippdu.h:496
void SetExpires(unsigned v)
PCaselessString m_remoteAddress
Definition: sippdu.h:818
Definition: sippdu.h:1110
Definition: sippdu.h:547
SDPSessionDescription * m_SDP
Definition: sippdu.h:715
void AddSupported(const PString &v)
PCaselessString & m_agentAddress
Definition: sippdu.h:1187
void SetDate(void)
Definition: sippdu.h:1293
SIPURL & operator=(const PURL &url)
Definition: sippdu.h:79
SIPURLList m_routeSet
Definition: sippdu.h:795
bool GetViaList(PStringList &v) const
PString GetCallID() const
SIPURL m_localURI
Definition: sippdu.h:791
const PString & GetLocalTag() const
Definition: sippdu.h:751
void SetCompactForm(bool form)
Definition: sippdu.h:284
SIPURL GetPPreferredIdentity() const
EventPackage & operator=(const PString &str)
Definition: sippdu.h:1127
virtual PString GetEntityBody()
Definition: sippdu.h:999
Definition: sippdu.h:509
Registration Contact header field.
Definition: sippdu.h:177
SIPURL m_proxy
Definition: sippdu.h:800
PString m_addressofRecord
Address of record for registration.
Definition: sippdu.h:1141
PString GetSIPETag() const
Definition: sippdu.h:510
bool SendResponse(SIP_PDU::StatusCodes status, const char *extra=NULL)
PCaselessString GetContentEncoding() const
PString m_body
Definition: sippdu.h:1367
virtual SIPTransaction * CreateDuplicate() const
Definition: sippdu.h:543
Definition: sippdu.h:568
Definition: sippdu.h:557
SIP_PDU & m_response
Definition: sippdu.h:1165
SIPEndPoint & m_endpoint
Definition: sippdu.h:1162
Definition: sippdu.h:521
OpalRTPSessionManager m_rtpSessions
Definition: sippdu.h:990
SIPNotify(SIPEndPoint &ep, OpalTransport &trans, SIPDialogContext &dialog, const SIPEventPackage &eventPackage, const PString &state, const PString &body)
void SetRouteSet(const PString &str)
Definition: sippdu.h:764
unsigned m_lastSentCSeq
Definition: sippdu.h:796
void SetReferredBy(const PString &r)
Definition: sippdu.h:1254
SIPSubscribe::EventPackage SIPEventPackage
Definition: sippdu.h:1212
virtual SIPTransaction * CreateDuplicate() const
CompatibilityModes
Definition: sippdu.h:1040
void SetAlertInfo(const PString &info, int appearance)
void SetVia(const PString &v)
PString GetUserAgent() const
const SIPMIMEInfo & GetMIME() const
Definition: sippdu.h:700
virtual SIPTransaction * CreateDuplicate() const
PTimeInterval m_minRetryTime
Definition: sippdu.h:830
void SetSIPETag(const PString &v)
States m_state
Definition: sippdu.h:929
PString GetSubject() const
PString Build()
Definition: sippdu.h:512
virtual PString GetURI()
SIPURL & operator=(const PString &str)
Definition: sippdu.h:99
bool operator==(const char *cstr) const
Definition: sippdu.h:1132
Definition: sippdu.h:561
void SetCSeq(const PString &v)
PCaselessString m_contentType
Definition: sippdu.h:1322
virtual PBoolean OnCompleted(SIP_PDU &response)
Params()
Definition: sippdu.h:1360
unsigned m_lastReceivedCSeq
Definition: sippdu.h:797
bool SetRoute(const SIPURLList &routeSet)
Definition: sippdu.h:515
void SetAcceptLanguage(const PString &v)
void SetOrganization(const PString &v)
void SetURI(const SIPURL &newuri)
Definition: sippdu.h:691
virtual bool InternalAddMIME(const PString &fieldName, const PString &fieldValue)
PString GetFirstVia() const
Definition: sippdu.h:548
void GetAlertInfo(PString &info, int &appearance)
CompatibilityModes m_compatibility
Definition: sippdu.h:1072
PCaselessString m_localAddress
Definition: sippdu.h:819
Definition: mediafmt.h:72
Definition: sippdu.h:973
Definition: sippdu.h:1041
SIPMIMEInfo(bool compactForm=false)
bool IsFailed() const
Definition: sippdu.h:880
virtual PMIMEInfo & GetMIME()
Definition: sippdu.h:552
Definition: sippdu.h:533
SIP_PDU(Methods method=SIP_PDU::NumMethods)
General Contact header field.
Definition: sippdu.h:176
void SetPPreferredIdentity(const PString &v)
bool IsProceeding() const
Definition: sippdu.h:878
const OpalRTPSessionManager & GetSessionManager() const
Definition: sippdu.h:986
void SetSubject(const PString &v)
const SIPURL & GetLocalAddress() const
Definition: sippdu.h:1340
SIPPublish(SIPEndPoint &ep, OpalTransport &trans, const PString &id, const PString &sipIfMatch, const SIPSubscribe::Params &params, const PString &body)
PString ToString() const
void SetContact(const PString &v)
void SetSubscriptionState(const PString &v)
Definition: sippdu.h:473
Definition: sippdu.h:1111
Definition: sippdu.h:564
Definition: sippdu.h:1353
Redirect Contact header field.
Definition: sippdu.h:175
void SetViaList(const PStringList &v)
Definition: sippdu.h:1358
void AddUnsupported(const PString &v)
virtual PBoolean OnReceivedResponse(SIP_PDU &response)
PString m_authID
Definition: sippdu.h:825
Definition: sippdu.h:540
static PString GenerateCallID()
Definition: sippdu.h:514
unsigned m_versionMinor
Definition: sippdu.h:710
const PString & GetRemoteTag() const
Definition: sippdu.h:757
SIPResponse(SIPEndPoint &endpoint, StatusCodes code)
PAtomicInteger::IntegerType m_messageId
Definition: sippdu.h:1325
Params()
Definition: sippdu.h:1316
unsigned m_retry
Definition: sippdu.h:930
SIPPrack(SIPConnection &conn, const PString &rack)
PCaselessString m_acceptContent
Definition: sippdu.h:1365
void SetReferTo(const PString &r)
Definition: sippdu.h:513
Definition: sippdu.h:555
Definition: handlers.h:54
Definition: sippdu.h:1106
SIPURL m_remoteURI
Definition: sippdu.h:793
PCaselessString GetSubscriptionState(PStringToString &info) const
Definition: sippdu.h:912
Definition: sippdu.h:569
Definition: sippdu.h:1423
virtual SIPTransaction * CreateDuplicate() const
Definition: sippdu.h:539
static PString GenerateTag()
Generate a unique string suitable as a dialog tag.
PCaselessString m_contentType
Definition: sippdu.h:1190
Definition: sippdu.h:806
virtual SIPTransaction * CreateDuplicate() const
Definition: sdp.h:300
PTimeInterval m_retryTimeoutMax
Definition: sippdu.h:927
void IncrementCSeq(unsigned inc)
Definition: sippdu.h:772
Definition: sippdu.h:577
bool m_reSubscribing
Was a registration refresh.
Definition: sippdu.h:1143
bool operator==(const PString &str) const
Definition: sippdu.h:1131
void SetParameters(const SIPParameters &params)
PString m_localTag
Definition: sippdu.h:792
Definition: sippdu.h:549
PString GetCSeq() const
OpalTransportAddress m_externalTransportAddress
Definition: sippdu.h:798
void SetRemoteURI(const SIPURL &url)
void SetMinExpires(PINDEX v)
Methods GetMethod() const
Definition: sippdu.h:687
virtual PCaselessString GetContentType() const =0
EventPackage(const char *str)
Definition: sippdu.h:1124
EventPackage & operator=(const char *str)
Definition: sippdu.h:1128
Definition: sippdu.h:542
SIPInfo(SIPConnection &conn, const Params &params)
Definition: sippdu.h:508
PString GetAllow() const
Definition: sippdu.h:556
const SIPURL & GetRemoteURI() const
Definition: sippdu.h:760
void PrintOn(ostream &strm) const
Definition: sippdu.h:909
PString GetRoute() const
Definition: sippdu.h:565
Definition: sippdu.h:1139
unsigned GetAllowBitMask() const
Definition: sippdu.h:1102
Definition: sippdu.h:1036
Definition: sippdu.h:734
PHTTPClientAuthentication SIPAuthentication
Definition: sippdu.h:471
friend PredefinedPackages operator|(PredefinedPackages p1, PredefinedPackages p2)
Definition: sippdu.h:1116
PINDEX GetMaxForwards() const
Definition: sippdu.h:526
PString GetTransactionID() const
Params(const Params &param)
Definition: sippdu.h:1177
PBoolean Write(OpalTransport &transport, const OpalTransportAddress &remoteAddress=OpalTransportAddress(), const PString &localInterface=PString::Empty())
Definition: sippdu.h:1219
void * m_userData
Definition: sippdu.h:832
Definition: sippdu.h:918
To header field.
Definition: sippdu.h:172
UsageContext
Definition: sippdu.h:169
URI on REGISTER request line.
Definition: sippdu.h:178
Request-URI (after the INVITE)
Definition: sippdu.h:171
virtual ~SIPEventPackageHandler()
Definition: sippdu.h:1222
OpalTransportAddress m_remoteAddress
Definition: sippdu.h:936
SIPURL GetFrom() const
PString m_callId
Definition: sippdu.h:789
unsigned GetCSeqIndex() const
Definition: sippdu.h:376
PCaselessString m_addressOfRecord
Definition: sippdu.h:821
void SetInterface(const PString &localIf)
Definition: sippdu.h:895
PString AsString() const
virtual void SetTerminated(States newState)
void SetRecordRoute(const PString &v)
void SetDisplayName(const PString &str)
Definition: sippdu.h:152
bool GetContacts(SIPURLList &contacts) const
SIPSubscribe(SIPEndPoint &ep, OpalTransport &trans, SIPDialogContext &dialog, const Params &params)
void SetUnsupported(const PStringSet &v)
ostream & operator<<(ostream &strm, OpalSilenceDetector::Mode mode)
void SetLocalURI(const SIPURL &url)
Definition: sippdu.h:913
Definition: sippdu.h:1235
Definition: sippdu.h:520
virtual PString OnSendNOTIFY(SIPHandler &, const PObject *)
Definition: sippdu.h:1226
StatusCodes GetStatusCode() const
Definition: sippdu.h:688
void SetCallID(const PString &v)
void Update(OpalTransport &transport, const SIP_PDU &response)
SIPAck(SIPTransaction &invite, SIP_PDU &response)
static const char * GetStatusCodeDescription(int code)
virtual SIPTransaction * CreateDuplicate() const
Definition: sippdu.h:562
Definition: sippdu.h:910
SIPURL(const PURL &url)
Definition: sippdu.h:76
PString m_id
Definition: sippdu.h:1323
PINDEX GetContentLength() const
Definition: sippdu.h:550
bool IsEstablished() const
Definition: sippdu.h:776
PString m_localInterface
Definition: sippdu.h:935
SIPURL GetContact() const
virtual Comparison InternalCompare(PINDEX offset, PINDEX length, const char *cstr) const
PNotifierTemplate< NotifyCallbackInfo & > m_onNotify
Definition: sippdu.h:1193
const SIPURL & GetRequestURI() const
Definition: sippdu.h:748
SIPURL m_requestURI
Definition: sippdu.h:790
Definition: sippdu.h:544
bool IsCanceled() const
Definition: sippdu.h:882
Definition: sippdu.h:536
bool Send(OpalTransport &transport, const SIP_PDU &command)
Definition: sippdu.h:567
void Sanitise(UsageContext context)
Definition: sippdu.h:917
void SetAllowEvents(const PString &v)
Definition: sippdu.h:911
Params(const PString &contentType=PString::Empty(), const PString &body=PString::Empty())
Definition: sippdu.h:1399
Definition: sippdu.h:524
void SetPAssertedIdentity(const PString &v)
unsigned GetVersionMajor() const
Definition: sippdu.h:692
const SIPURL & GetURI() const
Definition: sippdu.h:690
void GetProductInfo(OpalProductInfo &info) const
URI used anywhere outside of protocol.
Definition: sippdu.h:170
virtual SIPTransaction * CreateDuplicate() const
Definition: handlers.h:222
OpalTransportAddress GetViaReceivedAddress() const
OpalTransportAddress GetHostAddress() const
SIPMIMEInfo m_mime
Definition: sippdu.h:824
Registrar parameters.
Definition: sippdu.h:1059
SIPURL GetPAssertedIdentity() const
PCaselessString m_proxyAddress
Definition: sippdu.h:820
OpalTransport & m_transport
Definition: sippdu.h:924
PBoolean Start()
void SetEntityBody()
void SetInfo(const PString &info)
Definition: sippdu.h:699
void SetCallID(const PString &id)
Definition: sippdu.h:746
Params(const Params &param)
Definition: sippdu.h:1065
Params()
Definition: sippdu.h:1060
Definition: sippdu.h:919
void SetSupported(const PStringSet &v)
virtual SIPTransaction * CreateDuplicate() const
bool m_sendResponse
Definition: sippdu.h:1166
void SetRoute(const PString &v)
bool m_eventList
Definition: sippdu.h:1189
SIP_PDU & m_notify
Definition: sippdu.h:1164
Definition: sippdu.h:914
SIPPing(SIPEndPoint &ep, OpalTransport &trans, const SIPURL &address)
SIPURL GetReferredBy() const
Definition: sippdu.h:1392
Definition: sippdu.h:228
Definition: sippdu.h:1112
void Construct(const Params &params)
PStringSet GetSupported() const
Definition: sippdu.h:584
PString GetSIPIfMatch() const
bool IsCompleted() const
Definition: sippdu.h:881
SIPURL GetTo() const
Definition: sippdu.h:545
void SetAllow(unsigned bitmask)
void SetForking(bool f)
Definition: sippdu.h:786
void SetTo(const PString &v)
const SIPURL & GetLocalURI() const
Definition: sippdu.h:754
PStringSet GetRequire() const
void SetAccept(const PString &v)
Definition: sippdu.h:527
Methods
Definition: sippdu.h:500
void SetCSeq(unsigned cseq)
unsigned m_versionMajor
Definition: sippdu.h:709
const SIPURLList & GetRouteSet() const
Definition: sippdu.h:763
OpalTransport & m_transport
Definition: sippdu.h:1163
void SetFieldParameter(const PString &fieldName, const PString &paramName, const PString &newValue)
Definition: sippdu.h:434
friend ostream & operator<<(ostream &strm, StatusCodes status)
Definition: sippdu.h:1273
const PStringOptions & GetFieldParameters() const
Return string options in field parameters.
Definition: sippdu.h:158
void SetTokenSet(const char *field, const PStringSet &tokens)
PString m_transactionID
Definition: sippdu.h:717
void SetHostAddress(const OpalTransportAddress &addr)
PBoolean Cancel()
SIPMessage(SIPEndPoint &ep, OpalTransport &trans, const Params &params)
bool FromString(const PString &str)
bool IsTerminated() const
Definition: sippdu.h:883
Params(PredefinedPackages pkg=NumPredefinedPackages)
Definition: sippdu.h:1171
void SetStatusCode(StatusCodes c)
Definition: sippdu.h:689
SIPURL & operator=(const char *cstr)
Definition: sippdu.h:89
PFactory< SIPEventPackageHandler, SIPEventPackage > SIPEventPackageFactory
Definition: sippdu.h:1230
SIPMIMEInfo m_mime
Definition: sippdu.h:712
Definition: sippdu.h:573
void SetEvent(const PString &v)
PSyncPoint m_completed
Definition: sippdu.h:933
SIPRefer(SIPConnection &connection, const SIPURL &referTo, const SIPURL &referred_by, bool referSub)
EventPackage & operator=(PredefinedPackages pkg)
Definition: sippdu.h:503
SIPSubscribeHandler * m_handler
Handler for subscription.
Definition: sippdu.h:1140
PString GetInterface() const
Definition: sippdu.h:894
const PString & GetCallID() const
Definition: sippdu.h:745
PString GetDisplayName(PBoolean useDefault=true) const
States
Definition: sippdu.h:907
Definition: sippdu.h:1149
Definition: transports.h:149
PString m_info
Definition: sippdu.h:711
OpalTransportAddress GetRemoteTransportAddress() const
EventPackage m_eventPackage
Definition: sippdu.h:1188
void SetRequestURI(const SIPURL &url)
Definition: sippdu.h:749
bool compactForm
Encode using compact form.
Definition: sippdu.h:464
bool IsDuplicateCSeq(unsigned sequenceNumber)
Definition: sippdu.h:525
unsigned GetExpires(unsigned dflt=UINT_MAX) const
SIPParameters(const PString &aor=PString::Empty(), const PString &remote=PString::Empty())
virtual SIPTransaction * CreateDuplicate() const
void InitialiseHeaders(const SIPURL &dest, const SIPURL &to, const SIPURL &from, const PString &callID, unsigned cseq, const PString &via)
PCaselessString GetContentType(bool includeParameters=false) const
Definition: sippdu.h:519
void SetRemoteTag(const PString &tag)
Definition: sippdu.h:758
void AddTokenSet(const char *field, const PString &token)
void WaitForCompletion()
bool FromString(const PString &str, SIPURL::UsageContext context=SIPURL::RouteURI, bool reversed=false)
SIPInvite(SIPConnection &connection, const OpalRTPSessionManager &sm)
virtual bool OnReceivedNOTIFY(SIPHandler &handler, SIP_PDU &request)=0
unsigned m_expire
Definition: sippdu.h:828
void Normalise(const PString &defaultUser, const PTimeInterval &defaultExpire)
From header field.
Definition: sippdu.h:173
PINDEX GetMinExpires() const
PString m_entityBody
Definition: sippdu.h:713
Definition: sippdu.h:1397
PStringSet GetTokenSet(const char *field) const
PString GetEvent() const
Definition: sippdu.h:575
SIPConnection * GetConnection() const
Definition: sippdu.h:893
PStringOptions m_fieldParameters
Definition: sippdu.h:224
bool SendPDU(SIP_PDU &pdu)
PString m_password
Definition: sippdu.h:826
PString m_body
Definition: sippdu.h:1407
Definition: sippdu.h:908
Definition: sippdu.h:506
Record-Route header field.
Definition: sippdu.h:174
PBoolean IsContentLengthPresent() const
EventPackage(const PString &str)
Definition: sippdu.h:1123
Definition: connection.h:312
PString CreateVia(SIPEndPoint &endpoint, const OpalTransport &transport)
PString GetCallInfo() const
PSafePtr< SIPConnection > m_connection
Definition: sippdu.h:925
Definition: sippdu.h:502
Definition: sippdu.h:574
void SetSDP(SDPSessionDescription *sdp)
unsigned GetNextCSeq()
bool m_wasSubscribing
Was registering or unregistering.
Definition: sippdu.h:1142
Definition: sippdu.h:504
PString GetDate() const