[reSIProcate] onTerminated: client or server session?
Robert Whitaker
capnwhit at yahoo.com
Tue Sep 5 20:30:48 CDT 2006
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 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/20060905/9b3ed4c3/attachment.htm>
More information about the resiprocate-devel
mailing list