/[resiprocate]/main/resip/dum/test/basicClientCall.hxx
ViewVC logotype

Contents of /main/resip/dum/test/basicClientCall.hxx

Parent Directory Parent Directory | Revision Log Revision Log


Revision 9034 - (show annotations) (download)
Sun Feb 27 17:35:49 2011 UTC (8 years, 9 months ago) by sgodin
File MIME type: text/plain
File size: 7210 byte(s)
-new dum test program basicClient that provides a good reference starting
 place for people developing user agents
  - demonstrates how to use client outbound support (RFC5626)
  - uses AppDialogSet -> Call abstraction
  - uses recommended SelectInterruptor to drive the stack
  - ability to be dummy subscription server for fabricated basicClientTest event 
   (plain text bodies) - used for testing subscription recovery after flow failure
  - ability for to form a client subscription to a command line
    provided URI (typically this would be set to the AOR of another basicClient user)
  - command line parameter to be able to place a call after registration
     - Once call is placed, five test MESSAGEs will be sent every 30 seconds, then a 
       BYE will be sent
     - 30 seconds later the entire process is repeated
     - if we receive a call then it will be auto-answered, and for any received call, 
       if we receive a sip MESSAGE, then a answer MESSAGE will be sent to the far end 
     - this allows mid-dialog routing testing in both directions
  - performs an Invite with Replaces if a flow is terminated
1 #if !defined(basicClientCall_hxx)
2 #define basicClientCall_hxx
3
4 #include <resip/dum/AppDialogSet.hxx>
5
6 #include <resip/dum/SubscriptionHandler.hxx>
7 #include <resip/dum/RedirectHandler.hxx>
8 #include <resip/dum/InviteSessionHandler.hxx>
9 #include <resip/dum/DialogSetHandler.hxx>
10 #include <resip/dum/DialogUsageManager.hxx>
11
12 #include "basicClientUserAgent.hxx"
13
14 namespace resip
15 {
16
17 class BasicClientCall : public AppDialogSet
18 {
19 public:
20 BasicClientCall(BasicClientUserAgent& userAgent);
21 virtual ~BasicClientCall();
22
23 virtual void initiateCall(const Uri& target, SharedPtr<UserProfile> profile);
24 virtual void terminateCall();
25 virtual void timerExpired();
26
27 protected:
28 friend class BasicClientUserAgent;
29
30 // This API must return an appropriate user profile after inspecting the incoming INVITE
31 virtual SharedPtr<UserProfile> selectUASUserProfile(const SipMessage&);
32
33 // Invite Session Handler /////////////////////////////////////////////////////
34 virtual void onNewSession(resip::ClientInviteSessionHandle h, resip::InviteSession::OfferAnswerType oat, const resip::SipMessage& msg);
35 virtual void onNewSession(resip::ServerInviteSessionHandle h, resip::InviteSession::OfferAnswerType oat, const resip::SipMessage& msg);
36 virtual void onFailure(resip::ClientInviteSessionHandle h, const resip::SipMessage& msg);
37 virtual void onEarlyMedia(resip::ClientInviteSessionHandle, const resip::SipMessage&, const resip::SdpContents&);
38 virtual void onProvisional(resip::ClientInviteSessionHandle, const resip::SipMessage& msg);
39 virtual void onConnected(resip::ClientInviteSessionHandle h, const resip::SipMessage& msg);
40 virtual void onConnected(resip::InviteSessionHandle, const resip::SipMessage& msg);
41 virtual void onStaleCallTimeout(resip::ClientInviteSessionHandle);
42 virtual void onTerminated(resip::InviteSessionHandle h, resip::InviteSessionHandler::TerminatedReason reason, const resip::SipMessage* msg);
43 virtual void onRedirected(resip::ClientInviteSessionHandle, const resip::SipMessage& msg);
44 virtual void onAnswer(resip::InviteSessionHandle, const resip::SipMessage& msg, const resip::SdpContents&);
45 virtual void onOffer(resip::InviteSessionHandle handle, const resip::SipMessage& msg, const resip::SdpContents& offer);
46 virtual void onOfferRequired(resip::InviteSessionHandle, const resip::SipMessage& msg);
47 virtual void onOfferRejected(resip::InviteSessionHandle, const resip::SipMessage* msg);
48 virtual void onOfferRequestRejected(resip::InviteSessionHandle, const resip::SipMessage& msg);
49 virtual void onRemoteSdpChanged(resip::InviteSessionHandle, const resip::SipMessage& msg, const resip::SdpContents& sdp);
50 virtual void onInfo(resip::InviteSessionHandle, const resip::SipMessage& msg);
51 virtual void onInfoSuccess(resip::InviteSessionHandle, const resip::SipMessage& msg);
52 virtual void onInfoFailure(resip::InviteSessionHandle, const resip::SipMessage& msg);
53 virtual void onRefer(resip::InviteSessionHandle, resip::ServerSubscriptionHandle, const resip::SipMessage& msg);
54 virtual void onReferAccepted(resip::InviteSessionHandle, resip::ClientSubscriptionHandle, const resip::SipMessage& msg);
55 virtual void onReferRejected(resip::InviteSessionHandle, const resip::SipMessage& msg);
56 virtual void onReferNoSub(resip::InviteSessionHandle, const resip::SipMessage& msg);
57 virtual void onMessage(resip::InviteSessionHandle, const resip::SipMessage& msg);
58 virtual void onMessageSuccess(resip::InviteSessionHandle, const resip::SipMessage& msg);
59 virtual void onMessageFailure(resip::InviteSessionHandle, const resip::SipMessage& msg);
60 virtual void onForkDestroyed(resip::ClientInviteSessionHandle);
61 virtual void onReadyToSend(InviteSessionHandle, SipMessage& msg);
62 virtual void onFlowTerminated(InviteSessionHandle);
63
64 // DialogSetHandler //////////////////////////////////////////////
65 virtual void onTrying(resip::AppDialogSetHandle, const resip::SipMessage& msg);
66 virtual void onNonDialogCreatingProvisional(resip::AppDialogSetHandle, const resip::SipMessage& msg);
67
68 // ClientSubscriptionHandler ///////////////////////////////////////////////////
69 virtual void onUpdatePending(resip::ClientSubscriptionHandle h, const resip::SipMessage& notify, bool outOfOrder);
70 virtual void onUpdateActive(resip::ClientSubscriptionHandle h, const resip::SipMessage& notify, bool outOfOrder);
71 virtual void onUpdateExtension(resip::ClientSubscriptionHandle h, const resip::SipMessage& notify, bool outOfOrder);
72 virtual void onNotifyNotReceived(resip::ClientSubscriptionHandle h);
73 virtual void onTerminated(resip::ClientSubscriptionHandle h, const resip::SipMessage* notify);
74 virtual void onNewSubscription(resip::ClientSubscriptionHandle h, const resip::SipMessage& notify);
75 virtual int onRequestRetry(resip::ClientSubscriptionHandle h, int retrySeconds, const resip::SipMessage& notify);
76
77 // RedirectHandler /////////////////////////////////////////////////////////////
78 virtual void onRedirectReceived(AppDialogSetHandle h, const SipMessage& msg);
79
80 private:
81 BasicClientUserAgent &mUserAgent;
82 resip::InviteSessionHandle mInviteSessionHandle;
83 unsigned int mTimerExpiredCounter;
84 bool mPlacedCall;
85 resip::InviteSessionHandle mInviteSessionHandleReplaced;
86
87 // UAC forked call handling helper members
88 bool isUACConnected();
89 bool isStaleFork(const resip::DialogId& dialogId);
90 resip::DialogId mUACConnectedDialogId;
91
92 void makeOffer(SdpContents& offer);
93 };
94
95 }
96
97 #endif
98
99 /* ====================================================================
100
101 Copyright (c) 2011, SIP Spectrum, Inc.
102 All rights reserved.
103
104 Redistribution and use in source and binary forms, with or without
105 modification, are permitted provided that the following conditions are
106 met:
107
108 1. Redistributions of source code must retain the above copyright
109 notice, this list of conditions and the following disclaimer.
110
111 2. Redistributions in binary form must reproduce the above copyright
112 notice, this list of conditions and the following disclaimer in the
113 documentation and/or other materials provided with the distribution.
114
115 3. Neither the name of SIP Spectrum nor the names of its contributors
116 may be used to endorse or promote products derived from this
117 software without specific prior written permission.
118
119 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
120 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
121 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
122 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
123 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
124 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
125 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
126 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
127 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
128 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
129 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
130
131 ==================================================================== */

Properties

Name Value
svn:eol-style native
svn:mime-type text/plain

webmaster AT resiprocate DOT org
ViewVC Help
Powered by ViewVC 1.1.27