sipxtacklib  Version 3.3
SipUserAgent.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2004-2006 SIPfoundry Inc.
3 // Licensed by SIPfoundry under the LGPL license.
4 //
5 // Copyright (C) 2004-2006 Pingtel Corp. All rights reserved.
6 // Licensed to SIPfoundry under a Contributor Agreement.
7 //
8 // $$
10 
11 
12 #ifndef _SipUserAgent_h_
13 #define _SipUserAgent_h_
14 
15 // SYSTEM INCLUDES
16 //#include <...>
17 
18 // APPLICATION INCLUDES
19 #include <utl/UtlHashBag.h>
20 #include <os/OsServerTask.h>
21 #include <net/SipUserAgentBase.h>
22 #include <net/SipMessage.h>
23 #include <net/SipMessageEvent.h>
24 #include <net/SipTransaction.h>
25 #include <net/SipTransactionList.h>
26 #include <net/SipUdpServer.h>
27 #include <os/OsQueuedEvent.h>
28 #ifdef SIP_TLS
29 #include <net/SipTlsServer.h>
30 #include <os/OsTLS.h>
31 #endif
32 #include <os/OsNatKeepaliveListener.h>
33 
34 // DEFINES
35 #define SIP_DEFAULT_RTT 500
36 #define SIP_MINIMUM_RTT 100
37 #define SIP_MAX_PORT_RANGE 10 // If a port is in use and the sip user agent
38  // is created with bUseNextAvailablePort set to
39  // true, this is the number of sequential ports
40  // to try.
41 
42 // proxy, registrar, etc. UDP socket buffer size
43 #define SIPUA_DEFAULT_SERVER_UDP_BUFFER_SIZE 1000000
44 
45 // proxy, registrar, etc. OsServerTask OsMsg queue size
46 #define SIPUA_DEFAULT_SERVER_OSMSG_QUEUE_SIZE 10000
47 
48 // MACROS
49 // EXTERNAL FUNCTIONS
50 // EXTERNAL VARIABLES
51 // CONSTANTS
52 // STRUCTS
53 // TYPEDEFS
54 // FORWARD DECLARATIONS
55 class OsConfigDb;
56 class OsQueuedEvent;
57 class OsTimer;
58 class SipSession;
59 class SipTcpServer;
60 class SipLineMgr;
61 class SipUserAgentBase;
62 
64 
158 #ifdef SIP_TLS
159  , public ITlsSink
160 #endif
161 {
162 /* //////////////////////////// PUBLIC //////////////////////////////////// */
163 public:
164 
165  friend class SipTransaction;
166  friend class SipUdpServer;
167  friend int SipUdpServer::run(void* runArg);
168 
170  {
174  };
175 
176 /* ============================ CREATORS ================================== */
177 
179 
234  SipUserAgent(int sipTcpPort = SIP_PORT,
235  int sipUdpPort = SIP_PORT,
236  int sipTlsPort = SIP_PORT+1,
237  const char* publicAddress = NULL,
238  const char* defaultUser = NULL,
239  const char* defaultSipAddress = NULL,
240  const char* sipProxyServers = NULL,
241  const char* sipDirectoryServers = NULL,
242  const char* sipRegistryServers = NULL,
243  const char* authenticationScheme = NULL,
244  const char* authenicateRealm = NULL,
245  OsConfigDb* authenticateDb = NULL,
246  OsConfigDb* authorizeUserIds = NULL,
247  OsConfigDb* authorizePasswords = NULL,
248  SipLineMgr* lineMgr = NULL,
249  int sipFirstResendTimeout = SIP_DEFAULT_RTT,
250  UtlBoolean defaultToUaTransactions = TRUE,
251  int readBufferSize = -1,
252  int queueSize = OsServerTask::DEF_MAX_MSGS,
253  UtlBoolean bUseNextAvailablePort = FALSE,
254  UtlString certNickname = "",
255  UtlString certPassword = "",
256  UtlString dbLocation = ".",
257  UtlBoolean doUaMessageChecks = TRUE);
258 
260  virtual
261  ~SipUserAgent();
262 
263 /* ============================ MANIPULATORS ============================== */
264 
266 
273  void shutdown(UtlBoolean blockingShutdown = TRUE);
274 
277  virtual void enableStun(const char* szStunServer,
278  int iStunPort,
279  int refreshPeriodInSecs,
280  OsNotification* pNotification = NULL,
281  const char* szIp = NULL) ;
282 
284  virtual UtlBoolean handleMessage(OsMsg& eventMessage);
285 
287  virtual void addMessageConsumer(OsServerTask* messageConsumer);
288 
291 
312  void addMessageObserver(OsMsgQ& messageQueue,
313  const char* sipMethod = NULL,
314  UtlBoolean wantRequests = TRUE,
315  UtlBoolean wantResponses = TRUE,
316  UtlBoolean wantIncoming = TRUE,
317  UtlBoolean wantOutGoing = FALSE,
318  const char* eventName = NULL,
319  SipSession* pSession = NULL,
320  void* observerData = NULL);
321 
322 
325 
333  UtlBoolean removeMessageObserver(OsMsgQ& messageQueue,
334  void* pObserverData = NULL);
335 
337 
353  virtual UtlBoolean send(SipMessage& message,
354  OsMsgQ* responseListener = NULL,
355  void* responseListenerData = NULL,
356  SIPX_TRANSPORT_DATA* pTransport = NULL);
357 
359 
369  virtual void dispatch(SipMessage* message,
370  int messageType = SipMessageEvent::APPLICATION,
371  SIPX_TRANSPORT_DATA* pData = NULL);
372 
373  void allowMethod(const char* methodName, const bool bAllow = true);
374 
375  void allowExtension(const char* extension);
376 
377  void getSupportedExtensions(UtlString& extensionsString);
378 
380 
385  void setProxyServers(const char* sipProxyServers);
386 
387 
388  UtlBoolean addCrLfKeepAlive(const char* szLocalIp,
389  const char* szRemoteIp,
390  const int remotePort,
391  const int keepAliveSecs,
392  OsNatKeepaliveListener* pListener) ;
393 
394  UtlBoolean removeCrLfKeepAlive(const char* szLocalIp,
395  const char* szRemoteIp,
396  const int remotePort) ;
397 
398  UtlBoolean addStunKeepAlive(const char* szLocalIp,
399  const char* szRemoteIp,
400  const int remotePort,
401  const int keepAliveSecs,
402  OsNatKeepaliveListener* pListener) ;
403 
404  UtlBoolean removeStunKeepAlive(const char* szLocalIp,
405  const char* szRemoteIp,
406  const int remotePort) ;
407 
408  OsTimer* getTimer() { return mpTimer; }
409 
410  UtlBoolean addSipKeepAlive(const char* szLocalIp,
411  const char* szRemoteIp,
412  const int remotePort,
413  const char* szMethod,
414  const int keepAliveSecs,
415  OsNatKeepaliveListener* pListener) ;
416 
417  UtlBoolean removeSipKeepAlive(const char* szLocalIp,
418  const char* szRemoteIp,
419  const int remotePort,
420  const char* szMethod) ;
421 
422 /* ============================ ACCESSORS ================================= */
423 
426  UtlBoolean setUseRport(UtlBoolean bEnable) ;
427 
429  UtlBoolean getUseRport() const ;
430 
432  void setUseRportMapping(UtlBoolean bEnable);
433 
435  UtlBoolean getUseRportMapping() const;
436 
438  UtlBoolean getConfiguredPublicAddress(UtlString* pIpAddress, int* pPort) ;
439 
441  UtlBoolean getLocalAddress(UtlString* pIpAddress,
442  int* pPort,
443  SIPX_TRANSPORT_TYPE protocol = TRANSPORT_UDP) ;
444 
446  UtlBoolean getNatMappedAddress(UtlString* pIpAddress, int* pPort) ;
447 
448  void setIsUserAgent(UtlBoolean isUserAgent);
449 
451  void setUserAgentHeaderProperty( const char* property );
458  void setMaxForwards(int maxForwards);
460 
462  int getMaxForwards();
463 
465  void setForking(UtlBoolean enabled);
466 
467  void getFromAddress(UtlString* address, int* port, UtlString* protocol);
468 
469  void getViaInfo(int protocol,
470  UtlString& address,
471  int& port,
472  const char* pszTargetAddress,
473  const int* piTargetPort);
474 
475  void getDirectoryServer(int index, UtlString* address,
476  int* port, UtlString* protocol);
477 
478  void getProxyServer(int index, UtlString* address,
479  int* port, UtlString* protocol);
480 
482  void printStatus();
483 
484  void startMessageLog(int newMaximumLogSize = 0);
485 
486  void stopMessageLog();
487 
488  void clearMessageLog();
489 
490  virtual void logMessage(const char* message, int messageLength);
491 
492  void getMessageLog(UtlString& logData);
493 
495 
496  int getDefaultExpiresSeconds() const;
497 
498  const int getRegisterResponseTimeout() const { return mRegisterTimeoutSeconds; }
499  void setRegisterResponseTimeout(const int seconds) { mRegisterTimeoutSeconds = seconds; }
500 
501  void setDefaultExpiresSeconds(int expiresSeconds);
502 
503  int getDefaultSerialExpiresSeconds() const;
504 
505  void setLocationHeader(const char* szHeader);
506 
509  void setIncludePlatformInUserAgentName(const bool bInclude);
510 
511  void setDefaultSerialExpiresSeconds(int expiresSeconds);
512 
514  void setMaxTcpSocketIdleTime(int idleTimeSeconds);
515 
518  int getMaxSrvRecords() const;
519 
522  void setMaxSrvRecords(int numRecords);
523 
525  int getDnsSrvTimeout();
526 
528  void setDnsSrvTimeout(int timeout);
529 
532 
537  void setHostAliases(UtlString& aliases);
538 
540  void setRecurseOnlyOne300Contact(UtlBoolean recurseOnlyOne);
541  /***< @note this is a 300 not 3xx class response.@endnote */
542 
544  void setReturnViasForMaxForwards(UtlBoolean returnVias);
545 
548 
551  SipMessage* getRequest(const SipMessage& response);
552 
553  int getUdpPort() const ;
555 
556  int getTcpPort() const ;
558 
559  int getTlsPort() const ;
561 
562  void setUserAgentName(const UtlString& name);
564 
565  const UtlString& getUserAgentName() const;
567 
568 
569  void setHeaderOptions(const bool bAllowHeader,
570  const bool bDateHeader,
571  const bool bShortNames,
572  const UtlString& acceptLanguage);
574 
576  {return mbShortNames;}
577  // Return enabled state of short names
578 
579  void setEnableLocationHeader(const bool bLocationHeader)
580  {mbUseLocationHeader=bLocationHeader;}
581  // Set if location header is enabled or not
582 
583 
584  void stopTransactionTimers() { mSipTransactions.stopTransactionTimers(); }
585  void startTransactionTimers() { mSipTransactions.startTransactionTimers(); }
586 
587 /* ============================ INQUIRY =================================== */
588 
589  virtual UtlBoolean isMessageLoggingEnabled();
590 
591  virtual UtlBoolean isReady();
592  //: Return boolean if the UA is started and initialized
593 
594  virtual UtlBoolean waitUntilReady();
595  //: Block and wait until the UA is started and initialized
596 
597  UtlBoolean isMethodAllowed(const char* method);
598 
599  UtlBoolean isExtensionAllowed(const char* extension) const;
600 
601  UtlBoolean isForkingEnabled();
602 
603  UtlBoolean isMyHostAlias(Url& route) const;
604 
605  UtlBoolean recurseOnlyOne300Contact();
606 
607  UtlBoolean isOk(OsSocket::IpProtocolSocketType socketType);
608 
610 
614  UtlBoolean isShutdownDone();
615 
616  void setUserAgentHeader(SipMessage& message);
617 
618  void setServerHeader(SipMessage& message);
619 
621  void setSelfHeader(SipMessage& message);
622 
624 
626  const bool addContactAddress(SIPX_CONTACT_ADDRESS& contactAddress);
627 
629  void getContactAddresses(SIPX_CONTACT_ADDRESS* pContacts[], int &numContacts);
630 
631  void prepareVia(SipMessage& message,
632  UtlString& branchId,
633  OsSocket::IpProtocolSocketType& toProtocol,
634  const char* szTargetAddress,
635  const int* piTargetPort,
636  SIPX_TRANSPORT_DATA* pTransport = NULL) ;
637 
638 #ifdef SIP_TLS
639  SipTlsServer* getTlsServer() { return mSipTlsServer; }
640  // ITlsSink implementation
641  bool onServerCertificate(void* pCert, char* serverHostName);
642  bool onTlsEvent(int cause);
643 #endif
644 
645  void addExternalTransport(const UtlString tranportName, const SIPX_TRANSPORT_DATA* const pTransport);
646  void removeExternalTransport(const UtlString transportName, const SIPX_TRANSPORT_DATA* const pTransport);
647  const SIPX_TRANSPORT_DATA* const lookupExternalTransport(const UtlString transportName, const UtlString ipAddress) const;
648 
649 /* //////////////////////////// PROTECTED ///////////////////////////////// */
650 protected:
651  void prepareContact(SipMessage& message,
652  const char* szTargetAddress,
653  const int* piTargetPort) ;
654 
656  void selfHeaderValue(UtlString& self);
657 
658  void getAllowedMethods(UtlString* allowedMethods);
659 
660  void whichExtensionsNotAllowed(const SipMessage* message,
661  UtlString* disallowedExtensions) const;
662 
663  UtlBoolean checkMethods(SipMessage* message);
664 
665  UtlBoolean checkExtensions(SipMessage* message);
666 
667  UtlBoolean sendStatelessResponse(SipMessage& response);
668 
669  UtlBoolean sendStatelessRequest(SipMessage& request,
670  UtlString& address,
671  int port,
672  OsSocket::IpProtocolSocketType protocol,
673  UtlString& branchId);
674 
675  UtlBoolean sendTls(SipMessage* message,
676  const char* serverAddress,
677  int port);
678 
679  UtlBoolean sendTcp(SipMessage* message,
680  const char* serverAddress,
681  int port);
682 
683  UtlBoolean sendUdp(SipMessage* message,
684  const char* serverAddress,
685  int port);
686 
687  UtlBoolean sendCustom(SIPX_TRANSPORT_DATA* pTransport,
688  SipMessage* message,
689  const char* sendAddress,
690  const int sendPort);
691 
692  UtlBoolean sendSymmetricUdp(SipMessage& message,
693  const char* serverAddress,
694  int port);
695 
697  void lookupSRVSipAddress(UtlString protocol,
698  UtlString& sipAddress,
699  int& port,
700  UtlString& srcIp);
701 
703 
704  int getFirstResendTimeout();
705 
706  int getLastResendTimeout();
707 
708  UtlBoolean shouldAuthenticate(SipMessage* message) const;
709 
710  UtlBoolean authorized(SipMessage* request,
711  const char* uri = NULL) const;
712 
713  void addAuthentication(SipMessage* message) const;
714 
715  UtlBoolean resendWithAuthorization(SipMessage* response,
716  SipMessage* request,
717  int* messageType,
718  int authorizationEntity);
719 
720 /* //////////////////////////// PRIVATE /////////////////////////////////// */
721 private:
722 
723  SipTcpServer* mSipTcpServer;
724  SipUdpServer* mSipUdpServer;
725 #ifdef SIP_TLS
726  SipTlsServer* mSipTlsServer;
727 #endif
728  SipTransactionList mSipTransactions;
729  UtlString defaultSipUser;
730  UtlString defaultSipAddress;
731  UtlString proxyServers;
732  UtlString directoryServers;
733  UtlString registryServers;
734  int registryPeriod;
735  int lastRegisterSeqNum;
736  UtlString registerCallId;
737  UtlString sipIpAddress;
738  UtlString mConfigPublicAddress ;
739  int mSipPort;
740  UtlDList allowedSipMethods;
741  UtlDList allowedSipExtensions;
742  UtlString mUserAgentHeaderProperties;
743  UtlHashBag mMyHostAliases;
744  UtlHashBag mMessageObservers;
745  UtlHashMap mExternalTransports;
746  OsRWMutex mMessageLogRMutex;
747  OsRWMutex mMessageLogWMutex;
748 
749  //times
750  int mFirstResendTimeoutMs; //intialtimeout
751  int mLastResendTimeoutMs; //timeout between last 2 resends
752  int mReliableTransportTimeoutMs;//TCP timeout
753  int mTransactionStateTimeoutMs;//transaction timeout
754  int mDefaultExpiresSeconds; // Seconds
755  int mDefaultSerialExpiresSeconds;
756  int mMinInviteTransactionTimeout; // INVITE tx must live longer so the phone can ring
757  int mMaxTcpSocketIdleTime; // time after which unused TCP sockets are removed
758  int mMaxSrvRecords; // Max num of DNS SRV records to use before giving up
759  int mDnsSrvTimeout; // second to give up & try the next DNS SRV record
760 
761  SipMessage* mpLastSipMessage;
762  UtlString defaultUserAgentName;
763  long mLastCleanUpTime;
764  UtlString mAuthenticationScheme;
765  UtlString mAuthenticationRealm;
766  OsConfigDb* mpAuthenticationDb;
767  OsConfigDb* mpAuthorizationUserIds;
768  OsConfigDb* mpAuthorizationPasswords;
769  SipLineMgr* mpLineMgr;
770  int mMaxMessageLogSize;
771  UtlString mMessageLog;
772  UtlString mLocationHeader;
773  UtlBoolean mIsUaTransactionByDefault;
774  UtlBoolean mForkingEnabled;
775  int mMaxForwards;
776  UtlBoolean mRecurseOnlyOne300Contact;
777  UtlBoolean mReturnViasForMaxForwards;
778  UtlBoolean mbUseRport;
779  UtlBoolean mUseRportMapping; // use Rport IP and port for contact database
780  UtlBoolean mbUseLocationHeader;
781  bool mbIncludePlatformInUserAgentName; // whether or not the platform name should
782  // be appended to the user agent name
783 
789  UtlBoolean mDoUaMessageChecks;
790 
791  void garbageCollection();
792 
793  void queueMessageToInterestedObservers(SipMessageEvent& event,
794  const UtlString& method);
795  void queueMessageToObservers(SipMessage* message,
796  int messageType);
797 
799  OsTimer* mpTimer;
800 
802  UtlBoolean mbShuttingDown;
803  UtlBoolean mbShutdownDone;
804  UtlBoolean mbBlockingShutdown;
805 
806  bool mbAllowHeader;
807  bool mbDateHeader;
808  bool mbShortNames;
809  UtlString mAcceptLanguage;
810 
811  int mRegisterTimeoutSeconds;
812 
814  SipUserAgent(const SipUserAgent& rSipUserAgent);
815 
817  SipUserAgent& operator=(const SipUserAgent& rhs);
818 
819 };
820 
821 /* ============================ INLINE METHODS ============================ */
822 
823 #endif // _SipUserAgent_h_
UtlBoolean sendSymmetricUdp(SipMessage &message, const char *serverAddress, int port)
Definition: SipUserAgent.cpp:1169
void setDefaultSerialExpiresSeconds(int expiresSeconds)
Definition: SipUserAgent.cpp:3574
UtlBoolean sendTcp(SipMessage *message, const char *serverAddress, int port)
Definition: SipUserAgent.cpp:1441
Definition: SipSession.h:33
void setUserAgentName(const UtlString &name)
Get the local Tls port number (or PORT_NONE if disabled)
Definition: SipUserAgent.cpp:3082
void setRegisterResponseTimeout(const int seconds)
Definition: SipUserAgent.h:499
void getDirectoryServer(int index, UtlString *address, int *port, UtlString *protocol)
Definition: SipUserAgent.cpp:3487
UtlBoolean isForkingEnabled()
Definition: SipUserAgent.cpp:3887
void setDefaultExpiresSeconds(int expiresSeconds)
Definition: SipUserAgent.cpp:3553
Transaction and Transport manager for SIP stack.
Definition: SipUserAgent.h:157
Definition: SipTcpServer.h:58
void getFromAddress(UtlString *address, int *port, UtlString *protocol)
Definition: SipUserAgent.cpp:3439
The SipUdpServer is owner/container of the sockets used for UDP communications.
Definition: SipUdpServer.h:52
Definition: SipMessageEvent.h:39
void getViaInfo(int protocol, UtlString &address, int &port, const char *pszTargetAddress, const int *piTargetPort)
Definition: SipUserAgent.cpp:3398
UtlBoolean sendTls(SipMessage *message, const char *serverAddress, int port)
Definition: SipUserAgent.cpp:1519
void lookupSRVSipAddress(UtlString protocol, UtlString &sipAddress, int &port, UtlString &srcIp)
DNS SRV lookup for to address.
Definition: SipUserAgent.cpp:4131
void allowMethod(const char *methodName, const bool bAllow=true)
Definition: SipUserAgent.cpp:674
const SIPX_TRANSPORT_DATA *const lookupExternalTransport(const UtlString transportName, const UtlString ipAddress) const
Definition: SipUserAgent.cpp:4430
void getAllowedMethods(UtlString *allowedMethods)
Definition: SipUserAgent.cpp:3379
void stopTransactionTimers()
Definition: SipTransactionList.cpp:312
UtlBoolean sendStatelessRequest(SipMessage &request, UtlString &address, int port, OsSocket::IpProtocolSocketType protocol, UtlString &branchId)
Definition: SipUserAgent.cpp:1392
UtlBoolean addStunKeepAlive(const char *szLocalIp, const char *szRemoteIp, const int remotePort, const int keepAliveSecs, OsNatKeepaliveListener *pListener)
Definition: SipUserAgent.cpp:2986
SipContactDb mContactDb
Definition: SipUserAgentBase.h:123
void shutdown(UtlBoolean blockingShutdown=TRUE)
Cleanly shuts down SipUserAgent.
Definition: SipUserAgent.cpp:534
int getUdpPort() const
Definition: SipUserAgent.cpp:3780
void setReturnViasForMaxForwards(UtlBoolean returnVias)
Flag to return Vias in too many hops response to request with max-forwards == 0.
void addAuthentication(SipMessage *message) const
Definition: SipUserAgent.cpp:4065
#define SIP_DEFAULT_RTT
Definition: SipUserAgent.h:35
void startMessageLog(int newMaximumLogSize=0)
Definition: SipUserAgent.cpp:3656
int getDnsSrvTimeout()
Get the number of seconds to wait before trying the next DNS SRV record.
Definition: SipUserAgent.cpp:3254
const bool addContactAddress(SIPX_CONTACT_ADDRESS &contactAddress)
Adds a contact record to the contact db.
Definition: SipUserAgent.cpp:4292
Indicator for a UDP socket type.
Definition: sipXtapi.h:543
UtlBoolean checkExtensions(SipMessage *message)
void setUserAgentHeader(SipMessage &message)
Definition: SipUserAgent.cpp:4260
void startTransactionTimers()
Definition: SipUserAgent.h:585
void stopTransactionTimers()
Definition: SipUserAgent.h:584
UtlBoolean isShutdownDone()
Find out if SipUserAgent has finished shutting down.
Definition: SipUserAgent.cpp:3955
virtual UtlBoolean handleMessage(OsMsg &eventMessage)
For internal use only.
Definition: SipUserAgent.cpp:2443
void removeExternalTransport(const UtlString transportName, const SIPX_TRANSPORT_DATA *const pTransport)
Definition: SipUserAgent.cpp:4422
void selfHeaderValue(UtlString &self)
constuct the value to be used in either user-agent or server header.
Definition: SipUserAgent.cpp:4272
UtlBoolean removeStunKeepAlive(const char *szLocalIp, const char *szRemoteIp, const int remotePort)
Definition: SipUserAgent.cpp:3003
void setForking(UtlBoolean enabled)
Allow or disallow recursion and forking of 3xx class requests.
Definition: SipUserAgent.cpp:3264
void setProxyServers(const char *sipProxyServers)
Set the SIP proxy servers for the user agent.
Definition: SipUserAgent.cpp:3516
int getTcpPort() const
Get the local UDP port number (or PORT_NONE if disabled)
Definition: SipUserAgent.cpp:3768
Specialization of HttpMessage to contain and manipulate SIP messages.
Definition: SipMessage.h:343
void whichExtensionsNotAllowed(const SipMessage *message, UtlString *disallowedExtensions) const
Definition: SipUserAgent.cpp:3841
UtlBoolean removeMessageObserver(OsMsgQ &messageQueue, void *pObserverData=NULL)
Removes all SIP message observers for the given message/queue observer.
Definition: SipUserAgent.cpp:640
UtlBoolean getUseRport() const
Is use report set?
Definition: SipUserAgent.cpp:3077
Definition: SipContactDb.h:36
SipTransaction correlates requests and responses.
Definition: SipTransaction.h:51
void prepareVia(SipMessage &message, UtlString &branchId, OsSocket::IpProtocolSocketType &toProtocol, const char *szTargetAddress, const int *piTargetPort, SIPX_TRANSPORT_DATA *pTransport=NULL)
Definition: SipUserAgent.cpp:4317
Definition: SipUserAgent.h:172
void setHostAliases(UtlString &aliases)
Set other DNS names or IP addresses which are considered to refer to this SipUserAgent.
Definition: SipUserAgent.cpp:3603
void setServerHeader(SipMessage &message)
Definition: SipUserAgent.cpp:4246
UtlBoolean removeSipKeepAlive(const char *szLocalIp, const char *szRemoteIp, const int remotePort, const char *szMethod)
Definition: SipUserAgent.cpp:3037
UtlBoolean getConfiguredPublicAddress(UtlString *pIpAddress, int *pPort)
Get the manually configured public address.
Definition: SipUserAgent.cpp:3095
virtual ~SipUserAgent()
Destructor.
Definition: SipUserAgent.cpp:438
#define SIP_PORT
Definition: SipMessage.h:256
UtlBoolean getNatMappedAddress(UtlString *pIpAddress, int *pPort)
Get the NAT mapped address and port.
Definition: SipUserAgent.cpp:3162
int getMaxSrvRecords() const
Get the maximum number of DNS SRV records to pursue in the case of failover.
Definition: SipUserAgent.cpp:3244
UtlBoolean recurseOnlyOne300Contact()
Definition: SipUserAgent.cpp:3915
int getSipStateTransactionTimeout()
Definition: SipUserAgent.cpp:3528
void setHeaderOptions(const bool bAllowHeader, const bool bDateHeader, const bool bShortNames, const UtlString &acceptLanguage)
Sets the User Agent name sent with outgoing sip messages.
Definition: SipUserAgent.cpp:4306
void stopMessageLog()
Definition: SipUserAgent.cpp:3670
virtual UtlBoolean waitUntilReady()
Definition: SipUserAgent.cpp:3874
void setMaxForwards(int maxForwards)
Set the limit of allowed hops a message can make.
Definition: SipUserAgent.cpp:3213
UtlBoolean sendStatelessResponse(SipMessage &response)
Definition: SipUserAgent.cpp:1339
OsTimer * getTimer()
Definition: SipUserAgent.h:408
SipMessage * getRequest(const SipMessage &response)
Get a copy of the original request that was sent corresponding to this incoming response.
Definition: SipUserAgent.cpp:3744
void setEnableLocationHeader(const bool bLocationHeader)
Definition: SipUserAgent.h:579
void printStatus()
Print diagnostics.
Definition: SipUserAgent.cpp:3632
void clearMessageLog()
Definition: SipUserAgent.cpp:3675
void addExternalTransport(const UtlString tranportName, const SIPX_TRANSPORT_DATA *const pTransport)
Definition: SipUserAgent.cpp:4415
virtual UtlBoolean send(SipMessage &message, OsMsgQ *responseListener=NULL, void *responseListenerData=NULL, SIPX_TRANSPORT_DATA *pTransport=NULL)
Send a SIP message over the net.
Definition: SipUserAgent.cpp:698
UtlBoolean setUseRport(UtlBoolean bEnable)
Enable or disable the outbound use of rport (send packet to actual port – not advertised port)...
Definition: SipUserAgent.cpp:3057
int getTlsPort() const
Get the local TCP port number (or PORT_NONE if disabled)
Definition: SipUserAgent.cpp:3792
void prepareContact(SipMessage &message, const char *szTargetAddress, const int *piTargetPort)
Definition: SipUserAgent.cpp:3269
Definition: SipUserAgent.h:171
int getLastResendTimeout()
Definition: SipUserAgent.cpp:3543
virtual void logMessage(const char *message, int messageLength)
Definition: SipUserAgent.cpp:3682
UtlBoolean checkMethods(SipMessage *message)
EventSubTypes
Definition: SipUserAgent.h:169
virtual void addMessageConsumer(OsServerTask *messageConsumer)
Deprecated (Add a SIP message recipient)
Definition: SipUserAgent.cpp:598
void getProxyServer(int index, UtlString *address, int *port, UtlString *protocol)
Definition: SipUserAgent.cpp:3502
void allowExtension(const char *extension)
Definition: SipUserAgent.cpp:3713
UtlBoolean isMethodAllowed(const char *method)
Definition: SipUserAgent.cpp:3809
UtlBoolean isMyHostAlias(Url &route) const
Definition: SipUserAgent.cpp:3892
Definition: SipLineMgr.h:67
void getSupportedExtensions(UtlString &extensionsString)
Definition: SipUserAgent.cpp:3722
int getReliableTransportTimeout()
Definition: SipUserAgent.cpp:3533
int getFirstResendTimeout()
Definition: SipUserAgent.cpp:3538
SipUserAgent(int sipTcpPort=SIP_PORT, int sipUdpPort=SIP_PORT, int sipTlsPort=SIP_PORT+1, const char *publicAddress=NULL, const char *defaultUser=NULL, const char *defaultSipAddress=NULL, const char *sipProxyServers=NULL, const char *sipDirectoryServers=NULL, const char *sipRegistryServers=NULL, const char *authenticationScheme=NULL, const char *authenicateRealm=NULL, OsConfigDb *authenticateDb=NULL, OsConfigDb *authorizeUserIds=NULL, OsConfigDb *authorizePasswords=NULL, SipLineMgr *lineMgr=NULL, int sipFirstResendTimeout=SIP_DEFAULT_RTT, UtlBoolean defaultToUaTransactions=TRUE, int readBufferSize=-1, int queueSize=OsServerTask::DEF_MAX_MSGS, UtlBoolean bUseNextAvailablePort=FALSE, UtlString certNickname="", UtlString certPassword="", UtlString dbLocation=".", UtlBoolean doUaMessageChecks=TRUE)
Constructor.
Definition: SipUserAgent.cpp:108
virtual void enableStun(const char *szStunServer, int iStunPort, int refreshPeriodInSecs, OsNotification *pNotification=NULL, const char *szIp=NULL)
Enable stun lookups for UDP signaling. Use a NULL szStunServer to disable.
Definition: SipUserAgent.cpp:582
const int getRegisterResponseTimeout() const
Definition: SipUserAgent.h:498
void setUseRportMapping(UtlBoolean bEnable)
Enable or disable use of rport IP and port in response via for contact mapping database.
Definition: SipUserAgent.cpp:3066
void addMessageObserver(OsMsgQ &messageQueue, const char *sipMethod=NULL, UtlBoolean wantRequests=TRUE, UtlBoolean wantResponses=TRUE, UtlBoolean wantIncoming=TRUE, UtlBoolean wantOutGoing=FALSE, const char *eventName=NULL, SipSession *pSession=NULL, void *observerData=NULL)
Add a SIP message observer for receiving SIP messages meeting the given filter criteria.
Definition: SipUserAgent.cpp:613
UtlBoolean removeCrLfKeepAlive(const char *szLocalIp, const char *szRemoteIp, const int remotePort)
Definition: SipUserAgent.cpp:2971
bool getEnabledShortNames()
Sets header options - send or not send.
Definition: SipUserAgent.h:575
Definition: SipMessageEvent.h:32
SIPX_TRANSPORT_TYPE
SIPX_TRANSPORT_TYPE defines various protocols use for signaling transport.
Definition: sipXtapi.h:541
Definition: sipXtapiInternal.h:288
virtual UtlBoolean isMessageLoggingEnabled()
Definition: SipUserAgent.cpp:3864
UtlBoolean shouldAuthenticate(SipMessage *message) const
Definition: SipUserAgent.cpp:3961
int getDefaultSerialExpiresSeconds() const
Definition: SipUserAgent.cpp:3569
UtlBoolean addCrLfKeepAlive(const char *szLocalIp, const char *szRemoteIp, const int remotePort, const int keepAliveSecs, OsNatKeepaliveListener *pListener)
Definition: SipUserAgent.cpp:2953
void setRecurseOnlyOne300Contact(UtlBoolean recurseOnlyOne)
Flag to recurse only one contact in a 300 response.
Definition: SipUserAgent.cpp:3739
UtlBoolean sendUdp(SipMessage *message, const char *serverAddress, int port)
Definition: SipUserAgent.cpp:1031
void setSelfHeader(SipMessage &message)
Add either Server or User-Agent header, as appropriate based on isUserAgent.
Definition: SipUserAgent.cpp:3185
void getMessageLog(UtlString &logData)
Definition: SipUserAgent.cpp:3707
Definition: SipUserAgent.h:173
void getContactAddresses(SIPX_CONTACT_ADDRESS *pContacts[], int &numContacts)
Gets all contact addresses for this user agent.
Definition: SipUserAgent.cpp:4301
void setUserAgentHeaderProperty(const char *property)
Provides a string to be appended to the standard User-Agent header.
Definition: SipUserAgent.cpp:3203
UtlBoolean resendWithAuthorization(SipMessage *response, SipMessage *request, int *messageType, int authorizationEntity)
Definition: SipUserAgent.cpp:4073
void setIsUserAgent(UtlBoolean isUserAgent)
Definition: SipUserAgent.cpp:3179
virtual void dispatch(SipMessage *message, int messageType=SipMessageEvent::APPLICATION, SIPX_TRANSPORT_DATA *pData=NULL)
Dispatch the SIP message to the message consumer(s)
Definition: SipUserAgent.cpp:1597
Definition: SipUserAgentBase.h:44
UtlBoolean getUseRportMapping() const
Get if use of rport IP and port in response via for contact mapping database is enabled.
Definition: SipUserAgent.cpp:3071
void setIncludePlatformInUserAgentName(const bool bInclude)
Tells the User Agent whether or not to append the platform name onto the User Agent string...
Definition: SipUserAgent.cpp:4287
SipContactDb & getContactDb()
Definition: SipUserAgent.h:623
int getMaxForwards()
Get the limit of allowed hops a message can make.
Definition: SipUserAgent.cpp:3226
URL parser and constructor.
Definition: Url.h:90
UtlBoolean isExtensionAllowed(const char *extension) const
Definition: SipUserAgent.cpp:3828
void startTransactionTimers()
Definition: SipTransactionList.cpp:331
UtlBoolean sendCustom(SIPX_TRANSPORT_DATA *pTransport, SipMessage *message, const char *sendAddress, const int sendPort)
Definition: SipUserAgent.cpp:1229
void setLocationHeader(const char *szHeader)
Definition: SipUserAgent.cpp:3734
int run(void *pArg)
Definition: SipUdpServer.cpp:349
int getDefaultExpiresSeconds() const
Definition: SipUserAgent.cpp:3548
void setMaxSrvRecords(int numRecords)
Set the maximum number of DNS SRV records to pursue in the case of failover.
Definition: SipUserAgent.cpp:3249
UtlBoolean getLocalAddress(UtlString *pIpAddress, int *pPort, SIPX_TRANSPORT_TYPE protocol=TRANSPORT_UDP)
Get the local address and port.
Definition: SipUserAgent.cpp:3118
void setDnsSrvTimeout(int timeout)
Set the number of seconds to wait before trying the next DNS SRV record.
Definition: SipUserAgent.cpp:3259
UtlBoolean isOk(OsSocket::IpProtocolSocketType socketType)
Definition: SipUserAgent.cpp:3921
virtual UtlBoolean isReady()
Definition: SipUserAgent.cpp:3869
const UtlString & getUserAgentName() const
Sets the User Agent name sent with outgoing sip messages.
Definition: SipUserAgent.cpp:3088
The CONTACT_ADDRESS structure includes contact information (IP-address and port), address source type...
Definition: sipXtapi.h:640
void setMaxTcpSocketIdleTime(int idleTimeSeconds)
Period of time a TCP socket can remain idle before it is removed.
Definition: SipUserAgent.cpp:3589
Definition: SipTransactionList.h:36
UtlBoolean addSipKeepAlive(const char *szLocalIp, const char *szRemoteIp, const int remotePort, const char *szMethod, const int keepAliveSecs, OsNatKeepaliveListener *pListener)
Definition: SipUserAgent.cpp:3019
UtlBoolean authorized(SipMessage *request, const char *uri=NULL) const
Definition: SipUserAgent.cpp:3987

sipXtackLib home page