Indications.php 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <?php
  2. /*
  3. Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland
  4. All rights reserved.
  5. Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
  6. http://www.opensolutions.ie/
  7. This file is part of the OSS_SNMP package.
  8. Redistribution and use in source and binary forms, with or without
  9. modification, are permitted provided that the following conditions are met:
  10. * Redistributions of source code must retain the above copyright
  11. notice, this list of conditions and the following disclaimer.
  12. * Redistributions in binary form must reproduce the above copyright
  13. notice, this list of conditions and the following disclaimer in the
  14. documentation and/or other materials provided with the distribution.
  15. * Neither the name of Open Source Solutions Limited nor the
  16. names of its contributors may be used to endorse or promote products
  17. derived from this software without specific prior written permission.
  18. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  19. ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  20. WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  21. DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
  22. DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  23. (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  24. LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  25. ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  26. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  27. SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  28. */
  29. namespace OSS\SNMP\MIBS\Asterisk;
  30. /**
  31. * A class for performing SNMP V2 queries on Asterisk
  32. *
  33. * @see https://wiki.asterisk.org/wiki/display/AST/Asterisk+MIB+Definitions
  34. * @copyright Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland
  35. * @author Barry O'Donovan <barry@opensolutions.ie>
  36. */
  37. class Indications extends \OSS\SNMP\MIB
  38. {
  39. const OID_ASTERISK_INDICATIONS_COUNT = '.1.3.6.1.4.1.22736.1.4.1.0';
  40. const OID_ASTERISK_DEFAULT_INDICATION = '.1.3.6.1.4.1.22736.1.4.2.0';
  41. const OID_ASTERISK_INDICATIONS_COUNTRY = '.1.3.6.1.4.1.22736.1.4.3.1.2';
  42. const OID_ASTERISK_INDICATIONS_DESCRIPTION = '.1.3.6.1.4.1.22736.1.4.3.1.4';
  43. /**
  44. * Returns the number of indications defined in Asterisk
  45. *
  46. * > Number of indications currently defined in Asterisk.
  47. *
  48. * @return int The number of indications defined in Asterisk
  49. */
  50. public function number()
  51. {
  52. return $this->getSNMP()->get( self::OID_ASTERISK_INDICATIONS_COUNT );
  53. }
  54. /**
  55. * Returns the default indication zone to use.
  56. *
  57. * > Default indication zone to use.
  58. *
  59. * @return string The default indication zone to use
  60. */
  61. public function defaultZone()
  62. {
  63. return $this->getSNMP()->get( self::OID_ASTERISK_DEFAULT_INDICATION );
  64. }
  65. /**
  66. * Returns an array of ISO country codes for the defined indications zones (indexed by SNMP table entry)
  67. *
  68. * > Country for which the indication zone is valid,
  69. * > typically this is the ISO 2-letter code of the country.
  70. *
  71. * @return array An array of ISO country codes for the defined indications zones (indexed by SNMP table entry)
  72. */
  73. public function countryCodes()
  74. {
  75. return $this->getSNMP()->walk1d( self::OID_ASTERISK_INDICATIONS_COUNTRY );
  76. }
  77. /**
  78. * Returns an array of indications zone descriptions (indexed by SNMP table entry)
  79. *
  80. * > Description of the indication zone, usually the full
  81. * > name of the country it is valid for.
  82. *
  83. * @return array An array of indications zone descriptions
  84. */
  85. public function descriptions()
  86. {
  87. return $this->getSNMP()->walk1d( self::OID_ASTERISK_INDICATIONS_DESCRIPTION );
  88. }
  89. }