[asterisk-commits] file: branch file/stasis_peerevent r389201 - /team/file/stasis_peerevent/chan...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon May 20 08:44:10 CDT 2013


Author: file
Date: Mon May 20 08:44:06 2013
New Revision: 389201

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=389201
Log:
Update the endpoint state to reflect the known state when certain things occur.

Modified:
    team/file/stasis_peerevent/channels/chan_sip.c

Modified: team/file/stasis_peerevent/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/file/stasis_peerevent/channels/chan_sip.c?view=diff&rev=389201&r1=389200&r2=389201
==============================================================================
--- team/file/stasis_peerevent/channels/chan_sip.c (original)
+++ team/file/stasis_peerevent/channels/chan_sip.c Mon May 20 08:44:06 2013
@@ -15757,6 +15757,7 @@
 		peer->socket.ws_session = NULL;
 	}
 
+	ast_endpoint_set_state(peer->endpoint, AST_ENDPOINT_OFFLINE);
 	manager_event(EVENT_FLAG_SYSTEM, "PeerStatus", "ChannelType: SIP\r\nPeer: SIP/%s\r\nPeerStatus: Unregistered\r\nCause: Expired\r\n", peer->name);
 	register_peer_exten(peer, FALSE);	/* Remove regexten */
 	ast_devstate_changed(AST_DEVICE_UNKNOWN, AST_DEVSTATE_CACHABLE, "SIP/%s", peer->name);
@@ -16188,6 +16189,8 @@
 		}
 		ast_db_put("SIP/Registry", peer->name, data);
 	}
+
+	ast_endpoint_set_state(peer->endpoint, AST_ENDPOINT_ONLINE);
 	manager_event(EVENT_FLAG_SYSTEM, "PeerStatus", "ChannelType: SIP\r\nPeer: SIP/%s\r\nPeerStatus: Registered\r\nAddress: %s\r\n", peer->name,  ast_sockaddr_stringify(&peer->addr));
 
 	/* Is this a new IP address for us? */
@@ -23820,8 +23823,11 @@
 		manager_event(EVENT_FLAG_SYSTEM, "PeerStatus",
 			"ChannelType: SIP\r\nPeer: SIP/%s\r\nPeerStatus: %s\r\nTime: %d\r\n",
 			peer->name, s, pingtime);
-		if (is_reachable && sip_cfg.regextenonqualify)
-			register_peer_exten(peer, TRUE);
+		if (is_reachable) {
+			if (sip_cfg.regextenonqualify)
+				register_peer_exten(peer, TRUE);
+			ast_endpoint_set_state(peer->endpoint, AST_ENDPOINT_ONLINE);
+		}
 	}
 
 	pvt_set_needdestroy(p, "got OPTIONS response");
@@ -29701,6 +29707,7 @@
 		if (sip_cfg.peer_rtupdate) {
 			ast_update_realtime(ast_check_realtime("sipregs") ? "sipregs" : "sippeers", "name", peer->name, "lastms", "-1", SENTINEL);
 		}
+		ast_endpoint_set_state(peer->endpoint, AST_ENDPOINT_OFFLINE);
 		manager_event(EVENT_FLAG_SYSTEM, "PeerStatus", "ChannelType: SIP\r\nPeer: SIP/%s\r\nPeerStatus: Unreachable\r\nTime: %d\r\n", peer->name, -1);
 		if (sip_cfg.regextenonqualify) {
 			register_peer_exten(peer, FALSE);




More information about the asterisk-commits mailing list