1 |
jason |
4076 |
#if !defined(DUM_UserAgent_hxx) |
2 |
|
|
#define DUM_UserAgent_hxx |
3 |
|
|
|
4 |
|
|
#include "CommandLineParser.hxx" |
5 |
|
|
|
6 |
|
|
#include "resiprocate/os/ThreadIf.hxx" |
7 |
|
|
#include "resiprocate/dum/MasterProfile.hxx" |
8 |
|
|
#include "resiprocate/dum/RegistrationHandler.hxx" |
9 |
|
|
#include "resiprocate/dum/SubscriptionHandler.hxx" |
10 |
|
|
#include "resiprocate/dum/PublicationHandler.hxx" |
11 |
|
|
#include "resiprocate/dum/OutOfDialogHandler.hxx" |
12 |
|
|
#include "resiprocate/dum/InviteSessionHandler.hxx" |
13 |
|
|
#include "resiprocate/dum/DialogUsageManager.hxx" |
14 |
|
|
|
15 |
|
|
namespace resip |
16 |
|
|
{ |
17 |
|
|
|
18 |
|
|
class UserAgent : public CommandLineParser, |
19 |
|
|
public ClientRegistrationHandler, |
20 |
|
|
public ClientSubscriptionHandler, |
21 |
|
|
public ClientPublicationHandler, |
22 |
|
|
public OutOfDialogHandler, |
23 |
|
|
public InviteSessionHandler, |
24 |
|
|
public ThreadIf |
25 |
|
|
{ |
26 |
|
|
public: |
27 |
|
|
UserAgent(int argc, char** argv); |
28 |
|
|
virtual ~UserAgent(); |
29 |
|
|
|
30 |
jason |
4078 |
void startup(); |
31 |
|
|
void shutdown(); |
32 |
|
|
|
33 |
jason |
4076 |
virtual void thread(); |
34 |
|
|
void process(); |
35 |
|
|
|
36 |
|
|
|
37 |
|
|
public: |
38 |
|
|
// Invite Session Handler ///////////////////////////////////////////////////// |
39 |
|
|
virtual void onNewSession(ClientInviteSessionHandle h, InviteSession::OfferAnswerType oat, const SipMessage& msg); |
40 |
|
|
virtual void onNewSession(ServerInviteSessionHandle h, InviteSession::OfferAnswerType oat, const SipMessage& msg); |
41 |
|
|
virtual void onFailure(ClientInviteSessionHandle h, const SipMessage& msg); |
42 |
|
|
virtual void onEarlyMedia(ClientInviteSessionHandle, const SipMessage&, const SdpContents&); |
43 |
|
|
virtual void onProvisional(ClientInviteSessionHandle, const SipMessage& msg); |
44 |
|
|
virtual void onConnected(ClientInviteSessionHandle h, const SipMessage& msg); |
45 |
|
|
virtual void onConnected(InviteSessionHandle, const SipMessage& msg); |
46 |
|
|
virtual void onStaleCallTimeout(ClientInviteSessionHandle); |
47 |
|
|
virtual void onTerminated(InviteSessionHandle h, InviteSessionHandler::TerminatedReason reason, const SipMessage* msg); |
48 |
|
|
virtual void onRedirected(ClientInviteSessionHandle, const SipMessage& msg); |
49 |
|
|
virtual void onAnswer(InviteSessionHandle, const SipMessage& msg, const SdpContents&); |
50 |
|
|
virtual void onOffer(InviteSessionHandle handle, const SipMessage& msg, const SdpContents& offer); |
51 |
|
|
virtual void onOfferRequired(InviteSessionHandle, const SipMessage& msg); |
52 |
|
|
virtual void onOfferRejected(InviteSessionHandle, const SipMessage& msg); |
53 |
|
|
virtual void onDialogModified(InviteSessionHandle, InviteSession::OfferAnswerType oat, const SipMessage& msg); |
54 |
|
|
virtual void onInfo(InviteSessionHandle, const SipMessage& msg); |
55 |
|
|
virtual void onInfoSuccess(InviteSessionHandle, const SipMessage& msg); |
56 |
|
|
virtual void onInfoFailure(InviteSessionHandle, const SipMessage& msg); |
57 |
|
|
virtual void onRefer(InviteSessionHandle, ServerSubscriptionHandle, const SipMessage& msg); |
58 |
|
|
virtual void onReferAccepted(InviteSessionHandle, ClientSubscriptionHandle, const SipMessage& msg); |
59 |
|
|
virtual void onReferRejected(InviteSessionHandle, const SipMessage& msg); |
60 |
|
|
|
61 |
|
|
// Registration Handler //////////////////////////////////////////////////////// |
62 |
|
|
virtual void onSuccess(ClientRegistrationHandle h, const SipMessage& response); |
63 |
|
|
virtual void onFailure(ClientRegistrationHandle h, const SipMessage& response); |
64 |
|
|
virtual void onRemoved(ClientRegistrationHandle h); |
65 |
|
|
virtual int onRequestRetry(ClientRegistrationHandle h, int retryMinimum, const SipMessage& msg); |
66 |
|
|
|
67 |
|
|
// ClientSubscriptionHandler /////////////////////////////////////////////////// |
68 |
|
|
virtual void onRefreshRejected(ClientSubscriptionHandle h, const SipMessage& rejection); |
69 |
|
|
virtual void onUpdatePending(ClientSubscriptionHandle h, const SipMessage& notify); |
70 |
|
|
virtual void onUpdateActive(ClientSubscriptionHandle h, const SipMessage& notify); |
71 |
|
|
virtual void onUpdateExtension(ClientSubscriptionHandle, const SipMessage& notify); |
72 |
|
|
virtual void onTerminated(ClientSubscriptionHandle h, const SipMessage& notify); |
73 |
|
|
virtual void onNewSubscription(ClientSubscriptionHandle h, const SipMessage& notify); |
74 |
|
|
virtual int onRequestRetry(ClientSubscriptionHandle h, int retryMinimum, const SipMessage& notify); |
75 |
|
|
|
76 |
|
|
// ClientPublicationHandler //////////////////////////////////////////////////// |
77 |
|
|
virtual void onSuccess(ClientPublicationHandle h, const SipMessage& status); |
78 |
|
|
virtual void onRemove(ClientPublicationHandle h, const SipMessage& status); |
79 |
|
|
virtual void onFailure(ClientPublicationHandle h, const SipMessage& response); |
80 |
|
|
virtual int onRequestRetry(ClientPublicationHandle h, int retryMinimum, const SipMessage& response); |
81 |
|
|
|
82 |
|
|
// OutOfDialogHandler ////////////////////////////////////////////////////////// |
83 |
|
|
virtual void onSuccess(ClientOutOfDialogReqHandle, const SipMessage& response); |
84 |
|
|
virtual void onFailure(ClientOutOfDialogReqHandle, const SipMessage& response); |
85 |
|
|
virtual void onReceivedRequest(ServerOutOfDialogReqHandle, const SipMessage& request); |
86 |
|
|
virtual void onForkDestroyed(ClientInviteSessionHandle); |
87 |
|
|
|
88 |
|
|
protected: |
89 |
|
|
void addTransport(TransportType type, int port); |
90 |
|
|
|
91 |
|
|
private: |
92 |
|
|
MasterProfile mProfile; |
93 |
|
|
DialogUsageManager mDum; |
94 |
|
|
}; |
95 |
|
|
|
96 |
|
|
} |
97 |
|
|
|
98 |
|
|
#endif |