Distributed device state updates fail

I’m really having a hard time to get remote server BLF working and have no clue why the following happens. Perhaps it’s a bug.
The custom device states can’t be globally updated.

I have two asterisk pbx boxes. Box 1 has a jabber server installed. Jabber buddies and connections are fine.

xmpp.conf is basically out of the book and nothing fancy:

Server 1:

[code][general]
debug=yes ; Enable debugging (disabled by default).
autoregister=yes ; Auto register users from buddy list.

[asterisk]
type=client ; Client or Component connection
serverhost=raspbx1 ; Route to server for example, talk.google.com
pubsub_node=pubsub.raspbx1 ; Node to use for publishing events via PubSub
username=pbx1@raspbx1/astvoip1 ; Username with optional resource.
secret=pbx1 ; Password
usesasl=yes ; Use sasl or not
buddy=pbx2@raspbx1/astvoip2 ; Manual addition of buddy to list.
; For distributed events, these buddies are
; automatically added in the whitelist as
; ‘owners’ of the node(s).
distribute_events=yes ; Whether or not to distribute events using
; this connection. Default is ‘no’.
status=available ; One of: chat, available, away, xaway, or dnd
[/code]

and Server 2:[code][general]
debug=yes ; Enable debugging (disabled by default).
autoregister=yes ; Auto register users from buddy list.

[asterisk]
type=client ; Client or Component connection
serverhost=raspbx1 ; Route to server for example, talk.google.com
pubsub_node=pubsub.raspbx1 ; Node to use for publishing events via PubSub
username=pbx2@raspbx1/astvoip2 ; Username with optional resource.
secret=pbx2 ; Password
usesasl=yes ; Use sasl or not
buddy=pbx1@raspbx1/astvoip1 ; Manual addition of buddy to list.
; For distributed events, these buddies are
; automatically added in the whitelist as
; ‘owners’ of the node(s).
distribute_events=yes ; Whether or not to distribute events using
; this connection. Default is ‘no’.
status=available ; One of: chat, available, away, xaway, or dnd
[/code]

on both boxes is the following hint:

[code][from-internal-custom]

exten => 6123,hint,Custom:ext100[/code]

Okay, problem is to set the custom device state ext100 FROM box 2. Box 1 should reflect this state.
xmpp is working fine as far as I can see.

On box 2:[code]raspbx2*CLI> devstate change Custom:ext100 RINGING
Changing ext100 to RINGING

<— XMPP sent to ‘asterisk’ —>
RINGING
<------------->

<— XMPP received from ‘asterisk’ —>
RINGINGdevice_state
<------------->

<— XMPP received from ‘asterisk’ —>

<------------->
raspbx2*CLI> core show hints

-= Registered Asterisk Dial Plan Hints =-
               6123@from-internal-custom: Custom:ext100         State:Ringing         Watchers  0
                200@ext-local           : SIP/200               State:Unavailable     Watchers  0

[/code]
and the coresponding log on box 1:[code]<— XMPP received from ‘asterisk’ —>
RINGINGdevice_state
<------------->
[2013-02-12 15:58:40] DEBUG[1373]: res_xmpp.c:3023 xmpp_pak_message: XMPP client ‘asterisk’ received a message
[2013-02-12 15:58:40] DEBUG[1359]: res_xmpp.c:1220 xmpp_pubsub_devstate_cb: Returning here
[2013-02-12 15:58:40] DEBUG[1374]: devicestate.c:666 handle_devstate_change: Processing device state change for ‘Custom:ext100’
[2013-02-12 15:58:40] DEBUG[1374]: devicestate.c:612 process_collection: Adding per-server state of ‘Not in use’ for ‘Custom:ext100’
[2013-02-12 15:58:40] DEBUG[1374]: devicestate.c:612 process_collection: Adding per-server state of ‘Ringing’ for ‘Custom:ext100’
[2013-02-12 15:58:40] DEBUG[1374]: devicestate.c:619 process_collection: Aggregate devstate result is ‘Ringing’ for ‘Custom:ext100’
[2013-02-12 15:58:40] DEBUG[1374]: devicestate.c:641 process_collection: Aggregate state for device ‘Custom:ext100’ has changed to ‘Ringing’
[2013-02-12 15:58:40] DEBUG[1414]: app_queue.c:1806 handle_statechange: Device ‘Custom:ext100’ changed to state ‘6’ (Ringing) but we don’t care because they’re not a member of any queue.
[2013-02-12 15:58:40] DEBUG[1373]: res_xmpp.c:3537 xmpp_client_receive: XML parsing successful
raspbx1*CLI> core show hints

-= Registered Asterisk Dial Plan Hints =-
                100@ext-local           : SIP/100               State:Idle            Watchers  0
                101@ext-local           : SIP/101               State:Unavailable     Watchers  0
               6123@from-internal-custom: Custom:ext100         State:Idle            Watchers  1

[/code]
State should be RINGING, but is still IDLE.
Watcher is the BLF-LED on my phone.

But if I set on box 1 now:

[code]raspbx1*CLI> devstate change Custom:ext100 NOT_INUSE
Changing ext100 to NOT_INUSE
[2013-02-12 16:01:26] DEBUG[1418]: devicestate.c:442 devstate_event: device ‘Custom:ext100’ state ‘1’
[2013-02-12 16:01:26] DEBUG[1374]: devicestate.c:666 handle_devstate_change: Processing device state change for ‘Custom:ext100’
[2013-02-12 16:01:26] DEBUG[1374]: devicestate.c:612 process_collection: Adding per-server state of ‘Ringing’ for ‘Custom:ext100’
[2013-02-12 16:01:26] DEBUG[1374]: devicestate.c:612 process_collection: Adding per-server state of ‘Not in use’ for ‘Custom:ext100’
[2013-02-12 16:01:26] DEBUG[1374]: devicestate.c:619 process_collection: Aggregate devstate result is ‘Ringing’ for ‘Custom:ext100’
[2013-02-12 16:01:26] DEBUG[1374]: devicestate.c:641 process_collection: Aggregate state for device ‘Custom:ext100’ has changed to ‘Ringing’

<— XMPP sent to ‘asterisk’ —>
NOT_INUSE
<------------->
[2013-02-12 16:01:26] DEBUG[1367]: app_queue.c:1908 extension_state_cb: Extension ‘6123@from-internal-custom’ changed to state ‘6’ (Ringing) but we don’t care because they’re not a member of any queue.
[2013-02-12 16:01:26] DEBUG[1367]: chan_sip.c:3864 __sip_xmit: Trying to put ‘NOTIFY sip:’ onto UDP socket destined for 192.168.2.25:47210

<— XMPP received from ‘asterisk’ —>
NOT_INUSEdevice_state
<------------->
[2013-02-12 16:01:26] DEBUG[1373]: res_xmpp.c:3023 xmpp_pak_message: XMPP client ‘asterisk’ received a message
[2013-02-12 16:01:26] DEBUG[1373]: res_xmpp.c:1325 xmpp_pubsub_handle_event: Returning here, eid of incoming event matches ours!
[2013-02-12 16:01:26] DEBUG[1373]: res_xmpp.c:3537 xmpp_client_receive: XML parsing successful

<— XMPP received from ‘asterisk’ —>

<------------->
[2013-02-12 16:01:26] DEBUG[1414]: app_queue.c:1806 handle_statechange: Device ‘Custom:ext100’ changed to state ‘6’ (Ringing) but we don’t care because they’re not a member of any queue.
== Extension Changed 6123[from-internal-custom] new state Ringing for Notify User 100
[2013-02-12 16:01:26] DEBUG[1373]: res_xmpp.c:3537 xmpp_client_receive: XML parsing successful

<— XMPP received from ‘asterisk’ —>
NOT_INUSEdevice_state
<------------->
[2013-02-12 16:02:49] DEBUG[1373]: res_xmpp.c:3023 xmpp_pak_message: XMPP client ‘asterisk’ received a message
[2013-02-12 16:02:49] DEBUG[1359]: res_xmpp.c:1220 xmpp_pubsub_devstate_cb: Returning here
[2013-02-12 16:02:49] DEBUG[1374]: devicestate.c:666 handle_devstate_change: Processing device state change for ‘Custom:ext100’
[2013-02-12 16:02:49] DEBUG[1374]: devicestate.c:612 process_collection: Adding per-server state of ‘Not in use’ for ‘Custom:ext100’
[2013-02-12 16:02:49] DEBUG[1374]: devicestate.c:612 process_collection: Adding per-server state of ‘Not in use’ for ‘Custom:ext100’
[2013-02-12 16:02:49] DEBUG[1374]: devicestate.c:619 process_collection: Aggregate devstate result is ‘Not in use’ for ‘Custom:ext100’
[2013-02-12 16:02:49] DEBUG[1374]: devicestate.c:641 process_collection: Aggregate state for device ‘Custom:ext100’ has changed to ‘Not in use’
[2013-02-12 16:02:49] DEBUG[1367]: chan_sip.c:3864 __sip_xmit: Trying to put ‘NOTIFY sip:’ onto UDP socket destined for 192.168.2.25:47210
[2013-02-12 16:02:49] DEBUG[1414]: app_queue.c:1806 handle_statechange: Device ‘Custom:ext100’ changed to state ‘1’ (Not in use) but we don’t care because they’re not a member of any queue.
== Extension Changed 6123[from-internal-custom] new state Ringing for Notify User 100
[2013-02-12 16:02:49] DEBUG[1373]: res_xmpp.c:3537 xmpp_client_receive: XML parsing successful
raspbx1*CLI> core show hints

-= Registered Asterisk Dial Plan Hints =-
                100@ext-local           : SIP/100               State:Idle            Watchers  0
                101@ext-local           : SIP/101               State:Unavailable     Watchers  0
               6123@from-internal-custom: Custom:ext100         State:Ringing         Watchers  1

[/code]Tadaa: The state is RINGING!

Seems that there is an update problem.
Why don’t I get a RINGING state right after the xmpp message from box 2?

And reseting the state is quite the same.
A NOT_INUSE message from box 2 DOES NOT set the state to IDLE:

[code][2013-02-12 16:13:34] DEBUG[1373]: res_xmpp.c:3023 xmpp_pak_message: XMPP client ‘asterisk’ received a message
[2013-02-12 16:13:34] DEBUG[1359]: res_xmpp.c:1220 xmpp_pubsub_devstate_cb: Returning here
[2013-02-12 16:13:34] DEBUG[1374]: devicestate.c:666 handle_devstate_change: Processing device state change for ‘Custom:ext100’
[2013-02-12 16:13:34] DEBUG[1374]: devicestate.c:612 process_collection: Adding per-server state of ‘Not in use’ for ‘Custom:ext100’
[2013-02-12 16:13:34] DEBUG[1374]: devicestate.c:612 process_collection: Adding per-server state of ‘Not in use’ for ‘Custom:ext100’
[2013-02-12 16:13:34] DEBUG[1374]: devicestate.c:619 process_collection: Aggregate devstate result is ‘Not in use’ for ‘Custom:ext100’
[2013-02-12 16:13:34] DEBUG[1374]: devicestate.c:641 process_collection: Aggregate state for device ‘Custom:ext100’ has changed to ‘Not in use’
[2013-02-12 16:13:34] DEBUG[1367]: chan_sip.c:3864 __sip_xmit: Trying to put ‘NOTIFY sip:’ onto UDP socket destined for 192.168.2.25:47210
[2013-02-12 16:13:34] DEBUG[1414]: app_queue.c:1806 handle_statechange: Device ‘Custom:ext100’ changed to state ‘1’ (Not in use) but we don’t care because they’re not a member of any queue.
== Extension Changed 6123[from-internal-custom] new state Ringing for Notify User 100
[2013-02-12 16:13:34] DEBUG[1373]: res_xmpp.c:3537 xmpp_client_receive: XML parsing successful

<— XMPP keep alive from ‘asterisk’ —>
raspbx1*CLI> core show hints

-= Registered Asterisk Dial Plan Hints =-
                100@ext-local           : SIP/100               State:Idle            Watchers  0
                101@ext-local           : SIP/101               State:Unavailable     Watchers  0
               6123@from-internal-custom: Custom:ext100         State:Ringing         Watchers  1

raspbx1*CLI> devstate list


— Custom Device States --------------------------------------------


— Name: ‘Custom:ext100’ State: ‘NOT_INUSE’

— Name: ‘Custom:ext101’ State: ‘NOT_INUSE’


---------------------------------------------------------------------[/code]The aggregated state evaluates to ‘Not in use’ but the state of ext100 is still ‘Ringing’ :confused:

Is this a bug or do miss something?
Tested with Asterisk 11.1.2 on both boxes.

Thanx,
Marco

Have you found a solution?