Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

amqp_basic_publish method returns status as 0 but message doesn't reach rabbitmq as connection is broken. #724

Open
taju20910 opened this issue Mar 15, 2022 · 1 comment

Comments

@taju20910
Copy link

taju20910 commented Mar 15, 2022

Hi There,

I am using freeswitch mod_amqp producer profile with heartbeat enabled. When I am sending the message after heartbeat interval is done, my first message doesn't reach Rabbitmq and still I get return status as 0 which ideally means success. When I send the second message I am able to see non zero status code after which a reconnection is done and message is sent successfully after.

First message ::

freeswitch@ccs-fsconf1> luarun /usr/local/freeswitch/scripts/MakeEventAPI.lua DROPPED_PARKED_CALL_EVENT hello +OK 2022-03-14 18:13:27.171352 [INFO] mod_amqp_producer.c:87 inside event handler RECV EVENT Event-Subclass: DROPPED_PARKED_CALL_EVENT Event-Name: CUSTOM Core-UUID: 7e005200-153f-47f5-9a50-ff8011cb847c FreeSWITCH-Hostname: ccs-fsconf1-57b5d6496f-dmm5x FreeSWITCH-Switchname: ccs-fsconf1 FreeSWITCH-IPv4: 10.1.2.24 FreeSWITCH-IPv6: ::1 Event-Date-Local: 2022-03-14 18:13:27 Event-Date-GMT: Mon, 14 Mar 2022 18:13:27 GMT Event-Date-Timestamp: 1647281607171352 Event-Calling-File: switch_cpp.cpp Event-Calling-Function: Event Event-Calling-Line-Number: 314 Event-Sequence: 13483 Event-Data: hello 2022-03-14 18:13:27.171352 [INFO] mod_amqp_producer.c:523 Got Message 2022-03-14 18:13:27.171352 [INFO] mod_amqp_producer.c:408 in send function for Profile :: [dropped_park_call_event] 2022-03-14 18:13:27.171352 [INFO] mod_amqp_producer.c:438 in send function , calling publish 2022-03-14 18:13:27.171352 [INFO] mod_amqp_producer.c:448 in send function , status is :: 0 2022-03-14 18:13:27.171352 [WARNING] mod_amqp_producer.c:527 Send success

Second message ::

freeswitch@ccs-fsconf1> luarun /usr/local/freeswitch/scripts/MakeEventAPI.lua DROPPED_PARKED_CALL_EVENT hello +OK 2022-03-14 18:14:13.451348 [INFO] mod_amqp_producer.c:87 inside event handler RECV EVENT Event-Subclass: DROPPED_PARKED_CALL_EVENT Event-Name: CUSTOM Core-UUID: 7e005200-153f-47f5-9a50-ff8011cb847c FreeSWITCH-Hostname: ccs-fsconf1-57b5d6496f-dmm5x FreeSWITCH-Switchname: ccs-fsconf1 FreeSWITCH-IPv4: 10.1.2.24 FreeSWITCH-IPv6: ::1 Event-Date-Local: 2022-03-14 18:14:13 Event-Date-GMT: Mon, 14 Mar 2022 18:14:13 GMT Event-Date-Timestamp: 1647281653451348 Event-Calling-File: switch_cpp.cpp Event-Calling-Function: Event Event-Calling-Line-Number: 314 Event-Sequence: 13552 Event-Data: hello 2022-03-14 18:14:13.451348 [INFO] mod_amqp_producer.c:109 inside event handler 2022-03-14 18:14:13.451348 [INFO] mod_amqp_producer.c:111 inside event handler 2022-03-14 18:14:13.451348 [INFO] mod_amqp_producer.c:125 inside event handler 2022-03-14 18:14:13.451348 [INFO] mod_amqp_producer.c:523 Got Message 2022-03-14 18:14:13.451348 [INFO] mod_amqp_producer.c:408 in send function for Profile :: [dropped_park_call_event] 2022-03-14 18:14:13.451348 [INFO] mod_amqp_producer.c:438 in send function , calling publish 2022-03-14 18:14:13.451348 [INFO] mod_amqp_producer.c:448 in send function , status is :: -7 2022-03-14 18:14:13.451348 [CRIT] mod_amqp_producer.c:452 Profile[dropped_park_call_event] failed to send event on connection[primary]: (unknown error) 2022-03-14 18:14:13.451348 [CRIT] mod_amqp_utils.c:52 Closing channel: a socket error occurred 2022-03-14 18:14:13.451348 [CRIT] mod_amqp_utils.c:52 Closing connection: a socket error occurred 2022-03-14 18:14:13.451348 [ERR] mod_amqp_producer.c:536 Send failed with 'socket error' 2022-03-14 18:14:13.451348 [ERR] mod_amqp_producer.c:540 Send failed with 'socket error' 2022-03-14 18:14:13.451348 [ERR] mod_amqp_producer.c:541 message {"Event-Subclass":"DROPPED_PARKED_CALL_EVENT","Event-Name":"CUSTOM","Core-UUID":"7e005200-153f-47f5-9a50-ff8011cb847c","FreeSWITCH-Hostname":"ccs-fsconf1-57b5d6496f-dmm5x","FreeSWITCH-Switchname":"ccs-fsconf1","FreeSWITCH-IPv4":"10.1.2.24","FreeSWITCH-IPv6":"::1","Event-Date-Local":"2022-03-14 18:14:13","Event-Date-GMT":"Mon, 14 Mar 2022 18:14:13 GMT","Event-Date-Timestamp":"1647281653451348","Event-Calling-File":"switch_cpp.cpp","Event-Calling-Function":"Event","Event-Calling-Line-Number":"314","Event-Sequence":"13552","Event-Data":"hello"} 2022-03-14 18:14:13.451348 [WARNING] mod_amqp_producer.c:477 Amqp no connection- reconnecting... 2022-03-14 18:14:13.451348 [DEBUG] mod_amqp_connection.c:119 Profile[dropped_park_call_event] trying to connect to AMQP broker ccs-rabbitmq1.default.svc.cluster.local:5672 2022-03-14 18:14:13.451348 [DEBUG] mod_amqp_connection.c:138 Profile[dropped_park_call_event] opened socket connection to AMQP broker ccs-rabbitmq1.default.svc.cluster.local:5672 2022-03-14 18:14:13.451348 [INFO] mod_amqp_producer.c:502 Amqp reconnect successful- connected 2022-03-14 18:14:13.451348 [INFO] mod_amqp_producer.c:523 Got Message 2022-03-14 18:14:13.451348 [INFO] mod_amqp_producer.c:408 in send function for Profile :: [dropped_park_call_event] 2022-03-14 18:14:13.451348 [INFO] mod_amqp_producer.c:438 in send function , calling publish 2022-03-14 18:14:13.451348 [INFO] mod_amqp_producer.c:448 in send function , status is :: 0 2022-03-14 18:14:13.451348 [WARNING] mod_amqp_producer.c:527 Send success

Rabbitmq versions I am using ::
dpkg -l | grep -i rabbit ii librabbitmq-dev:amd64 0.9.0-0.2 amd64 AMQP client library written in C - Dev Files ii librabbitmq4:amd64 0.9.0-0.2 amd64 AMQP client library written in C

Paramters I am passing in amqp_basic_publish::

status = amqp_basic_publish(  
                                                                                                                                                                                                    profile->conn_active->state,      
                                                                                                                                                                    1,                                                                                                                                                                                                        amqp_cstring_bytes(profile->exchange),      
                                                                                                                                                          amqp_cstring_bytes(msg->routing_key),              
                                                                                                                                                   0,                                                                                                                                                                                                        0,    
                                                                                                                                                                                                &props,
                                                                                                                                                                                               amqp_cstring_bytes(msg->pjson));
@dmitryuk
Copy link

The same issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants