title: Get extensions list in Asterisk with AMI
body: <p>I'm running Asterisk 11.4.0 and I've got access to it with AMI. How can I get list of all extensions (not peers or users)?</p>
  
  <p>For example, I've got dialplan like this:</p>
  
  <pre><code>exten = _XXXX,1,Verbose(Start recording!)
  exten = _XXXX,2,NoOp()
  exten = _XXXX,3,Set(SCREEN_FILE=${STRFTIME(${EPOCH},,%d.%m.%Y-%H:%M:%S)}_${CALLERID(num)}&gt;${EXTEN}.gsm)
  exten = _XXXX,4,MixMonitor(${SCREEN_FILE},b)
  exten = _XXXX,5,Dial(SIP/${EXTEN})
  exten = _XXXX,6,StopMonitor()
  exten = _XXXX,7,Hangup()
  exten = _49000030[0-9a-zA-Z.@_/-].,1,Goto(test1,${EXTEN},1)
  exten = _49000033[0-9a-zA-Z.@_/-].,1,Goto(test2,${EXTEN},1)
  </code></pre>
  
  <p>So, my extensions are _XXXX, <em>49000030[0-9a-zA-Z.@</em>/-]. and <em>49000033[0-9a-zA-Z.@</em>/-].</p>