I currently am trying to sync custom Devstates between two Asterisk servers, however it is not working.
I followed the guide here: https://wiki.asterisk.org/wiki/display/AST/Exchanging+Device+and+Mailbox+State+Using+PJSI
Config is as follows:
Server1:
[instance2]
type=endpoint
[instance2-devicestate]
type=outbound-publish
server_uri=sip:instance1@11.11.11.99
event=asterisk-devicestate
[instance2-mwi]
type=outbound-publish
server_uri=sip:instance1@11.11.11.99
event=asterisk-mwi
[instance2]
type=inbound-publication
event_asterisk-devicestate=instance2
event_asterisk-mwi=instance2
[instance2]
type=asterisk-publication
devicestate_publish=instance2-devicestate
mailboxstate_publish=instance2-mwi
device_state=yes
mailbox_state=yes
Server2:
[instance1]
type=endpoint
[instance1-devicestate]
type=outbound-publish
server_uri=sip:instance2@11.11.11.98
event=asterisk-devicestate
[instance1-mwi]
type=outbound-publish
server_uri=sip:instance2@11.11.11.98
event=asterisk-mwi
[instance1]
type=inbound-publication
event_asterisk-devicestate=instance1
event_asterisk-mwi=instance1
[instance1]
type=asterisk-publication
devicestate_publish=instance1-devicestate
mailboxstate_publish=instance1-mwi
device_state=yes
mailbox_state=yes
On instance2, I execute the command “devstate change Custom:99 BUSY” and I see the following SIP Messages arriving on Instance1:
<--- Received SIP request (593 bytes) from UDP:11.11.11.99:5060 --->
PUBLISH sip:instance2@11.11.11.98 SIP/2.0
Via: SIP/2.0/UDP 11.11.11.99:5060;rport;branch=z9hG4bKPj64eee22b-1289-4f0a-a681-9b4f3e3473c0
From: <sip:instance2@11.11.11.98>;tag=30a41cf2-3587-40fb-860c-3ecd4178ea0d
To: <sip:instance2@11.11.11.98>
Call-ID: becaa895-8415-4581-a41b-7265654057ac
CSeq: 39227 PUBLISH
Event: asterisk-devicestate
SIP-If-Match: 28
Expires: 3600
Max-Forwards: 70
User-Agent: Asterisk PBX 18.9.0
Content-Type: application/json
Content-Length: 97
{"type":"devicestate","device":"Custom:99","state":"BUSY","cachable":1,"eid":"00:50:56:a9:b2:94"}
<--- Transmitting SIP response (455 bytes) to UDP:192.112.255.99:5060 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 11.11.11.99:5060;rport=5060;received=11.11.11.99;branch=z9hG4bKPj64eee22b-1289-4f0a-a681-9b4f3e3473c0
Call-ID: becaa895-8415-4581-a41b-7265654057ac
From: <sip:instance2@11.11.11.98>;tag=30a41cf2-3587-40fb-860c-3ecd4178ea0d
To: <sip:instance2@11.11.11.98>;tag=z9hG4bKPj64eee22b-1289-4f0a-a681-9b4f3e3473c0
CSeq: 39227 PUBLISH
SIP-ETag: 29
Expires: 3600
Server: Asterisk PBX 18.9.0
Content-Length: 0
However, the status is not updated:
Instance1*CLI> devstate list
— Custom Device States --------------------------------------------
— Name: ‘Custom:99’ State: ‘INUSE’
On another note, when executing the same command on Instance1 it doesn’t even send the SIP PUBLISH messages to instance2.