[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 to the US (and 30+ countries) for 2¢/min or less.