[asterisk-commits] anthonyl: branch anthonyl/testing-branch r41805 - in /team/anthonyl/testing-b...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Sat Sep 2 00:29:40 MST 2006


Author: anthonyl
Date: Sat Sep  2 02:29:40 2006
New Revision: 41805

URL: http://svn.digium.com/view/asterisk?rev=41805&view=rev
Log:
making a new testing branch

Added:
    team/anthonyl/testing-branch/
      - copied from r41764, trunk/
Modified:
    team/anthonyl/testing-branch/channels/chan_jingle.c
    team/anthonyl/testing-branch/channels/chan_sip.c

Modified: team/anthonyl/testing-branch/channels/chan_jingle.c
URL: http://svn.digium.com/view/asterisk/team/anthonyl/testing-branch/channels/chan_jingle.c?rev=41805&r1=41764&r2=41805&view=diff
==============================================================================
--- team/anthonyl/testing-branch/channels/chan_jingle.c (original)
+++ team/anthonyl/testing-branch/channels/chan_jingle.c Sat Sep  2 02:29:40 2006
@@ -1254,23 +1254,28 @@
 
 	jingle = p->parent;
 	client = jingle->connection;
+	
 	iq = iks_new("iq");
 	desc = iks_new("description");
 	session = iks_new("session");
+	
 	iks_insert_attrib(iq, "type", "set");
 	iks_insert_attrib(iq, "to", p->from);
 	iks_insert_attrib(iq, "from", client->jid->full);
 	iks_insert_attrib(iq, "id", client->mid);
 	ast_aji_increment_mid(client->mid);
+	
 	iks_insert_attrib(session, "type", "initiate");
 	iks_insert_attrib(session, "id", p->sid);
 	iks_insert_attrib(session, "initiator", client->jid->full);
 	iks_insert_attrib(session, "xmlns", "http://www.google.com/session");
 	iks_insert_attrib(desc, "xmlns", "http://www.google.com/session/phone");
+	
 	payload_pcmu = iks_new("payload-type");
 	iks_insert_attrib(payload_pcmu, "id", "0");
 	iks_insert_attrib(payload_pcmu, "name", "PCMU");
 	payload_eg711u = iks_new("payload-type");
+	
 	iks_insert_attrib(payload_eg711u, "id", "100");
 	iks_insert_attrib(payload_eg711u, "name", "EG711U");
 	iks_insert_node(desc, payload_pcmu);
@@ -1278,6 +1283,7 @@
 	iks_insert_node(iq, session);
 	iks_insert_node(session, desc);
 	iks_send(client->p, iq);
+	
 	iks_delete(iq);
 	iks_delete(desc);
 	iks_delete(session);
@@ -1309,7 +1315,7 @@
 static int jingle_call(struct ast_channel *ast, char *dest, int timeout)
 {
 	struct jingle_pvt *p = ast->tech_pvt;
-
+	ast_verbose("We are trying to make a jingle call to!\n");
 	if ((ast->_state != AST_STATE_DOWN) && (ast->_state != AST_STATE_RESERVED)) {
 		ast_log(LOG_WARNING, "jingle_call called on %s, neither down nor reserved\n", ast->name);
 		return -1;

Modified: team/anthonyl/testing-branch/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/anthonyl/testing-branch/channels/chan_sip.c?rev=41805&r1=41764&r2=41805&view=diff
==============================================================================
--- team/anthonyl/testing-branch/channels/chan_sip.c (original)
+++ team/anthonyl/testing-branch/channels/chan_sip.c Sat Sep  2 02:29:40 2006
@@ -9047,7 +9047,8 @@
 }
 
 /*! \brief  Report Peer status in character string
- * 	\return 1 if peer is online, -1 if unmonitored */
+ *  \return 0 if peer is unreachable, 1 if peer is online, -1 if unmonitored
+ */
 static int peer_status(struct sip_peer *peer, char *status, int statuslen)
 {
 	int res = 0;
@@ -9165,8 +9166,10 @@
 
 	char name[256];
 	int total_peers = 0;
-	int peers_online = 0;
-	int peers_offline = 0;
+	int peers_mon_online = 0;
+	int peers_mon_offline = 0;
+	int peers_unmon_offline = 0;
+	int peers_unmon_online = 0;
 	char *id;
 	char idtext[256] = "";
 	int realtimepeers;
@@ -9185,8 +9188,9 @@
 			if (regcomp(&regexbuf, argv[4], REG_EXTENDED | REG_NOSUB))
 				return RESULT_SHOWUSAGE;
 			havepattern = TRUE;
-		} else
+		} else {
 			return RESULT_SHOWUSAGE;
+		}
 	case 3:
 		break;
 	default:
@@ -9211,25 +9215,23 @@
 
 		if (!ast_strlen_zero(iterator->username) && !s)
 			snprintf(name, sizeof(name), "%s/%s", iterator->name, iterator->username);
-		else
+		else {
 			ast_copy_string(name, iterator->name, sizeof(name));
-
+		}
+		
 		pstatus = peer_status(iterator, status, sizeof(status));
-		if (pstatus) 	
-			peers_online++;
-		else	{
-			if (pstatus == 0)
-				peers_offline++;
-			else {	/* Unmonitored */
-				/* Checking if port is 0 */
-				if ( ntohs(iterator->addr.sin_port) == 0 ) {
-					peers_offline++;
-				} else {
-					peers_online++;
-				}
+		if (pstatus == 1)
+			peers_mon_online++;
+		else if (pstatus == 0)
+			peers_mon_offline++;
+		else {
+			if (iterator->addr.sin_port == 0)
+				peers_unmon_offline++;
+			else {
+				peers_unmon_online++;
 			}
-		}			
-		
+		}
+
 		snprintf(srch, sizeof(srch), FORMAT, name,
 			iterator->addr.sin_addr.s_addr ? ast_inet_ntoa(iterator->addr.sin_addr) : "(Unspecified)",
 			ast_test_flag(&iterator->flags[1], SIP_PAGE2_DYNAMIC) ? " D " : "   ", 	/* Dynamic or not? */
@@ -9278,9 +9280,10 @@
 
 		total_peers++;
 	} while(0) );
-
+	
 	if (!s) {
-		ast_cli(fd,"%d sip peers [%d online , %d offline]\n",total_peers,peers_online,peers_offline);
+		ast_cli(fd, "sip peers %d [Monitored: %d online, %d offline Unmonitored: %d online, %d offline]\n",
+		        total_peers, peers_mon_online, peers_mon_offline,peers_unmon_online, peers_mon_offline);
 	}
 
 	if (havepattern)



More information about the asterisk-commits mailing list