예제 #1
0
static void ui_call_transfer(pj_bool_t no_refersub)
{
    if (current_call == -1) {
	PJ_LOG(3,(THIS_FILE, "No current call"));
    } else {
	int call = current_call;
	char buf[128];
	pjsip_generic_string_hdr refer_sub;
	pj_str_t STR_REFER_SUB = { "Refer-Sub", 9 };
	pj_str_t STR_FALSE = { "false", 5 };
	pjsua_call_info ci;
	input_result result;
	pjsua_msg_data msg_data;

	pjsua_call_get_info(current_call, &ci);
	printf("Transferring current call [%d] %.*s\n", current_call,
	       (int)ci.remote_info.slen, ci.remote_info.ptr);

	ui_input_url("Transfer to URL", buf, sizeof(buf), &result);

	/* Check if call is still there. */

	if (call != current_call) {
	    puts("Call has been disconnected");
	    return;
	}

	pjsua_msg_data_init(&msg_data);
	if (no_refersub) {
	    /* Add Refer-Sub: false in outgoing REFER request */
	    pjsip_generic_string_hdr_init2(&refer_sub, &STR_REFER_SUB,
		&STR_FALSE);
	    pj_list_push_back(&msg_data.hdr_list, &refer_sub);
	}
	if (result.nb_result != PJSUA_APP_NO_NB) {
	    if (result.nb_result == -1 || result.nb_result == 0)
		puts("You can't do that with transfer call!");
	    else {
		pjsua_buddy_info binfo;
		pjsua_buddy_get_info(result.nb_result-1, &binfo);
		pjsua_call_xfer( current_call, &binfo.uri, &msg_data);
	    }

	} else if (result.uri_result) {
	    pj_str_t tmp;
	    tmp = pj_str(result.uri_result);
	    pjsua_call_xfer( current_call, &tmp, &msg_data);
	}
    }
}
예제 #2
0
//----------------------------------------------------------------------
int SipPhone::redirectCall(const int &call_id, const QString &dest_uri)
{
    pjsua_msg_data msg_data;
    pjsua_msg_data_init(&msg_data);
    pj_str_t str = pj_str((char*)dest_uri.toLocal8Bit().data());

    return pjsua_call_xfer(call_id,&str,NULL);
}
예제 #3
0
void Transfer::OnBnClickedOk()
{
	MessagesContact* messagesContactSelected = microsipDlg->messagesDlg->GetMessageContact();
	if (messagesContactSelected->callId!=-1) {
		CString number;
		GetDlgItem(IDC_NUMBER)->GetWindowText(number);
		number.Trim();
		if (!number.IsEmpty()) {
			pj_str_t pj_uri = StrToPjStr ( GetSIPURI(number, true) );
			pjsua_call_xfer(messagesContactSelected->callId, &pj_uri, NULL);
			OnClose();
		}
	}
}
예제 #4
0
bool BlabbleCall::Transfer(const FB::VariantMap &params)
{
	std::string destination;
	pj_str_t desturi;
	BlabbleAccountPtr p = parent_.lock();
	if (!p)
		return false;

	if (call_id_ == INVALID_CALL)
		return false;

	FB::VariantMap::const_iterator iter = params.find("destination");
	if (iter == params.end())
	{
		throw FB::script_error("No destination given!");
	}
	else
	{
		destination = iter->second.cast<std::string>();
		if (destination.size() <= 4 || destination.substr(0, 4) != "sip:")
			destination = "sip:" + destination + "@" + p->server();

		if (p->use_tls() && destination.find("transport=TLS") == std::string::npos)
			destination += ";transport=TLS";
	}

	if ((iter = params.find("onStatusChange")) != params.end() &&
		iter->second.is_of_type<FB::JSObjectPtr>())
	{
		set_on_transfer_status(iter->second.cast<FB::JSObjectPtr>());
	}

	desturi.ptr = const_cast<char*>(destination.c_str());
	desturi.slen = destination.length();
	return pjsua_call_xfer(call_id_, &desturi, NULL) == PJ_SUCCESS;
}