Dials a call, from a phone number to a phone number.
@param params the call params
@return the call
@throws IOException unexpected error.
497849
public static Call create(final Map <String, Object>params)  throws Exception
    {
    	assert (params != null);
    	
    	return create(BandwidthClient.getInstance(), params);
    }
365554
public boolean dispatch(String dispatch, String[] parameters)// throws IOException
	{
		String dispatchURL = dispatch;
		HttpServletRequest servletRequest = httpRequest.get();
		HttpServletResponse servletResponse = httpResponse.get();
		//set content type, because otherwise the response
		//  may be interpreted as text/plain
		servletResponse.setContentType("text/html; charset=UTF-8");
		try
		{
			//pass set attributes as new servlet parameters (a hack to get rid of)
			Request request = requestRegistry.getCurrentRequest();
			if(request != null) {
				for (Object name : request.getAttributeMap().keySet())
				{
					Object o = request.getAttributeMap().get(name);
					servletRequest.setAttribute(name.toString(), o);
				}
			}
			//servlet-include, servlet-forward, service-invocation
            switch(this.dispatchMode)
			{
				case FORWARD:
				{
					ServletSupport.forward(dispatchURL, servletRequest, servletResponse);
				}
				default://INCLUDE
				{
					ServletSupport.include(dispatchURL, servletRequest, servletResponse);
				}
			}
		}
		catch (ServletException e)
		{
			throw new ResourceException("failed to dispatch servlet request to " + dispatchURL, e);
		}
		catch (IOException e)
		{
			throw new ResourceException("failed to dispatch servlet request to " + dispatchURL, e);
		}
		return true;
	}
1015977
public function call($method, array $params = array())
    {
        $params = array($this->getSession(), $method, $params);
        return $this->getClient()->call('call', $params);
    }
439035
public static String concat(Object... params) {
		StringBuffer finalMessage = new StringBuffer();
		for (Object object : params) {
			finalMessage.append(JKObjectUtil.toString(object, true));
		}
		return finalMessage.toString();
	}
1212046
public static <T> T wrapCatchedExceptions(Callable<T> callable, String messageFormat, Object... params) {
		try {
			return callable.call();
		} catch (Exception e) {
			String formattedMessage = String.format(messageFormat, params);
			throw new IllegalStateException(formattedMessage, e);
		}
	}
669005
public void call(String method, Object[] args)
        throws IOException
    {
        int length = args != null ? args.length : 0;

        startCall(method, length);

        for (int i = 0; i < length; i++)
            writeObject(args[i]);

        completeCall();
    }

    /**
     * Starts the method call.  Clients would use <code>startCall</code>
     * instead of <code>call</code> if they wanted finer control over
     * writing the arguments, or needed to write headers.
     *
     * <code><pre>
     * c major minor
     * m b16 b8 method-name
     * </pre></code>
     *
     * @param method the method name to call.
     */
    public void startCall(String method, int length)
        throws IOException
    {
        os.write('c');
        os.write(_version);
        os.write(0);

        os.write('m');
        int len = method.length();
        os.write(len >> 8);
        os.write(len);
        printString(method, 0, len);
    }

    /**
     * Writes the call tag.  This would be followed by the
     * headers and the method tag.
     *
     * <code><pre>
     * c major minor
     * </pre></code>
     *
     * @param method the method name to call.
     */
    public void startCall()
        throws IOException
    {
        os.write('c');
        os.write(0);
        os.write(1);
    }

    /**
     * Writes the method tag.
     *
     * <code><pre>
     * m b16 b8 method-name
     * </pre></code>
     *
     * @param method the method name to call.
     */
    public void writeMethod(String method)
        throws IOException
    {
        os.write('m');
        int len = method.length();
        os.write(len >> 8);
        os.write(len);
        printString(method, 0, len);
    }

    /**
     * Completes.
     *
     * <code><pre>
     * z
     * </pre></code>
     */
    public void completeCall()
        throws IOException
    {
        os.write('z');
    }

    /**
     * Starts the reply
     *
     * <p>A successful completion will have a single value:
     *
     * <pre>
     * r
     * </pre>
     */
    public void startReply()
        throws IOException
    {
        os.write('r');
        os.write(1);
        os.write(0);
    }

    /**
     * Completes reading the reply
     *
     * <p>A successful completion will have a single value:
     *
     * <pre>
     * z
     * </pre>
     */
    public void completeReply()
        throws IOException
    {
        os.write('z');
    }

    /**
     * Writes a header name.  The header value must immediately follow.
     *
     * <code><pre>
     * H b16 b8 foo <em>value</em>
     * </pre></code>
     */
    public void writeHeader(String name)
        throws IOException
    {
        int len = name.length();

        os.write('H');
        os.write(len >> 8);
        os.write(len);

        printString(name);
    }

    /**
     * Writes a fault.  The fault will be written
     * as a descriptive string followed by an object:
     *
     * <code><pre>
     * f
     * &lt;string>code
     * &lt;string>the fault code
     *
     * &lt;string>message
     * &lt;string>the fault mesage
     *
     * &lt;string>detail
     * mt\x00\xnnjavax.ejb.FinderException
     *     ...
     * z
     * z
     * </pre></code>
     *
     * @param code the fault code, a three digit
     */
    public void writeFault(String code, String message, Object detail)
        throws IOException
    {
        // hessian/3525
        os.write('r');
        os.write(1);
        os.write(0);

        os.write('f');
        writeString("code");
        writeString(code);

        writeString("message");
        writeString(message);

        if (detail != null) {
            writeString("detail");
            writeObject(detail);
        }
        os.write('z');

        os.write('z');
    }
331285
private Call createCall(String method, Object[] params) {

		if(isFlagSet(FLAGS_STRICT) && !method.matches("^[A-Za-z0-9\\._:/]*$")) {
			throw new XMLRPCRuntimeException("Method name must only contain A-Z a-z . : _ / ");
		}

		return new Call(serializerHandler, method, params);
	}
105093
public static final ParseResult parseParams(Object[] params) {
		Tree data = null;
		CallOptions.Options opts = null;
		Groups groups = null;
		PacketStream stream = null;
		if (params != null) {
			if (params.length == 1) {
				if (params[0] instanceof Tree) {
					data = (Tree) params[0];
				} else if (params[0] instanceof CallOptions.Options) {
					opts = (CallOptions.Options) params[0];
				} else if (params[0] instanceof Groups) {
					groups = (Groups) params[0];
				} else if (params[0] instanceof PacketStream) {
					data = new Tree();
					stream = (PacketStream) params[0];
				} else {
					data = new CheckedTree(params[0]);
				}
			} else {
				LinkedHashMap<String, Object> map = new LinkedHashMap<>();
				String prev = null;
				Object value;
				for (int i = 0; i < params.length; i++) {
					value = params[i];
					if (prev == null) {
						if (!(value instanceof String)) {
							if (value instanceof CallOptions.Options) {
								opts = (CallOptions.Options) value;
								continue;
							}
							if (value instanceof Groups) {
								groups = (Groups) value;
								continue;
							}
							if (value instanceof PacketStream) {
								stream = (PacketStream) value;
								continue;
							}
							i++;
							throw new IllegalArgumentException("Parameter #" + i + " (\"" + value
									+ "\") must be String, Context, Groups, PacketStream or CallOptions!");
						}
						prev = (String) value;
						continue;
					}
					map.put(prev, value);
					prev = null;
				}
				data = new Tree(map);
			}
		}
		return new ParseResult(data, opts, groups, stream);
	}
943633
public void startCall(String method)
        throws IOException
    {
        os.write('c');
        os.write(0);
        os.write(1);

        os.write('m');
        int len = method.length();
        os.write(len >> 8);
        os.write(len);
        printString(method, 0, len);
    }
124808
public int call(String method, Object[] params,
            DDPListener resultListener) {
        return getDDP().call(method, params, resultListener);
    }
985354
public static Object invokeMethod(Object obj, String methodName, Object... params) {
        Method method = findMethod(obj, methodName, params);
        return invokeMethod(obj, method, params);
    }
1347380
public ClientResponseImpl call(Object... paramListIn) {
        m_perCallStats = m_statsCollector.beginProcedure();

        // if we're keeping track, calculate parameter size
        if (m_perCallStats != null) {
            StoredProcedureInvocation invoc = (m_txnState != null ? m_txnState.getInvocation() : null);
            ParameterSet params = (invoc != null ? invoc.getParams() : ParameterSet.fromArrayNoCopy(paramListIn));
            m_perCallStats.setParameterSize(params.getSerializedSize());
        }

        ClientResponseImpl result = coreCall(paramListIn);

        // if we're keeping track, calculate result size
        if (m_perCallStats != null) {
            m_perCallStats.setResultSize(result.getResults());
        }

        m_statsCollector.endProcedure(result.getStatus() == ClientResponse.USER_ABORT,
                                      (result.getStatus() != ClientResponse.USER_ABORT) &&
                                      (result.getStatus() != ClientResponse.SUCCESS),
                                      m_perCallStats);
        // allow the GC to collect per-call stats if this proc isn't called for a while
        m_perCallStats = null;

        return result;
    }
1246464
private IoBuffer encodeInvoke(String method, Object[] params) {
        log.debug("RemotingClient encodeInvoke - method: {} params: {}", method, params);
        IoBuffer result = IoBuffer.allocate(1024);
        result.setAutoExpand(true);
        //force version 3
        result.putShort((short) 3);
        // Headers
        Collection<RemotingHeader> hdr = headers.values();
        result.putShort((short) hdr.size());
        for (RemotingHeader header : hdr) {
            Output.putString(result, header.getName());
            result.put(header.getMustUnderstand() ? (byte) 0x01 : (byte) 0x00);

            IoBuffer tmp = IoBuffer.allocate(1024);
            tmp.setAutoExpand(true);
            Output tmpOut = new Output(tmp);
            Serializer.serialize(tmpOut, header.getValue());
            tmp.flip();
            // Size of header data
            result.putInt(tmp.limit());
            // Header data
            result.put(tmp);
            tmp.free();
            tmp = null;
        }
        // One body
        result.putShort((short) 1);
        // Method name
        Output.putString(result, method);
        // Client callback for response
        //Output.putString(result, "");
        //responseURI 
        Output.putString(result, "/" + sequenceCounter++);
        // Serialize parameters
        IoBuffer tmp = IoBuffer.allocate(1024);
        tmp.setAutoExpand(true);
        Output tmpOut = new Output(tmp);
        //if the params are null send the NULL AMF type
        //this should fix APPSERVER-296
        if (params == null) {
            tmpOut.writeNull();
        } else {
            tmpOut.writeArray(params);
        }
        tmp.flip();
        // Store size and parameters
        result.putInt(tmp.limit());
        result.put(tmp);
        tmp.free();
        tmp = null;

        result.flip();
        return result;
    }
368817
public boolean startCall(int channel, MuxInputStream in, MuxOutputStream out)
        throws IOException
    {
        // XXX: Eventually need to check to see if the channel is used.
        // It's not clear whether this should cause a wait or an exception.

        in.init(this, channel);
        out.init(this, channel);

        return true;
    }
119527
public JSONObject requestApproval(HashMap<String, String> params) throws JSONException {
        return oClient.post("/hr/v3/fp/submissions", params);
    }
1353470
public final srecParser.method_call_param_return method_call_param() throws RecognitionException {
        srecParser.method_call_param_return retval = new srecParser.method_call_param_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        srecParser.literal_return literal26 = null;

        srecParser.method_call_or_varref_return method_call_or_varref27 = null;



        try {
            // /home/victor/srec/core/src/main/antlr/srec.g:71:2: ( literal | method_call_or_varref )
            int alt9=2;
            int LA9_0 = input.LA(1);

            if ( (LA9_0==STRING||(LA9_0>=NUMBER && LA9_0<=NULL)) ) {
                alt9=1;
            }
            else if ( (LA9_0==ID) ) {
                alt9=2;
            }
            else {
                if (state.backtracking>0) {state.failed=true; return retval;}
                NoViableAltException nvae =
                    new NoViableAltException("", 9, 0, input);

                throw nvae;
            }
            switch (alt9) {
                case 1 :
                    // /home/victor/srec/core/src/main/antlr/srec.g:71:4: literal
                    {
                    root_0 = (CommonTree)adaptor.nil();

                    pushFollow(FOLLOW_literal_in_method_call_param327);
                    literal26=literal();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, literal26.getTree());

                    }
                    break;
                case 2 :
                    // /home/victor/srec/core/src/main/antlr/srec.g:71:14: method_call_or_varref
                    {
                    root_0 = (CommonTree)adaptor.nil();

                    pushFollow(FOLLOW_method_call_or_varref_in_method_call_param331);
                    method_call_or_varref27=method_call_or_varref();

                    state._fsp--;
                    if (state.failed) return retval;
                    if ( state.backtracking==0 ) adaptor.addChild(root_0, method_call_or_varref27.getTree());

                    }
                    break;

            }
            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
800920
public function call($method, $params = [])
    {
        if (null === $this->client) {
            $this->client = new Client([
                'base_uri' => static::API_URL,
                'content-type' => 'application/json',
            ]);
        }

        $requestParams = array_merge($this->defaultParams, [
            $method => [$params],
        ]);

        if ($this->sandbox) {
            $requestParams['apikey'] = self::SANDBOX_KEY;
        }

        $response = $this->client->post(null, ['body' => json_encode($requestParams)]);
        if ($response->getStatusCode() != 200) {
            throw new \Exception('Api http error: ' . $response->getStatusCode(), $response->getStatusCode());
        }

        $result = json_decode($response->getBody(), true);
        if (isset($result['error'])) {
            throw new \BadMethodCallException('Api error: ' . $result['error']['description'],
                $result['error']['code']);
        }

        return $result;
    }