dmq: test of if reply code and reason are set to send the response
authorDaniel-Constantin Mierla <miconda@gmail.com>
Fri, 24 Apr 2020 19:14:24 +0000 (21:14 +0200)
committerDaniel-Constantin Mierla <miconda@gmail.com>
Fri, 24 Apr 2020 19:14:24 +0000 (21:14 +0200)
src/modules/dmq/worker.c

index 38b49e4..a2ccc63 100644 (file)
@@ -126,12 +126,17 @@ void worker_loop(int id)
                                        }
                                }
                                /* send the reply */
-                               if(slb.freply(current_job->msg, peer_response.resp_code,
-                                                  &peer_response.reason)
-                                               < 0) {
-                                       LM_ERR("error sending reply\n");
+                               if(peer_response.resp_code>0 && peer_response.reason.s!=NULL
+                                               && peer_response.reason.len>0) {
+                                       if(slb.freply(current_job->msg, peer_response.resp_code,
+                                                          &peer_response.reason)
+                                                       < 0) {
+                                               LM_ERR("error sending reply\n");
+                                       } else {
+                                               LM_DBG("done sending reply\n");
+                                       }
                                } else {
-                                       LM_DBG("done sending reply\n");
+                                       LM_WARN("no reply sent\n");
                                }
                                worker->jobs_processed++;