From 58f0ade4db08772c01eb83571c42327eab261b29 Mon Sep 17 00:00:00 2001
From: Automerge script <automerge@asterisk.org>
Date: Mon, 10 Dec 2012 07:19:34 +0000
Subject: [PATCH] Merged revisions 377594-377595 via svnmerge from
 file:///srv/subversion/repos/asterisk/trunk

................
  r377594 | igorg | 2012-12-10 00:56:04 -0600 (Mon, 10 Dec 2012) | 15 lines

  Fix codec mismatch

  Fix code to send in both rx and tx open stream messages correct codecs. Found that on phase 0/1 phones wrong codecs cause to no audio in some situations.

  (issue ASTERISK-20183)
  ........

  Merged revisions 377591 from http://svn.asterisk.org/svn/asterisk/branches/1.8
  ........

  Merged revisions 377592 from http://svn.asterisk.org/svn/asterisk/branches/10
  ........

  Merged revisions 377593 from http://svn.asterisk.org/svn/asterisk/branches/11
................
  r377595 | igorg | 2012-12-10 01:03:48 -0600 (Mon, 10 Dec 2012) | 3 lines

  Add firmware information to CLI devices listing
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@377602 65c4cc65-6c06-0410-ace0-fbb531ad65f3
---
 channels/chan_unistim.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/channels/chan_unistim.c b/channels/chan_unistim.c
index 2179cb65ee..80dad41c6b 100644
--- a/channels/chan_unistim.c
+++ b/channels/chan_unistim.c
@@ -446,6 +446,7 @@ static struct unistimsession {
 	int size_buff_entry;	    /*!< size of the buffer used to enter datas */
 	char buff_entry[16];	    /*!< Buffer for temporary datas */
 	char macaddr[18];		       /*!< mac adress of the phone (not always available) */
+	char firmware[8];		       /*!< firmware of the phone (not always available) */
 	struct wsabuf wsabufsend[MAX_BUF_NUMBER];      /*!< Size of each paquet stored in the buffer array & pointer to this buffer */
 	unsigned char buf[MAX_BUF_NUMBER][MAX_BUF_SIZE];	/*!< Buffer array used to keep the lastest non-acked paquets */
 	struct unistim_device *device;
@@ -2666,9 +2667,9 @@ static void send_start_rtp(struct unistim_subchannel *sub)
 			buffsend[16] = (htons(sin.sin_port) & 0x00ff);
 			buffsend[20] = (us.sin_port & 0xff00) >> 8;
 			buffsend[19] = (us.sin_port & 0x00ff);
-			buffsend[11] = codec;
 		}
-		buffsend[12] = codec;
+		buffsend[11] = codec; /* rx */
+		buffsend[12] = codec; /* tx */
 		send_client(SIZE_HEADER + sizeof(packet_send_open_audio_stream_tx), buffsend, pte);
 
 		if (unistimdebug) {
@@ -2697,9 +2698,9 @@ static void send_start_rtp(struct unistim_subchannel *sub)
 			buffsend[16] = (htons(sin.sin_port) & 0x00ff);
 			buffsend[20] = (us.sin_port & 0xff00) >> 8;
 			buffsend[19] = (us.sin_port & 0x00ff);
-			buffsend[12] = codec;
 		}
-		buffsend[11] = codec;
+		buffsend[11] = codec; /* rx */
+		buffsend[12] = codec; /* tx */
 		send_client(SIZE_HEADER + sizeof(packet_send_open_audio_stream_rx), buffsend, pte);
 	} else {
 		uint16_t rtcpsin_port = htons(us.sin_port) + 1; /* RTCP port is RTP + 1 */
@@ -4320,6 +4321,7 @@ static void process_request(int size, unsigned char *buf, struct unistimsession
 		if (unistimdebug) {
 			ast_verb(0, "Got the firmware version : '%s'\n", buf + 13);
 		}
+		ast_copy_string(pte->firmware, (char *) (buf + 13), sizeof(pte->firmware));
 		init_phone_step2(pte);
 		return;
 	}
@@ -5932,12 +5934,13 @@ static char *unistim_show_devices(struct ast_cli_entry *e, int cmd, struct ast_c
 	if (a->argc != e->args)
 		return CLI_SHOWUSAGE;
 
-	ast_cli(a->fd, "%-20.20s %-20.20s %-15.15s %s\n", "Name/username", "MAC", "Host", "Status");
+	ast_cli(a->fd, "%-20.20s %-20.20s %-15.15s %-15.15s %s\n", "Name/username", "MAC", "Host", "Firmware", "Status");
 	ast_mutex_lock(&devicelock);
 	while (device) {
-		ast_cli(a->fd, "%-20.20s %-20.20s %-15.15s %s\n",
+		ast_cli(a->fd, "%-20.20s %-20.20s %-15.15s %-15.15s %s\n",
 			device->name, device->id,
 			(!device->session) ? "(Unspecified)" : ast_inet_ntoa(device->session->sin.sin_addr),
+			(!device->session) ? "(Unspecified)" : device->session->firmware,
 			(!device->session) ? "UNKNOWN" : "OK");
 		device = device->next;
 	}
-- 
GitLab