ARI websocket connection 500 error in Asterisk 14.7.2

Hi guys , meet a critical problem when using ari in asterisk!!!

1. install version 14.7.2 with shell script below:

git clone -b 14.7.2 --depth 1 https://github.com/asterisk/asterisk.git && \
 $COMPILE_DIR/asterisk/contrib/scripts/install_prereq install

cd $COMPILE_DIR/asterisk

# Configure
 mkdir $COMPILE_DIR/downloads && \
 wget -O $COMPILE_DIR/downloads/pjproject-2.6.tar.bz2 http://www.pjsip.org/release/2.6/pjproject-2.6.tar.bz2 && \
 wget -O $COMPILE_DIR/downloads/pjproject-2.6.md5 http://www.pjsip.org/release/2.6/MD5SUM.TXT


contrib/scripts/get_mp3_source.sh 
./configure --prefix=$INSTALL_DIR --libdir=/usr/lib64 --with-externals-cache=$COMPILE_DIR/downloads --with-pjproject-bundled

make menuselect/menuselect menuselect-tree menuselect.makeopts && \
       menuselect/menuselect --disable BUILD_NATIVE \
                             --enable format_mp3 menuselect.makeopts \
                             --enable app_fax menuselect.makeopts \
                             --enable codec_opus menuselect.makeopts \
                             --enable codec_silk menuselect.makeopts \
                             --enable BETTER_BACKTRACES menuselect.makeopts \
                             --disable MOH-OPSOUND-WAV \
                             --enable MOH-OPSOUND-GSM \
                             menuselect.makeopts

make 1> /dev/null
make install 1> /dev/null
make install samples

2. I edit the “http.conf”

[general]
servername=Asterisk
enabled=yes
bindaddr=0.0.0.0:8087
**"ari.conf"**
[general]
enabled = yes       
pretty = no        
allowed_origins = * ; 
[mashuishui]
type = user       
read_only = no    
password = 123456
**"extensions.conf"**
[default]
exten => 1000,1,NoOp()
 same =>      n,Stasis(pttProxy)
 same =>      n,Hangup()    

3. enter cli asterisk -vvvvvr && connect with

wscat -c “ws://“Server IP”:8087/ari/events?api_key=mashuishui:123456&app=pttProxy”

but get error :

error: Error: unexpected server response (500)

and In asterisk console:
<— Sending ARI response to “Connect IP”:51425 —>
0 (null)

then I use web “ari.asterisk.org” to connect :

<— Sending ARI response to “Client IP”:51689 —>
0 (null)
Access-Control-Allow-Origin: http://ari.asterisk.org
Access-Control-Allow-Credentials: true

4. I tried to reinstall asterisk with :
make clean make uninstall-all and the install script in section 1
I still got the same error
&& I tried change http bind port in http.conf, still the same …

Question:
I dont know how to solve this… i have tried everything i thought…

What else occurred on the console? Were there any errors at startup?

Here are the log with typing “asterisk -cvvvvv” to start the server and filter with “error” tag

Line 512: [Dec 4 10:05:46] ERROR[4628]: res_config_pgsql.c:1605 pgsql_reconnect: PostgreSQL RealTime: Failed to connect database asterisk on 127.0.0.1:
Line 522: [Dec 4 10:05:46] ERROR[4628]: res_config_ldap.c:1852 parse_config: No directory URL or host found.
Line 523: [Dec 4 10:05:46] ERROR[4628]: res_config_ldap.c:1714 load_module: Cannot load LDAP RealTime driver.
Line 1794: [Dec 4 10:05:47] ERROR[4628]: codec_dahdi.c:818 find_transcoders: Failed to open /dev/dahdi/transcode: No such file or directory

“ari” tag:

Line 384: Loading res_ari.so.
Line 385: == Parsing ‘/opt/hooweptt/etc/asterisk/ari.conf’: Found
Line 386: == res_ari.so => (Asterisk RESTful Interface)
Line 397: == AGI Command ‘get full variable’ registered
Line 399: == AGI Command ‘get variable’ registered
Line 420: == AGI Command ‘set variable’ registered
Line 448: Loading res_ari_model.so.
Line 449: == res_ari_model.so => (ARI Model validators)
Line 449: == res_ari_model.so => (ARI Model validators)
Line 495: == Message handler ‘ari’ registered.
Line 992: Loading res_ari_asterisk.so.
Line 993: == res_ari_asterisk.so => (RESTful API module - Asterisk resources)
Line 1049: Loading res_ari_sounds.so.
Line 1050: == res_ari_sounds.so => (RESTful API module - Sound resources)
Line 1056: Loading res_ari_events.so.
Line 1057: == WebSocket registered sub-protocol ‘ari’
Line 1058: == res_ari_events.so => (RESTful API module - WebSocket resource)
Line 1108: == Setting global variable ‘CONSOLE-AEL’ to ‘“Console/dsp”’
Line 1109: == Setting global variable ‘IAXINFO-AEL’ to ‘guest’
Line 1110: == Setting global variable ‘OUTBOUND-TRUNK’ to ‘“Zap/g2”’
Line 1111: == Setting global variable ‘OUTBOUND-TRUNKMSD’ to ‘1’
Line 1309: Loading res_ari_channels.so.
Line 1310: == res_ari_channels.so => (RESTful API module - Channel resources)
Line 1313: == app_read.so => (Read Variable Application)
Line 1616: Loading res_ari_device_states.so.
Line 1617: == res_ari_device_states.so => (RESTful API module - Device state resources)
Line 1735: Loading res_ari_bridges.so.
Line 1736: == res_ari_bridges.so => (RESTful API module - Bridge resources)
Line 1819: Loading res_ari_endpoints.so.
Line 1820: == res_ari_endpoints.so => (RESTful API module - Endpoint resources)
Line 1842: == func_global.so => (Variable dialplan functions)
Line 1843: Loading res_ari_recordings.so.
Line 1844: == res_ari_recordings.so => (RESTful API module - Recording resources)
Line 1863: Loading res_ari_playbacks.so.
Line 1864: == res_ari_playbacks.so => (RESTful API module - Playback control resources)
Line 1887: == func_config.so => (Asterisk configuration file variable access)
Line 1895: Loading res_ari_applications.so.
Line 1896: == res_ari_applications.so => (RESTful API module - Stasis application resources)
Line 2111: == Registered custom function ‘QUEUE_VARIABLES’

And is the output right by typing follow commands ? I cant see the “pttProxy” ari app

*CLI> dialplan show default
[ Context ‘default’ created by ‘pbx_config’ ]
‘1000’ => 1. NoOp() [extensions.conf:2]
2. Stasis(pttProxy) [extensions.conf:3]
3. Hangup() [extensions.conf:4]
‘1234’ => hint: SIP/1234 [pbx_lua]
Alt. Switch => ‘Lua/’ [pbx_lua]
-= 2 extensions (4 priorities) in 1 context. =-

*CLI> ari show apps
Application Name
=========================
*CLI>