[Home]

Summary:ASTERISK-14572: res_ais, communication ok, but wrong state send and receive.
Reporter:Fossard Florent (ffossard)Labels:
Date Opened:2009-07-31 09:33:04Date Closed:2009-08-01 05:45:56
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Resources/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:I try to use res_ais for sharing devstate between two Asterisk.
Servers communicate, but the devstate don’t change on « other » server, because the first server sends a wrong state.


There is two identical test servers, vm-test1 and vm-test2.

Configuration files :

vm-test1:~# cat /etc/asterisk/ais.conf
[device_state]
type=event_channel
publish_event=device_state
subscribe_event=device_state

vm-test2:~# cat /etc/asterisk/ais.conf
[device_state]
type=event_channel
publish_event=device_state
subscribe_event=device_state


vm-test1:~# cat /etc/asterisk/extensions.conf
[general]
static=yes
writeprotect=no
autofallthrough=yes
clearglobalvars=no
language=fr

[globals]

[devstate_test]
exten => 1234,hint,Custom:mystate

exten => set_inuse,1,Set(DEVICE_STATE(Custom:mystate)=INUSE)
exten => set_not_inuse,1,Set(DEVICE_STATE(Custom:mystate)=NOT_INUSE)
exten => check,1,NoOp(Custom:mystate is ${DEVICE_STATE(Custom:mystate)})



vm-test2:~# cat /etc/asterisk/extensions.conf
[general]
static=yes
writeprotect=no
autofallthrough=yes
clearglobalvars=no
language=fr

[globals]

[devstate_test]
exten => 1234,hint,Custom:mystate

exten => set_inuse,1,Set(DEVICE_STATE(Custom:mystate)=INUSE)
exten => set_not_inuse,1,Set(DEVICE_STATE(Custom:mystate)=NOT_INUSE)
exten => check,1,NoOp(Custom:mystate is ${DEVICE_STATE(Custom:mystate)})



After, I verify « connection » between servers :

vm-test1:~# asterisk -vvvvvvvvvvvvvr
vm-test1*CLI> ais clm show members
vm-test1*CLI>
=============================================================
=== Cluster Members =========================================
=============================================================
===
=== ---------------------------------------------------------
=== Node Name: 10.78.99.253
=== ==> ID: 0xfd634e0a
=== ==> Address: 10.78.99.253
=== ==> Member: Yes
=== ---------------------------------------------------------
===
=== ---------------------------------------------------------
=== Node Name: 10.78.99.252
=== ==> ID: 0xfc634e0a
=== ==> Address: 10.78.99.252
=== ==> Member: Yes
=== ---------------------------------------------------------
===
=============================================================


vm-test1*CLI> ais evt show event channels
vm-test1*CLI>
=============================================================
=== Event Channels ==========================================
=============================================================
===
=== ---------------------------------------------------------
=== Event Channel Name: device_state
=== ==> Publishing Event Type: device_state
=== ==> Subscribing to Event Type: device_state
=== ---------------------------------------------------------
===
=============================================================

vm-test1*CLI> core show settings
Entity ID:                   00:0c:29:ef:e5:63




vm-test2:~# asterisk -vvvvvvvvvvvvvr
vm-test2*CLI> ais clm show members
vm-test2*CLI>
=============================================================
=== Cluster Members =========================================
=============================================================
===
=== ---------------------------------------------------------
=== Node Name: 10.78.99.252
=== ==> ID: 0xfc634e0a
=== ==> Address: 10.78.99.252
=== ==> Member: Yes
=== ---------------------------------------------------------
===
=== ---------------------------------------------------------
=== Node Name: 10.78.99.253
=== ==> ID: 0xfd634e0a
=== ==> Address: 10.78.99.253
=== ==> Member: Yes
=== ---------------------------------------------------------
===
=============================================================



vm-test2*CLI> ais evt show event channels
vm-test2*CLI>
=============================================================
=== Event Channels ==========================================
=============================================================
===
=== ---------------------------------------------------------
=== Event Channel Name: device_state
=== ==> Publishing Event Type: device_state
=== ==> Subscribing to Event Type: device_state
=== ---------------------------------------------------------
===
=============================================================

vm-test2*CLI> core show settings
Entity ID:                   00:0c:29:e9:1b:81




vm-test1*CLI> core show hints
vm-test1*CLI>
   -= Registered Asterisk Dial Plan Hints =-
                  1234@devstate_test       : Custom:mystate        State:Idle     Watchers  0
----------------
1 hints registered



vm-test2*CLI> core show hints
vm-test2*CLI>
   -= Registered Asterisk Dial Plan Hints =-
                  1234@devstate_test       : Custom:mystate      State:Idle     Watchers  0
----------------
1 hints registered


Same devstate in same state, ok.

I modify the devstate on first server:

vm-test1*CLI> console dial set_inuse@devstate_test
[Jul 23 17:39:56] WARNING[3112]: chan_oss.c:492 setformat: Unable to re-open DSP device /dev/dsp: No such file or directory
[Jul 23 17:39:56] DEBUG[3119]: pbx.c:3179 pbx_extension_helper: Launching 'Set'
   -- Executing [set_inuse@devstate_test:1] Set("Console/dsp", "DEVICE_STATE(Custom:mystate)=INUSE") in new stack
[Jul 23 17:39:56] NOTICE[3112]: console_video.c:133 console_video_start: voice only, console video support not present
   -- Auto fallthrough, channel 'Console/dsp' status is 'UNKNOWN'
[Jul 23 17:39:56] DEBUG[3119]: channel.c:1549 ast_softhangup_nolock: Soft-Hanging up channel 'Console/dsp'
[Jul 23 17:39:56] DEBUG[3119]: channel.c:1644 ast_hangup: Hanging up channel 'Console/dsp'
<< Hangup on console >>
[Jul 23 17:39:56] DEBUG[3087]: devicestate.c:680 handle_devstate_change: Processing device state change for 'Custom:mystate'
[Jul 23 17:39:56] DEBUG[3087]: devicestate.c:637 process_collection: Aggregate devstate result is 1
[Jul 23 17:39:56] DEBUG[3087]: devicestate.c:659 process_collection: Aggregate state for device 'Custom:mystate' has changed to 'Not in use'
[Jul 23 17:39:56] DEBUG[3066]: ais/evt.c:184 ast_event_cb: Got an event to forward
[Jul 23 17:39:56] DEBUG[3066]: ais/evt.c:239 ast_event_cb: Returning here (event_free)
[Jul 23 17:39:56] DEBUG[3066]: ais/evt.c:184 ast_event_cb: Got an event to forward
[Jul 23 17:39:56] DEBUG[3087]: devicestate.c:680 handle_devstate_change: Processing device state change for 'Console/dsp'
[Jul 23 17:39:56] DEBUG[3087]: devicestate.c:637 process_collection: Aggregate devstate result is 1
[Jul 23 17:39:56] DEBUG[3087]: devicestate.c:659 process_collection: Aggregate state for device 'Console/dsp' has changed to 'Not in use'
[Jul 23 17:39:56] DEBUG[3066]: ais/evt.c:239 ast_event_cb: Returning here (event_free)


vm-test1*CLI> core show hints
vm-test1*CLI>
   -= Registered Asterisk Dial Plan Hints =-
                  1234@devstate_test       : Custom:mystate        State:InUse           Watchers  0
----------------
- 1 hints registered



Ok for server test1, but strange message « Aggregate state for device 'Custom:mystate' has changed to 'Not in use' »


At the same time, on serveur vm-test2 :

vm-test2*CLI>
[Jul 23 17:38:40] DEBUG[7589]: devicestate.c:680 handle_devstate_change: Processing device state change for 'Custom:mystate'
[Jul 23 17:38:40] DEBUG[7589]: devicestate.c:637 process_collection: Aggregate devstate result is 1
[Jul 23 17:38:40] DEBUG[7589]: devicestate.c:659 process_collection: Aggregate state for device 'Custom:mystate' has changed to 'Not in use'
[Jul 23 17:38:40] DEBUG[7572]: ais/evt.c:184 ast_event_cb: Got an event to forward
[Jul 23 17:38:40] DEBUG[7572]: ais/evt.c:188 ast_event_cb: Returning here
[Jul 23 17:38:40] DEBUG[7572]: ais/evt.c:184 ast_event_cb: Got an event to forward
[Jul 23 17:38:40] DEBUG[7572]: ais/evt.c:188 ast_event_cb: Returning here
[Jul 23 17:38:40] DEBUG[7589]: devicestate.c:680 handle_devstate_change: Processing device state change for 'Console/dsp'
[Jul 23 17:38:40] DEBUG[7589]: devicestate.c:637 process_collection: Aggregate devstate result is 1
[Jul 23 17:38:40] DEBUG[7589]: devicestate.c:659 process_collection: Aggregate state for device 'Console/dsp' has changed to 'Not in use'


vm-test2*CLI> core show hints
vm-test2*CLI>
   -= Registered Asterisk Dial Plan Hints =-
                  1234@devstate_test       : Custom:mystate         State:Idle            Watchers  0
----------------
-  1 hints registered



Same wrong state is receive, then no change.


****** ADDITIONAL INFORMATION ******

Systems are Debian Lenny.

I installed Asterisk and res_ais like this :
cd /usr/src
wget ftp://ftp%40corosync%2Eorg:downloads@corosync.org/downloads/corosync-1.0.0/corosync-1.0.0.tar.gz
tar xvzf corosync-1.0.0.tar.gz
cd corosync-1.0.0
./configure
make install

mv /etc/corosync/corosync.conf.example /etc/corosync/corosync.conf
vim /etc/corosync/corosync.conf  # modify « bindnetaddr: » line

cd ..
wget ftp://ftp%40openais%2Eorg:downloads@openais.org/downloads/openais-1.0.0/openais-1.0.0.tar.gz
tar xvzf openais-1.0.0.tar.gz
cd openais-1.0.0
./configure
make PREFIX=/usr
make install PREFIX=/usr
mkdir /etc/ais
mv ./conf/openais.conf.example /etc/ais/openais.conf
vim /etc/ais/openais.conf # modify « bindnetaddr: » line

groupadd ais
adduser --system --no-create-home --ingroup ais ais

aisexec –f  # for test

cd ..
wget -c http://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk-1.6.1.1.tar.gz
tar xvzf asterisk-1.6.1.1.tar.gz
cd asterisk-1.6.1.1
./configure
make menuselect # verify "Resource Modules > res_ais"
make
make install
make samples
make config
Comments:By: Digium Subversion (svnbot) 2009-08-01 05:43:54

Repository: asterisk
Revision: 209835

U   trunk/main/event.c

------------------------------------------------------------------------
r209835 | russell | 2009-08-01 05:43:54 -0500 (Sat, 01 Aug 2009) | 6 lines

Fix ast_event_queue_and_cache() to actually do the cache() part.

(closes issue ASTERISK-14572)
Reported by: ffossard
Tested by: russell

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=209835

By: Digium Subversion (svnbot) 2009-08-01 05:44:51

Repository: asterisk
Revision: 209836

_U  branches/1.6.1/
U   branches/1.6.1/main/event.c

------------------------------------------------------------------------
r209836 | russell | 2009-08-01 05:44:50 -0500 (Sat, 01 Aug 2009) | 13 lines

Merged revisions 209835 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

........
 r209835 | russell | 2009-08-01 05:43:40 -0500 (Sat, 01 Aug 2009) | 6 lines
 
 Fix ast_event_queue_and_cache() to actually do the cache() part.
 
 (closes issue ASTERISK-14572)
 Reported by: ffossard
 Tested by: russell
........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=209836

By: Digium Subversion (svnbot) 2009-08-01 05:45:55

Repository: asterisk
Revision: 209837

_U  branches/1.6.2/
U   branches/1.6.2/main/event.c

------------------------------------------------------------------------
r209837 | russell | 2009-08-01 05:45:55 -0500 (Sat, 01 Aug 2009) | 13 lines

Merged revisions 209835 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

........
 r209835 | russell | 2009-08-01 05:43:40 -0500 (Sat, 01 Aug 2009) | 6 lines
 
 Fix ast_event_queue_and_cache() to actually do the cache() part.
 
 (closes issue ASTERISK-14572)
 Reported by: ffossard
 Tested by: russell
........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=209837