src/interfaces/channels.php
public function originate($endpoint = NULL, $channel_id = NULL, $data = NULL, $variables = NULL)
        {
            try {

                $inputParser = new parsing_helper();


                if (is_null($endpoint))
                    throw new Exception("End point not provided or is null", 503);

                $originateData = array();
                $originateData['endpoint'] = $endpoint;

                if (!is_null($data))
                    $originateData = array_merge($originateData, $inputParser->parseRequestData($data));

                if (!is_null($variables))
                    $originateData['variables'] = $inputParser->parseRequestData($variables);

                $uri = (is_null($channel_id)) ? "/channels" : "/channels/" . $channel_id;
                $result = $this->pestObject->post($uri, $originateData);

                return $result;

            } catch (Pest_NotFound $e) {
                $this->phpariObject->lasterror = $e->getMessage();
                $this->phpariObject->lasttrace = $e->getTraceAsString();

                return FALSE;
            } catch (Pest_BadRequest $e) {
                $this->phpariObject->lasterror = $e->getMessage();
                $this->phpariObject->lasttrace = $e->getTraceAsString();

                return FALSE;
            } catch (Exception $e) {
                $this->phpariObject->lasterror = $e->getMessage();
                $this->phpariObject->lasttrace = $e->getTraceAsString();

                return FALSE;
            }


        }
public function originate($endpoint = NULL, $channel_id = NULL, $data = NULL, $variables = NULL)
        {
            try {

                $inputParser = new parsing_helper();


                if (is_null($endpoint))
                    throw new Exception("End point not provided or is null", 503);

                $originateData = array();
                $originateData['endpoint'] = $endpoint;

                if (!is_null($data))
                    $originateData = array_merge($originateData, $inputParser->parseRequestData($data));

                if (!is_null($variables))
                    $originateData['variables'] = $inputParser->parseRequestData($variables);

                $uri = (is_null($channel_id)) ? "/channels" : "/channels/" . $channel_id;
                $result = $this->pestObject->post($uri, $originateData);

                return $result;

            } catch (Pest_NotFound $e) {
                $this->phpariObject->lasterror = $e->getMessage();
                $this->phpariObject->lasttrace = $e->getTraceAsString();

                return FALSE;
            } catch (Pest_BadRequest $e) {
                $this->phpariObject->lasterror = $e->getMessage();
                $this->phpariObject->lasttrace = $e->getTraceAsString();

                return FALSE;
            } catch (Exception $e) {
                $this->phpariObject->lasterror = $e->getMessage();
                $this->phpariObject->lasttrace = $e->getTraceAsString();

                return FALSE;
            }


        }
public function originate ( $ endpoint = NULL , $ channel_id = NULL , $ data = NULL , $ variables = NULL ) { try { $ inputParser = new parsing_helper ( ) ; if ( is_null ( $ endpoint ) ) throw new Exception ( "End point not provided or is null" , 503 ) ; $ originateData = array ( ) ; $ originateData [ 'endpoint' ] = $ endpoint ; if ( ! is_null ( $ data ) ) $ originateData = array_merge ( $ originateData , $ inputParser -> parseRequestData ( $ data ) ) ; if ( ! is_null ( $ variables ) ) $ originateData [ 'variables' ] = $ inputParser -> parseRequestData ( $ variables ) ; $ uri = ( is_null ( $ channel_id ) ) ? "/channels" : "/channels/" . $ channel_id ; $ result = $ this -> pestObject -> post ( $ uri , $ originateData ) ; return $ result ; } catch ( Pest_NotFound $ e ) { $ this -> phpariObject -> lasterror = $ e -> getMessage ( ) ; $ this -> phpariObject -> lasttrace = $ e -> getTraceAsString ( ) ; return FALSE ; } catch ( Pest_BadRequest $ e ) { $ this -> phpariObject -> lasterror = $ e -> getMessage ( ) ; $ this -> phpariObject -> lasttrace = $ e -> getTraceAsString ( ) ; return FALSE ; } catch ( Exception $ e ) { $ this -> phpariObject -> lasterror = $ e -> getMessage ( ) ; $ this -> phpariObject -> lasttrace = $ e -> getTraceAsString ( ) ; return FALSE ; } }
Originate a call on a channel

@param null (string)                              $endpoint   - endpoint to originate the call to, eg:
SIP/alice
@param null (string)                              $channel_id - Assign a channel ID for the newly created
channel
@param null (JSON_STRING|JSON_OBJECT|ASSOC_ARRAY) $data       - originate data
@param null (JSON_STRING|JSON_OBJECT|ASSOC_ARRAY) $variables  - originate assigned variables

@return bool - false on success, Integer or True on failure

$data structure:

{
"extension": (String) "The extension to dial after the endpoint answers",
"context": (String) "The context to dial after the endpoint answers. If omitted, uses 'default'",
"priority": (Long) "he priority to dial after the endpoint answers. If omitted, uses 1",
"app": (String) "The application that is subscribed to the originated channel, and passed to the Stasis
application",
"appArgs": (String) "The application arguments to pass to the Stasis application",
"callerId": (String) "CallerID to use when dialing the endpoint or extension",
"timeout": (Integer) "Timeout (in seconds) before giving up dialing, or -1 for no timeout",
"channelId": (String) "The unique id to assign the channel on creation",
"otherChannelId": (String) "The unique id to assign the second channel when using local channels"
}

$variables structure:

{
"variable_name": "value",
}

eg.

{
"CALLERID(name): "Mark Spencer"
}
Originate a call on a channel