[asterisk-bugs] [JIRA] (ASTERISK-24863) res_pjsip: No endpoint events raised via AMI when contacts cannot be reached/qualified

Matt Jordan (JIRA) noreply at issues.asterisk.org
Wed Mar 11 09:46:35 CDT 2015


    [ https://issues.asterisk.org/jira/browse/ASTERISK-24863?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=225332#comment-225332 ] 

Matt Jordan commented on ASTERISK-24863:
----------------------------------------

When we determine that a contact is unreachable, that never actually translates into an {{ast_endpoint}} state. As a result, we don't raise a Stasis message or AMI event indicating that the endpoint is unreachable. Further, that doesn't then get reached in {{chan_pjsip}} when we calculate the device state.

Currently, we appear to only do this when a contact is created/deleted (as the result of a received REGISTER request or un-REGISTER request):
{code}
/*! \brief Callback function for changing the state of an endpoint */
static int persistent_endpoint_update_state(void *obj, void *arg, int flags)
{
	struct sip_persistent_endpoint *persistent = obj;
	char *aor = arg;
	RAII_VAR(struct ast_sip_contact *, contact, NULL, ao2_cleanup);
	RAII_VAR(struct ast_json *, blob, NULL, ast_json_unref);

	if (!ast_strlen_zero(aor) && !strstr(persistent->aors, aor)) {
		return 0;
	}

	if ((contact = ast_sip_location_retrieve_contact_from_aor_list(persistent->aors))) {
		ast_endpoint_set_state(persistent->endpoint, AST_ENDPOINT_ONLINE);
		blob = ast_json_pack("{s: s}", "peer_status", "Reachable");
	} else {
		ast_endpoint_set_state(persistent->endpoint, AST_ENDPOINT_OFFLINE);
		blob = ast_json_pack("{s: s}", "peer_status", "Unreachable");
	}

	ast_endpoint_blob_publish(persistent->endpoint, ast_endpoint_state_type(), blob);

	ast_devstate_changed(AST_DEVICE_UNKNOWN, AST_DEVSTATE_CACHABLE, "PJSIP/%s", ast_endpoint_get_resource(persistent->endpoint));

	return 0;
}
{code}

However, that doesn't help the case where we are qualifying an already registered endpoint (or for things with a static contact, but with no network connectivity).

> res_pjsip: No endpoint events raised via AMI when contacts cannot be reached/qualified
> --------------------------------------------------------------------------------------
>
>                 Key: ASTERISK-24863
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-24863
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Resources/res_pjsip
>    Affects Versions: 13.2.0
>            Reporter: Dmitriy Serov
>
> Using res_pjsip I have not any AMI events when lost connection to outgoing SIP server.
> Endpoint configured as a trunk, outbound authentication.
> Qualify changes status of contact. But endpoint does not change own status, no AMI events I see.



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list