[reSIProcate] What's going on?
Hi,
Below is a description of the problem I'm having with issuing an Invite
command
to our SIP server. The partial code fragment explains the problem.
ClientInviteSession::dispatchStart (const SipMessage& msg)
{
assert(msg.isResponse());
assert(msg.header(h_StatusLine).statusCode() > 100);
assert(msg.header(h_CSeq).method() == INVITE);
InviteSessionHandler* handler = mDum.mInviteSessionHandler;
std::auto_ptr<SdpContents> sdp = InviteSession::getSdp(msg);
InviteSession::Event event = toEvent(msg, sdp.get());
switch (event)
{
case On1xx:
transition(UAC_Early);
handler->onNewSession(getHandle(), None, msg); <--- Here is
where it calls my InviteHandler.
if(!isTerminated()) {
handleProvisional(msg);
}
break;
-----------------------------------------------------------------
My Invite handler's "onNewSession" handler
void
InviteClient::onNewSession(ClientInviteSessionHandle,
InviteSession::OfferAnswerType oat, const SipMessage& msg)
{
cout << ": ClientInviteSession-onNewSession - " << msg.brief() << endl;
// gets the status line of this message, should be 200 OK.
// but this is how you get it if you need it.
int code = msg.header(h_StatusLine).statusCode();
// save the data coming in.
// registerHandle = h;
reqresponse = msg; <--- I break just before calling
this, then "Step over", and get following..
[mBridge status:@"Inv: Attempting to connect"];
}
<-------- RESULT --------->
Since the "=" is an override... I eventually get here.... Not
surprisingly.
SipMessage&
SipMessage::operator=(const SipMessage& rhs)
{
if (this != &rhs)
{
this->cleanUp(); <---- and here is where things get interesting.
Does this mean the code is trying to delete the object on the LEFT side of
the "=" if they happen to be different? In this case,
------------------------------------
void
SipMessage::cleanUp()
{
for (int i = 0; i < Headers::MAX_HEADERS; i++)
{
delete mHeaders[i]; <---- Crashes here with i=0
mHeaders[i] = 0;
}
-----------
Am I to assume, the problem is in the statement....
reqresponse = msg;
Since "=" is overridden, according to the code I see above, why would
it try to
first delete reqresponse?
Is that intentional, or am I mis-using the resip stack? If I am, I
can certainly
believe it, since no such document describes what I'm to do....
By the way, in my "onNewSession" handler, I'm getting back a 180 AFTER
first
getting a 200 OK. Is this what it's supposed to do?
John