VoiceCall_Controls::VoiceCall_Controls(GUI_Handler* _gui_handler, QWidget* parent) : QWidget(parent), gui_handler(_gui_handler), ui(new Ui::VoiceCall_Controls), making_call(false), active_call_id(0), vol_muted(false), mic_muted(false), last_vol_lvl(255), last_mic_lvl(255) { ui->setupUi(this); ui->verticalSlider_vol->setMinimum(0); ui->verticalSlider_mic->setMinimum(0); ui->verticalSlider_vol->setMaximum(255); ui->verticalSlider_mic->setMaximum(255); QObject::connect(ui->verticalSlider_vol, SIGNAL(sliderMoved(int)), this, SLOT(vol_changed(int))); QObject::connect(ui->verticalSlider_mic, SIGNAL(sliderMoved(int)), this, SLOT(mic_changed(int))); QObject::connect(ui->pushButton_muteVol, SIGNAL(clicked()), this, SLOT(mute_vol())); QObject::connect(ui->pushButton_muteMic, SIGNAL(clicked()), this, SLOT(mute_mic())); QObject::connect(ui->pushButton, SIGNAL(clicked()), this, SLOT(make_call())); QObject::connect(ui->lineEdit, SIGNAL(returnPressed()), this, SLOT(make_call())); // this->update_ui(); this->registered(false); this->set_vol( last_vol_lvl ); this->set_mic( last_mic_lvl ); ui->label_info->clear(); ui->label_status->clear(); }
int main(int argc, char** argv){ mach_port_t port = get_user_client("IOUSBInterface", 0x0); map_payload(0xffff414141414141); make_call(port); return 0; }
/* * main() * */ int main(int argc, char *argv[]) { pj_caching_pool cp; pj_thread_t *thread; pj_pool_t *pool; pj_status_t status; if (argc != 2) { puts("Error: destination URL needed"); return 0; } /* Must init PJLIB first: */ status = pj_init(); PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1); /* Then init PJLIB-UTIL: */ status = pjlib_util_init(); PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1); /* Must create a pool factory before we can allocate any memory. */ pj_caching_pool_init(&cp, &pj_pool_factory_default_policy, 0); /* Create the endpoint: */ status = pjsip_endpt_create(&cp.factory, "sipstateless", &sip_endpt); PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1); /* * Add UDP transport, with hard-coded port */ { pj_sockaddr_in addr; addr.sin_family = pj_AF_INET(); addr.sin_addr.s_addr = 0; addr.sin_port = pj_htons(PORT); status = pjsip_udp_transport_start( sip_endpt, &addr, NULL, 1, NULL); if (status != PJ_SUCCESS) { PJ_LOG(3,(THIS_FILE, "Error starting UDP transport (port in use?)")); return 1; } } status = pjsip_tsx_layer_init_module(sip_endpt); pj_assert(status == PJ_SUCCESS); status = pjsip_ua_init_module(sip_endpt, NULL); pj_assert(status == PJ_SUCCESS); /* * Register our module to receive incoming requests. */ status = pjsip_endpt_register_module( sip_endpt, &mod_app); PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1); pool = pjsip_endpt_create_pool(sip_endpt, "", 1000, 1000); status = pj_thread_create(pool, "", &worker_thread, NULL, 0, 0, &thread); PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1); printf("Destination URL: %s\n", argv[1]); for (;;) { char line[10]; fgets(line, sizeof(line), stdin); switch (line[0]) { case 'm': make_call(argv[1], PJ_FALSE); break; case 'M': make_call(argv[1], PJ_TRUE); break; case 'r': reinvite(PJ_FALSE); break; case 'R': reinvite(PJ_TRUE); break; case 'h': hangup(); break; case 'q': goto on_quit; } } on_quit: quit_flag = 1; pj_thread_join(thread); pjsip_endpt_destroy(sip_endpt); pj_caching_pool_destroy(&cp); pj_shutdown(); return 0; }
Call_expr& Builder::make_call(Type& t, Function_decl& f, Expr_list const& a) { return make_call(t, make_reference(f), a); }
void make_call(const Arg1& arg1, const Args&... args) { const int cur_idx = sizeof ... (Contracts) - sizeof ... (Args) - 1; get<cur_idx>(base)(arg1); make_call( args...); }
//---------------------------------------------------------------------------// bool CAddInNative::CallAsProc(const long lMethodNum, tVariant* paParams, const long lSizeArray) { switch(lMethodNum) { case eMethEnable: m_boolEnabled = true; break; case eMethDisable: m_boolEnabled = false; //_tmain(0, NULL); break; case eMethShowInStatusLine: if (m_iConnect && lSizeArray) { tVariant *var = paParams; m_iConnect->SetStatusLine(var->pwstrVal); #ifndef __linux__ Sleep(5000); #else sleep(5); #endif } break; case eMethStartTimer: pAsyncEvent = m_iConnect; /* The task of length of turn of messages if (m_iConnect) m_iConnect->SetEventBufferDepth(4000); */ #ifndef __linux__ m_uiTimer = ::SetTimer(NULL,0,100,(TIMERPROC)MyTimerProc); #else struct sigaction sa; struct itimerval tv; memset(&tv, 0, sizeof(tv)); sa.sa_handler = MyTimerProc; sigemptyset(&sa.sa_mask); sa.sa_flags = SA_RESTART; sigaction(SIGALRM, &sa, NULL); tv.it_interval.tv_sec = 1; tv.it_value.tv_sec = 1; setitimer(ITIMER_REAL, &tv, NULL); #endif break; case eMethStopTimer: #ifndef __linux__ if (m_uiTimer != 0) ::KillTimer(NULL,m_uiTimer); #else alarm(0); #endif m_uiTimer = 0; pAsyncEvent = NULL; break; case eMethShowMsgBox: { if(eAppCapabilities1 <= g_capabilities) { IAddInDefBaseEx* cnn = (IAddInDefBaseEx*)m_iConnect; IMsgBox* imsgbox = (IMsgBox*)cnn->GetInterface(eIMsgBox); if (imsgbox) { IPlatformInfo* info = (IPlatformInfo*)cnn->GetInterface(eIPlatformInfo); assert(info); const IPlatformInfo::AppInfo* plt = info->GetPlatformInfo(); if (!plt) break; tVariant retVal; tVarInit(&retVal); if(imsgbox->Confirm(plt->AppVersion, &retVal)) { bool succeed = TV_BOOL(&retVal); if (succeed) { imsgbox->Alert(L"OKFFFFF"); } else imsgbox->Alert(L"Cancel"); } } } } break; case eMethInit: { init(); } break; case eMethReg: { reg_on_srv(); } break; case eMethMakeCall: { make_call(unicode_to_pj_str(paParams->pwstrVal)); } break; case eMethsetNullDev: { setNullDev(); } break; default: return false; } return true; }
/* Client worker thread */ static int client_thread(void *arg) { pj_time_val end_time, last_report, now; unsigned thread_index = (unsigned)(long)arg; unsigned cycle = 0, last_cycle = 0; pj_thread_sleep(100); pj_gettimeofday(&end_time); end_time.sec += app.client.timeout; pj_gettimeofday(&last_report); if (app.client.first_request.sec == 0) { pj_gettimeofday(&app.client.first_request); } /* Submit all jobs */ while (app.client.job_submitted < app.client.job_count && !app.thread_quit){ pj_time_val timeout = { 0, 1 }; unsigned i; int outstanding; pj_status_t status; /* Calculate current outstanding job */ outstanding = app.client.job_submitted - app.client.job_finished; /* Update stats on max outstanding jobs */ if (outstanding > (int)app.client.stat_max_window) app.client.stat_max_window = outstanding; /* Wait if there are more pending jobs than allowed in the * window. But spawn a new job anyway if no events are happening * after we wait for some time. */ for (i=0; outstanding > (int)app.client.job_window && i<1000; ++i) { pj_time_val wait = { 0, 500 }; unsigned count = 0; pjsip_endpt_handle_events2(app.sip_endpt, &wait, &count); outstanding = app.client.job_submitted - app.client.job_finished; if (count == 0) break; ++cycle; } /* Submit one job */ if (app.client.method.id == PJSIP_INVITE_METHOD) { status = make_call(&app.client.dst_uri); } else if (app.client.stateless) { status = submit_stateless_job(); } else { status = submit_job(); } ++app.client.job_submitted; ++cycle; /* Handle event */ pjsip_endpt_handle_events2(app.sip_endpt, &timeout, NULL); /* Check for time out, also print report */ if (cycle - last_cycle >= 500) { pj_gettimeofday(&now); if (PJ_TIME_VAL_GTE(now, end_time)) { break; } last_cycle = cycle; if (thread_index == 0 && now.sec-last_report.sec >= 2) { printf("\r%d jobs started, %d completed... ", app.client.job_submitted, app.client.job_finished); fflush(stdout); last_report = now; } } } if (app.client.requests_sent.sec == 0) { pj_gettimeofday(&app.client.requests_sent); } if (thread_index == 0) { printf("\r%d jobs started, %d completed%s\n", app.client.job_submitted, app.client.job_finished, (app.client.job_submitted!=app.client.job_finished ? ", waiting..." : ".") ); fflush(stdout); } /* Wait until all jobs completes, or timed out */ pj_gettimeofday(&now); while (PJ_TIME_VAL_LT(now, end_time) && app.client.job_finished < app.client.job_count && !app.thread_quit) { pj_time_val timeout = { 0, 1 }; unsigned i; for (i=0; i<1000; ++i) { unsigned count; count = 0; pjsip_endpt_handle_events2(app.sip_endpt, &timeout, &count); if (count == 0) break; } pj_gettimeofday(&now); } /* Wait couple of seconds to let jobs completes (e.g. ACKs to be sent) */ pj_gettimeofday(&now); end_time = now; end_time.sec += 2; while (PJ_TIME_VAL_LT(now, end_time)) { pj_time_val timeout = { 0, 1 }; unsigned i; for (i=0; i<1000; ++i) { unsigned count; count = 0; pjsip_endpt_handle_events2(app.sip_endpt, &timeout, &count); if (count == 0) break; } pj_gettimeofday(&now); } return 0; }
BtFImpl_R(i_gcall, t, p, r) { return make_call(t, p, r); }
BtFImpl(i_call, t, p) { return make_call(t, p, -1); }