当前位置: 首页>>代码示例>>C++>>正文


C++ AmSession::setCallgroup方法代码示例

本文整理汇总了C++中AmSession::setCallgroup方法的典型用法代码示例。如果您正苦于以下问题:C++ AmSession::setCallgroup方法的具体用法?C++ AmSession::setCallgroup怎么用?C++ AmSession::setCallgroup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AmSession的用法示例。


在下文中一共展示了AmSession::setCallgroup方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: startSessionUAC

AmSession* AmSessionContainer::startSessionUAC(AmSipRequest& req) {
  AmSession* session = NULL;
  as_mut.lock();
  try {
    if((session = createSession(req)) != 0){
      session->dlg.updateStatusFromLocalRequest(req); // sets local tag as well
      session->setCallgroup(req.from_tag);

      session->setNegotiateOnReply(true);
      session->sendInvite();
      session->start();

      addSession_unsafe(req.callid,req.from_tag,req.from_tag,session);
      // session does not get its own INVITE
      //      session->postEvent(new AmSipRequestEvent(req)); 
    }
  } 
  catch(const AmSession::Exception& e){
    ERROR("%i %s\n",e.code,e.reason.c_str());
    AmSipDialog::reply_error(req,e.code,e.reason);
  }
  catch(const string& err){
    ERROR("startSession: %s\n",err.c_str());
    AmSipDialog::reply_error(req,500,err);
  }
  catch(...){
    ERROR("unexpected exception\n");
    AmSipDialog::reply_error(req,500,"unexpected exception");
  }
  as_mut.unlock();
  return session;
}
开发者ID:BackupTheBerlios,项目名称:sems-svn,代码行数:32,代码来源:AmSessionContainer.cpp

示例2: startSessionUAS

void AmSessionContainer::startSessionUAS(AmSipRequest& req)
{
  as_mut.lock();
  try {
	
    AmSession* session = getSession(req.callid,req.from_tag);
    if( session ){
	    
      // it's a forked-and-merged INVITE
      // reply 482 Loop detected
      throw AmSession::Exception(482, "Loop detected");
    }
    else {
      // Call-ID and From-Tag are unknown: it's a new session
      AmSession* session;
      if((session = createSession(req)) != 0){

	// update session's local tag (ID) if not already set
	session->setLocalTag();
	const string& local_tag = session->getLocalTag();
	// by default each session is in its own callgroup
	session->setCallgroup(local_tag);

	if (AmConfig::LogSessions) {
	  INFO("Starting UAS session %s app %s\n",
	       session->getLocalTag().c_str(), req.cmd.c_str());
	}

	session->start();

	addSession_unsafe(req.callid,req.from_tag,local_tag,session);
	session->postEvent(new AmSipRequestEvent(req));
      }
    }
  } 
  catch(const AmSession::Exception& e){
    ERROR("%i %s\n",e.code,e.reason.c_str());
    AmSipDialog::reply_error(req,e.code,e.reason);
  }
  catch(const string& err){
    ERROR("startSession: %s\n",err.c_str());
    AmSipDialog::reply_error(req,500,err);
  }
  catch(...){
    ERROR("unexpected exception\n");
    AmSipDialog::reply_error(req,500,"unexpected exception");
  }
  as_mut.unlock();
}
开发者ID:BackupTheBerlios,项目名称:sems-svn,代码行数:49,代码来源:AmSessionContainer.cpp

示例3: startSessionUAS

void AmSessionContainer::startSessionUAS(AmSipRequest& req)
{
  as_mut.lock();
  try {
	
    AmSession* session = getSession(req.callid,req.from_tag);
    if( session ){
	    
      // it's a forked-and-merged INVITE
      // reply 482 Loop detected
      throw AmSession::Exception(482, "Loop detected");
    }
    else {
      // Call-ID and From-Tag are unknown: it's a new session
      AmSession* session;
      if((session = createSession(req)) != 0){

	string local_tag = AmSession::getNewId();
	session->setLocalTag(local_tag);
	session->setCallgroup(local_tag);
	session->start();

	addSession_unsafe(req.callid,req.from_tag,local_tag,session);
	session->postEvent(new AmSipRequestEvent(req));
      }
      //else
      //throw AmSession::Exception(500,"internal error");
    }
  } 
  //     catch(const AmSession::SessionTimerException& e){
  //  	ERROR("%i %s\n",e.code,e.reason.c_str());
  // 	AmSipDialog::reply_error(req,e.code,e.reason,e.getErrorHeaders());
  //     }
  catch(const AmSession::Exception& e){
    ERROR("%i %s\n",e.code,e.reason.c_str());
    AmSipDialog::reply_error(req,e.code,e.reason);
  }
  catch(const string& err){
    ERROR("startSession: %s\n",err.c_str());
    AmSipDialog::reply_error(req,500,err);
  }
  catch(...){
    ERROR("unexpected exception\n");
    AmSipDialog::reply_error(req,500,"unexpected exception");
  }
  as_mut.unlock();
}
开发者ID:BackupTheBerlios,项目名称:sems-svn,代码行数:47,代码来源:AmSessionContainer.cpp

示例4: startSessionUAC

AmSession* AmSessionContainer::startSessionUAC(AmSipRequest& req, AmArg* session_params) {
  AmSession* session = NULL;
  as_mut.lock();
  try {
    if((session = createSession(req, session_params)) != 0){
      session->dlg.updateStatusFromLocalRequest(req); // sets local tag as well
      session->setCallgroup(req.from_tag);

      session->setNegotiateOnReply(true);
      if (int err = session->sendInvite(req.hdrs)) {
	ERROR("INVITE could not be sent: error code = %d.\n", 
	      err);
	delete session;
	as_mut.unlock();
	return NULL;
      }

      if (AmConfig::LogSessions) {      
	INFO("Starting UAC session %s app %s\n",
	     session->getLocalTag().c_str(), req.cmd.c_str());
      }

      session->start();

      addSession_unsafe(req.callid,"",req.from_tag,session);
      // session does not get its own INVITE
      //      session->postEvent(new AmSipRequestEvent(req)); 
    }
  } 
  catch(const AmSession::Exception& e){
    ERROR("%i %s\n",e.code,e.reason.c_str());
    AmSipDialog::reply_error(req,e.code,e.reason);
  }
  catch(const string& err){
    ERROR("startSession: %s\n",err.c_str());
    AmSipDialog::reply_error(req,500,err);
  }
  catch(...){
    ERROR("unexpected exception\n");
    AmSipDialog::reply_error(req,500,"unexpected exception");
  }
  as_mut.unlock();
  return session;
}
开发者ID:BackupTheBerlios,项目名称:sems-svn,代码行数:44,代码来源:AmSessionContainer.cpp


注:本文中的AmSession::setCallgroup方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。