]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-8432 fixes timestamp type resolution, adds new header of type uint64 to carry...
authorAndrew Cassidy <andee@bytz.co.uk>
Tue, 10 Nov 2015 21:03:03 +0000 (21:03 +0000)
committerAndrew Cassidy <andee@bytz.co.uk>
Tue, 10 Nov 2015 21:04:36 +0000 (21:04 +0000)
src/mod/event_handlers/mod_amqp/mod_amqp_producer.c

index 3c82aa6225b3b54dbccc0128b3fd8d9d6c724765..980cad8a05a09b3338cd017b926c3eb03f17015e 100644 (file)
@@ -391,9 +391,10 @@ switch_status_t mod_amqp_producer_create(char *name, switch_xml_t cfg)
 /* This should only be called in a single threaded context from the producer profile send thread */
 switch_status_t mod_amqp_producer_send(mod_amqp_producer_profile_t *profile, mod_amqp_message_t *msg)
 {
-       amqp_table_entry_t messageTableEntries[1];
+       amqp_table_entry_t messageTableEntries[2];
        amqp_basic_properties_t props;
        int status;
+       uint64_t timestamp;
 
        if (! profile->conn_active) {
                /* No connection, so we can not send the message. */
@@ -415,9 +416,13 @@ switch_status_t mod_amqp_producer_send(mod_amqp_producer_profile_t *profile, mod
                props.timestamp = (uint64_t)time(NULL);
                props.headers.num_entries = 1;
                props.headers.entries = messageTableEntries;
+               timestamp = (uint64_t)switch_micro_time_now();
                messageTableEntries[0].key = amqp_cstring_bytes("x_Liquid_MessageSentTimeStamp");
                messageTableEntries[0].value.kind = AMQP_FIELD_KIND_TIMESTAMP;
-               messageTableEntries[0].value.value.u64 = (uint64_t)switch_micro_time_now();
+               messageTableEntries[0].value.value.u64 = (uint64_t)(timestamp / 1000000);
+               messageTableEntries[1].key = amqp_cstring_bytes("x_Liquid_MessageSentTimeStampMicro");
+               messageTableEntries[1].value.kind = AMQP_FIELD_KIND_U64;
+               messageTableEntries[1].value.value.u64 = timestamp;
        }
 
        status = amqp_basic_publish(