< Previous by Date Date Index Next by Date >
< Previous in Thread Thread Index  

Re: [reSIProcate] Information regarding 3pcc call


Hi Aadilkhan,

I managed to do 3pcc with the svn head revision. I had some minor compilation problems - which I cannot remember exactly. Then I had some problem because the gperf tool needed for the build was missing on my system.

There is 3cpp example: resip/dum/test/test3pcc.cxx, but is incomplete on my opinion.

I'm attaching a rough variant with wich I managed to do 3cpp call.
I'm really cannot test it right now, hopefully it is left in working state. If you have problem with it, tell me and I'll find some time to check it. My project on 3cpp is on hold at this moment so I have no progress besides the one in this file.
Hope this will help you.

--

Kind regards,
Ilia


Aadilkhan Maniyar wrote:
Hi  Illia,

I am trying the very same thing in 3PCC call as you have mentioned in your post. And I am facing the very same problems regarding sending the Initial INVITE without any SDP. What I am interested in knowing is that are you able to send the INVITE without SDP using the svn head version now.
Also did you face any problems while compiling the SVN version.

Thanks in Advance,
Aadil
_______________________________________________
resiprocate-devel mailing list
resiprocate-devel@xxxxxxxxxxxxxxxxxxx
https://list.sipfoundry.org/mailman/listinfo/resiprocate-devel


#include "resip/stack/SdpContents.hxx"
#include "resip/stack/SipMessage.hxx"
#include "resip/stack/ShutdownMessage.hxx"
#include "resip/stack/SipStack.hxx"
#include "resip/dum/ClientAuthManager.hxx"
#include "resip/dum/ClientInviteSession.hxx"
#include "resip/dum/ClientRegistration.hxx"
#include "resip/dum/DialogUsageManager.hxx"
#include "resip/dum/DumShutdownHandler.hxx"
#include "resip/dum/InviteSessionHandler.hxx"
#include "resip/dum/MasterProfile.hxx"
#include "resip/dum/RegistrationHandler.hxx"
#include "resip/dum/ServerInviteSession.hxx"
#include "resip/dum/ServerOutOfDialogReq.hxx"
#include "resip/dum/OutOfDialogHandler.hxx"
#include "resip/dum/AppDialog.hxx"
#include "resip/dum/AppDialogSet.hxx"
#include "resip/dum/AppDialogSetFactory.hxx"
#include "rutil/Log.hxx"
#include "rutil/Logger.hxx"
#include "rutil/Random.hxx"

#include <sstream>
#include <time.h>

#define RESIPROCATE_SUBSYSTEM Subsystem::TEST

using namespace resip;
using namespace std;

SipStack theStack;
DialogUsageManager controller(theStack);
   
class Controller : public InviteSessionHandler
{
   public:
      virtual void onNewSession(ClientInviteSessionHandle, InviteSession::OfferAnswerType oat, 
                                const SipMessage& msg)
      {
      }
      
      virtual void onNewSession(ServerInviteSessionHandle, InviteSession::OfferAnswerType oat, 
                                const SipMessage& msg)
      {
      }

      virtual void onFailure(ClientInviteSessionHandle, const SipMessage& msg)
      {
      }
      
      virtual void onProvisional(ClientInviteSessionHandle h, const SipMessage& msg)
      {
      }

      virtual void onConnected(ClientInviteSessionHandle, const SipMessage& msg)
      {
      }

      virtual void onStaleCallTimeout(ClientInviteSessionHandle)
      {
      }

      virtual void onConnected(InviteSessionHandle, const SipMessage& msg)
      {
      }

      virtual void onRedirected(ClientInviteSessionHandle, const SipMessage& msg)
      {
      }

      virtual void onTerminated(InviteSessionHandle h, InviteSessionHandler::TerminatedReason reason, 
                                const SipMessage* msg)
      {
//            sessionB_->end(reason);
/*              InviteSessionHandle toTerminate = (sessionA_ == h) ? sessionB_ : sessionA_;
              if (toTerminate.isValid()) {
	          toTerminate->end();
              }*/
	
      }

      virtual void onAnswer(InviteSessionHandle h, const SipMessage& msg, const SdpContents& sdp)
      {
                if (h == sessionA_) {
			return;
		}
		sessionB_ = h;
		sessionA_->provideAnswer(sdp);		
      }

      virtual void onOffer(InviteSessionHandle is, const SipMessage& msg, const SdpContents& sdp)      
      {
      		sessionA_ = is;
      		cout << "**** onOffer ****" << endl;
		NameAddr targetB("sip:*18004958611@xxxxxxxxxxxxxx");
		controller.send(controller.makeInviteSession(targetB, &sdp));
      }

      virtual void onEarlyMedia(ClientInviteSessionHandle, const SipMessage& msg, const SdpContents& sdp)
      {
      }

      virtual void onOfferRequired(InviteSessionHandle, const SipMessage& msg)
      {
      }

      virtual void onOfferRejected(InviteSessionHandle, const SipMessage& msg)
      {
      }

      virtual void onDialogModified(InviteSessionHandle, InviteSession::OfferAnswerType oat, 
                                    const SipMessage& msg)
      {
      }

      virtual void onInfo(InviteSessionHandle, const SipMessage& msg)
      {
      }

      virtual void onRefer(InviteSessionHandle, ServerSubscriptionHandle, const SipMessage& msg)
      {
      }

      virtual void onReferNoSub(InviteSessionHandle, const SipMessage& msg)
      {}

      virtual void onReferAccepted(InviteSessionHandle, ClientSubscriptionHandle, const SipMessage& msg)
      {
      }

      virtual void onReferRejected(InviteSessionHandle, const SipMessage& msg)
      {
      }

      virtual void onInfoSuccess(InviteSessionHandle, const SipMessage& msg)
      {
      }

      virtual void onInfoFailure(InviteSessionHandle, const SipMessage& msg)
      {
      }

      virtual void onForkDestroyed(ClientInviteSessionHandle)
	  {
	  }
	  
      /// called if an offer in a UPDATE or re-INVITE was rejected - not real
      /// useful. A SipMessage is provided if one is available
      virtual void onOfferRejected(InviteSessionHandle, const SipMessage* msg)
      {}
      
      /// called when MESSAGE message is received 
      virtual void onMessage(InviteSessionHandle, const SipMessage& msg)
      {}

      /// called when response to MESSAGE message is received 
      virtual void onMessageSuccess(InviteSessionHandle, const SipMessage& msg)
      {}
      virtual void onMessageFailure(InviteSessionHandle, const SipMessage& msg)
      {}
      
private:
	InviteSessionHandle sessionA_;
	InviteSessionHandle sessionB_;

};


int 
main (int argc, char** argv)
{
   Log::initialize(Log::Cout, resip::Log::Warning, argv[0]);
   
   controller.addTransport(UDP, 5060);

   SharedPtr<MasterProfile> uacMasterProfile(new MasterProfile);      
   auto_ptr<ClientAuthManager> uacAuth(new ClientAuthManager);
   controller.setMasterProfile(uacMasterProfile);
   controller.setClientAuthManager(uacAuth);
    
   controller.getMasterProfile()->setDigestCredential("fwd.pulver.com", "testuser", "testpassword");

   Controller invSessionHandler;
   controller.setInviteSessionHandler(&invSessionHandler);

//   NameAddr controllerAor("sip:ikrustev@xxxxxxxxxxxx:5060");
   NameAddr proxy("sip:ikrustev@xxxxxxxxxxxxxx");
   controller.getMasterProfile()->setDefaultFrom(proxy); //controllerAor);

// controller.send(controller.makeRegistration(proxy));

// NameAddr targetA("sip:IKrustevTest@xxxxxxxxxxxxxx");
   NameAddr targetA("sip:*18003564674@xxxxxxxxxxxxxx");
   controller.send(controller.makeInviteSession(targetA, 0));
   
   
   int n = 0;
   while (true)
   {
     FdSet fdset;
     // Should these be buildFdSet on the DUM?
     theStack.buildFdSet(fdset);
     int err = fdset.selectMilliSeconds(100);
     assert ( err != -1 );
     theStack.process(fdset);
     while (controller.process());
     if (!(n++ % 10)) cerr << "|/-\\"[(n/10)%4] << '\b';
   }   
   return 0;
}

/* ====================================================================
 * The Vovida Software License, Version 1.0 
 * 
 * Copyright (c) 2000 Vovida Networks, Inc.  All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 * 
 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
 *    and "Vovida Open Communication Application Library (VOCAL)" must
 *    not be used to endorse or promote products derived from this
 *    software without prior written permission. For written
 *    permission, please contact vocal@xxxxxxxxxxx
 *
 * 4. Products derived from this software may not be called "VOCAL", nor
 *    may "VOCAL" appear in their name, without prior written
 *    permission of Vovida Networks, Inc.
 * 
 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
 * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL VOVIDA
 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
 * DAMAGE.
 * 
 * ====================================================================
 * 
 * This software consists of voluntary contributions made by Vovida
 * Networks, Inc. and many individuals on behalf of Vovida Networks,
 * Inc.  For more information on Vovida Networks, Inc., please see
 * <http://www.vovida.org/>.
 *
 */