Exchange of device state between two Asterisks

Hello
I have a simple setup with two asterisks (versions 13.23 and 16) exchanging device state using the following code in pjsip.conf:

[asterisk_1]
type=endpoint
;
[asterisk_1-devicestate]
type=outbound-publish
server_uri=sip:asterisk_2@x.x.x.x:5060
event=asterisk-devicestate
;
[asterisk_1]
type=inbound-publication
endpoint=asterisk_1
;
[asterisk_1]
type=asterisk-publication
devicestate_publish=asterisk_1-devicestate
device_state=yes

The above is cut-and-paste from Joshua Colp’s article and it works great:
https://wiki.asterisk.org/wiki/display/AST/Exchanging+Device+and+Mailbox+State+Using+PJSIP

Now that the two asterisks are exchanging device state I am hoping to put the information to use. As it stands now the the PUBLISH messages that arrive at the other instance get answered with 404 Not Found.

The trunk to our ITSP and the main business asterisk are on one server and most (but not all) of the SIP user devices are on the other. Is there a good way to have the device state of all the SIP phones available to both asterisk instances? This would be for the basic dialplan needs of the Dial() and Queue() applications to tell if a device on the other server is available or not.

Thank you!

In my original post I said I was getting 404 Not Found. When I turned on debug I got this message:
DEBUG[6309] res_pjsip_pubsub.c: Event ‘asterisk-devicestate’ is not configured for ‘asterisk_1’

The error in my code above was that I left out the event_asterisk-devicestate=asterisk_1 config option in the inbound-publication section. Putting the event_asterisk-devicestate=asterisk_1 option in the inbound-publication section made the difference and device state data is being correctly exchanged.

BTW I could only find this option event_asterisk-devicestate=asterisk_1 in the above-mentioned article:
https://wiki.asterisk.org/wiki/display/AST/Exchanging+Device+and+Mailbox+State+Using+PJSIP and not elsewhere so follow the article closely :slight_smile:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.