bool
RtspEmbeddedRtpPacket::bind(RTPPacket *     newRtpPacket,
                            ChannelIdType   newChannelId,
                            LengthType      newLength
                           )
{
    // check args
    //

    if (! checkSanity(newRtpPacket, newChannelId, newLength))
    {
        return false;
    }

    // args are fine

    totalNumFragments = 0;
    boundaryReached = false;
    status = BOUND;

    buildDollarSequenceBuffer(newChannelId, newLength);
    fillOutBufferFragmentGroupFromPacket(newRtpPacket);
    startAccounting();

    return true;
}
Esempio n. 2
0
bool MyCCDialog::onOtherReply(const AmSipReply& reply) {
  DBG("OnOtherReply \n");
  if (state == CC_Dialing) {
    if (reply.code < 200) {
      DBG("Callee is trying... code %d\n", reply.code);
    } else if(reply.code < 300){
      if (getCalleeStatus()  == Connected) {
	state = CC_Connected;
	startAccounting();
	// clear audio input and output
	setInOut(NULL, NULL);
	// detach from media processor (not in RTP path any more)
	AmMediaProcessor::instance()->removeSession(this);
	// set the call timer
	setTimer(TIMERID_CREDIT_TIMEOUT, credit);
      }
    } else {
      DBG("Callee final error with code %d\n",reply.code);
      addToPlaylist(MyCCFactory::DialFailed);
      number = "";
      state = CC_Collecting_Number;
    }
  }  
  // we dont call
  //  AmB2BCallerSession::onOtherReply(reply);
  // as it tears down the call if callee could
  // not be reached
  return false;
}
Esempio n. 3
0
    void Grub::ready_executing()
    {
	DBGENTER(_SERVER_DBG_LEV);
        status = EXECUTING;
	Tick extra = supervisor->get_capacity();
	//cout << "Extra: " << extra << endl;
	cap.set_value(cap.get_value() + double(extra));
	startAccounting();
    }
Esempio n. 4
0
bool SWPrepaidSIPDialog::onOtherReply(const AmSipReply& reply)
{
  bool ret = false;

  if (m_state == CC_Dialing) {
    if (reply.code < 200) {
      DBG("Callee is trying... code %d\n", reply.code);
    }
    else if(reply.code < 300) {
      if(getCalleeStatus()  == Connected) {
        m_state = CC_Connected;
        startAccounting();
        setInOut(NULL, NULL);

        // set the call timer
        AmArg di_args,ret;
        di_args.push(TIMERID_CREDIT_TIMEOUT);
        di_args.push(m_credit);  // in seconds
        di_args.push(dlg.local_tag.c_str());
        m_user_timer->invoke("setTimer", di_args, ret);
      }
    }
    else if(reply.code == 487 && dlg.getStatus() == AmSipDialog::Pending) {
      DBG("Canceling leg A on 487 from B");
      dlg.reply(m_localreq, 487, "Call terminated");
      setStopped();
      ret = true;
    }
    else if (reply.code >= 300 && dlg.getStatus() == AmSipDialog::Connected) {
      DBG("Callee final error in connected state with code %d\n",reply.code);
      terminateLeg();
    }
    else {
      DBG("Callee final error with code %d\n",reply.code);
      AmB2BCallerSession::onOtherReply(reply);
    }
  }
  return ret;
}