/** * Add a member inside * a conference * * @param id: Catapult id * @param params -> List of member parameters * joinTone * leavingTone */ public function addMember($params) { $args = Ensure::Input($params); $url = URIResource::Make($this->path, array($this->id, "members")); $memberid = Locator::Find($this->client->post($url, $args->get())); return $this->member($memberid); }
/** * Send message with additional parameters * important rewrite in place of * more polymorphic style. * i.e send(from, to, message, calback) * * @param args: list of valid parameters */ public function send($args) { $data = Ensure::Input($args); $url = URIResource::Make($this->path); if ($data->has("media")) { $data->add("media", (string) new MediaURL($data->val("media", $this))); } $message_id = Locator::Find($this->client->post($url, $data->get())); $data->add("id", $message_id); return Constructor::Make($this, $data->get(), array("messageId" => "id")); }
/** * allocate a new number * number must be available * or warning will be thrown * @param args * number, * application (one you want to associate this number with) * fallback a fallback option if this isnt available */ public function allocate($args) { $data = Ensure::Input($args); $url = URIResource::Make($this->path); $id = Locator::Find($this->client->post($url, $data->get())); $data->add("id", $id); return Constructor::Make($this, $data->get()); }
/** * Accept an incoming * call. * * @return void */ public function accept() { $url = URIResource::Make($this->path, array($this->id)); $data = new DataPacket(array("state" => CALL_STATES::active)); $id = Locator::Find($this->client->post($url, $data->get())); $data->add("id", $id); return Constructor::Make($this, $data->get()); }
/** * prototypal add. This needs * term to be set as a function * in its caller it will be used * to initialize the resulting * object * * Conference->addMember * should return * ConferenceMember * * @params: mix of function arguments as well as object prototypes, terms */ public static function add() { $args = func_get_args(); $that = self::get_this($args); $term = self::get_term($args); $url = URIResource::Make($that->path, array($that->id, $term)); $id = Locator::Find($that->client->post($url, $args->get())); return $this->{$term}($id); }