]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Use ast_sockaddr_stringify_fmt wrappers for various functions in chan_sip
authorJonathan Rose <jrose@digium.com>
Wed, 1 Feb 2012 21:05:26 +0000 (21:05 +0000)
committerJonathan Rose <jrose@digium.com>
Wed, 1 Feb 2012 21:05:26 +0000 (21:05 +0000)
There are a number of cleaner looking wrappers for ast_sockaddr_stringify_fmt
available which are slightly more readable than using a direct call to
ast_sockaddr_stringify_fmt. This patch switches a number of those calls in
chan_sip to use those wrappers and is generally harmless.

(Closes issue ASTERISK-16930)
Reported by: Michael L. Young
Patches:
chan_sip-broken-registration-1.8.diff uploaded by Michael L. Young (license 5026)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@353720 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_sip.c

index bb1c749056d45734056f5038d4b3f80fefa17169..c26f3a1e66f34737f31eb58c2f4af494dcda73d1 100644 (file)
@@ -16631,7 +16631,7 @@ static char *_sip_show_peers(int fd, int *total, struct mansession *s, const str
        
 /* the last argument is left-aligned, so we don't need a size anyways */
 #define FORMAT2 "%-25.25s  %-39.39s %-3.3s %-10.10s %-3.3s %-8s %-10s %s\n"
-#define FORMAT  "%-25.25s  %-39.39s %-3.3s %-3.3s %-3.3s %-8d %-10s %s\n"
+#define FORMAT  "%-25.25s  %-39.39s %-3.3s %-3.3s %-3.3s %-8s %-10s %s\n"
 
        char name[256];
        int total_peers = 0;
@@ -16735,7 +16735,7 @@ static char *_sip_show_peers(int fd, int *total, struct mansession *s, const str
                        peer->host_dynamic ? " D " : "   ",     /* Dynamic or not? */
                        ast_test_flag(&peer->flags[0], SIP_NAT_FORCE_RPORT) ? " N " : "   ",    /* NAT=yes? */
                        peer->ha ? " A " : "   ",       /* permit/deny */
-                       ast_sockaddr_isnull(&peer->addr) ? 0 : ast_sockaddr_port(&peer->addr), status,
+                       ast_sockaddr_isnull(&peer->addr) ? 0 : ast_sockaddr_stringify_port(&peer->addr), status,
                        realtimepeers ? (peer->is_realtime ? "Cached RT":"") : "");
 
                if (!s)  {/* Normal CLI list */
@@ -16744,7 +16744,7 @@ static char *_sip_show_peers(int fd, int *total, struct mansession *s, const str
                        peer->host_dynamic ? " D " : "   ",     /* Dynamic or not? */
                        ast_test_flag(&peer->flags[0], SIP_NAT_FORCE_RPORT) ? " N " : "   ",    /* NAT=yes? */
                        peer->ha ? " A " : "   ",       /* permit/deny */
-                       ast_sockaddr_isnull(&peer->addr) ? 0 : ast_sockaddr_port(&peer->addr), status,
+                       ast_sockaddr_isnull(&peer->addr) ? 0 : ast_sockaddr_stringify_port(&peer->addr), status,
                        realtimepeers ? (peer->is_realtime ? "Cached RT":"") : "");
                } else {        /* Manager format */
                        /* The names here need to be the same as other channels */
@@ -16754,7 +16754,7 @@ static char *_sip_show_peers(int fd, int *total, struct mansession *s, const str
                        "ObjectName: %s\r\n"
                        "ChanObjectType: peer\r\n"      /* "peer" or "user" */
                        "IPaddress: %s\r\n"
-                       "IPport: %d\r\n"
+                       "IPport: %s\r\n"
                        "Dynamic: %s\r\n"
                        "Forcerport: %s\r\n"
                        "VideoSupport: %s\r\n"
@@ -16764,8 +16764,8 @@ static char *_sip_show_peers(int fd, int *total, struct mansession *s, const str
                        "RealtimeDevice: %s\r\n\r\n",
                        idtext,
                        peer->name,
-                       ast_sockaddr_isnull(&peer->addr) ? "-none-" : ast_sockaddr_stringify_fmt(&peer->addr, AST_SOCKADDR_STR_HOST),
-                       ast_sockaddr_isnull(&peer->addr) ? 0 : ast_sockaddr_port(&peer->addr),
+                       ast_sockaddr_isnull(&peer->addr) ? "-none-" : ast_sockaddr_stringify_addr(&peer->addr),
+                       ast_sockaddr_isnull(&peer->addr) ? 0 : ast_sockaddr_stringify_port(&peer->addr),
                        peer->host_dynamic ? "yes" : "no",      /* Dynamic or not? */
                        ast_test_flag(&peer->flags[0], SIP_NAT_FORCE_RPORT) ? "yes" : "no",     /* NAT=yes? */
                        ast_test_flag(&peer->flags[1], SIP_PAGE2_VIDEOSUPPORT) ? "yes" : "no",  /* VIDEOSUPPORT=yes? */