summaryrefslogtreecommitdiff
path: root/channels
diff options
context:
space:
mode:
authorPaul Belanger <paul.belanger@polybeacon.com>2011-09-07 19:38:58 +0000
committerPaul Belanger <paul.belanger@polybeacon.com>2011-09-07 19:38:58 +0000
commit272afe432b2068125261ad4a32b08f1410e3284f (patch)
treef7e10b082d9b92c717ac93e0703794a74aefcbf0 /channels
parent3d63ec89e0a0148b77fcc57dd3cb7259aae504eb (diff)
Merged revisions 334844 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/10 ................ r334844 | pabelanger | 2011-09-07 15:37:24 -0400 (Wed, 07 Sep 2011) | 11 lines Merged revisions 334843 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.8 ........ r334843 | pabelanger | 2011-09-07 15:35:52 -0400 (Wed, 07 Sep 2011) | 4 lines Cleanup chan_iax2.c log messages Review: https://code.asterisk.org/code/cru/CR-AST-11 ........ ................ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@334845 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_iax2.c33
1 files changed, 19 insertions, 14 deletions
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c
index 725936f12..da00e019c 100644
--- a/channels/chan_iax2.c
+++ b/channels/chan_iax2.c
@@ -8513,12 +8513,15 @@ static int iax2_ack_registry(struct iax_ies *ies, struct sockaddr_in *sin, int c
struct sockaddr_in reg_addr;
memset(&us, 0, sizeof(us));
- if (ies->apparent_addr)
+ if (ies->apparent_addr) {
memmove(&us, ies->apparent_addr, sizeof(us));
- if (ies->username)
+ }
+ if (ies->username) {
ast_copy_string(peer, ies->username, sizeof(peer));
- if (ies->refresh)
+ }
+ if (ies->refresh) {
refresh = ies->refresh;
+ }
if (ies->calling_number) {
/* We don't do anything with it really, but maybe we should */
}
@@ -8535,24 +8538,26 @@ static int iax2_ack_registry(struct iax_ies *ies, struct sockaddr_in *sin, int c
return -1;
}
memcpy(&reg->us, &us, sizeof(reg->us));
- if (ies->msgcount >= 0)
+ if (ies->msgcount >= 0) {
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
*/
reg->refresh = refresh;
- reg->expire = iax2_sched_replace(reg->expire, sched,
+ reg->expire = iax2_sched_replace(reg->expire, sched,
(5 * reg->refresh / 6) * 1000, iax2_do_register_s, reg);
if (inaddrcmp(&oldus, &reg->us) || (reg->messages != oldmsgs)) {
- 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 new messages waiting\n", reg->messages);
- else if (reg->messages > 0)
- ast_copy_string(msgstatus, " with 1 new message waiting\n", sizeof(msgstatus));
- else
- ast_copy_string(msgstatus, " with no messages waiting\n", sizeof(msgstatus));
- snprintf(ourip, sizeof(ourip), "%s:%d", ast_inet_ntoa(reg->us.sin_addr), ntohs(reg->us.sin_port));
+ 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 new messages waiting", reg->messages);
+ } else if (reg->messages > 0) {
+ ast_copy_string(msgstatus, " with 1 new message waiting", sizeof(msgstatus));
+ } else {
+ ast_copy_string(msgstatus, " with no messages waiting", sizeof(msgstatus));
+ }
+ snprintf(ourip, sizeof(ourip), "%s:%d", ast_inet_ntoa(reg->us.sin_addr), ntohs(reg->us.sin_port));
ast_verb(3, "Registered IAX2 to '%s', who sees us as %s%s\n", ast_inet_ntoa(sin->sin_addr), ourip, msgstatus);
manager_event(EVENT_FLAG_SYSTEM, "Registry", "ChannelType: IAX2\r\nDomain: %s\r\nStatus: Registered\r\n", ast_inet_ntoa(sin->sin_addr));
}