本文整理汇总了C++中Call类的典型用法代码示例。如果您正苦于以下问题:C++ Call类的具体用法?C++ Call怎么用?C++ Call使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Call类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: on_call_state
// Call callbacks
void Endpoint::on_call_state(pjsua_call_id call_id, pjsip_event *e)
{
Call *call = Call::lookup(call_id);
if (!call) {
return;
}
OnCallStateParam prm;
prm.e.fromPj(*e);
call->processStateChange(prm);
/* If the state is DISCONNECTED, call may have already been deleted
* by the application in the callback, so do not access it anymore here.
*/
}
示例2: on_stream_destroyed
void Endpoint::on_stream_destroyed(pjsua_call_id call_id,
pjmedia_stream *strm,
unsigned stream_idx)
{
Call *call = Call::lookup(call_id);
if (!call) {
return;
}
OnStreamDestroyedParam prm;
prm.stream = strm;
prm.streamIdx = stream_idx;
call->onStreamDestroyed(prm);
}
示例3: mainProg1
static void mainProg1() throw(Error)
{
Endpoint ep;
// Create library
ep.libCreate();
// Init library
EpConfig ep_cfg;
ep_cfg.logConfig.level = 4;
ep.libInit( ep_cfg );
// Transport
TransportConfig tcfg;
tcfg.port = 5060;
ep.transportCreate(PJSIP_TRANSPORT_UDP, tcfg);
// Start library
ep.libStart();
std::cout << "*** PJSUA2 STARTED ***" << std::endl;
// Add account
AccountConfig acc_cfg;
acc_cfg.idUri = "sip:[email protected]";
acc_cfg.regConfig.registrarUri = "sip:pjsip.org";
acc_cfg.sipConfig.authCreds.push_back( AuthCredInfo("digest", "*",
"test1", 0, "test1") );
std::auto_ptr<MyAccount> acc(new MyAccount);
acc->create(acc_cfg);
pj_thread_sleep(2000);
// Make outgoing call
Call *call = new MyCall(*acc);
acc->calls.push_back(call);
CallOpParam prm(true);
prm.opt.audioCount = 1;
prm.opt.videoCount = 0;
call->makeCall("sip:[email protected]", prm);
// Hangup all calls
pj_thread_sleep(8000);
ep.hangupAllCalls();
pj_thread_sleep(4000);
// Destroy library
std::cout << "*** PJSUA2 SHUTTING DOWN ***" << std::endl;
}
示例4: NS_ENSURE_TRUE_VOID
void
BluetoothHfpManager::SendCLCC(Call& aCall, int aIndex)
{
NS_ENSURE_TRUE_VOID(aCall.mState !=
nsITelephonyService::CALL_STATE_DISCONNECTED);
NS_ENSURE_TRUE_VOID(sBluetoothHfpInterface);
BluetoothHandsfreeCallState callState =
ConvertToBluetoothHandsfreeCallState(aCall.mState);
if (mPhoneType == PhoneType::CDMA && aIndex == 1 && aCall.IsActive()) {
callState = (mCdmaSecondCall.IsActive()) ? HFP_CALL_STATE_HELD :
HFP_CALL_STATE_ACTIVE;
}
if (callState == HFP_CALL_STATE_INCOMING &&
FindFirstCall(nsITelephonyService::CALL_STATE_CONNECTED)) {
callState = HFP_CALL_STATE_WAITING;
}
sBluetoothHfpInterface->ClccResponse(
aIndex, aCall.mDirection, callState, HFP_CALL_MODE_VOICE,
HFP_CALL_MPTY_TYPE_SINGLE, aCall.mNumber,
aCall.mType, mDeviceAddress, new ClccResponseResultHandler());
}
示例5: PJ_UNUSED_ARG
void Endpoint::on_call_tsx_state(pjsua_call_id call_id,
pjsip_transaction *tsx,
pjsip_event *e)
{
PJ_UNUSED_ARG(tsx);
Call *call = Call::lookup(call_id);
if (!call) {
return;
}
OnCallTsxStateParam prm;
prm.e.fromPj(*e);
call->onCallTsxState(prm);
}
示例6: TEST_P
// This test verifies if the role is invalid in scheduler's framework message,
// the event is error on the stream in response to a Subscribe call request.
TEST_P(SchedulerHttpApiTest, RejectFrameworkWithInvalidRole)
{
Try<Owned<cluster::Master>> master = StartMaster();
ASSERT_SOME(master);
Call call;
call.set_type(Call::SUBSCRIBE);
Call::Subscribe* subscribe = call.mutable_subscribe();
v1::FrameworkInfo framework = v1::DEFAULT_FRAMEWORK_INFO;
// Set invalid role.
framework.set_role("/test/test1");
subscribe->mutable_framework_info()->CopyFrom(framework);
// Retrieve the parameter passed as content type to this test.
const string contentType = GetParam();
process::http::Headers headers = createBasicAuthHeaders(DEFAULT_CREDENTIAL);
headers["Accept"] = contentType;
Future<Response> response = process::http::streaming::post(
master.get()->pid,
"api/v1/scheduler",
headers,
serialize(call, contentType),
contentType);
AWAIT_EXPECT_RESPONSE_STATUS_EQ(OK().status, response);
AWAIT_EXPECT_RESPONSE_HEADER_EQ("chunked", "Transfer-Encoding", response);
ASSERT_EQ(Response::PIPE, response.get().type);
Option<Pipe::Reader> reader = response.get().reader;
ASSERT_SOME(reader);
auto deserializer = lambda::bind(
&SchedulerHttpApiTest::deserialize, this, contentType, lambda::_1);
Reader<Event> responseDecoder(Decoder<Event>(deserializer), reader.get());
Future<Result<Event>> event = responseDecoder.read();
AWAIT_READY(event);
ASSERT_SOME(event.get());
// Check event type is error.
ASSERT_EQ(Event::ERROR, event.get().get().type());
}
示例7: Call
//==========================================================================================================
// If call-id exists, return the call that it is mapped to.
// If not create a new call object. Its direction will be the direction of its first message.
//==========================================================================================================
Call* ScriptReader::CallsMap::get_call(SipMessage* msg)
{
string call_id = msg->get_call_id();
Call* call;
if(calls_map.count(call_id) != 0)
{
call = calls_map[call_id];
call->update(msg);
return call;
}
else
{
calls_map[call_id] = new Call(++last_call_num, msg);
return calls_map[call_id];
}
}
示例8: throw
void Call::xferReplaces(const Call& dest_call,
const CallOpParam &prm) throw(Error)
{
call_param param(prm.txOption);
PJSUA2_CHECK_EXPR(pjsua_call_xfer_replaces(id, dest_call.getId(),
prm.options, param.p_msg_data) );
}
示例9: LOG
void SIPEngine::onAnswer(resip::InviteSessionHandle is, const resip::SipMessage& msg, const resip::SdpContents& sdp)
{
Call *pCall = (Call*)is->getAppDialogSet().get();
const char* peerIP = sdp.session().origin().getAddress().c_str();
unsigned int peerPort = sdp.session().media().front().port();
LOG("Outgoing call was answered. SDP: "<<peerIP<<":"<<peerPort);
Dumais::Sound::RTPSession *rtpSession = pCall->getRTPSession();
rtpSession->setPeerAddress(peerIP, peerPort);
rtpSession->start();
pCall->mCallState = Answered;
mpObserver->onAnswer(pCall);
}
示例10: serialize
string serialize(const Call& call, const string& contentType)
{
if (contentType == APPLICATION_PROTOBUF) {
return call.SerializeAsString();
}
return stringify(JSON::protobuf(call));
}
示例11: resourceOffers
void resourceOffers(const vector<Offer>& offers)
{
foreach (const Offer& offer, offers) {
cout << "Received offer " << offer.id() << " with " << offer.resources()
<< endl;
static const Resources TASK_RESOURCES = Resources::parse(
"cpus:" + stringify(CPUS_PER_TASK) +
";mem:" + stringify(MEM_PER_TASK)).get();
Resources remaining = offer.resources();
// Launch tasks.
vector<TaskInfo> tasks;
while (tasksLaunched < totalTasks &&
TASK_RESOURCES <= remaining.flatten()) {
int taskId = tasksLaunched++;
cout << "Launching task " << taskId << " using offer "
<< offer.id() << endl;
TaskInfo task;
task.set_name("Task " + lexical_cast<string>(taskId));
task.mutable_task_id()->set_value(
lexical_cast<string>(taskId));
task.mutable_slave_id()->MergeFrom(offer.slave_id());
task.mutable_executor()->MergeFrom(executor);
Option<Resources> resources =
remaining.find(TASK_RESOURCES, framework.role());
CHECK_SOME(resources);
task.mutable_resources()->MergeFrom(resources.get());
remaining -= resources.get();
tasks.push_back(task);
}
Call call;
call.mutable_framework_info()->CopyFrom(framework);
call.set_type(Call::LAUNCH);
Call::Launch* launch = call.mutable_launch();
foreach (const TaskInfo& taskInfo, tasks) {
launch->add_task_infos()->CopyFrom(taskInfo);
}
示例12: killTask
void killTask(const TaskID& taskId, const AgentID& agentId)
{
cout << "Asked to kill task '" << taskId
<< "' on agent '" << agentId << "'" << endl;
Call call;
call.set_type(Call::KILL);
CHECK(frameworkInfo.has_id());
call.mutable_framework_id()->CopyFrom(frameworkInfo.id());
Call::Kill* kill = call.mutable_kill();
kill->mutable_task_id()->CopyFrom(taskId);
kill->mutable_agent_id()->CopyFrom(agentId);
mesos->send(call);
}
示例13: DocumentObject
Call::Call(const Call& src) :
DocumentObject(src.getDocument(),"",0),
_callType(src._callType), _destinationEntry(src._destinationEntry),
_callMean(src._callMean), _histogram(src._histogram),
_hasResultVarianceWaitingTime(false),
_resultWaitingTime(0.0), _resultWaitingTimeVariance(0.0),
_resultVarianceWaitingTime(0.0), _resultVarianceWaitingTimeVariance(0.0),
_resultDropProbability(0.0), _resultDropProbabilityVariance(0.0)
{
}
示例14:
// must be locked
vector<Call> CallManager::getClientList(unsigned int translator)
{
vector<Call> calllist;
for (int i=0; i<calls.size(); i++) {
Call *call = calls[i];
PhoneCall *pcall = dynamic_cast<PhoneCall *>(call);
if (pcall) {
if (pcall->getTranslator() != translator)
continue;
pcall->lock();
Call callc = *pcall;
pcall->unlock();
callc.reset_lock();
calllist.push_back(callc);
}
}
return calllist;
}
示例15: dtmf_pressed
static gboolean
dtmf_pressed(RingMainWindow *win,
GdkEventKey *event,
G_GNUC_UNUSED gpointer user_data)
{
g_return_val_if_fail(event->type == GDK_KEY_PRESS, GDK_EVENT_PROPAGATE);
/* we want to react to digit key presses, as long as a GtkEntry is not the
* input focus
*/
GtkWidget *focus = gtk_window_get_focus(GTK_WINDOW(win));
if (GTK_IS_ENTRY(focus))
return GDK_EVENT_PROPAGATE;
/* make sure that a call is selected*/
QItemSelectionModel *selection = CallModel::instance().selectionModel();
QModelIndex idx = selection->currentIndex();
if (!idx.isValid())
return GDK_EVENT_PROPAGATE;
/* make sure that the selected call is in progress */
Call *call = CallModel::instance().getCall(idx);
Call::LifeCycleState state = call->lifeCycleState();
if (state != Call::LifeCycleState::PROGRESS)
return GDK_EVENT_PROPAGATE;
/* filter out cretain MOD masked key presses so that, for example, 'Ctrl+c'
* does not result in a 'c' being played.
* we filter Ctrl, Alt, and SUPER/HYPER/META keys */
if ( event->state
& ( GDK_CONTROL_MASK | GDK_MOD1_MASK | GDK_SUPER_MASK | GDK_HYPER_MASK | GDK_META_MASK ))
return GDK_EVENT_PROPAGATE;
/* pass the character that was entered to be played by the daemon;
* the daemon will filter out invalid DTMF characters */
guint32 unicode_val = gdk_keyval_to_unicode(event->keyval);
QString val = QString::fromUcs4(&unicode_val, 1);
call->playDTMF(val);
g_debug("attemptingto play DTMF tone during ongoing call: %s", val.toUtf8().constData());
/* always propogate the key, so we don't steal accelerators/shortcuts */
return GDK_EVENT_PROPAGATE;
}