summaryrefslogtreecommitdiff
path: root/channels/chan_iax2.c
diff options
context:
space:
mode:
authorJoshua Colp <jcolp@digium.com>2006-05-18 00:12:54 +0000
committerJoshua Colp <jcolp@digium.com>2006-05-18 00:12:54 +0000
commit5769ed6ea288484a2462fc45682d664b801f2d3d (patch)
tree73a3993db38b32835f9a8a2c83dd6decb45a8bbe /channels/chan_iax2.c
parente08dc08ae28d2c900b501d37ea4a31530763acd3 (diff)
Fix receiving message count information from a remote IAX2 peer. (issue #7163 reported by and fixed by akohlsmith)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@28017 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels/chan_iax2.c')
-rw-r--r--channels/chan_iax2.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c
index 42c034e8a..67aad714f 100644
--- a/channels/chan_iax2.c
+++ b/channels/chan_iax2.c
@@ -412,7 +412,7 @@ struct iax2_registry {
int expire; /*!< Sched ID of expiration */
int refresh; /*!< How often to refresh */
enum iax_reg_state regstate;
- int messages; /*!< Message count */
+ int messages; /*!< Message count, low 8 bits = new, high 8 bits = old */
int callno; /*!< Associated call number if applicable */
struct sockaddr_in us; /*!< Who the server thinks we are */
struct iax2_registry *next;
@@ -5410,7 +5410,7 @@ static int iax2_ack_registry(struct iax_ies *ies, struct sockaddr_in *sin, int c
return -1;
}
memcpy(&reg->us, &us, sizeof(reg->us));
- reg->messages = ies->msgcount;
+ reg->messages = ies->msgcount & 0xffff; /* only low 16 bits are used in the transmission of the IE */
/* always refresh the registration at the interval requested by the server
we are registering to
*/
@@ -5420,12 +5420,12 @@ static int iax2_ack_registry(struct iax_ies *ies, struct sockaddr_in *sin, int c
reg->expire = ast_sched_add(sched, (5 * reg->refresh / 6) * 1000, iax2_do_register_s, reg);
if (inaddrcmp(&oldus, &reg->us) || (reg->messages != oldmsgs)) {
if (option_verbose > 2) {
- if (reg->messages > 65534)
- snprintf(msgstatus, sizeof(msgstatus), " with message(s) waiting\n");
+ if (reg->messages > 255)
+ snprintf(msgstatus, sizeof(msgstatus), " with %d new and %d old messages waiting", reg->messages & 0xff, reg->messages >> 8);
else if (reg->messages > 1)
- snprintf(msgstatus, sizeof(msgstatus), " with %d messages waiting\n", reg->messages);
+ snprintf(msgstatus, sizeof(msgstatus), " with %d new messages waiting\n", reg->messages);
else if (reg->messages > 0)
- snprintf(msgstatus, sizeof(msgstatus), " with 1 message waiting\n");
+ snprintf(msgstatus, sizeof(msgstatus), " with 1 new message waiting\n");
else
snprintf(msgstatus, sizeof(msgstatus), " with no messages waiting\n");
snprintf(ourip, sizeof(ourip), "%s:%d", ast_inet_ntoa(iabuf, sizeof(iabuf), reg->us.sin_addr), ntohs(reg->us.sin_port));