Hi,
I am trying to understand how the responses are routed in OpenSBC.
B2BUserAgent::ProcessEvent checks if there is a SIPMessage event,
differentiates between different types of requests, then if event is not
a request, event dispatcher checks if it already has a session for this
response. Once session has been found, it calls
B2BUAEndPoint::ProcessStackEvent. The latter does the following magic to
handle the responses:
if( !msg.IsRequest() )
{
OString meth = msg.GetCSeqMethod();
if( meth == "SUBSCRIBE" ||
meth == "NOTIFY" ||
meth == "PUBLISH" )
{
///this is a response
SIPSession::GCRef ref = proxy->FindGCRefByCallId(
msg.GetCallId() );
if( ref != NULL )
{
proxy->ProcessStackEvent( ref, event );
return;
}
}
}
So far so good. The switch loop inside the
SIPSessionManager::ProcessStackEvent function calls OnIncomingSIPMessage:
case SIPStackEvent::Message:
LOG_CONTEXT( LogDetail(), eventObject->GetCallId(),
"Event"
<< ": " << "---> Inbound - "
<<
((SIPMessageArrival&)*eventObject).GetMessage().GetStartLine() );
OnIncomingSIPMessage( (SIPMessageArrival&)*eventObject, session );
break;
OnIncomingSIPMessage to dispatch a valid response calls
SIPSession::OnIncomingSIPMessage. It does the following thing:
if( messageEvent.GetMessage().IsRequest() )
{
if( !messageEvent.GetMessage().IsAck() )
{
PWaitAndSignal lock( m_CurrentUASRequestMutex );
m_CurrentUASRequest = messageEvent.GetMessage();
}
}
I have kind of reached a deadlock here. What I want to know is how the
response if actually delivered to the local transaction layer or remote
proxy. We've seen a scenario where OpenBSC is serving as a frontend to
PortaSIP and from it we know that responses are a subject to a check of
Request-URI and To-URI to distinguish between local handling and relay.
I just do not see where these checks are done. Thanks,
--
Sincerely,
Andrew Pogrebennyk
|