diff --git a/libs/sofia-sip/libsofia-sip-ua/msg/msg_internal.h b/libs/sofia-sip/libsofia-sip-ua/msg/msg_internal.h
index d3e61ff0cb..3b1ac9bb5e 100644
--- a/libs/sofia-sip/libsofia-sip-ua/msg/msg_internal.h
+++ b/libs/sofia-sip/libsofia-sip-ua/msg/msg_internal.h
@@ -145,67 +145,79 @@ struct hep_ip6hdr {
 #endif
 
 /* HEPv3 types */
+
+#if (defined __SUNPRO_CC) || defined(__SUNPRO_C) || defined(_MSC_VER)
+#define PACKED
+#endif
+#ifndef PACKED
+#define PACKED __attribute__ ((__packed__))
+#endif
+
+#ifdef _MSC_VER
+#pragma pack(push, 1)
+#endif
+
 struct hep_chunk {
        uint16_t vendor_id;
        uint16_t type_id;
        uint16_t length;
-} __attribute__((packed));
+} PACKED;
 
 typedef struct hep_chunk hep_chunk_t;
 
 struct hep_chunk_uint8 {
        hep_chunk_t chunk;
        uint8_t data;
-} __attribute__((packed));
+} PACKED;
 
 typedef struct hep_chunk_uint8 hep_chunk_uint8_t;
 
 struct hep_chunk_uint16 {
        hep_chunk_t chunk;
        uint16_t data;
-} __attribute__((packed));
+} PACKED;
 
 typedef struct hep_chunk_uint16 hep_chunk_uint16_t;
 
 struct hep_chunk_uint32 {
        hep_chunk_t chunk;
        uint32_t data;
-} __attribute__((packed));
+} PACKED;
 
 typedef struct hep_chunk_uint32 hep_chunk_uint32_t;
 
 struct hep_chunk_str {
        hep_chunk_t chunk;
        char *data;
-} __attribute__((packed));
+} PACKED;
 
 typedef struct hep_chunk_str hep_chunk_str_t;
 
 struct hep_chunk_ip4 {
        hep_chunk_t chunk;
        struct in_addr data;
-} __attribute__((packed));
+} PACKED;
 
 typedef struct hep_chunk_ip4 hep_chunk_ip4_t;
 
 struct hep_chunk_ip6 {
        hep_chunk_t chunk;
        struct in6_addr data;
-} __attribute__((packed));
+} PACKED;
 
 typedef struct hep_chunk_ip6 hep_chunk_ip6_t;
 
 struct hep_chunk_payload {
     hep_chunk_t chunk;
     char *data;
-} __attribute__((packed));
+} PACKED;
 
 typedef struct hep_chunk_payload hep_chunk_payload_t;
 
 struct hep_ctrl {
     char id[4];
     uint16_t length;
-} __attribute__((packed));
+} PACKED;
 
 typedef struct hep_ctrl hep_ctrl_t;
 
@@ -219,11 +231,14 @@ struct hep_generic {
         hep_chunk_uint32_t time_usec;
         hep_chunk_uint8_t  proto_t;
         hep_chunk_uint32_t capt_id;
-} __attribute__((packed));
+} PACKED;
+
+#ifdef _MSC_VER
+#pragma pack(pop)
+#endif
 
 typedef struct hep_generic hep_generic_t;
 
-
 /** Maximum size when streaming. */
 #define MSG_SSIZE_MAX (USIZE_MAX)