invoked when received sdp offer/answer from server
340552
function onSDPDescription(id,rtcId,data)
    {
        if(scope._servConn.useRTC)
        {
            if(scope.hasWebRTCSupport())
            {
                var peer   = getOrCreatePeer(id);
                peer.rtcId = rtcId;
                peer.onServerMessage(JSON.parse(data));
            }
            else
            {
                scope._servConn.sendRTCState(false,id);
            }
        }
    }
1074007
def requestPdpContextActivation(AccessPointName_presence=0):
    """"""
    a = TpPd(pd=0x8)
    b = MessageType(mesType=0x44)  # 01000100
    c = PacketDataProtocolAddress()
    packet = a / b / c
    if AccessPointName_presence is 1:
        d = AccessPointName(ieiAPN=0x28)
        packet = packet / d
    return packet
211827
def _inbound(self, From, to, protocol, udp_source=None):
        
        # Verify stuff!

        self.verifyCertificateAllowed(to, From)
        return self.service.verifyHook(From, to, protocol
                                       ).addCallback(self._inboundimpl,
                                                     From,
                                                     to,
                                                     protocol,
                                                     udp_source).addErrback(
            lambda f: f.trap(KeyError) and dict(listeners=[]))
142889
@Handler(priority = Integer.MIN_VALUE)
    public void onOptions(Request.In.Options event, IOSubchannel appChannel) {
        if (event.requestUri() == HttpRequest.ASTERISK_REQUEST) {
            HttpResponse response = event.httpRequest().response().get();
            response.setStatus(HttpStatus.OK);
            appChannel.respond(new Response(response));
            event.setResult(true);
            event.stop();
        }
    }
252127
def dispense(self):
        ''''''
        self.sendcommand(Vendapin.DISPENSE)
        # wait for the reply
        time.sleep(1)
        # parse the reply
        response = self.receivepacket()
        print('Vendapin.dispense(): ' + str(response))
        if not self.was_packet_accepted(response):
            raise Exception('DISPENSE packet not accepted: ' + str(response))
        return self.parsedata(response)[0]
1298185
function (changes, cb) {
        var self = this;

        this._log('info', 'Initiating incoming session');

        this.state = 'pending';

        this.pc.isInitiator = false;

        var desc = changes.contents[0].application;


        this.receiver = new FileTransfer.Receiver({hash: desc.offer.hash.algo});
        this.receiver.on('progress', function (received, size) {
            self._log('info', 'Receive progress ' + received + '/' + size);
        });
        this.receiver.on('receivedFile', function (file) {
            self.receivedFile = file;
            self.maybeReceivedFile();
        });
        this.receiver.metadata = desc.offer;

        changes.contents[0].application = {
            applicationType: 'datachannel'
        };

        this.pc.handleOffer({
            type: 'offer',
            jingle: changes
        }, function (err) {
            if (err) {
                self._log('error', 'Could not create WebRTC answer');
                return cb({condition: 'general-error'});
            }
            cb();
        });
    }
473870
private void npnReceived(ServerHello mesg) throws IOException
    {
        NextProtoNegoExtension extension = (NextProtoNegoExtension)mesg.extensions.get(ExtensionType.EXT_NEXT_PROTOCOL_NEGOTIATION);
        if (extension != null)
        {
            protocols = extension.getProtocols();
            if (NextProtoNego.debug)
                System.err.println(new StringBuilder("[C] NPN protocols ").append(protocols).append(" received from server for ").append(conn != null ? conn : engine));
        }
        else
        {
            if (NextProtoNego.debug)
                System.err.println(new StringBuilder("[C] NPN protocols not sent by server for ").append(conn != null ? conn : engine));
        }
    }
177695
async function requestConfirmation(message, defaultAnswer = false) {
  const answerName = 'requestConfirmation';
  const answers = await inquirer.prompt([
    {
      message,
      name: answerName,
      type: 'confirm',
      default: defaultAnswer,
    },
  ]);
  return answers[answerName];
}
554247
def __handle_known_solicited(self, msg):
        """"""
        with self.__requests:
            try:
                req = self.__requests[msg[M_CLIENTREF]]
            except KeyError:
                return False

            if self.__handle_low_seq_resend(msg, req):
                return True

            perform_cb = finish = False
            if msg[M_TYPE] not in _RSP_NO_REF:
                self.__update_existing(msg, req)
                # Finalise request if applicable (not marked as finished here so can perform callback first below)
                if msg[M_TYPE] in _RSP_TYPE_FINISH:
                    finish = True
                    # Exception - DUPLICATED also should produce callback
                    perform_cb = (msg[M_TYPE] == E_DUPLICATED)
                elif msg[M_TYPE] not in _RSP_TYPE_ONGOING:
                    perform_cb = True
            else:
                logger.warning('Reference unexpected for request %s of type %s', msg[M_CLIENTREF],
                               msg[M_TYPE])

        # outside lock to avoid deadlock if callbacks try to perform request-related functions
        if perform_cb:
            self.__perform_unsolicited_callbacks(msg)

        # mark request as finished
        if finish:
            req.success = msg[M_TYPE] in _RSP_TYPE_SUCCESS
            req.payload = msg[M_PAYLOAD]
            self.__clear_references(req)
            # Serialise completion of CRUD requests (together with CREATED, DELETED, etc. messages)
            if req.is_crud:
                self.__crud_threadpool.submit(req._set)
            else:
                req._set()

        return True
1254738
protected void subscriptionResponseReceived(IoSession session,
			SubscriptionMessage subscriptionMessage) {
		log.info("Received {}", subscriptionMessage);
		this.receivedSubscription = subscriptionMessage;

		if (this.sentSubscription == null) {
			log.error(
					"Protocol error: Received a subscription response without sending a request.\n{}",
					subscriptionMessage);
			this._disconnect();
			return;
		}

		if (!this.sentSubscription.equals(this.receivedSubscription)) {
			log.info(
					"Server did not fully accept subscription request.\nOriginal:\n{}\nAmended\n{}",
					this.sentSubscription, this.receivedSubscription);
		}

		for (ConnectionListener listener : this.connectionListeners) {
			listener.subscriptionReceived(this, subscriptionMessage);
		}
	}
872766
private void send(JainMgcpResponseEvent event) {

		cancelLongtranTimer();

		// to send response we already should know the address and port
		// number from which the original request was received
		if (remoteAddress == null) {
			throw new IllegalArgumentException("Unknown orinator address");
		}

		// restore the original transaction handle parameter
		// and encode event objet into MGCP response message
		event.setTransactionHandle(remoteTID);

		// encode event object into MGCP response message
		if(originalPacket==null)
			originalPacket=stack.allocatePacket();
		
		originalPacket.setLength(encode(event,originalPacket.getRawData()));						
		InetSocketAddress inetSocketAddress = new InetSocketAddress(remoteAddress, remotePort);
		originalPacket.setRemoteAddress(inetSocketAddress);		
		
		if (logger.isDebugEnabled()) {
			logger.debug("--- TransactionHandler:" + this + " :LocalID=" + localTID + ", Send response event to "
					+ remoteAddress + ":" + remotePort + ", message\n" + new String(originalPacket.getRawData(),0,originalPacket.getLength()));
		}
		stack.send(originalPacket);

		/*
		 * Just reset timer in case of provisional response. Otherwise, release tx.
		 */
		if (isProvisional(event.getReturnCode())) {
			// reset timer.
			resetLongtranTimer();
		} else {
			
			release();
			stack.getCompletedTransactions().put(Integer.valueOf(event.getTransactionHandle()), this);
			resetTHISTTimerTask(true);
		}
	}
373621
def on_message(self, ws, reply, *args):
        
        log.debug("Received message: %s" % str(reply))
        data = {}
        try:
            data = json.loads(reply, strict=False)
        except ValueError:
            raise ValueError("API node returned invalid format. Expected JSON!")

        if data.get("method") == "notice":
            id = data["params"][0]

            if id >= len(self.__events__):
                log.critical("Received an id that is out of range\n\n" + str(data))
                return

            # This is a "general" object change notification
            if id == self.__events__.index("on_object"):
                # Let's see if a specific object has changed
                for notice in data["params"][1]:
                    try:
                        if "id" in notice:
                            self.process_notice(notice)
                        else:
                            for obj in notice:
                                if "id" in obj:
                                    self.process_notice(obj)
                    except Exception as e:
                        log.critical(
                            "Error in process_notice: {}\n\n{}".format(
                                str(e), traceback.format_exc
                            )
                        )
            else:
                try:
                    callbackname = self.__events__[id]
                    log.info("Patching through to call %s" % callbackname)
                    [getattr(self.events, callbackname)(x) for x in data["params"][1]]
                except Exception as e:
                    log.critical(
                        "Error in {}: {}\n\n{}".format(
                            callbackname, str(e), traceback.format_exc()
                        )
                    )
634189
def _event_received(self, ref, data):
        
        match = self._resolve_match_data(ref, data)
        if match:
            if self.flag_to_set:
                self.flag_to_set.set()
            if self.callback:
                self.callback(EventMatch(ref, data, match))
            if self.__forget:
                self.forget()
10091
def post_event(self, client, check):
        
        self._request('POST', '/resolve',
                      data=json.dumps({'client': client, 'check': check}))
        return True
1365877
private void onParticipantAdded(ParticipantAddedEvent event) {
        handler.post(() -> listener.onParticipantAdded(event));
        log("Event published " + event.toString());
    }
748372
public void doDynamic(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
        rsp.setStatus(SC_INTERNAL_SERVER_ERROR);
        req.getView(this,"index.jelly").forward(req,rsp);
    }
50930
@SuppressWarnings("unchecked")
    public void receiveResponse(Object response_value, Address sender, boolean is_exception) {
        Rsp<T> rsp;
        if(isDone() || (rsp=rsps.get(sender)) == null)
            return;

        RspFilter rsp_filter=options.rspFilter();
        lock.lock();
        try {
            if(!rsp.wasReceived()) {
                if(!(rsp.wasSuspected() || rsp.wasUnreachable()))
                    num_received++;
                if(rsp_filter == null || rsp_filter.isAcceptable(response_value, sender)) {
                    if(is_exception && response_value instanceof Throwable)
                        rsp.setException((Throwable)response_value);
                    else
                        rsp.setValue((T)response_value);
                    num_valid++;
                }
            }

            if(responsesComplete() || (rsp_filter != null && !rsp_filter.needMoreResponses())) {
                complete(this.rsps);
                corrDone();
            }
        }
        finally {
            lock.unlock();
        }
    }