i debugged this problem a bit more.  as i have mentioned earlier, if 183
with sdp precedes 200 ok with dsp, onSessionStart event is not called.

i then searched where onSessionStart event is called and found only one
place (in AmSipDialog.cpp):

int AmSipDialog::onSdpCompleted()
{
  INFO("entering AmSipDialog::onSdpCompleted\n");

  if(!hdl) return 0;

  int ret = ((AmSipDialogEventHandler*)hdl)->
    onSdpCompleted(oa.getLocalSdp(), oa.getRemoteSdp());

  if(!ret) {
    sdp_local = oa.getLocalSdp();
    sdp_remote = oa.getRemoteSdp();

    if((getStatus() == Early) && !early_session_started) {
      ((AmSipDialogEventHandler*)hdl)->onEarlySessionStart();
      INFO("calling onEarlySessionStart()\n"); 
      early_session_started = true;
    }

    if((getStatus() == Connected) && !session_started) {
      ((AmSipDialogEventHandler*)hdl)->onSessionStart();
      INFO("calling onSessionStart()\n"); 
      session_started = true;
    }
  }
  else {
    oa.clear();
  }

  return ret;
}

the INFO calls that i added to the above function reveal that in 183 +
200 case only onEarlySession start is called:

Dec 30 14:01:13 box sems[19270]: [#7f7214cd8700] [onSdpCompleted, 
AmSipDialog.cpp:158] INFO:  entering AmSipDialog::onSdpCompleted
Dec 30 14:01:13 box sems[19270]: [#7f7214cd8700] [onSdpCompleted, 
AmSipDialog.cpp:170] INFO:  calling onEarlySessionStart()

onSdpCompleted, in turn, is only called from here:

int AmOfferAnswer::checkStateChange()
{
  int ret = 0;

  if((saved_state != state) &&
     (state == OA_Completed)) {

    ret = dlg->onSdpCompleted();
  }

  return ret;
}

i then when and edited AmOfferAnswer::onReplyIn so that state is always
changed when 200 ok is received (see below):

  if((reply.cseq_method == SIP_METH_INVITE || 
      reply.cseq_method == SIP_METH_UPDATE || 
      reply.cseq_method == SIP_METH_PRACK) &&
     !reply.body.empty() ) {

    const AmMimeBody* sdp_body = reply.body.hasContentType(SIP_APPLICATION_SDP);
    if(sdp_body) {

      /* I ADDED THIS STATEMENT */ 
      if ((state == OA_Completed) && (reply.code == 200)) state = OA_OfferSent;
    
      if(((state == OA_Completed) ||
          (state == OA_OfferRecved)) &&
         (reply.cseq == cseq)) {
        
        DBG("ignoring subsequent SDP reply within the same transaction\n");
        DBG("this usually happens when 183 and 200 have SDP\n");
      }
      else {
        saveState();
        err_code = onRxSdp(reply.cseq,reply.body,&err_txt);
        checkStateChange();
      }
    }
  }

after that 183 + 200 case started to work ok:

Dec 30 14:21:07 box sems[19573]: [#7f3ee18a6700] [onSdpCompleted, 
AmSipDialog.cpp:158] INFO:  entering AmSipDialog::onSdpCompleted
Dec 30 14:21:07 box sems[19573]: [#7f3ee18a6700] [onSdpCompleted, 
AmSipDialog.cpp:170] INFO:  calling onEarlySessionStart()
Dec 30 14:21:10 box sems[19573]: [#7f3ee18a6700] [onSdpCompleted, 
AmSipDialog.cpp:158] INFO:  entering AmSipDialog::onSdpCompleted
Dec 30 14:21:10 box sems[19573]: [#7f3ee18a6700] [onSdpCompleted, 
AmSipDialog.cpp:176] INFO:  calling onSessionStart()

since AmSipDialog::onSdpCompleted() checks the current state, why cannot
it be called from AmOfferAnswer::onReplyIn always when 183 or 200 with dsp
is received?

-- juha
_______________________________________________
Sems mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/sems

Reply via email to