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

RE: [reSIProcate] How do I end a call at the client after the call iscompleted.


There are a few notes here:
http://wiki.resiprocate.org/wiki/index.php?title=DUM_Ending_an_Invite_Se
ssion

Note:  ClientInviteSessionHandle and ServerInviteSessionHandle can be
casted to InviteSessionHandle - they are subclasses.

Also I don't think your code should have crashed when calling:
>   theSessHandl = myUAC->getSessHandle();
>   theSessHand->end();    <--- but this crashed of course.

However this would be a problem if you called end from another thread -
check out:
http://wiki.resiprocate.org/wiki/index.php?title=DUM_Threading

You may also want to look at dum/test/BasicCall.cxx for an example.

Scott

> -----Original Message-----
> From: resiprocate-devel-bounces@xxxxxxxxxxxxxxxxxxx
[mailto:resiprocate-
> devel-bounces@xxxxxxxxxxxxxxxxxxx] On Behalf Of frank zhao
> Sent: Monday, February 06, 2006 9:59 AM
> To: resiprocate-devel
> Subject: [reSIProcate] How do I end a call at the client after the
call
> iscompleted.
> 
> Hi,
> 
> I've been able to establish a sucessful Invite, but now I want to end
the
> call.
> I have a "Hangup" button, and when Pressed, I want to reverse the
action
> that Invite does.
> 
> Here are the parameters I have....
> 
>         myUAC = new InviteClient;
> 
> Where...
> 
> class InviteClient : public InviteSessionHandler, public
> OutOfDialogHandler
>    < I have all my handlers defined here - which are callbacks from
> resip >
> 
>     clientDum = new DialogUsageManager(*stack);
> 
> Now,  I need to clear down the call after making it.  How do I do
that?
> 
> I need to somehow get a ClientInviteSessionHandle, and send it an
> "end()" message.
> Or do I somehow have to get a "InviteSessionHandle" and send it an
> "end()" message.
> Which one is it?   Or am I way off the beaten path.
> 
> I have no clue how to get these handles because they are not passed in
> as
> arguments in the onxxxxxxx callbacks...   For instance...
> 
> virtual void onNewSession(ServerInviteSessionHandle sis,
> InviteSession::OfferAnswerType oat, const SipMessage& msg);
> 
> The SERVER passes in the "ServerInviteSessionHandle" as you see
above...
> 
> But the CLIENT....
> 
> virtual void onNewSession(ClientInviteSessionHandle,
> InviteSession::OfferAnswerType oat, const SipMessage& msg);
> 
> does not pass in the handle...!!!
> 
> I tried this...
> 
> virtual void onNewSession(ClientInviteSessionHandle cis,
> InviteSession::OfferAnswerType oat, const SipMessage& msg);
> 
> Where I added "cis" above, then in the body of the callback,  I set an
> instance variable
> Like this...
> 
>    mySessHandle = sis;
> 
> Then,  I added a "getSessHandle()" method to return "mySessHandle"
like
> this...  So in my
> "End call" code,  I tried this...
> 
>   theSessHandl = myUAC->getSessHandle();
>   theSessHand->end();    <--- but this crashed of course.
> 
> 
> IE:
> 
> myUAC - my subclass of InviteSessionHandler and OutOfDialogHandler,
and
> contains my handlers
> clientDum - A pointer to my DialogUsageManager.
> 
> The full definition of the InviteClient is...
> 
> class InviteClient : public InviteSessionHandler, public
> OutOfDialogHandler {
>    public:
>       bool connected;
>       ClientRegistrationHandle registerHandle;
> 
>       // More instance variables
>       bool                 done;
>       SdpContents*         sdp;
>       HeaderFieldValue* hfv;
>       Data*             txt;
>       time_t*             pHangupAt;
>       const SipMessage& reqresponse;
> 
>     // remote IP and Port of client when Invite was sucessful
>     // is set in "onConnected".
>       u_int16_t port;
>       char      *ip;
> 
>       InviteClient();   // removes const Data& n
>       virtual ~InviteClient();    // Don't need the Virtual part
> 
>       // My own methods
>       virtual void SetStartTime(time_t* pH);
>       virtual void SetDelegate(SipBridge *theBridge);
>       virtual void Create_sdp(char *myDestURI);
>       ServerInviteSessionHandle GetSessionHandle();
> 
>       // Only interested in the Client methods.
>       virtual void onNewSession(ClientInviteSessionHandle,
> InviteSession::OfferAnswerType oat, const SipMessage& msg);
>       virtual void onProvisional(ClientInviteSessionHandle, const
> SipMessage& msg);
>       virtual void onConnected(ClientInviteSessionHandle, const
> SipMessage& msg);
>       virtual void onOfferRejected(InviteSessionHandle, const
> SipMessage& msg);
>       virtual void onStaleCallTimeout(ClientInviteSessionHandle);
>       virtual void onRedirected(ClientInviteSessionHandle, const
> SipMessage& msg);
>       virtual void onEarlyMedia(ClientInviteSessionHandle, const
> SipMessage& msg, const SdpContents& sdp);
>       virtual void onForkDestroyed(ClientInviteSessionHandle);
>       virtual void onTerminated(InviteSessionHandle,
> InviteSessionHandler::TerminatedReason reason, const SipMessage* msg);
> 
>       virtual void onAnswer(InviteSessionHandle, const SipMessage&
msg,
> const SdpContents& sdp);
>       virtual void onOffer(InviteSessionHandle is, const SipMessage&
> msg, const SdpContents& sdp);
>       virtual void onOfferRequired(InviteSessionHandle, const
> SipMessage& msg);
>       virtual void onInfo(InviteSessionHandle, const SipMessage& msg);
>       virtual void onInfoSuccess(InviteSessionHandle, const
SipMessage&
> msg);
>       virtual void onInfoFailure(InviteSessionHandle, const
SipMessage&
> msg);
>       virtual void onRefer(InviteSessionHandle,
> ServerSubscriptionHandle, const SipMessage& msg);
>       virtual void onReferRejected(InviteSessionHandle, const
> SipMessage& msg);
>       virtual void onReferAccepted(InviteSessionHandle,
> ClientSubscriptionHandle, const SipMessage& msg);
> 
>       // Server - we use this for incoming calls
>       virtual void onNewSession(ServerInviteSessionHandle sis,
> InviteSession::OfferAnswerType oat, const SipMessage& msg);
>       virtual void onFailure(ClientInviteSessionHandle, const
> SipMessage& msg);
>       virtual void onConnected(InviteSessionHandle, const SipMessage&
> msg);
> 
>       // Out-of-Dialog Callbacks
>       virtual void onSuccess(ClientOutOfDialogReqHandle, const
> SipMessage& successResponse);
>       virtual void onFailure(ClientOutOfDialogReqHandle, const
> SipMessage& errorResponse);
>       virtual void onReceivedRequest(ServerOutOfDialogReqHandle ood,
> const SipMessage& request);
> 
>     private:
> 
> 
>         ServerInviteSessionHandle mSis;
> 
> 
> };
> _______________________________________________
> resiprocate-devel mailing list
> resiprocate-devel@xxxxxxxxxxxxxxxxxxx
> https://list.sipfoundry.org/mailman/listinfo/resiprocate-devel