[svn-commits] oej: branch oej/sip-max-forwards-1.4 r272642 - in /team/oej/sip-max-forwards-...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Sun Jun 27 07:09:59 CDT 2010


Author: oej
Date: Sun Jun 27 07:09:55 2010
New Revision: 272642

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=272642
Log:
Reset, resolve

Modified:
    team/oej/sip-max-forwards-1.4/   (props changed)
    team/oej/sip-max-forwards-1.4/apps/app_meetme.c
    team/oej/sip-max-forwards-1.4/apps/app_queue.c
    team/oej/sip-max-forwards-1.4/apps/app_voicemail.c
    team/oej/sip-max-forwards-1.4/channels/chan_dahdi.c
    team/oej/sip-max-forwards-1.4/channels/chan_sip.c
    team/oej/sip-max-forwards-1.4/configs/sip_notify.conf.sample
    team/oej/sip-max-forwards-1.4/doc/voicemail_odbc_postgresql.txt
    team/oej/sip-max-forwards-1.4/pbx/pbx_dundi.c

Propchange: team/oej/sip-max-forwards-1.4/
------------------------------------------------------------------------------
    automerge = http://www.codename-pineapple.org/

Propchange: team/oej/sip-max-forwards-1.4/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Sun Jun 27 07:09:55 2010
@@ -1,1 +1,1 @@
-/branches/1.4:1-271599
+/branches/1.4:1-272640

Modified: team/oej/sip-max-forwards-1.4/apps/app_meetme.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/sip-max-forwards-1.4/apps/app_meetme.c?view=diff&rev=272642&r1=272641&r2=272642
==============================================================================
--- team/oej/sip-max-forwards-1.4/apps/app_meetme.c (original)
+++ team/oej/sip-max-forwards-1.4/apps/app_meetme.c Sun Jun 27 07:09:55 2010
@@ -2873,10 +2873,11 @@
 				if (allowretry)
 					confno[0] = '\0';
 			} else {
-				if ((!ast_strlen_zero(cnf->pin) &&
-				     !ast_test_flag(&confflags, CONFFLAG_ADMIN)) ||
+				if (((!ast_strlen_zero(cnf->pin) &&
+				    !ast_test_flag(&confflags, CONFFLAG_ADMIN)) ||
 				    (!ast_strlen_zero(cnf->pinadmin) &&
-				     ast_test_flag(&confflags, CONFFLAG_ADMIN))) {
+				    ast_test_flag(&confflags, CONFFLAG_ADMIN))) &&
+				    (!(cnf->users == 0 && cnf->isdynamic))) {
 					char pin[MAX_PIN] = "";
 					int j;
 

Modified: team/oej/sip-max-forwards-1.4/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/sip-max-forwards-1.4/apps/app_queue.c?view=diff&rev=272642&r1=272641&r2=272642
==============================================================================
--- team/oej/sip-max-forwards-1.4/apps/app_queue.c (original)
+++ team/oej/sip-max-forwards-1.4/apps/app_queue.c Sun Jun 27 07:09:55 2010
@@ -3286,6 +3286,20 @@
 				ast_queue_log(queuename, qe->chan->uniqueid, member->membername, "TRANSFER", "%s|%s|%ld|%ld",
 					qe->chan->exten, qe->chan->context, (long) (callstart - qe->start),
 					(long) (time(NULL) - callstart));
+				if (qe->parent->eventwhencalled)
+					manager_event(EVENT_FLAG_AGENT, "AgentComplete",
+							"Queue: %s\r\n"
+							"Uniqueid: %s\r\n"
+							"Channel: %s\r\n"
+							"Member: %s\r\n"
+							"MemberName: %s\r\n"
+							"HoldTime: %ld\r\n"
+							"TalkTime: %ld\r\n"
+							"Reason: transfer\r\n"
+							"%s",
+							queuename, qe->chan->uniqueid, peer->name, member->interface, member->membername,
+							(long)(callstart - qe->start), (long)(time(NULL) - callstart),
+							qe->parent->eventwhencalled == QUEUE_EVENT_VARIABLES ? vars2manager(qe->chan, vars, sizeof(vars)) : "");
 			} else if (qe->chan->_softhangup) {
 				ast_queue_log(queuename, qe->chan->uniqueid, member->membername, "COMPLETECALLER", "%ld|%ld|%d",
 					(long) (callstart - qe->start), (long) (time(NULL) - callstart), qe->opos);
@@ -3325,6 +3339,21 @@
 				ast_channel_datastore_remove(qe->chan, tds);
 			}
 			update_queue(qe->parent, member, callcompletedinsl);
+		} else {
+			if (qe->parent->eventwhencalled)
+				manager_event(EVENT_FLAG_AGENT, "AgentComplete",
+						"Queue: %s\r\n"
+						"Uniqueid: %s\r\n"
+						"Channel: %s\r\n"
+						"Member: %s\r\n"
+						"MemberName: %s\r\n"
+						"HoldTime: %ld\r\n"
+						"TalkTime: %ld\r\n"
+						"Reason: transfer\r\n"
+						"%s",
+						queuename, qe->chan->uniqueid, peer->name, member->interface, member->membername, (long)(callstart - qe->start),
+						(long)(time(NULL) - callstart),
+						qe->parent->eventwhencalled == QUEUE_EVENT_VARIABLES ? vars2manager(qe->chan, vars, sizeof(vars)) : "");
 		}
 
 		if (transfer_ds) {

Modified: team/oej/sip-max-forwards-1.4/apps/app_voicemail.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/sip-max-forwards-1.4/apps/app_voicemail.c?view=diff&rev=272642&r1=272641&r2=272642
==============================================================================
--- team/oej/sip-max-forwards-1.4/apps/app_voicemail.c (original)
+++ team/oej/sip-max-forwards-1.4/apps/app_voicemail.c Sun Jun 27 07:09:55 2010
@@ -1193,9 +1193,10 @@
 
 	fprintf(text_file_ptr, "%s\n", "[message]");
 
+	cid_name = get_header_by_tag(header_content, "X-Asterisk-VM-Caller-ID-Name:");
+	fprintf(text_file_ptr, "callerid=\"%s\" ", S_OR(cid_name, ""));
 	cid_num = get_header_by_tag(header_content, "X-Asterisk-VM-Caller-ID-Num:");
-	cid_name = get_header_by_tag(header_content, "X-Asterisk-VM-Caller-ID-Name:");
-	fprintf(text_file_ptr, "callerid=\"%s\" <%s>\n", S_OR(cid_name, ""), S_OR(cid_num, ""));
+	fprintf(text_file_ptr, "<%s>\n", S_OR(cid_num, ""));
 	context = get_header_by_tag(header_content, "X-Asterisk-VM-Context:");
 	fprintf(text_file_ptr, "context=%s\n", S_OR(context, ""));
 	origtime = get_header_by_tag(header_content, "X-Asterisk-VM-Orig-time:");

Modified: team/oej/sip-max-forwards-1.4/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/sip-max-forwards-1.4/channels/chan_dahdi.c?view=diff&rev=272642&r1=272641&r2=272642
==============================================================================
--- team/oej/sip-max-forwards-1.4/channels/chan_dahdi.c (original)
+++ team/oej/sip-max-forwards-1.4/channels/chan_dahdi.c Sun Jun 27 07:09:55 2010
@@ -6048,6 +6048,7 @@
 				ast_dsp_digitreset(p->dsp);
 			}
 			if (p->pri->overlapdial & DAHDI_OVERLAPDIAL_INCOMING) {
+				ast_mutex_lock(&p->lock);
 				if (p->pri->pri) {		
 					if (!pri_grab(p, p->pri)) {
 						pri_proceeding(p->pri->pri, p->call, PVT_TO_CHANNEL(p), 0);
@@ -6057,6 +6058,7 @@
 						ast_log(LOG_WARNING, "Unable to grab PRI on span %d\n", p->span);
 					}
 				}
+				ast_mutex_unlock(&p->lock);
 			}
 			dahdi_enable_ec(p);
 			ast_setstate(chan, AST_STATE_RING);

Modified: team/oej/sip-max-forwards-1.4/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/sip-max-forwards-1.4/channels/chan_sip.c?view=diff&rev=272642&r1=272641&r2=272642
==============================================================================
--- team/oej/sip-max-forwards-1.4/channels/chan_sip.c (original)
+++ team/oej/sip-max-forwards-1.4/channels/chan_sip.c Sun Jun 27 07:09:55 2010
@@ -636,6 +636,7 @@
 	char *header[SIP_MAX_HEADERS];
 	char *line[SIP_MAX_LINES];
 	char data[SIP_MAX_PACKET];
+	char content[SIP_MAX_PACKET];
 	unsigned int sdp_start; /*!< the line number where the SDP begins */
 	unsigned int sdp_count; /*!< the number of lines of SDP */
 	AST_LIST_ENTRY(sip_request) next;
@@ -1564,7 +1565,8 @@
 static int add_header(struct sip_request *req, const char *var, const char *value);
 static int add_header_contentLength(struct sip_request *req, int len);
 static int add_header_max_forwards(struct sip_pvt *dialog, struct sip_request *req, int value);
-static int add_line(struct sip_request *req, const char *line);
+static int add_content(struct sip_request *req, const char *line);
+static int finalize_content(struct sip_request *req);
 static int add_text(struct sip_request *req, const char *text);
 static int add_digit(struct sip_request *req, char digit, unsigned int duration);
 static int add_vidupdate(struct sip_request *req);
@@ -2380,6 +2382,7 @@
 {
 	int res;
 
+	finalize_content(req);
 	add_blank(req);
 	if (sip_debug_test_pvt(p)) {
 		const struct sockaddr_in *dst = sip_real_dst(p);
@@ -2414,6 +2417,7 @@
 {
 	int res;
 
+	finalize_content(req);
 	add_blank(req);
 	if (sip_debug_test_pvt(p)) {
 		if (ast_test_flag(&p->flags[0], SIP_NAT_ROUTE))
@@ -3694,6 +3698,7 @@
 		ast_clear_flag(&p->flags[0], SIP_NEEDDESTROY);
 		p->owner->tech_pvt = NULL;
 		p->owner = NULL;  /* Owner will be gone after we return, so take it away */
+		ast_module_unref(ast_module_info->self);
 		return 0;
 	}
 	if (option_debug) {
@@ -6036,7 +6041,7 @@
 /*! \brief Add header to SIP message */
 static int add_header(struct sip_request *req, const char *var, const char *value)
 {
-	int maxlen = sizeof(req->data) - 4 - req->len; /* 4 bytes are for two \r\n ? */
+	int maxlen = sizeof(req->data) - 4 - req->len - strlen(req->content); /* 4 bytes are for two \r\n ? */
 
 	if (req->headers == SIP_MAX_HEADERS) {
 		ast_log(LOG_WARNING, "Out of SIP header space\n");
@@ -6083,35 +6088,42 @@
 }
 
 /*! \brief Add 'Content-Length' header to SIP message */
-static int add_header_contentLength(struct sip_request *req, int len)
+static int finalize_content(struct sip_request *req)
 {
 	char clen[10];
 
-	snprintf(clen, sizeof(clen), "%d", len);
-	return add_header(req, "Content-Length", clen);
+	if (req->lines) {
+		ast_log(LOG_WARNING, "finalize_content() called on a message that has already been finalized\n");
+		return -1;
+	}
+
+	snprintf(clen, sizeof(clen), "%zd", strlen(req->content));
+	add_header(req, "Content-Length", clen);
+
+	if (!ast_strlen_zero(req->content)) {
+		snprintf(req->data + req->len, sizeof(req->data) - req->len, "\r\n%s", req->content);
+		req->len += strlen(req->data + req->len);
+	}
+
+	req->lines = !ast_strlen_zero(req->content);
+	return 0;
 }
 
 /*! \brief Add content (not header) to SIP message */
-static int add_line(struct sip_request *req, const char *line)
-{
-	if (req->lines == SIP_MAX_LINES)  {
-		ast_log(LOG_WARNING, "Out of SIP line space\n");
+static int add_content(struct sip_request *req, const char *line)
+{
+	if (req->lines) {
+		ast_log(LOG_WARNING, "Can't add more content when the content has been finalized\n");
 		return -1;
 	}
-	if (!req->lines) {
-		/* Add extra empty return */
-		snprintf(req->data + req->len, sizeof(req->data) - req->len, "\r\n");
-		req->len += strlen(req->data + req->len);
-	}
-	if (req->len >= sizeof(req->data) - 4) {
+
+	if (req->len + strlen(req->content) + strlen(line) >= sizeof(req->data) - 4) {
 		ast_log(LOG_WARNING, "Out of space, can't add anymore\n");
 		return -1;
 	}
-	req->line[req->lines] = req->data + req->len;
-	snprintf(req->line[req->lines], sizeof(req->data) - req->len, "%s", line);
-	req->len += strlen(req->line[req->lines]);
-	req->lines++;
-	return 0;	
+
+	snprintf(req->content + strlen(req->content), sizeof(req->content) - strlen(req->content), "%s", line);
+	return 0;
 }
 
 /*! \brief Copy one header field from one request to another */
@@ -6564,7 +6576,6 @@
 		return -1;
 	}
 	respprep(&resp, p, msg, req);
-	add_header_contentLength(&resp, 0);
 	/* If we are cancelling an incoming invite for some reason, add information
 		about the reason why we are doing this in clear text */
 	if (p->method == SIP_INVITE && msg[0] != '1' && p->owner && p->owner->hangupcause) {
@@ -6650,7 +6661,6 @@
 	respprep(&resp, p, msg, req);
 	append_date(&resp);
 	add_header(&resp, "Unsupported", unsupported);
-	add_header_contentLength(&resp, 0);
 	return send_response(p, &resp, XMIT_UNRELIABLE, 0);
 }
 
@@ -6680,7 +6690,6 @@
 	struct sip_request resp;
 	respprep(&resp, p, msg, req);
 	append_date(&resp);
-	add_header_contentLength(&resp, 0);
 	return send_response(p, &resp, XMIT_UNRELIABLE, 0);
 }
 
@@ -6690,7 +6699,6 @@
 	struct sip_request resp;
 	respprep(&resp, p, msg, req);
 	add_header(&resp, "Accept", "application/sdp");
-	add_header_contentLength(&resp, 0);
 	return send_response(p, &resp, reliable, 0);
 }
 
@@ -6710,7 +6718,6 @@
 	snprintf(tmp, sizeof(tmp), "Digest algorithm=MD5, realm=\"%s\", nonce=\"%s\"%s", global_realm, randdata, stale ? ", stale=true" : "");
 	respprep(&resp, p, msg, req);
 	add_header(&resp, header, tmp);
-	add_header_contentLength(&resp, 0);
 	append_history(p, "AuthChal", "Auth challenge sent for %s - nc %d", p->username, p->noncecount);
 	return send_response(p, &resp, reliable, seqno);
 }
@@ -6733,8 +6740,7 @@
 {
 	/* XXX Convert \n's to \r\n's XXX */
 	add_header(req, "Content-Type", "text/plain");
-	add_header_contentLength(req, strlen(text));
-	add_line(req, text);
+	add_content(req, text);
 	return 0;
 }
 
@@ -6746,8 +6752,7 @@
 
 	snprintf(tmp, sizeof(tmp), "Signal=%c\r\nDuration=%u\r\n", digit, duration);
 	add_header(req, "Content-Type", "application/dtmf-relay");
-	add_header_contentLength(req, strlen(tmp));
-	add_line(req, tmp);
+	add_content(req, tmp);
 	return 0;
 }
 
@@ -6766,8 +6771,7 @@
 		"  </vc_primitive>\r\n"
 		" </media_control>\r\n";
 	add_header(req, "Content-Type", "application/media_control+xml");
-	add_header_contentLength(req, strlen(xml_is_a_huge_waste_of_space));
-	add_line(req, xml_is_a_huge_waste_of_space);
+	add_content(req, xml_is_a_huge_waste_of_space);
 	return 0;
 }
 
@@ -6881,7 +6885,6 @@
 /*! \brief Add Session Description Protocol message */
 static enum sip_result add_sdp(struct sip_request *resp, struct sip_pvt *p, int add_audio, int add_t38)
 {
-	int len = 0;
 	int alreadysent = 0;
 
 	struct sockaddr_in sin;
@@ -7150,45 +7153,35 @@
 			ast_build_string(&a_modem_next, &a_modem_left, "a=T38FaxUdpEC:%s\r\n", (p->t38.jointcapability & T38FAX_UDP_EC_REDUNDANCY) ? "t38UDPRedundancy" : "t38UDPFEC");
 	}
 
-	len = strlen(version) + strlen(subject) + strlen(owner) + strlen(connection) + strlen(stime);
-	if (add_audio)
-		len += strlen(m_audio) + strlen(a_audio) + strlen(hold);
-	if (needvideo) /* only if video response is appropriate */
-		len += strlen(m_video) + strlen(a_video) + strlen(bandwidth) + strlen(hold);
-	if (add_t38) {
-		len += strlen(m_modem) + strlen(a_modem);
-	}
-
 	add_header(resp, "Content-Type", "application/sdp");
-	add_header_contentLength(resp, len);
-	add_line(resp, version);
-	add_line(resp, owner);
-	add_line(resp, subject);
-	add_line(resp, connection);
+	add_content(resp, version);
+	add_content(resp, owner);
+	add_content(resp, subject);
+	add_content(resp, connection);
 	if (needvideo)	 	/* only if video response is appropriate */
-		add_line(resp, bandwidth);
-	add_line(resp, stime);
+		add_content(resp, bandwidth);
+	add_content(resp, stime);
 	if (add_audio) {
-		add_line(resp, m_audio);
-		add_line(resp, a_audio);
-		add_line(resp, hold);
+		add_content(resp, m_audio);
+		add_content(resp, a_audio);
+		add_content(resp, hold);
 	} else if (p->offered_media[SDP_AUDIO].offered) {
 		snprintf(dummy_answer, sizeof(dummy_answer), "m=audio 0 RTP/AVP %s\r\n", p->offered_media[SDP_AUDIO].text);
-		add_line(resp, dummy_answer);
+		add_content(resp, dummy_answer);
 	}
 	if (needvideo) { /* only if video response is appropriate */
-		add_line(resp, m_video);
-		add_line(resp, a_video);
-		add_line(resp, hold);	/* Repeat hold for the video stream */
+		add_content(resp, m_video);
+		add_content(resp, a_video);
+		add_content(resp, hold);	/* Repeat hold for the video stream */
 	} else if (p->offered_media[SDP_VIDEO].offered) {
 		snprintf(dummy_answer, sizeof(dummy_answer), "m=video 0 RTP/AVP %s\r\n", p->offered_media[SDP_VIDEO].text);
-		add_line(resp, dummy_answer);
+		add_content(resp, dummy_answer);
 	}
 	if (add_t38) {
-		add_line(resp, m_modem);
-		add_line(resp, a_modem);
+		add_content(resp, m_modem);
+		add_content(resp, a_modem);
 	} else if (p->offered_media[SDP_IMAGE].offered) {
-		add_line(resp, "m=image 0 udptl t38\r\n");
+		add_content(resp, "m=image 0 udptl t38\r\n");
 	}
 
 	/* Update lastrtprx when we send our SDP */
@@ -7694,8 +7687,6 @@
 			add_sdp(&req, p, 0, 1);
 		} else if (p->rtp) 
 			add_sdp(&req, p, 1, 0);
-	} else {
-		add_header_contentLength(&req, 0);
 	}
 
 	if (!p->initreq.headers || init > 2)
@@ -7880,8 +7871,7 @@
 	if (t > tmp + sizeof(tmp))
 		ast_log(LOG_WARNING, "Buffer overflow detected!!  (Please file a bug report)\n");
 
-	add_header_contentLength(&req, strlen(tmp));
-	add_line(&req, tmp);
+	add_content(&req, tmp);
 	p->pendinginvite = p->ocseq;	/* Remember that we have a pending NOTIFY in order not to confuse the NOTIFY subsystem */
 
 	return send_request(p, &req, XMIT_RELIABLE, p->ocseq);
@@ -7930,8 +7920,7 @@
 	if (t > tmp + sizeof(tmp))
 		ast_log(LOG_WARNING, "Buffer overflow detected!!  (Please file a bug report)\n");
 
-	add_header_contentLength(&req, strlen(tmp));
-	add_line(&req, tmp);
+	add_content(&req, tmp);
 
 	if (!p->initreq.headers) 
 		initialize_initreq(p, &req);
@@ -7961,8 +7950,7 @@
 	add_header(&req, "Supported", SUPPORTED_EXTENSIONS);
 
 	snprintf(tmp, sizeof(tmp), "SIP/2.0 %s\r\n", message);
-	add_header_contentLength(&req, strlen(tmp));
-	add_line(&req, tmp);
+	add_content(&req, tmp);
 
 	if (!p->initreq.headers)
 		initialize_initreq(p, &req);
@@ -8267,7 +8255,6 @@
 	add_header(&req, "Expires", tmp);
 	add_header(&req, "Contact", p->our_contact);
 	add_header(&req, "Event", "registration");
-	add_header_contentLength(&req, 0);
 
 	initialize_initreq(p, &req);
 	if (sip_debug_test_pvt(p))
@@ -8401,7 +8388,6 @@
 		p->invitestate = INV_CONFIRMED;
 
 	reqprep(&resp, p, sipmethod, seqno, newbranch);
-	add_header_contentLength(&resp, 0);
 	return send_request(p, &resp, reliable, seqno ? seqno : p->ocseq);
 }
 
@@ -8435,7 +8421,6 @@
 		add_header(&resp, "X-Asterisk-HangupCauseCode", buf);
 	}
 
-	add_header_contentLength(&resp, 0);
 	return send_request(p, &resp, reliable, seqno ? seqno : p->ocseq);	
 }
 
@@ -12166,8 +12151,15 @@
 
 		initreqprep(&req, p, SIP_NOTIFY);
 
-		for (var = varlist; var; var = var->next)
+		for (var = varlist; var; var = var->next) {
+			if (!strcasecmp(var->name, "Content-Length")) {
+				if (option_debug >= 2) {
+					ast_log(LOG_DEBUG, "Ignoring pair %s=%s\n", var->name, var->value);
+				}
+				continue; /* ignore content-length, it is calculated automatically */
+			}
 			add_header(&req, var->name, ast_unescape_semicolon(var->value));
+		}
 
 		/* Recalculate our side, and recalculate Call ID */
 		if (ast_sip_ouraddrfor(&p->sa.sin_addr, &p->ourip))

Modified: team/oej/sip-max-forwards-1.4/configs/sip_notify.conf.sample
URL: http://svnview.digium.com/svn/asterisk/team/oej/sip-max-forwards-1.4/configs/sip_notify.conf.sample?view=diff&rev=272642&r1=272641&r2=272642
==============================================================================
--- team/oej/sip-max-forwards-1.4/configs/sip_notify.conf.sample (original)
+++ team/oej/sip-max-forwards-1.4/configs/sip_notify.conf.sample Sun Jun 27 07:09:55 2010
@@ -1,11 +1,9 @@
 [polycom-check-cfg]
 Event=>check-sync
-Content-Length=>0
 
 ; Untested
 [sipura-check-cfg]
 Event=>resync
-Content-Length=>0
 
 ; Untested
 [grandstream-check-cfg]
@@ -14,9 +12,7 @@
 ; Untested
 [cisco-check-cfg]
 Event=>check-sync
-Content-Length=>0
 
 ; Tested
 [snom-check-cfg]
 Event=>check-sync\;reboot=false
-Content-Length=>0

Modified: team/oej/sip-max-forwards-1.4/doc/voicemail_odbc_postgresql.txt
URL: http://svnview.digium.com/svn/asterisk/team/oej/sip-max-forwards-1.4/doc/voicemail_odbc_postgresql.txt?view=diff&rev=272642&r1=272641&r2=272642
==============================================================================
--- team/oej/sip-max-forwards-1.4/doc/voicemail_odbc_postgresql.txt (original)
+++ team/oej/sip-max-forwards-1.4/doc/voicemail_odbc_postgresql.txt Sun Jun 27 07:09:55 2010
@@ -252,7 +252,7 @@
 11) Just as a sanity check, make sure you check the voicemessages table via the
 isql utility.
 
-[jsmith2 at localhost ODBC]$ echo "SELECT id, msgnum, dir, duration FROM voicemessages WHERE msgnum = 1" | isql testing
+[jsmith2 at localhost ODBC]$ echo "SELECT uniqueid, msgnum, dir, duration FROM voicemessages WHERE msgnum = 1" | isql testing
 +---------------------------------------+
 | Connected!                            |
 |                                       |
@@ -262,7 +262,7 @@
 |                                       |
 +---------------------------------------+
 SQL> +------------+------------+---------------------------------------------------------------------------------+---------------------+
-| id         | msgnum     | dir                                                                             | duration            |
+| uniqueid   | msgnum     | dir                                                                             | duration            |
 +------------+------------+---------------------------------------------------------------------------------+---------------------+
 +------------+------------+---------------------------------------------------------------------------------+---------------------+
 SQLRowCount returns 0
@@ -370,9 +370,9 @@
        \q to quit
 
 asterisk=# SELECT * FROM voicemessages;
- id | msgnum |                       dir                        | context | macrocontext |       callerid        |  origtime  | duration | mailboxuser | mailboxcontext | recording | label | read | sip_id | pabx_id | iax_id 
-----+--------+--------------------------------------------------+---------+--------------+-----------------------+------------+----------+-------------+----------------+-----------+-------+------+--------+---------+--------
- 26 |      0 | /var/spool/asterisk/voicemail/odbctest/101/INBOX | odbc    |              | "linksys" <linksys> | 1167794179 | 7        | 101         | odbctest       | 16599     |       | f    |        |         |       
+ uniqueid | msgnum |                       dir                        | context | macrocontext |       callerid        |  origtime  | duration | mailboxuser | mailboxcontext | recording | label | read | sip_id | pabx_id | iax_id 
+----------+--------+--------------------------------------------------+---------+--------------+-----------------------+------------+----------+-------------+----------------+-----------+-------+------+--------+---------+--------
+       26 |      0 | /var/spool/asterisk/voicemail/odbctest/101/INBOX | odbc    |              | "linksys" <linksys> | 1167794179 | 7        | 101         | odbctest       | 16599     |       | f    |        |         |       
 (1 row)
 
 Did you notice the the recording column is just a number?  When a recording

Modified: team/oej/sip-max-forwards-1.4/pbx/pbx_dundi.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/sip-max-forwards-1.4/pbx/pbx_dundi.c?view=diff&rev=272642&r1=272641&r2=272642
==============================================================================
--- team/oej/sip-max-forwards-1.4/pbx/pbx_dundi.c (original)
+++ team/oej/sip-max-forwards-1.4/pbx/pbx_dundi.c Sun Jun 27 07:09:55 2010
@@ -2519,6 +2519,7 @@
 		ast_cli(fd, "Peer:    %s\n", dundi_eid_to_str(eid_str, sizeof(eid_str), &peer->eid));
 		ast_cli(fd, "Model:   %s\n", model2str(peer->model));
 		ast_cli(fd, "Host:    %s\n", peer->addr.sin_addr.s_addr ? ast_inet_ntoa(peer->addr.sin_addr) : "<Unspecified>");
+		ast_cli(fd, "Port:    %d\n", ntohs(peer->addr.sin_port));
 		ast_cli(fd, "Dynamic: %s\n", peer->dynamic ? "yes" : "no");
 		ast_cli(fd, "Reg:     %s\n", peer->registerid < 0 ? "No" : "Yes");
 		ast_cli(fd, "In Key:  %s\n", ast_strlen_zero(peer->inkey) ? "<None>" : peer->inkey);
@@ -2550,8 +2551,8 @@
 
 static int dundi_show_peers(int fd, int argc, char *argv[])
 {
-#define FORMAT2 "%-20.20s %-15.15s     %-10.10s %-8.8s %-15.15s\n"
-#define FORMAT "%-20.20s %-15.15s %s %-10.10s %-8.8s %-15.15s\n"
+#define FORMAT2 "%-20.20s %-15.15s     %-6.6s %-10.10s %-8.8s %-15.15s\n"
+#define FORMAT "%-20.20s %-15.15s %s %-6d %-10.10s %-8.8s %-15.15s\n"
 	struct dundi_peer *peer;
 	int registeredonly=0;
 	char avgms[20];
@@ -2570,7 +2571,7 @@
 			return RESULT_SHOWUSAGE;
  	}
 	AST_LIST_LOCK(&peers);
-	ast_cli(fd, FORMAT2, "EID", "Host", "Model", "AvgTime", "Status");
+	ast_cli(fd, FORMAT2, "EID", "Host", "Port", "Model", "AvgTime", "Status");
 	AST_LIST_TRAVERSE(&peers, peer, list) {
 		char status[20];
 		int print_line = -1;
@@ -2605,7 +2606,7 @@
 			strcpy(avgms, "Unavail");
 		snprintf(srch, sizeof(srch), FORMAT, dundi_eid_to_str(eid_str, sizeof(eid_str), &peer->eid), 
 					peer->addr.sin_addr.s_addr ? ast_inet_ntoa(peer->addr.sin_addr) : "(Unspecified)",
-					peer->dynamic ? "(D)" : "(S)", model2str(peer->model), avgms, status);
+					peer->dynamic ? "(D)" : "(S)", ntohs(peer->addr.sin_port), model2str(peer->model), avgms, status);
 
                 if (argc == 5) {
                   if (!strcasecmp(argv[3],"include") && strstr(srch,argv[4])) {
@@ -2622,7 +2623,7 @@
         if (print_line) {
 			ast_cli(fd, FORMAT, dundi_eid_to_str(eid_str, sizeof(eid_str), &peer->eid), 
 					peer->addr.sin_addr.s_addr ? ast_inet_ntoa(peer->addr.sin_addr) : "(Unspecified)",
-					peer->dynamic ? "(D)" : "(S)", model2str(peer->model), avgms, status);
+					peer->dynamic ? "(D)" : "(S)", ntohs(peer->addr.sin_port), model2str(peer->model), avgms, status);
 		}
 	}
 	ast_cli(fd, "%d dundi peers [%d online, %d offline, %d unmonitored]\n", total_peers, online_peers, offline_peers, unmonitored_peers);
@@ -4194,6 +4195,8 @@
 			ast_copy_string(peer->inkey, v->value, sizeof(peer->inkey));
 		} else if (!strcasecmp(v->name, "outkey")) {
 			ast_copy_string(peer->outkey, v->value, sizeof(peer->outkey));
+		} else if (!strcasecmp(v->name, "port")) {
+			peer->addr.sin_port = htons(atoi(v->value));
 		} else if (!strcasecmp(v->name, "host")) {
 			if (!strcasecmp(v->value, "dynamic")) {
 				peer->dynamic = 1;




More information about the svn-commits mailing list