Copyright (C) IBM Corp. 2006
Author(s): Charles P. Wright <cpwright@us.ibm.com>

/*
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 *  Author : Richard GAYRAUD - 04 Nov 2003
 *           Marc LAMBERTON
 *           Olivier JACQUES
 *           Herve PELLAN
 *           David MANSUTTI
 *           Francois-Xavier Kowalski
 *           Gerard Lyonnaz
 *           From Hewlett Packard Company.
 *           F. Tarek Rogers
 *           Peter Higginson
 *           Vincent Luba
 *           Shriram Natarajan
 *           Guillaume Teissier from FTR&D
 *           Clement Chen
 *           Wolfgang Beck
 */
Index: sipp.2006-11-24/call.cpp
===================================================================
--- sipp.2006-11-24.orig/call.cpp
+++ sipp.2006-11-24/call.cpp
@@ -1375,7 +1375,7 @@ bool call::run()
       bInviteTransaction = true;
     }
 
-    if((nb_retrans > (bInviteTransaction ? UDP_MAX_RETRANS_INVITE_TRANSACTION : UDP_MAX_RETRANS_NON_INVITE_TRANSACTION)) || 
+    if((nb_retrans > (bInviteTransaction ? max_invite_retrans : max_non_invite_retrans)) ||
        (nb_retrans > max_udp_retrans)) {
       scenario[last_send_index] -> nb_timeout ++;
       if (scenario[last_send_index]->on_timeout) {  // action on timeout
Index: sipp.2006-11-24/sipp.cpp
===================================================================
--- sipp.2006-11-24.orig/sipp.cpp
+++ sipp.2006-11-24/sipp.cpp
@@ -3111,6 +3111,10 @@ void help() 
      "                      ends on timeout.\n"
      "                      Default is 5 for INVITE transactions and 7 for\n"
      "                      others.\n"
+     "   -max_invite_retrans : Maximum number of UDP retransmissions for invite\n"
+     "                      transactions before call ends on timeout.\n"
+     "   -max_non_invite_retrans : Maximum number of UDP retransmissions for\n"
+     "                      non-invite transactions before call ends on timeout.\n"
      "\n"
      "   -recv_timeout nb : Global receive timeout in milliseconds.\n"
      "                      If the expected message is not received, the call\n"
@@ -3604,6 +3608,30 @@ int main(int argc, char *argv[])
       }
     }
 
+    if(!strcmp(argv[argi], "-max_invite_retrans")) {
+      if((++argi) < argc) {
+        processed = 1;
+        if (atoi(argv[argi]) > 0) {
+          max_invite_retrans = atoi(argv[argi]);
+        }
+      } else {
+        ERROR_P1("Missing argument for param '%s'.\n"
+                 "Use 'sipp -h' for details",  argv[argi-1]);
+      }
+    }
+
+    if(!strcmp(argv[argi], "-max_non_invite_retrans")) {
+      if((++argi) < argc) {
+        processed = 1;
+        if (atoi(argv[argi]) > 0) {
+          max_non_invite_retrans = atoi(argv[argi]);
+        }
+      } else {
+        ERROR_P1("Missing argument for param '%s'.\n"
+                 "Use 'sipp -h' for details",  argv[argi-1]);
+      }
+    }
+
     if(!strcmp(argv[argi], "-nd")) {
       processed = 1;
       default_behavior = 0;
Index: sipp.2006-11-24/sipp.hpp
===================================================================
--- sipp.2006-11-24.orig/sipp.hpp
+++ sipp.2006-11-24/sipp.hpp
@@ -157,6 +157,8 @@ extern unsigned long      global_timeout
 extern int                transport               _DEFVAL(DEFAULT_TRANSPORT);
 extern int                retrans_enabled         _DEFVAL(1);
 extern int                max_udp_retrans         _DEFVAL(UDP_MAX_RETRANS);
+extern int                max_invite_retrans      _DEFVAL(UDP_MAX_RETRANS_INVITE_TRANSACTION);
+extern int                max_non_invite_retrans  _DEFVAL(UDP_MAX_RETRANS_NON_INVITE_TRANSACTION);
 extern int                default_behavior        _DEFVAL(1);
 extern int                pause_msg_ign           _DEFVAL(0);
 extern int                auto_answer             _DEFVAL(0);
