Example #1
0
void GWSession::on_stop() {
    DBG("GWSession::on_stop\n");
    if (!getDetached())
    	AmMediaProcessor::instance()->clearSession(this);
    else
        clearAudio();
}
void WebConferenceDialog::onMuted(bool mute) {
  DBG("########## WebConference::onMuted('%s') #########\n",
      mute?"true":"false");

  if (muted != mute) {
    muted = mute;
    switch (state) {

    case InConference:
    case InConferenceEarly: {
      if (muted)
	setInOut(NULL, &play_list);  
      else 
	setInOut(&play_list, &play_list);  
    } break;
      
    case InConferenceRinging: {
      if (muted) {
	setLocalInOut(NULL, NULL);
      } else {
	if(!RingTone.get())
	  RingTone.reset(new AmRingTone(0,2000,4000,440,480)); // US
    
	setLocalInOut(RingTone.get(), NULL);
	if (getDetached())
	  AmMediaProcessor::instance()->addSession(this,
						   callgroup); 
      }
    } break;
    default: DBG("No default action for changing mute status.\n"); break;
	
    }
  }
}
Example #3
0
void AmSession::on_stop()
{
  //sess_stopped.set(true);
  DBG("AmSession::on_stop()\n");

  if (!getDetached())
    AmMediaProcessor::instance()->clearSession(this);
  else
    clearAudio();
}
Example #4
0
void ConferenceDialog::onSipReply(const AmSipReply& reply)
{
  int status = dlg.getStatus();
  AmSession::onSipReply(reply);

  DBG("ConferenceDialog::onSipReply: code = %i, reason = %s\n, status = %i\n",
      reply.code,reply.reason.c_str(),dlg.getStatus());
    
  if(!dialedout && 
     !transfer_req.get())
    return;

  if(status < AmSipDialog::Connected){

    switch(dlg.getStatus()){

    case AmSipDialog::Connected:

      // connected!
      try {

	acceptAudio(reply.body,reply.hdrs);

	if(getDetached() && !getStopped()){
		    
	  setupAudio();
		    
	  if(getInput() || getOutput())
	    AmMediaProcessor::instance()->addSession(this,
						     getCallgroup()); 
	  else { 
	    ERROR("missing audio input and/or ouput.\n");
	    return;
	  }

	  if(!transfer_req.get()){

	    // send connect event
	    AmSessionContainer::instance()
	      ->postEvent(dialout_channel->getConfID(),
			  new DialoutConfEvent(DoConfConnect,
					       dialout_channel->getConfID()));
	  }
	  else {
	    dlg.reply(*(transfer_req.get()),202,"Accepted");
	    transfer_req.reset(0);
	    connectMainChannel();
	  }
	} 
	
      }
      catch(const AmSession::Exception& e){
	ERROR("%i %s\n",e.code,e.reason.c_str());
	dlg.bye();
	setStopped();
      }
      break;

    case AmSipDialog::Pending:

      switch(reply.code){
      case 180:

	// send ringing event
	AmSessionContainer::instance()
	  ->postEvent(dialout_channel->getConfID(),
		      new DialoutConfEvent(DoConfRinging,
					   dialout_channel->getConfID()));
		
	break;
      case 183: break;//TODO: remote ring tone.
      default:  break;// continue waiting.
      }
      break;

    case AmSipDialog::Disconnected:

      if(!transfer_req.get()){

	disconnectDialout();
	//switch(reply.code){
	//default:
	    
	AmSessionContainer::instance()
	  ->postEvent(dialout_channel->getConfID(),
		      new DialoutConfEvent(DoConfError,
					   dialout_channel->getConfID()));
	//}
      }
      else {
		
	dlg.reply(*(transfer_req.get()),reply.code,reply.reason);
	transfer_req.reset(0);
	setStopped();
      }
      break;

	    

    default: break;
    }


  }
}