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


C++ pjsua_call_get_info函数代码示例

本文整理汇总了C++中pjsua_call_get_info函数的典型用法代码示例。如果您正苦于以下问题:C++ pjsua_call_get_info函数的具体用法?C++ pjsua_call_get_info怎么用?C++ pjsua_call_get_info使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: info

//----------------------------------------------------------------------
bool SipPhone::removeCallFromConference(const int &call_src, const int &call_dest)
{
    int src = call_src;
    int dest = call_dest;

    if (src == -1 || dest == -1)
    {
        LogInfo info(LogInfo::STATUS_ERROR, "pjsip", 0, "Error: one of the selected calls does NOT exist!");
        signalLogData(info);
        return false;
    }

    pjsua_call_info src_ci, dest_ci;

    pjsua_call_get_info(src,&src_ci);
    pjsua_call_get_info(dest,&dest_ci);

    pj_status_t status =  pjsua_conf_disconnect(src_ci.conf_slot,dest_ci.conf_slot);
    if (status != PJ_SUCCESS)
    {
        LogInfo info(LogInfo::STATUS_ERROR, "pjsip", status, "Error connecting conference (1/2)!");
        signalLogData(info);
        return false;
    }
    return true;
}
开发者ID:BillTheBest,项目名称:GreenJ,代码行数:27,代码来源:sip_phone.cpp

示例2: on_call_state

/* Callback called by the library when call's state has changed */
static void on_call_state(pjsua_call_id call_id, pjsip_event *e) {
  pjsua_call_info ci;

  PJ_UNUSED_ARG(e);

  pjsua_call_get_info(call_id, &ci);
  PJ_LOG(3, (THIS_FILE, "Call %d state=%.*s", call_id,
             (int) ci.state_text.slen,
             ci.state_text.ptr));

  pjsua_call_get_info(call_id, &ci);

  char buf[ci.remote_info.slen];
  memcpy(&buf, ci.remote_info.ptr, ci.remote_info.slen);

  or_event_call_state (call_id, ci.state);

  if (ci.state == PJSIP_INV_STATE_CALLING) {
    or_event_outgoing_call(buf, call_id, ci.state);
  }
    
  else if (ci.state == PJSIP_INV_STATE_DISCONNECTED) {
    //TODO: or_event (OR_HANGUP, "Either you or the other party hung up.");
  }
}
开发者ID:AdaHeads,项目名称:Coverage_Tests,代码行数:26,代码来源:basic_agent.c

示例3: pjsua_call_get_info

void ScreenPhone::showVideoWindow(pjsua_call_id call_id)
{
    pjsua_call_info cinfo;
    unsigned i;

    if (call_id == -1)
    return;

    pjsua_call_get_info(call_id, &cinfo);
    qDebug() << "Opening video window.......";
    for (i = 0; i < cinfo.media_cnt; ++i) {
        if ((cinfo.media[i].type == PJMEDIA_TYPE_VIDEO) && (cinfo.media[i].dir & PJMEDIA_DIR_DECODING))
        {
            pjsua_vid_win_info wi;
            pjsua_vid_win_get_info(cinfo.media[i].stream.vid.win_in, &wi);

            const pjmedia_rect_size size = {320, 240};
            const pjmedia_coord pos = {(controller->qmlviewer->x()+controller->qmlviewer->width()),controller->qmlviewer->y()+210};
            pjsua_vid_win_set_size(cinfo.media[i].stream.vid.win_in, &size);
            pjsua_vid_win_set_pos(cinfo.media[i].stream.vid.win_in, &pos);

            this->controller->screenSettings->showPreviewWindow(controller->settings->m_videoDevice.m_name.append("::::").append(controller->settings->m_videoDevice.m_id));

            this->m_video_viewer = new VidWin(&wi.hwnd);

            break;
        }
    }
}
开发者ID:lmedeiros,项目名称:softphone,代码行数:29,代码来源:screenphone.cpp

示例4: pj_str

void ScreenPhone::sendDTMF(pjsua_call_id call_id, const char* digits)
{
    const char* p_digits;

    p_digits = digits;

    pj_str_t pj_digits = pj_str((char*)p_digits);
    pjsua_call_info call_info;

    //qDebug() << "Trying to play dtmf " << digits;

    if(call_id>=0)
    {
        pjsua_call_get_info(call_id, &call_info);
        if (call_info.media_status == PJSUA_CALL_MEDIA_ACTIVE)
        {
            playDTMF(call_id, (char*)p_digits);
            pjsua_call_dial_dtmf(call_id, &pj_digits);
            return;
        }
    }
    else
    {
        playDTMF(call_id, (char*)p_digits);
    }
}
开发者ID:lmedeiros,项目名称:softphone,代码行数:26,代码来源:screenphone.cpp

示例5: on_call_media_state

static void on_call_media_state(pjsua_call_id call_id)
{
#if PJMEDIA_HAS_VIDEO
    pjsua_call_info call_info;
    unsigned mi;

    pjsua_call_get_info(call_id, &call_info);

    for (mi=0; mi<call_info.media_cnt; ++mi) {
        pjsua_call_media_info *med_info = &call_info.media[mi];
	if (med_info->type == PJMEDIA_TYPE_VIDEO &&
	    med_info->status == PJSUA_CALL_MEDIA_ACTIVE &&
	    med_info->stream.vid.win_in != PJSUA_INVALID_ID)
	{
	    pjmedia_vid_dev_hwnd vhwnd;

	    /* Setup renderer surface */
	    pj_bzero(&vhwnd, sizeof(vhwnd));
	    vhwnd.type = PJMEDIA_VID_DEV_HWND_TYPE_ANDROID;
	    vhwnd.info.window = callVideoSurface;
	    pjsua_vid_win_set_win(med_info->stream.vid.win_in, &vhwnd);
	    break;
	}
    }
#endif
    
    /* Forward to original callback */
    if (pjsua_cb_orig.on_call_media_state)
	(*pjsua_cb_orig.on_call_media_state)(call_id);
}
开发者ID:0x0B501E7E,项目名称:pjproject,代码行数:30,代码来源:pjsua_app_callback.cpp

示例6: PJ_UNUSED_ARG

void SipAccount::onCallState(pjsua_call_id call_id, pjsip_event* e) {
  Logger::debug("SipAccount::onCallState(call_id=%d)...", call_id);
  PJ_UNUSED_ARG(e);

  pjsua_call_info ci;
  pjsua_call_get_info(call_id, &ci);

  std::string display, number;
  if (!getNumber(&ci.remote_info, &display, &number)) {
    Logger::warn("invalid URI received '%s'", pj_strbuf(&ci.remote_info));
    return;
  }

  std::string state = std::string(pj_strbuf(&ci.state_text), ci.state_text.slen);
  Logger::debug("[%s] call state changed to %s", number.c_str(), state.c_str());

#if 1
  if (ci.state == PJSIP_INV_STATE_CONFIRMED) {
    Logger::debug("hangup...");
    // code 0: pj takes care of hangup SIP status code
    pj_status_t status = pjsua_call_hangup(call_id, 0, NULL, NULL);
    if (status != PJ_SUCCESS) {
      Logger::warn("pjsua_call_hangup() failed (%s)", Helper::getPjStatusAsString(status).c_str());
    }
  }
#endif
}
开发者ID:Buffi79,项目名称:callblocker,代码行数:27,代码来源:SipAccount.cpp

示例7: OnCallState

void BlabbleCall::OnCallState(pjsua_call_id call_id, pjsip_event *e)
{
	pjsua_call_info info;
	if (pjsua_call_get_info(call_id, &info) == PJ_SUCCESS)
	{
		if (info.state == PJSIP_INV_STATE_DISCONNECTED) 
		{
			RemoteEnd(info);
		}
		else if (info.state == PJSIP_INV_STATE_CALLING)
		{
			if (on_call_ringing_)
				on_call_ringing_->InvokeAsync("", FB::variant_list_of(BlabbleCallWeakPtr(get_shared())));

			BlabbleAccountPtr p = parent_.lock();
			if (p)
				p->OnCallRingChange(get_shared(), info);
		}
		else if (info.state == PJSIP_INV_STATE_CONFIRMED)
		{
			if (on_call_connected_)
				on_call_connected_->InvokeAsync("", FB::variant_list_of(BlabbleCallWeakPtr(get_shared())));

			BlabbleAccountPtr p = parent_.lock();
			if (p)
				p->OnCallRingChange(get_shared(), info);
		}
	}
}
开发者ID:arovetto,项目名称:Blabble,代码行数:29,代码来源:BlabbleCall.cpp

示例8: PJ_UNUSED_ARG

void MainWin::on_call_state(pjsua_call_id call_id, pjsip_event *e)
{
    pjsua_call_info ci;

    PJ_UNUSED_ARG(e);

    pjsua_call_get_info(call_id, &ci);

    if (currentCall_ == -1 && ci.state < PJSIP_INV_STATE_DISCONNECTED &&
	ci.role == PJSIP_ROLE_UAC)
    {
	emit signalNewCall(call_id, false);
    }

    char status[80];
    if (ci.state == PJSIP_INV_STATE_DISCONNECTED) {
	snprintf(status, sizeof(status), "Call is %s (%s)",
	         ci.state_text.ptr,
	         ci.last_status_text.ptr);
	showStatus(status);
	emit signalCallReleased();
    } else {
	snprintf(status, sizeof(status), "Call is %s", pjsip_inv_state_name(ci.state));
	showStatus(status);
    }
}
开发者ID:avble,项目名称:natClientEx,代码行数:26,代码来源:vidgui.cpp

示例9: on_call_tsx_state

/* Called by the library when a transaction within the call has changed state. */
static void on_call_tsx_state (pjsua_call_id      call_id,
                               pjsip_transaction *tsx,
                               pjsip_event       *e) {
  PJ_UNUSED_ARG(e);

  pjsua_call_info ci;
  pjsua_call_get_info(call_id, &ci);


  if (tsx == NULL) {
    or_event_call_tsx_state (call_id, -1);
  } else {
    or_event_call_tsx_state (call_id, tsx->status_code);

    if ((tsx->status_code == 180) &&
        (previous_invitation_state == PJSIP_INV_STATE_CALLING)) {
      //TODO: or_event (OR_RINGING,   "Maybe somebody will pick up the phone at the other end soon.");
    }
    else if ((tsx->status_code == 200) &&
             (ci.state == PJSIP_INV_STATE_CONFIRMED)) {
      //TODO: or_event (OR_CONNECTED, "Somebody picked up the phone at the other end.");
    }
  }

  previous_invitation_state = ci.state;
}
开发者ID:AdaHeads,项目名称:Coverage_Tests,代码行数:27,代码来源:basic_agent.c

示例10: pjsua_call_hangup

// REITEK: Callback to handle transaction state changes
//Static
void PjsuaManager::OnCallTsxState(pjsua_call_id call_id, pjsip_transaction *tsx, pjsip_event *e)
{
	PjsuaManagerPtr manager = PjsuaManager::instance_.lock();

	if (!manager)
		return;

	pjsua_call_info info;
	pj_status_t status;
	if ((status = pjsua_call_get_info(call_id, &info)) == PJ_SUCCESS)
	{
		std::string str = "PjsuaManager::OnCallTsxState called with PJSIP call id: " + boost::lexical_cast<std::string>(call_id)+", state: " + boost::lexical_cast<std::string>(info.state);
		BlabbleLogging::blabbleLog(0, str.c_str(), 0);
		//BLABBLE_LOG_TRACE("PjsuaManager::OnCallTsxState called with PJSIP call id: "<< call_id << ", state: " << info.state);
		BlabbleAccountPtr acc = manager->FindAcc(info.acc_id);
		if (acc)
		{
			acc->OnCallTsxState(call_id, tsx, e);
		}

		// REITEK: !!! CHECK: If this necessary/wanted?
		if (info.state == PJSIP_INV_STATE_DISCONNECTED)
		{
			//Just make sure we get rid of the call
			pjsua_call_hangup(call_id, 0, NULL, NULL);
		}
	}
	else
	{
		std::string str = "PjsuaManager::OnCallTsxState failed to call pjsua_call_get_info for PJSIP call id: " + boost::lexical_cast<std::string>(call_id)+", got status: " + boost::lexical_cast<std::string>(status);
		BlabbleLogging::blabbleLog(0, str.c_str(), 0);
		//BLABBLE_LOG_ERROR("PjsuaManager::OnCallTsxState failed to call pjsua_call_get_info for PJSIP call id: "<< call_id << ", got status: " << status);
	}
}
开发者ID:reitek,项目名称:Blabble,代码行数:36,代码来源:PjsuaManager.cpp

示例11: on_call_state

/*
 * Handler when invite state has changed.
 */
static void on_call_state (pjsua_call_id call_id, pjsip_event *e)
{
    pjsua_call_info call_info;

    PJ_UNUSED_ARG (e);

    pjsua_call_get_info (call_id, &call_info);

    if (call_info.state == PJSIP_INV_STATE_DISCONNECTED) {

        g_current_call = PJSUA_INVALID_ID;
        SetURI (SIP_DST_URI, -1);
        SetAction (ID_MENU_CALL);
        //SetCallStatus(call_info.state_text.ptr, call_info.state_text.slen);
        SetCallStatus (call_info.last_status_text.ptr, call_info.last_status_text.slen);

    } else {
        //if (g_current_call == PJSUA_INVALID_ID)
        //    g_current_call = call_id;

        if (call_info.remote_contact.slen)
            SetURI (call_info.remote_contact.ptr, call_info.remote_contact.slen, false);
        else
            SetURI (call_info.remote_info.ptr, call_info.remote_info.slen, false);

        if (call_info.state == PJSIP_INV_STATE_CONFIRMED)
            SetAction (ID_MENU_DISCONNECT);

        SetCallStatus (call_info.state_text.ptr, call_info.state_text.slen);
    }
}
开发者ID:max3903,项目名称:SFLphone,代码行数:34,代码来源:pjsua_wince.cpp

示例12: on_incoming_call

/* Callback called by the library upon receiving incoming call */
static void on_incoming_call(pjsua_acc_id acc_id, pjsua_call_id call_id,
                             pjsip_rx_data *rdata) {
  pjsua_call_info ci;


  PJ_UNUSED_ARG(acc_id);
  PJ_UNUSED_ARG(rdata);

  pjsua_call_get_info(call_id, &ci);

  char buf[ci.remote_info.slen];
  memcpy(&buf, ci.remote_info.ptr, ci.remote_info.slen);

  or_event_incoming_call (buf, call_id, ci.state);

  current_call = call_id;

  PJ_LOG(3, (THIS_FILE, "Incoming call from %.*s!!",
             (int) ci.remote_info.slen,
             ci.remote_info.ptr));

  if (autoanswer[0]) {
    pjsua_call_answer(call_id, 200, NULL, NULL);
  } else {
    pjsua_call_answer(call_id, 180, NULL, NULL); //Acknowledge the call.
  }

}
开发者ID:AdaHeads,项目名称:Coverage_Tests,代码行数:29,代码来源:basic_agent.c

示例13: on_transport_created_wrapper

// ZRTP and other media dispatcher
pjmedia_transport* on_transport_created_wrapper(pjsua_call_id call_id,
	unsigned media_idx,
	pjmedia_transport *base_tp,
	unsigned flags) {
	pj_status_t status = PJ_SUCCESS;
	pjsua_call_info call_info;
	void* acc_user_data;
	int acc_use_zrtp = -1;

	// By default, use default global def
	pj_bool_t use_zrtp = css_var.default_use_zrtp;
    status = pjsua_call_get_info(call_id, &call_info);
	if(status == PJ_SUCCESS && pjsua_acc_is_valid (call_info.acc_id)){
		acc_user_data = pjsua_acc_get_user_data(call_info.acc_id);
		if(acc_user_data != NULL){
			acc_use_zrtp = ((csipsimple_acc_config *) acc_user_data)->use_zrtp;
			if(acc_use_zrtp >= 0){
				use_zrtp = (acc_use_zrtp == 1) ? PJ_TRUE : PJ_FALSE;
			}
		}
	}
#if defined(PJMEDIA_HAS_ZRTP) && PJMEDIA_HAS_ZRTP!=0
	if(use_zrtp){
		PJ_LOG(4, (THIS_FILE, "Dispatch transport creation on ZRTP one"));
		return on_zrtp_transport_created(call_id, media_idx, base_tp, flags);
	}
#endif


	return base_tp;
}
开发者ID:ChrisKwon,项目名称:spore,代码行数:32,代码来源:pjsua_jni_addons.c

示例14: INTERLOCKED_EXCHANGE

//Ended by us
void BlabbleCall::LocalEnd()
{
	pjsua_call_id old_id = INTERLOCKED_EXCHANGE((volatile long *)&call_id_, (long)INVALID_CALL);
	if (old_id == INVALID_CALL || 
		old_id < 0 || old_id >= (long)pjsua_call_get_max_count())
	{
		return;
	}

	StopRinging();

	pjsua_call_info info;
	if (pjsua_call_get_info(old_id, &info) == PJ_SUCCESS &&
		info.conf_slot > 0) 
	{
		//Kill the audio
		pjsua_conf_disconnect(info.conf_slot, 0);
		pjsua_conf_disconnect(0, info.conf_slot);
	}

	pjsua_call_hangup(old_id, 0, NULL, NULL);
	
	if (on_call_end_)
	{
		BlabbleCallPtr call = get_shared();
		on_call_end_->getHost()->ScheduleOnMainThread(call, boost::bind(&BlabbleCall::CallOnCallEnd, call));
	}

	BlabbleAccountPtr p = parent_.lock();
	if (p)
		p->OnCallEnd(get_shared());
}
开发者ID:arovetto,项目名称:Blabble,代码行数:33,代码来源:BlabbleCall.cpp

示例15: pjsua_call_get_info

void MainWin::initVideoWindow()
{
    pjsua_call_info ci;
    unsigned i;

    if (currentCall_ == -1)
	return;

    delete video_;
    video_ = NULL;

    pjsua_call_get_info(currentCall_, &ci);
    for (i = 0; i < ci.media_cnt; ++i) {
	if ((ci.media[i].type == PJMEDIA_TYPE_VIDEO) &&
	    (ci.media[i].dir & PJMEDIA_DIR_DECODING))
	{
	    pjsua_vid_win_info wi;
	    pjsua_vid_win_get_info(ci.media[i].stream.vid.win_in, &wi);

	    video_= new VidWin(&wi.hwnd);
            video_->putIntoLayout(vbox_left);

	    break;
	}
    }
}
开发者ID:avble,项目名称:natClientEx,代码行数:26,代码来源:vidgui.cpp


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