|
| 1 | +<?php |
| 2 | +/** |
| 3 | + * StartGather.php |
| 4 | + * |
| 5 | + * Implementation of the BXML StartGather tag |
| 6 | + * |
| 7 | + * * @copyright Bandwidth INC |
| 8 | + */ |
| 9 | + |
| 10 | +namespace BandwidthLib\Voice\Bxml; |
| 11 | + |
| 12 | +require_once "Verb.php"; |
| 13 | +require_once "SpeakSentence.php"; |
| 14 | +require_once "PlayAudio.php"; |
| 15 | + |
| 16 | +class StartGather extends Verb { |
| 17 | + |
| 18 | + /** |
| 19 | + * Sets the username attribute for StartGather |
| 20 | + * |
| 21 | + * @param string $username The username for http authentication for the gather callback |
| 22 | + */ |
| 23 | + public function username($username) { |
| 24 | + $this->username = $username; |
| 25 | + } |
| 26 | + |
| 27 | + /** |
| 28 | + * Sets the password attribute for StartGather |
| 29 | + * |
| 30 | + * @param string $password The password for http authentication for the gather callback |
| 31 | + */ |
| 32 | + public function password($password) { |
| 33 | + $this->password = $password; |
| 34 | + } |
| 35 | + |
| 36 | + /** |
| 37 | + * Sets the dtmfUrl attribute for StartGather |
| 38 | + * |
| 39 | + * @param string $dtmfUrl The url to receive the dtmf callback |
| 40 | + */ |
| 41 | + public function dtmfUrl($dtmfUrl) { |
| 42 | + $this->dtmfUrl = $dtmfUrl; |
| 43 | + } |
| 44 | + |
| 45 | + /** |
| 46 | + * Sets the dtmfMethod attribute for StartGather |
| 47 | + * |
| 48 | + * @param string $dtmfMethod The http method to send the dtmf callback |
| 49 | + */ |
| 50 | + public function dtmfMethod($dtmfMethod) { |
| 51 | + $this->dtmfMethod = $dtmfMethod; |
| 52 | + } |
| 53 | + |
| 54 | + /** |
| 55 | + * Sets the tag attribute for StartGather |
| 56 | + * |
| 57 | + * @param string $tag A custom string to be included in callbacks |
| 58 | + */ |
| 59 | + public function tag($tag) { |
| 60 | + $this->tag = $tag; |
| 61 | + } |
| 62 | + |
| 63 | + public function toBxml($doc) { |
| 64 | + $element = $doc->createElement("StartGather"); |
| 65 | + |
| 66 | + if(isset($this->username)) { |
| 67 | + $element->setAttribute("username", $this->username); |
| 68 | + } |
| 69 | + |
| 70 | + if(isset($this->password)) { |
| 71 | + $element->setAttribute("password", $this->password); |
| 72 | + } |
| 73 | + |
| 74 | + if(isset($this->tag)) { |
| 75 | + $element->setAttribute("tag", $this->tag); |
| 76 | + } |
| 77 | + |
| 78 | + if(isset($this->dtmfUrl)) { |
| 79 | + $element->setAttribute("dtmfUrl", $this->dtmfUrl); |
| 80 | + } |
| 81 | + |
| 82 | + if(isset($this->dtmfMethod)) { |
| 83 | + $element->setAttribute("dtmfMethod", $this->dtmfMethod); |
| 84 | + } |
| 85 | + |
| 86 | + return $element; |
| 87 | + } |
| 88 | +} |
0 commit comments