Thanks, did cookie did the trick for me ;)<br>Now it working fine.<br><br><div class="gmail_quote">On Fri, Jun 8, 2012 at 10:02 PM, Bogdan-Andrei Iancu <span dir="ltr">&lt;<a href="mailto:bogdan@opensips.org" target="_blank">bogdan@opensips.org</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><u></u>

  
    
  
  <div bgcolor="#ffffff" text="#000000">
    <tt>Hi Dinusha,<br>
      <br>
      Most probably OpenSIPS does not &quot;see&quot; the BYE - this may happen
      because:<br>
          - BYE is not reaching opensips<br>
          - BYE does not have in RR header the &quot;did&quot; cookie <br>
      <br>
      Try to run opensips in full debug (set debug=6) and post the log
      related to the BYE processing, to see what is going on there.<br>
      <br>
      Regards,</tt><br>
    <pre cols="72">Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
<a href="http://www.opensips-solutions.com" target="_blank">http://www.opensips-solutions.com</a></pre><div><div class="h5">
    <br>
    On 06/07/2012 11:04 AM, Dinusha Kannangara wrote:
    </div></div><blockquote type="cite"><div><div class="h5">Hi,
      <br>
      <br>
      I&#39;m new to opensips, and I&#39;m having trouble with dialogs created
      from the load_balancing module not being removed upon receiving
      the BYE when the call is terminated.
      <br>
      I&#39;m using opensips version 1.7.2 and have followed this example as
      well (<a href="http://www.opensips.org/Resources/DocsTutLoadbalancing" rel="nofollow" target="_blank">http://www.opensips.org/Resources/DocsTutLoadbalancing</a><br>
      ).
      <br>
      <br>
      Currently I&#39;m testing it on two sip phones which are registered on
      the opensips SIP Router (at times I&#39;m using one sip phone as both
      the caller and callee, rewriting the destination uri
      (automatically done through the load_balance() method) as my IP to
      route the call back to the same sip phone). Either way the dialog
      is not destroyed on bye and Wireshark output shows that I&#39;m
      receiving the 200 OK to both sides and the call gets cut without
      any problem.
      <br>
      <br>
      So, am I missing something on the config file ? Here&#39;s my config
      file....<br>
      <br>
      <u>opensips.cfg</u><br>
      <br>
      ####### Global Parameters #########
      <br>
      <br>
      debug=6
      <br>
      log_stderror=yes
      <br>
      log_facility=LOG_LOCAL0
      <br>
      <br>
      fork=yes
      <br>
      children=4
      <br>
      <br>
      /* uncomment the following lines to enable debugging */
      <br>
      <br>
      /* uncomment the next line to disable TCP (default on) */
      <br>
      #disable_tcp=yes
      <br>
      <br>
      /* uncomment the next line to enable the auto temporary
      blacklisting of
      <br>
         not available destinations (default disabled) */
      <br>
      #disable_dns_blacklist=no
      <br>
      <br>
      /* uncomment the next line to enable IPv6 lookup after IPv4 dns
      <br>
         lookup failures (default disabled) */
      <br>
      #dns_try_ipv6=yes
      <br>
      <br>
      /* uncomment the next line to disable the auto discovery of local
      aliases
      <br>
         based on revers DNS on IPs (default on) */
      <br>
      #auto_aliases=no
      <br>
      /* uncomment the following lines to enable TLS support  (default
      off) */
      <br>
      #disable_tls = no
      <br>
      #listen = tls:your_IP:5061
      <br>
      #tls_verify_server = 1
      <br>
      #tls_verify_client = 1
      <br>
      #tls_require_client_certificate = 0
      <br>
      #tls_method = TLSv1
      <br>
      #tls_certificate = &quot;//etc/opensips/tls/user/user-cert.pem&quot;
      <br>
      #tls_private_key = &quot;//etc/opensips/tls/user/user-privkey.pem&quot;
      <br>
      #tls_ca_list = &quot;//etc/opensips/tls/user/user-calist.pem&quot;
      <br>
      <br>
      /* default db_url to be used by modules requiring DB connection;
      <br>
         uncomment it if you use any module requiring DB connectivity */
      <br>
      #db_default_url=&quot;mysql://opensips:opensipsrw@localhost/opensips&quot;
      <br>
      <br>
      <br>
      port=5060
      <br>
      <br>
      /* uncomment and configure the following line if you want opensips
      to
      <br>
         bind on a specific interface/port/proto (default bind on all
      available) */
      <br>
      #listen=udp:<a href="http://192.168.1.2:5060" target="_blank">192.168.1.2:5060</a>
      <br>
       
      <br>
      <br>
      <br>
      <br>
      ####### Modules Section ########
      <br>
      <br>
      #set module path
      <br>
      mpath=&quot;//lib64/opensips/modules/&quot;
      <br>
      <br>
      /* uncomment next line for MySQL DB support */
      <br>
      loadmodule &quot;db_mysql.so&quot;
      <br>
      loadmodule &quot;signaling.so&quot;
      <br>
      loadmodule &quot;sl.so&quot;
      <br>
      loadmodule &quot;tm.so&quot;
      <br>
      loadmodule &quot;rr.so&quot;
      <br>
      loadmodule &quot;maxfwd.so&quot;
      <br>
      loadmodule &quot;usrloc.so&quot;
      <br>
      loadmodule &quot;registrar.so&quot;
      <br>
      loadmodule &quot;textops.so&quot;
      <br>
      loadmodule &quot;mi_fifo.so&quot;
      <br>
      loadmodule &quot;uri.so&quot;
      <br>
      loadmodule &quot;acc.so&quot;
      <br>
      loadmodule &quot;avpops.so&quot;
      <br>
      loadmodule &quot;dialog.so&quot;
      <br>
      loadmodule &quot;load_balancer.so&quot;
      <br>
      /* uncomment next lines for MySQL based authentication support
      <br>
         NOTE: a DB (like db_mysql) module must be also loaded */
      <br>
      loadmodule &quot;auth.so&quot;
      <br>
      loadmodule &quot;auth_db.so&quot;
      <br>
      /* uncomment next line for aliases support
      <br>
         NOTE: a DB (like db_mysql) module must be also loaded */
      <br>
      #loadmodule &quot;alias_db.so&quot;
      <br>
      /* uncomment next line for multi-domain support
      <br>
         NOTE: a DB (like db_mysql) module must be also loaded
      <br>
         NOTE: be sure and enable multi-domain support in all used
      modules
      <br>
               (see &quot;multi-module params&quot; section ) */
      <br>
      #loadmodule &quot;domain.so&quot;
      <br>
      /* uncomment the next two lines for presence server support
      <br>
         NOTE: a DB (like db_mysql) module must be also loaded */
      <br>
      #loadmodule &quot;presence.so&quot;
      <br>
      #loadmodule &quot;presence_xml.so&quot;
      <br>
      <br>
      <br>
      # ----------------- setting module-specific parameters
      ---------------
      <br>
      <br>
      <br>
      # ----- mi_fifo params -----
      <br>
      modparam(&quot;mi_fifo&quot;, &quot;fifo_name&quot;, &quot;/tmp/opensips_fifo&quot;)
      <br>
      <br>
      <br>
      # ----- rr params -----
      <br>
      # do not append from tag to the RR (no need for this script)
      <br>
      modparam(&quot;rr&quot;, &quot;append_fromtag&quot;, 0)
      <br>
      <br>
      <br>
      # ----- registrar params -----
      <br>
      /* uncomment the next line not to allow more than 10 contacts per
      AOR */
      <br>
      #modparam(&quot;registrar&quot;, &quot;max_contacts&quot;, 10)
      <br>
      # ----- usrloc params -----
      <br>
      modparam(&quot;usrloc&quot;, &quot;db_mode&quot;,   0)
      <br>
      /* uncomment the following lines if you want to enable DB
      persistency
      <br>
         for location entries */
      <br>
      #modparam(&quot;usrloc&quot;, &quot;db_mode&quot;,   2)
      <br>
      #modparam(&quot;usrloc&quot;, &quot;db_url&quot;,
      <br>
      #       &quot;mysql://opensips:opensipsrw@localhost/opensips&quot;)
      <br>
      <br>
      <br>
      # ----- uri params -----
      <br>
      modparam(&quot;uri&quot;, &quot;use_uri_table&quot;, 0)
      <br>
      <br>
      <br>
      # ----- acc params -----
      <br>
      /* what sepcial events should be accounted ? */
      <br>
      modparam(&quot;acc&quot;, &quot;early_media&quot;, 1)
      <br>
      modparam(&quot;acc&quot;, &quot;report_cancels&quot;, 1)
      <br>
      /* by default ww do not adjust the direct of the sequential
      requests.
      <br>
         if you enable this parameter, be sure the enable
      &quot;append_fromtag&quot;
      <br>
         in &quot;rr&quot; module */
      <br>
      modparam(&quot;acc&quot;, &quot;detect_direction&quot;, 0)
      <br>
      /* account triggers (flags) */
      <br>
      modparam(&quot;acc&quot;, &quot;failed_transaction_flag&quot;, 3)
      <br>
      modparam(&quot;acc&quot;, &quot;log_flag&quot;, 1)
      <br>
      modparam(&quot;acc&quot;, &quot;log_missed_flag&quot;, 2)
      <br>
      /* uncomment the following lines to enable DB accounting also */
      <br>
      modparam(&quot;acc&quot;, &quot;db_flag&quot;, 1)
      <br>
      modparam(&quot;acc&quot;, &quot;db_missed_flag&quot;, 2)
      <br>
      <br>
      #--------load_balance-------#
      <br>
      modparam(&quot;load_balancer&quot;,
      &quot;db_url&quot;,&quot;mysql://root:123@localhost/opensips&quot;)
      <br>
      <br>
      #---------Dialog-----------#
      <br>
      #modparam(&quot;dialog&quot;, &quot;dlg_flag&quot;, 13)
      <br>
      <br>
      <br>
      # ----- auth_db params -----
      <br>
      /* uncomment the following lines if you want to enable the DB
      based
      <br>
         authentication */
      <br>
      #modparam(&quot;auth_db&quot;, &quot;calculate_ha1&quot;, yes)
      <br>
      #modparam(&quot;auth_db&quot;, &quot;password_column&quot;, &quot;password&quot;)
      <br>
      modparam(&quot;auth_db&quot;, &quot;db_url&quot;,
      &quot;mysql://root:123@localhost/opensips&quot;)
      <br>
      #modparam(&quot;auth_db&quot;, &quot;load_credentials&quot;, &quot;&quot;)
      <br>
      <br>
      <br>
      # ----- alias_db params -----
      <br>
      /* uncomment the following lines if you want to enable the DB
      based
      <br>
         aliases */
      <br>
      #modparam(&quot;alias_db&quot;, &quot;db_url&quot;,
      <br>
      #       &quot;mysql://opensips:opensipsrw@localhost/opensips&quot;)
      <br>
      <br>
      <br>
      # ----- domain params -----
      <br>
      /* uncomment the following lines to enable multi-domain detection
      <br>
         support */
      <br>
      #modparam(&quot;domain&quot;, &quot;db_url&quot;,
      <br>
      #       &quot;mysql://opensips:opensipsrw@localhost/opensips&quot;)
      <br>
      #modparam(&quot;domain&quot;, &quot;db_mode&quot;, 1)   # Use caching
      <br>
      <br>
      <br>
      # ----- multi-module params -----
      <br>
      /* uncomment the following line if you want to enable multi-domain
      support
      <br>
         in the modules (dafault off) */
      <br>
      #modparam(&quot;auth_db|usrloc|uri&quot;, &quot;use_domain&quot;, 1)
      <br>
      <br>
      <br>
      # ----- presence params -----
      <br>
      /* uncomment the following lines if you want to enable presence */
      <br>
      #modparam(&quot;presence|presence_xml&quot;, &quot;db_url&quot;,
      <br>
      #       &quot;mysql://opensips:opensipsrw@localhost/opensips&quot;)
      <br>
      #modparam(&quot;presence_xml&quot;, &quot;force_active&quot;, 1)
      <br>
      #modparam(&quot;presence&quot;, &quot;server_address&quot;, &quot;sip:<a href="http://192.168.1.2:5060" target="_blank">192.168.1.2:5060</a>
      <br>
       
      <br>
      &quot;)
      <br>
      <br>
      <br>
      ####### Routing Logic ########
      <br>
      <br>
      <br>
      # main request routing logic
      <br>
      route{
      <br>
      <br>
             
      log(&quot;\n\n\n----------------------------------------\n\n\n&quot;);
      <br>
      <br>
              if (!mf_process_maxfwd_header(&quot;10&quot;)) {
      <br>
                      sl_send_reply(&quot;483&quot;,&quot;Too Many Hops&quot;);
      <br>
                      exit;
      <br>
              }
      <br>
      <br>
              if (has_totag()) {
      <br>
                      # sequential request withing a dialog should
      <br>
                      # take the path determined by record-routing
      <br>
                      if (loose_route()) {
      <br>
                              if (is_method(&quot;BYE&quot;)) {
      <br>
                                      setflag(1); # do accounting ...
      <br>
                                      setflag(3); # ... even if the
      transaction fails
      <br>
                              } else if (is_method(&quot;INVITE&quot;)) {
      <br>
                                      # even if in most of the cases is
      useless, do RR for
      <br>
                                      # re-INVITEs alos, as some buggy
      clients do change route set
      <br>
                                      # during the dialog.
      <br>
                                      record_route();
      <br>
                              }
      <br>
                              # route it out to whatever destination was
      set by loose_route()
      <br>
                              # in $du (destination URI).
      <br>
                              route(1);
      <br>
                      } else {
      <br>
                              /* uncomment the following lines if you
      want to enable presence */
      <br>
                              ##if (is_method(&quot;SUBSCRIBE&quot;) &amp;&amp;
      $rd == &quot;your.server.ip.address&quot;) {
      <br>
                              ##      # in-dialog subscribe requests
      <br>
                              ##      route(2);
      <br>
                              ##      exit;
      <br>
                              ##}
      <br>
                              if ( is_method(&quot;ACK&quot;) ) {
      <br>
                                      if ( t_check_trans() ) {
      <br>
                                              # non loose-route, but
      stateful ACK; must be an ACK after
      <br>
                                              # a 487 or e.g. 404 from
      upstream server
      <br>
                                              t_relay();
      <br>
                                              exit;
      <br>
                                      } else {
      <br>
                                              # ACK without matching
      transaction -&gt;
      <br>
                                              # ignore and discard
      <br>
                                              exit;
      <br>
                                      }
      <br>
                              }
      <br>
                              sl_send_reply(&quot;404&quot;,&quot;Not here&quot;);
      <br>
                      }
      <br>
                      exit;
      <br>
              }
      <br>
      <br>
              #initial requests
      <br>
      <br>
              # CANCEL processing
      <br>
              if (is_method(&quot;CANCEL&quot;))
      <br>
              {
      <br>
                      if (t_check_trans())
      <br>
                              t_relay();
      <br>
                      exit;
      <br>
              }
      <br>
      <br>
              t_check_trans();
      <br>
      <br>
              # preloaded route checking
      <br>
              if (loose_route()) {
      <br>
                      xlog(&quot;L_ERR&quot;,
      <br>
                      &quot;Attempt to route with preloaded Route&#39;s
      [$fu/$tu/$ru/$ci]&quot;);
      <br>
                      if (!is_method(&quot;ACK&quot;))
      <br>
                              sl_send_reply(&quot;403&quot;,&quot;Preload Route
      denied&quot;);
      <br>
                      exit;
      <br>
              }
      <br>
      <br>
              # record routing
      <br>
              if (!is_method(&quot;REGISTER|MESSAGE&quot;))
      <br>
                      record_route();
      <br>
      <br>
              # account only INVITEs
      <br>
              if (is_method(&quot;INVITE&quot;))
      <br>
              {
      <br>
                      append_hf(&quot;P-hint: outbound\r\n&quot;);
      <br>
      <br>
                      log(&quot;\n\n\n----------INVITE----------\n\n\n&quot;);
      <br>
                      load_balance(&quot;1&quot;,&quot;A&quot;);
      <br>
                      if ($retcode&lt;0)
      <br>
                      {
      <br>
                              sl_send_reply(&quot;500&quot;,&quot;Service full&quot;);
      <br>
                              exit;
      <br>
                      }
      <br>
                      record_route();
      <br>
                      route(1);
      <br>
              }
      <br>
      <br>
             <br>
      <br>
      <br>
              if (is_method(&quot;PUBLISH&quot;))
      <br>
              {
      <br>
                      sl_send_reply(&quot;503&quot;, &quot;Service Unavailable&quot;);
      <br>
                      exit;
      <br>
              }
      <br>
      <br>
      <br>
              if (is_method(&quot;REGISTER&quot;))
      <br>
              {
      <br>
                     
      log(&quot;\n\n\n----------------Register-----------------\n\n\n&quot;);
      <br>
                      <br>
                      if (!save(&quot;location&quot;))
      <br>
                              sl_reply_error();
      <br>
      <br>
                      exit;
      <br>
              }
      <br>
      <br>
              if ($rU==NULL) {
      <br>
                      # request with no Username in RURI
      <br>
                      sl_send_reply(&quot;484&quot;,&quot;Address Incomplete&quot;);
      <br>
                      exit;
      <br>
              }
      <br>
      <br>
              # apply DB based aliases (uncomment to enable)
      <br>
              ##alias_db_lookup(&quot;dbaliases&quot;);
      <br>
      <br>
              # do lookup with method filtering
      <br>
              if (!lookup(&quot;location&quot;,&quot;m&quot;)) {
      <br>
                      switch ($retcode) {
      <br>
                              case -1:
      <br>
                              case -3:
      <br>
                                      t_newtran();
      <br>
                                      t_reply(&quot;404&quot;, &quot;Not Found&quot;);
      <br>
                                      exit;
      <br>
                              case -2:
      <br>
                                      sl_send_reply(&quot;405&quot;, &quot;Method Not
      Allowed&quot;);
      <br>
                                      exit;
      <br>
                      }
      <br>
              }
      <br>
      <br>
              # when routing via usrloc, log the missed calls also
      <br>
              setflag(2);
      <br>
      <br>
              route(1);
      <br>
      }
      <br>
      <br>
      <br>
      route[1] {
      <br>
              # for INVITEs enable some additional helper routes
      <br>
              if (is_method(&quot;INVITE&quot;)) {
      <br>
                      t_on_branch(&quot;2&quot;);
      <br>
                      t_on_reply(&quot;2&quot;);
      <br>
                      t_on_failure(&quot;1&quot;);
      <br>
              }
      <br>
      <br>
              if (!t_relay()) {
      <br>
                      sl_reply_error();
      <br>
              };
      <br>
              exit;
      <br>
      }
      <br>
      branch_route[2] {
      <br>
              xlog(&quot;new branch at $ru\n&quot;);
      <br>
      }
      <br>
      <br>
      <br>
      onreply_route[2] {
      <br>
              xlog(&quot;incoming reply\n&quot;);
      <br>
      }
      <br>
      <br>
      <br>
      failure_route[1] {
      <br>
              if (t_was_cancelled()) {
      <br>
                      exit;
      <br>
              } 
      <br>
      }<br>
      <br>
      ---------------<br>
      <br>
      I could give you the opensips debug output as well but due to the
      message being too large I have excluded it... if need it please
      let me know and I will reply with it :)<br>
      </div></div><pre><fieldset></fieldset>
_______________________________________________
Users mailing list
<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
    </blockquote>
  </div>

</blockquote></div><br>