[asterisk-commits] anthonyl: branch anthonyl/verb-testing r42822 -
in /team/anthonyl/verb-testin...
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Mon Sep 11 22:54:12 MST 2006
Author: anthonyl
Date: Tue Sep 12 00:54:11 2006
New Revision: 42822
URL: http://svn.digium.com/view/asterisk?rev=42822&view=rev
Log:
making a testing branch for the cli re-verbifaction
Added:
team/anthonyl/verb-testing/
- copied from r42715, trunk/
Modified:
team/anthonyl/verb-testing/channels/chan_jingle.c
team/anthonyl/verb-testing/channels/chan_sip.c
team/anthonyl/verb-testing/channels/chan_skinny.c
Modified: team/anthonyl/verb-testing/channels/chan_jingle.c
URL: http://svn.digium.com/view/asterisk/team/anthonyl/verb-testing/channels/chan_jingle.c?rev=42822&r1=42715&r2=42822&view=diff
==============================================================================
--- team/anthonyl/verb-testing/channels/chan_jingle.c (original)
+++ team/anthonyl/verb-testing/channels/chan_jingle.c Tue Sep 12 00:54:11 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/verb-testing/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/anthonyl/verb-testing/channels/chan_sip.c?rev=42822&r1=42715&r2=42822&view=diff
==============================================================================
--- team/anthonyl/verb-testing/channels/chan_sip.c (original)
+++ team/anthonyl/verb-testing/channels/chan_sip.c Tue Sep 12 00:54:11 2006
@@ -9056,7 +9056,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;
@@ -9174,8 +9175,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;
@@ -9194,8 +9197,9 @@
if (regcomp(®exbuf, argv[4], REG_EXTENDED | REG_NOSUB))
return RESULT_SHOWUSAGE;
havepattern = TRUE;
- } else
+ } else {
return RESULT_SHOWUSAGE;
+ }
case 3:
break;
default:
@@ -9220,25 +9224,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? */
@@ -9287,9 +9289,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)
Modified: team/anthonyl/verb-testing/channels/chan_skinny.c
URL: http://svn.digium.com/view/asterisk/team/anthonyl/verb-testing/channels/chan_skinny.c?rev=42822&r1=42715&r2=42822&view=diff
==============================================================================
--- team/anthonyl/verb-testing/channels/chan_skinny.c (original)
+++ team/anthonyl/verb-testing/channels/chan_skinny.c Tue Sep 12 00:54:11 2006
@@ -1285,6 +1285,14 @@
ast_verbose("writing packet type %04X (%d bytes) to socket %d\n", letohl(req->e), letohl(req->len)+8, s->fd);
#endif
+ if (&req->data <= 0) {
+ ast_log(LOG_WARNING, "Transmit: failing, request data missing\n");
+ return 0;
+ } else if (s <= 0 ) {
+ ast_log(LOG_WARNING,"Transmit: failing, skinnysession invalid\n");
+ return 0;
+ }
+
memset(s->outbuf,0,sizeof(s->outbuf));
memcpy(s->outbuf, req, skinny_header_size);
memcpy(s->outbuf+skinny_header_size, &req->data, sizeof(skinny_data));
More information about the asterisk-commits
mailing list