<div dir="ltr">Hi All<br><br>We are trying to use the async module to to delay sending a bye on from one end of the call to the other.<br><br>We are using async_route(routename, seconds) to delay the WITHINDLG route. The idea is that in the future we want to be able to have our billing min duration enforced (though currently we are having issues with the dialog module that we are discussing in another thread).<div><br></div><div>After running this on our deploy servers, the delays before sending on the byes get longer and longer, and then kamailio goes down. Then the receive udp buffer fills up.<br><br>We tried it with both 4 and 400 async workers, and it made no difference.</div><div><br></div><div>I am including a screen capture of the servers stats when this happens taken from voip monitor.</div><div><br></div><div>Here are the relevant parts of the config:</div><div><br></div><div>...</div><div>loadmodule "async.so"<br></div><div>...</div><div>modparam("async", "workers", ASYNC_THREADS)<br></div><div>...</div><div>request_route {<br>...</div><div>route(DELAYED_BYE_STATIC);<br></div><div>...</div><div><div>route[DELAYED_BYE_STATIC] {</div><div><span class="" style="white-space:pre">  </span>xlog("L_DEBUG","route DELAYED_BYE_STATIC");</div><div><span class="" style="white-space:pre">    </span>#!ifdef WITH_DELAYED_BYE_STATIC</div><div><span class="" style="white-space:pre">            </span>if (is_method("BYE")) {</div><div><span class="" style="white-space:pre">                  </span>xlog("L_DEBUG","route DELAYED_BYE_STATIC, from self \n");</div><div><span class="" style="white-space:pre">                      </span>#if (from_uri == myself) {</div><div><span class="" style="white-space:pre">                 </span>if ((allow_trusted() || allow_source_address()) && from_uri == myself) {</div><div><span class="" style="white-space:pre">                           </span>xlog("L_DEBUG","route DELAYED_BYE_STATIC, Bye detected, from self \n");</div><div><span class="" style="white-space:pre">                                </span>send_reply("200", "OK");</div><div><span class="" style="white-space:pre">                               </span>xlog("L_DEBUG","route DELAYED_BYE_STATIC, sent 200 about to sleep \n");</div><div><span class="" style="white-space:pre">                                </span>setflag(FLT_ACC); # do accounting ...</div><div><span class="" style="white-space:pre">                              </span>setflag(FLT_ACCFAILED); # ... even if the transaction fails</div><div><span class="" style="white-space:pre">                                </span>if (has_totag()) {</div><div><span class="" style="white-space:pre">                                 </span>xlog("L_DEBUG","route DELAYED_BYE_STATIC, sleeping to WITHINDLG_DELAYED \n");</div><div><span class="" style="white-space:pre">                                  </span>async_route("WITHINDLG_DELAYED", MIN_DURATION);</div><div><span class="" style="white-space:pre">                          </span>} else {</div><div><span class="" style="white-space:pre">                                   </span>xlog("L_DEBUG","route DELAYED_BYE_STATIC, sleeping to WITHINDLG \n");</div><div><span class="" style="white-space:pre">                                  </span>async_route("WITHINDLG", MIN_DURATION);</div><div><span class="" style="white-space:pre">                          </span>}</div><div><span class="" style="white-space:pre">                          </span>xlog("L_DEBUG","route DELAYED_BYE_STATIC, slept\n");</div><div><span class="" style="white-space:pre">                           </span>exit;</div><div><span class="" style="white-space:pre">                      </span>}</div><div><span class="" style="white-space:pre">          </span>}</div><div><span class="" style="white-space:pre">  </span>#!endif</div><div><span class="" style="white-space:pre">    </span>return;</div><div>}</div></div><div>...</div><div><div>route[WITHINDLG_DELAYED] {</div><div><span class="" style="white-space:pre">  </span>xlog("L_DEBUG", "route WITHINDLG_DELAYED: triggered \n");</div><div><span class="" style="white-space:pre">      </span>$avp(was_delayed) = 1;</div><div><span class="" style="white-space:pre">     </span>route(WITHINDLG);</div><div>}</div></div><div>...</div><div><div>route[WITHINDLG] {</div><div><span class="" style="white-space:pre">        </span>xlog("L_DEBUG", "route WITHINDLG: will -- DLG triggered, request method: $rm \n");</div><div><span class="" style="white-space:pre">     </span>#!ifdef WITH_DISPATCHER</div><div><span class="" style="white-space:pre">            </span>if(is_method("BYE|CANCEL")) {</div><div><span class="" style="white-space:pre">                    </span>xlog("L_DEBUG","route WITHINDLG:  cancel or bye detected, request method: $rm \n");</div><div><span class="" style="white-space:pre">                   </span>#!ifdef WITH_DISPATCHER_LOAD_AWARE</div><div><span class="" style="white-space:pre">                         </span>xlog("L_DEBUG","route WITHINDLG: running ds_load_update, request method: $rm \n");</div><div><span class="" style="white-space:pre">                             </span>ds_load_update();</div><div><span class="" style="white-space:pre">                          </span>#dlg_get ("$ci","$ft","$tt"); </div><div><span class="" style="white-space:pre">      </span>                <span class="" style="white-space:pre">  </span>#dlg_bye ("all");</div><div>        <span class="" style="white-space:pre">    </span>#!endif</div><div><span class="" style="white-space:pre">            </span>}</div><div><span class="" style="white-space:pre">  </span>#!endif</div><div><br></div><div><span class="" style="white-space:pre">   </span>if (has_totag() || $avp(was_delayed) == 1) {</div><div><span class="" style="white-space:pre">               </span>xlog("L_DEBUG", "route WITHINDLG: will -- DLG has totag or was_delayed: $avp(was_delayed)  \n");</div><div><span class="" style="white-space:pre">              </span># sequential request withing a dialog should</div><div><span class="" style="white-space:pre">               </span># take the path determined by record-routing</div><div><span class="" style="white-space:pre">               </span>if (loose_route()) {</div><div><span class="" style="white-space:pre">                       </span>xlog("L_DEBUG", "route WITHINDLG: will -- DLG has loose route \n");</div><div><span class="" style="white-space:pre">                    </span>route(DLGURI);</div><div><span class="" style="white-space:pre">                     </span>if (is_method("BYE")) {</div><div><span class="" style="white-space:pre">                          </span>xlog("L_DEBUG","route WITHINDLG: BYE detected");</div><div><span class="" style="white-space:pre">                               </span>setflag(FLT_ACC); # do accounting ...</div><div><span class="" style="white-space:pre">                              </span>setflag(FLT_ACCFAILED); # ... even if the transaction fails</div><div><span class="" style="white-space:pre">                                </span>xlog("L_DEBUG","route WITHINDLG: ACC flag set");</div><div><span class="" style="white-space:pre">                       </span></div><div><span class="" style="white-space:pre">                   </span>}</div><div><span class="" style="white-space:pre">                  </span>else if ( is_method("ACK") ) {</div><div><span class="" style="white-space:pre">                           </span># ACK is forwarded statelessy</div><div><span class="" style="white-space:pre">                              </span>route(NATMANAGE);</div><div><span class="" style="white-space:pre">                  </span>}</div><div><span class="" style="white-space:pre">                  </span>else if ( is_method("NOTIFY") ) {</div><div><span class="" style="white-space:pre">                                </span># Add Record-Route for in-dialog NOTIFY as per RFC 6665.</div><div><span class="" style="white-space:pre">                           </span>record_route();</div><div><span class="" style="white-space:pre">                    </span>}</div><div><span class="" style="white-space:pre">                  </span>xlog("L_DEBUG", "route WITHINDLG: will -- DLG RELAY 1\n");</div><div><span class="" style="white-space:pre">                     </span>route(RELAY);</div><div><span class="" style="white-space:pre">              </span>} else {</div><div><span class="" style="white-space:pre">                   </span>xlog("L_DEBUG", "route WITHINDLG: will -- DLG else \n");</div><div><span class="" style="white-space:pre">                       </span>if (is_method("SUBSCRIBE") && uri == myself) {</div><div><span class="" style="white-space:pre">                           </span># in-dialog subscribe requests</div><div><span class="" style="white-space:pre">                             </span>route(PRESENCE);</div><div><span class="" style="white-space:pre">                           </span>exit;</div><div><span class="" style="white-space:pre">                      </span>}</div><div><span class="" style="white-space:pre">                  </span>if ( is_method("ACK") ) {</div><div><span class="" style="white-space:pre">                                </span>xlog("L_DEBUG", "route WITHINDLG: will -- DLG is ack \n");</div><div><span class="" style="white-space:pre">                             </span>if ( t_check_trans() ) {</div><div><span class="" style="white-space:pre">                                   </span>xlog("L_DEBUG", "route WITHINDLG: will -- DLG t_check_trans \n");</div><div><span class="" style="white-space:pre">                                      </span># no loose-route, but stateful ACK;</div><div><span class="" style="white-space:pre">                                        </span># must be an ACK after a 487</div><div><span class="" style="white-space:pre">                                       </span># or e.g. 404 from upstream server</div><div><span class="" style="white-space:pre">                                 </span>xlog("L_DEBUG", "route WITHINDLG: will -- DLG RELAY 2\n");</div><div><span class="" style="white-space:pre">                                     </span>route(RELAY);</div><div><span class="" style="white-space:pre">                                      </span>exit;</div><div><span class="" style="white-space:pre">                              </span>} else {</div><div><span class="" style="white-space:pre">                                   </span># ACK without matching transaction ... ignore and discard</div><div><span class="" style="white-space:pre">                                  </span>exit;</div><div><span class="" style="white-space:pre">                              </span>}</div><div><span class="" style="white-space:pre">                  </span>}</div><div><span class="" style="white-space:pre">                  </span>sl_send_reply("404","Not here");</div><div><span class="" style="white-space:pre">               </span>}</div><div><span class="" style="white-space:pre">          </span>exit;</div><div><span class="" style="white-space:pre">      </span>}</div><div>}</div></div><div>...</div><div><br></div><div><br></div><div><br></div><div>Does any one know if this is a bug or a leak with in the async module, or perhaps something I am doing in my config?</div><div><br></div><div>Thanks in advance for an assistance you can offer me.</div><div><br></div><div>All the best.</div><div><br></div><div>Will Ferrer</div><div>Switchsoft</div><div><br></div><div><br></div></div>