[reSIProcate] onTerminated: client or server session?

Scott Godin slgodin at icescape.com
Wed Sep 6 08:17:44 CDT 2006


I think this is the best way.
 
Scott

________________________________

From: resiprocate-devel-bounces at list.sipfoundry.org on behalf of Robert Whitaker
Sent: Tue 9/5/2006 9:30 PM
To: resiprocate-devel at list.sipfoundry.org
Subject: [reSIProcate] onTerminated: client or server session?


Hello all,
 
When "onTerminated" is called I would like to know if it is a client or a server session. Is using handle.get() and a dynamic_cast as shown below a good way to do this? 
 
----------------------------------------
// BEGIN CODE
void
MyInviteSessionHandler::onTerminated(InviteSessionHandle handle,
                                     InviteSessionHandler::TerminatedReason reason,
                                     const SipMessage* msg)
{
   assert(handle.isValid());

   ClientInviteSession* pc = dynamic_cast<ClientInviteSession*>(handle.get());
   if(pc != NULL)
   {
      // This is a client session (i.e. we originally sent an outgoing 
      // INVITE request)
   }
   else
   {
      ServerInviteSession* ps = dynamic_cast<ServerInviteSession*>(handle.get());
      if(ps != NULL)
      {
         // This is a server session (i.e. we originally received an incoming 
         // INVITE request)
      }
      else
      {
         assert(0);
      }
   }
}
// END CODE
----------------------------------------
 
Is there a better (or alternative) way of doing this?
 
Thanks,
 
Bob
 

________________________________

Yahoo! Messenger with Voice. Make PC-to-Phone Calls <http://us.rd.yahoo.com/mail_us/taglines/postman1/*http://us.rd.yahoo.com/evt=39663/*http://voice.yahoo.com>  to the US (and 30+ countries) for 2¢/min or less.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.resiprocate.org/pipermail/resiprocate-devel/attachments/20060906/c219116f/attachment.htm>


More information about the resiprocate-devel mailing list