void AmSession::onSipReply(const AmSipReply& reply) { CALL_EVENT_H(onSipReply,reply); int status = dlg.getStatus(); dlg.updateStatus(reply); if (status != dlg.getStatus()) DBG("Dialog status changed %s -> %s (stopped=%s) \n", AmSipDialog::status2str[status], AmSipDialog::status2str[dlg.getStatus()], sess_stopped.get() ? "true" : "false"); else DBG("Dialog status stays %s (stopped=%s)\n", AmSipDialog::status2str[status], sess_stopped.get() ? "true" : "false"); if (negotiate_onreply) { if(status < AmSipDialog::Connected){ switch(dlg.getStatus()){ case AmSipDialog::Connected: try { acceptAudio(reply.body,reply.hdrs); if(detached.get() && !getStopped()){ onSessionStart(reply); if(input || output) AmMediaProcessor::instance()->addSession(this, callgroup); else { ERROR("missing audio input and/or ouput.\n"); } } }catch(const AmSession::Exception& e){ ERROR("could not connect audio!!!\n"); ERROR("%i %s\n",e.code,e.reason.c_str()); dlg.bye(); setStopped(); break; } break; case AmSipDialog::Pending: switch(reply.code){ case 180: break;//TODO: local ring tone. case 183: break;//TODO: remote ring tone. default: break;// continue waiting. } } } } }
void AmSession::startMediaProcessing() { if(getStopped() || isProcessingMedia()) return; if(isAudioSet()) { AmMediaProcessor::instance()->addSession(this, callgroup); } else { DBG("no audio input and output set. " "Session will not be attached to MediaProcessor.\n"); } }
void AmSession::onSipRequest(const AmSipRequest& req) { CALL_EVENT_H(onSipRequest,req); dlg.updateStatus(req); DBG("onSipRequest: method = %s\n",req.method.c_str()); if(req.method == "INVITE"){ onInvite(req); if(detached.get() && !getStopped()){ onSessionStart(req); if(input || output) AmMediaProcessor::instance()->addSession(this, callgroup); else { ERROR("missing audio input and/or ouput.\n"); } } } else if( req.method == "BYE" ){ dlg.reply(req,200,"OK"); onBye(req); } else if( req.method == "CANCEL" ){ dlg.reply(req,200,"OK"); onCancel(); } else if( req.method == "INFO" ){ if ((strip_header_params(getHeader(req.hdrs, "Content-Type")) =="application/dtmf-relay")|| (strip_header_params(getHeader(req.hdrs, "c")) =="application/dtmf-relay")){ postDtmfEvent(new AmSipDtmfEvent(req.body)); dlg.reply(req, 200, "OK"); } } }
int AmB2BCallerSession::relayEvent(AmEvent* ev) { if(getOtherId().empty() && !getStopped()){ bool create_callee = false; B2BSipEvent* sip_ev = dynamic_cast<B2BSipEvent*>(ev); if (sip_ev && sip_ev->forward) create_callee = true; else create_callee = dynamic_cast<B2BConnectEvent*>(ev) != NULL; if (create_callee) { createCalleeSession(); if (getOtherId().length()) { MONITORING_LOG(getLocalTag().c_str(), "b2b_leg", getOtherId().c_str()); } } } return AmB2BSession::relayEvent(ev); }
int GStreamerPlayer::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QObject::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { if (_id < 13) qt_static_metacall(this, _c, _id, _a); _id -= 13; } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) { if (_id < 13) *reinterpret_cast<int*>(_a[0]) = -1; _id -= 13; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< int*>(_v) = getBrightness(); break; case 1: *reinterpret_cast< int*>(_v) = getContrast(); break; case 2: *reinterpret_cast< int*>(_v) = getHue(); break; case 3: *reinterpret_cast< int*>(_v) = getSaturation(); break; case 4: *reinterpret_cast< bool*>(_v) = getPlaying(); break; case 5: *reinterpret_cast< bool*>(_v) = getPaused(); break; case 6: *reinterpret_cast< bool*>(_v) = getStopped(); break; default: break; } _id -= 7; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: setBrightness(*reinterpret_cast< int*>(_v)); break; case 1: setContrast(*reinterpret_cast< int*>(_v)); break; case 2: setHue(*reinterpret_cast< int*>(_v)); break; case 3: setSaturation(*reinterpret_cast< int*>(_v)); break; case 4: setPlaying(*reinterpret_cast< bool*>(_v)); break; case 5: setPaused(*reinterpret_cast< bool*>(_v)); break; case 6: setStopped(*reinterpret_cast< bool*>(_v)); break; default: break; } _id -= 7; } else if (_c == QMetaObject::ResetProperty) { _id -= 7; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 7; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 7; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 7; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 7; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 7; } else if (_c == QMetaObject::RegisterPropertyMetaType) { if (_id < 7) *reinterpret_cast<int*>(_a[0]) = -1; _id -= 7; } #endif // QT_NO_PROPERTIES return _id; }
void ConferenceDialog::onSipReply(const AmSipReply& reply) { int status = dlg.getStatus(); AmSession::onSipReply(reply); DBG("ConferenceDialog::onSipReply: code = %i, reason = %s\n, status = %i\n", reply.code,reply.reason.c_str(),dlg.getStatus()); if(!dialedout && !transfer_req.get()) return; if(status < AmSipDialog::Connected){ switch(dlg.getStatus()){ case AmSipDialog::Connected: // connected! try { acceptAudio(reply.body,reply.hdrs); if(getDetached() && !getStopped()){ setupAudio(); if(getInput() || getOutput()) AmMediaProcessor::instance()->addSession(this, getCallgroup()); else { ERROR("missing audio input and/or ouput.\n"); return; } if(!transfer_req.get()){ // send connect event AmSessionContainer::instance() ->postEvent(dialout_channel->getConfID(), new DialoutConfEvent(DoConfConnect, dialout_channel->getConfID())); } else { dlg.reply(*(transfer_req.get()),202,"Accepted"); transfer_req.reset(0); connectMainChannel(); } } } catch(const AmSession::Exception& e){ ERROR("%i %s\n",e.code,e.reason.c_str()); dlg.bye(); setStopped(); } break; case AmSipDialog::Pending: switch(reply.code){ case 180: // send ringing event AmSessionContainer::instance() ->postEvent(dialout_channel->getConfID(), new DialoutConfEvent(DoConfRinging, dialout_channel->getConfID())); break; case 183: break;//TODO: remote ring tone. default: break;// continue waiting. } break; case AmSipDialog::Disconnected: if(!transfer_req.get()){ disconnectDialout(); //switch(reply.code){ //default: AmSessionContainer::instance() ->postEvent(dialout_channel->getConfID(), new DialoutConfEvent(DoConfError, dialout_channel->getConfID())); //} } else { dlg.reply(*(transfer_req.get()),reply.code,reply.reason); transfer_req.reset(0); setStopped(); } break; default: break; } } }