reSIProcate/DialogUsageManager  9694
Public Member Functions | Public Attributes | Private Attributes
TestUas Class Reference
Inheritance diagram for TestUas:
Inheritance graph
[legend]
Collaboration diagram for TestUas:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 TestUas (time_t *pH)
 ~TestUas ()
virtual void onNewSession (ServerInviteSessionHandle sis, InviteSession::OfferAnswerType oat, const SipMessage &msg)
 called when an initial INVITE or the intial response to an outoing invite
virtual void onTerminated (InviteSessionHandle, InviteSessionHandler::TerminatedReason reason, const SipMessage *msg)
virtual void onOffer (InviteSessionHandle is, const SipMessage &msg, const SdpContents &sdp)
 called when an offer is received - must send an answer soon after this
virtual void onOfferRequired (InviteSessionHandle is, const SipMessage &msg)
 called when an Invite w/out offer is sent, or any other context which requires an offer from the user
virtual void onConnected (InviteSessionHandle is, const SipMessage &msg)
 called when a dialog initiated as a UAS enters the connected state
virtual void onInfoSuccess (InviteSessionHandle is, const SipMessage &msg)
 called when response to INFO message is received
virtual void onMessage (InviteSessionHandle is, const SipMessage &msg)
 called when MESSAGE message is received
void hangup ()

Public Attributes

bool done
bool requestedOffer
time_t * pHangupAt
SdpContentsmSdp
HeaderFieldValuehfv
Datatxt
int mNumExpectedInfos

Private Attributes

ServerInviteSessionHandle mSis

Detailed Description

Definition at line 391 of file BasicCall.cxx.


Constructor & Destructor Documentation

TestUas::TestUas ( time_t *  pH) [inline]

Definition at line 405 of file BasicCall.cxx.

References type.

         : TestInviteSessionHandler("UAS"), 
           done(false),
           requestedOffer(false),
           pHangupAt(pH),
           hfv(0),
           mNumExpectedInfos(2)
      { 
         txt = new Data("v=0\r\n"
                        "o=1900 369696545 369696545 IN IP4 192.168.2.15\r\n"
                        "s=X-Lite\r\n"
                        "c=IN IP4 192.168.2.15\r\n"
                        "t=0 0\r\n"
                        "m=audio 8001 RTP/AVP 8 3 98 97 101\r\n"
                        "a=rtpmap:8 pcma/8000\r\n"
                        "a=rtpmap:3 gsm/8000\r\n"
                        "a=rtpmap:98 iLBC\r\n"
                        "a=rtpmap:97 speex/8000\r\n"
                        "a=rtpmap:101 telephone-event/8000\r\n"
                        "a=fmtp:101 0-15\r\n");
         
         hfv = new HeaderFieldValue(txt->data(), (unsigned int)txt->size());
         Mime type("application", "sdp");
         mSdp = new SdpContents(*hfv, type);
      }
TestUas::~TestUas ( ) [inline]

Definition at line 431 of file BasicCall.cxx.

      {
         assert(mNumExpectedInfos == 0);
         delete mSdp;
         delete txt;
         delete hfv;
      }

Member Function Documentation

void TestUas::hangup ( ) [inline]

Definition at line 523 of file BasicCall.cxx.

Referenced by main().

      {
         if (mSis.isValid())
         {
            cout << name << ": Sending BYE." << endl;
            mSis->end();
            done = true;
         }
      }
virtual void TestUas::onConnected ( InviteSessionHandle  ,
const SipMessage msg 
) [inline, virtual]

called when a dialog initiated as a UAS enters the connected state

Reimplemented from resip::TestInviteSessionHandler.

Definition at line 470 of file BasicCall.cxx.

References resip::Message::brief().

      {
         cout << name << ": InviteSession-onConnected - " << msg.brief() << endl;
         
         // At this point no NIT should have been sent
         assert(!is->getLastSentNITRequest());

         // Send a first INFO from UAS with some contents (we use a fake PlainContents contents here for
         // simplicity)
         PlainContents contents("Hello there!!!");
         is->info(contents);

         // Immediately send another one, which will end up queued on the
         // InviteSession's NIT queue
         PlainContents contentsOther("Hello again!!!");
         is->info(contentsOther);
      }

Here is the call graph for this function:

virtual void TestUas::onInfoSuccess ( InviteSessionHandle  ,
const SipMessage msg 
) [inline, virtual]

called when response to INFO message is received

Reimplemented from resip::TestInviteSessionHandler.

Definition at line 488 of file BasicCall.cxx.

References resip::Message::brief().

      {
         cout << name << ": InviteSession-onInfoSuccess - " << msg.brief() << endl;

         assert(is->getLastSentNITRequest());
         PlainContents* pContents = dynamic_cast<PlainContents*>(is->getLastSentNITRequest()->getContents());
         assert(pContents != NULL);

         if(mNumExpectedInfos == 2)
         {
            assert(pContents->text() == Data("Hello there!!!"));
            mNumExpectedInfos--;
         }
         else if(mNumExpectedInfos == 1)
         {
            assert(pContents->text() == Data("Hello again!!!"));
            mNumExpectedInfos--;

            // Schedule a BYE in 5 seconds
            if(*pHangupAt == 0)
            {
               *pHangupAt = time(NULL) + 5;
            }
         }
      }

Here is the call graph for this function:

virtual void TestUas::onMessage ( InviteSessionHandle  ,
const SipMessage msg 
) [inline, virtual]

called when MESSAGE message is received

Reimplemented from resip::TestInviteSessionHandler.

Definition at line 514 of file BasicCall.cxx.

References resip::Message::brief().

      {
         cout << name << ": InviteSession-onMessage - " << msg.brief() << endl;

         is->acceptNIT();
      }

Here is the call graph for this function:

virtual void TestUas::onNewSession ( ServerInviteSessionHandle  ,
InviteSession::OfferAnswerType  oat,
const SipMessage msg 
) [inline, virtual]

called when an initial INVITE or the intial response to an outoing invite

Reimplemented from resip::TestInviteSessionHandler.

Definition at line 441 of file BasicCall.cxx.

References resip::Message::brief().

      {
         cout << name << ": ServerInviteSession-onNewSession - " << msg.brief() << endl;
         cout << name << ": Sending 180 response." << endl;
         mSis = sis;         
         sis->provisional(180);
      }

Here is the call graph for this function:

virtual void TestUas::onOffer ( InviteSessionHandle  ,
const SipMessage msg,
const SdpContents  
) [inline, virtual]

called when an offer is received - must send an answer soon after this

Reimplemented from resip::TestInviteSessionHandler.

Definition at line 455 of file BasicCall.cxx.

      {
         cout << name << ": InviteSession-onOffer(SDP)" << endl;
         //sdp->encode(cout);
         cout << name << ": Sending 200 response with SDP answer." << endl;
         is->provideAnswer(sdp);
         mSis->accept();
      }
virtual void TestUas::onOfferRequired ( InviteSessionHandle  ,
const SipMessage msg 
) [inline, virtual]

called when an Invite w/out offer is sent, or any other context which requires an offer from the user

Reimplemented from resip::TestInviteSessionHandler.

Definition at line 464 of file BasicCall.cxx.

References resip::Message::brief().

      {
         cout << name << ": InviteSession-onOfferRequired - " << msg.brief() << endl;
         is->provideOffer(*mSdp);
      }

Here is the call graph for this function:

virtual void TestUas::onTerminated ( InviteSessionHandle  ,
InviteSessionHandler::TerminatedReason  reason,
const SipMessage msg 
) [inline, virtual]

Reimplemented from resip::TestInviteSessionHandler.

Definition at line 449 of file BasicCall.cxx.

      {
         cout << name << ": InviteSession-onTerminated - " << endl;
         done = true;
      }

Member Data Documentation

Definition at line 395 of file BasicCall.cxx.

Referenced by main().

Definition at line 400 of file BasicCall.cxx.

Definition at line 403 of file BasicCall.cxx.

Definition at line 399 of file BasicCall.cxx.

Definition at line 533 of file BasicCall.cxx.

Definition at line 397 of file BasicCall.cxx.

Definition at line 396 of file BasicCall.cxx.

Definition at line 401 of file BasicCall.cxx.


The documentation for this class was generated from the following file: