Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

As a SmartPBX admin user, I would like to see presence subscriptions that each device has made #3

Open
grahamsnz opened this issue Jul 7, 2017 · 0 comments
Assignees

Comments

@grahamsnz
Copy link
Member

As discussed in issue #1, the web UI has a /devices API which is used in the Devices page.

In addition to including the /registration API summary and details in the web UI Devices list from issue #1, we would also like to add details regarding the /presence API

The main list API for Devices is:

https://{crossbar-api-server}:8443/v2/accounts/{account_id}/devices

This will provide a list of devices in the following format:

        {
            "device_type": "{device_type}",
            "enabled": {true|false},
            "id": "{randomly-generated-device-id}",
            "mac_address": "{mac-address}",
            "name": "{device-name}",
            "username": "{device-sip-username}"
        }

The associated list API for Presence is:

https://{crossbar-api-server}:8443/v2/accounts/{account_id}/presence

This will provide a list of presence_id and their subscribing SIP devices the following format:

"subscriptions": {
            "{presence-id}": {
                "dialog": {
                    "{subscription_request_call_id}": {
                        "expires": {subscription-dialog-expiry-in-seconds},
                        "from": "{subcriber-device_sip_username}@{account-sip-realm}",
                        "notify": {
                            "body": "undefined",
                            "reply": 0,
                            "sequence": 0
                        },
                        "stalker": "BLF-{coordinating-SIP-presense-SBC-server}",
                        "timestamp": {erlang-timestamp-in-ms},
                        "version": 1
                    },
                    "{subscription_request_call_id}": {
                        "expires": {subscription-dialog-expiry-in-seconds},
                        "from": "{subcriber-device_sip_username}@{account-sip-realm}",
                        "notify": {
                            "body": "undefined",
                            "reply": 0,
                            "sequence": 0
                        },
                        "stalker": "BLF-{coordinating-SIP-presense-SBC-server}",
                        "timestamp": {erlang-timestamp-in-ms},
                        "user_agent": "{sip-device-model-firmware}",
                        "version": 1
                    },
                    "{subscription_request_call_id}": {
                        "expires": {subscription-dialog-expiry-in-seconds},
                        "from": "{subcriber-device_sip_username}@{account-sip-realm}",
                        "notify": {
                            "body": "undefined",
                            "reply": 0,
                            "sequence": 0
                        },
                        "stalker": "BLF-{coordinating-SIP-presense-SBC-server}",
                        "timestamp": {erlang-timestamp-in-ms},
                        "version": 1
                    }
                }
            },
            "{presence-id}": {
                "dialog": {
                    "{dialog_request_call_id}": {
                        "expires": {subscription-dialog-expiry-in-seconds},
                        "from": "{subcriber-device_sip_username}@{account-sip-realm}",
                        "notify": {
                            "body": "undefined",
                            "reply": 0,
                            "sequence": 0
                        },
                        "stalker": "BLF-{coordinating-SIP-presense-SBC-server}",
                        "timestamp": {erlang-timestamp-in-ms},
                        "user_agent": "{sip-device-model-firmware}",
                        "version": 1
                    },
                    "{dialog_request_call_id}": {
                        "expires": {subscription-dialog-expiry-in-seconds},
                        "from": "{subcriber-device_sip_username}@{account-sip-realm}",
                        "notify": {
                            "body": "undefined",
                            "reply": 0,
                            "sequence": 0
                        },
                        "stalker": "BLF-{coordinating-SIP-presense-SBC-server}",
                        "timestamp": {erlang-timestamp-in-ms},
                        "user_agent": "{sip-device-model-firmware}",
                        "version": 1
                    },
                    "{dialog_request_call_id}.": {
                        "expires": {subscription-dialog-expiry-in-seconds},
                        "from": "{subcriber-device_sip_username}@{account-sip-realm}",
                        "notify": {
                            "body": "undefined",
                            "reply": 0,
                            "sequence": 0
                        },
                        "stalker": "BLF-{coordinating-SIP-presense-SBC-server}",
                        "timestamp": {erlang-timestamp-in-ms},
                        "version": 1
                    }
                },
                "presence": {
                    "{presence_request_call_id}": {
                        "expires": {subscription-dialog-expiry-in-seconds},
                        "from": "{subcriber-device_sip_username}@{account-sip-realm}",
                        "notify": {
                            "body": "undefined",
                            "reply": 0,
                            "sequence": 0
                        },
                        "stalker": "BLF-{coordinating-SIP-presense-SBC-server}",
                        "timestamp": {erlang-timestamp-in-ms},
                        "user_agent": "{sip-device-model-firmware}",
                        "version": 1
                    }
                }
            },
            "{presence-id}": {
                "dialog": {
                    "presence": {
                        "expires": {subscription-dialog-expiry-in-seconds},
                        "from": "{subcriber-device_sip_username}@{account-sip-realm}",
                        "notify": {
                            "body": "undefined",
                            "reply": 0,
                            "sequence": 0
                        },
                        "stalker": "BLF-{coordinating-SIP-presense-SBC-server}",
                        "timestamp": {erlang-timestamp-in-ms},
                        "version": 1
                    }
                }
            },
            "{presence-id}": {
                "dialog": {
                    "{dialog_request_call_id}": {
                        "expires": {subscription-dialog-expiry-in-seconds},
                        "from": "{subcriber-device_sip_username}@{account-sip-realm}",
                        "notify": {
                            "body": "undefined",
                            "reply": 0,
                            "sequence": 0
                        },
                        "stalker": "BLF-{coordinating-SIP-presense-SBC-server}",
                        "timestamp": {erlang-timestamp-in-ms},
                        "user_agent": "{sip-device-model-firmware}",
                        "version": 1
                    }
                }
            }

The key variables from this list are:

  1. {presence-id} which is the presence target that other SIP devices are watching for status updates.
  2. and the {subcriber-device_sip_username} field which is found in the "from": "{subcriber-device_sip_username}@{account-sip-realm}" field.

The easiest way to think of these is observed devices and the observers devices. So, how does this relate to our devices?

What we want to see in the Devices page new right side Presence column is the observed {presence-id} that each Device is watching

If we have a device with {subcriber-device_sip_username}: 200 which would show as "from": "200@{account-sip-realm}" in the subscription observers list for the observed presence id *3101 that we want to show that this is an observed {presence-id} that

If we find an observed {presence-id} of *3101 in the /presence API list and in this observed {presence-id} we see that there is an observer "from": "200@{account-sip-realm}", which is {subcriber-device_sip_username}: 200, then we want to show that *3101 is being watched in the right column of the matching Device row for the Device that has {sip_username} = 200.

If we find an observed {presence-id} of 201 in the /presence API list and in this observed {presence-id} we see that there is an observer "from": "200@{account-sip-realm}", which is {subcriber-device_sip_username}: 200, then we want to show that 201 is being watched in the right column of the matching Device row for the Device that has {sip_username} = 200.

In the above examples, both *3101 and 201 would be shown together on the right column on the Device that has {sip_username} = 200.

@grahamsnz grahamsnz changed the title As a SmartPBX admin user, I would like to see and reset presence subscriptions As a SmartPBX admin user, I would like to see presence subscriptions that each device has made Jul 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants