I'm posting the following modifications in case others have been battling the 
same sipp limitations as I have.  Feel free to incorporate, use individually or 
ignore.

Background
=======

I've had weeks of battle with SIPP server-mode scripts in an environment where 
maintaining registration with an SBC is required.  Server mode means that you 
cannot start a script with a 'send' to carry out the registration, so a 
separate script had to be executed first to do this. Then all sorts of 
scripting acrobatics were required to maintain a registration (which had a 60 
second expiry) and respond to options pings (as used by dynamic HNT to 
calculate the NAT timeout) during execution.

Additionally running SIP over TCP proved completely impossible for server-mode 
(terminating party) scenarios - as discussed in a previous mail, our SBC drops 
the registration as soon as it received a FIN on the TCP session used to 
register the endpoint, meaning that it was impossible to run a separate 
client-mode script to register, then a server-mode script to terminate calls 
without losing our registration when the first script exits.

The obvious solution was to enable SIPP to run in a mixture of client and 
server mode concurrently.


Solution
=====

The following diff log shows to updates required to do the above.   The 
modifications add two new command line parameters:

-sfrx
-snrx

Including either of these at the command line puts SIPP into a mixed mode where 
it loads two scenarios, the first (specified in -sn or -sf) in client mode, and 
the second (specified in -snrx or -sfrx) in server mode.

The client mode scenario runs as normal, starting as many calls as specified in 
the command line parameters -m and -l.

Any unsolicited messages are handled in server mode by the second scenario - 
spawning a new 'call' to handle each new incoming call-id received as done in 
normal server mode.  The -m and -l call limits are ignored by the second 
server-mode scenario.

The result is that a client mode scenario file can be specified in -sf to 
handle registration or make outgoing calls, and a server mode scenario file can 
simultaneously be specified in -sfrx to terminate multiple incoming calls and 
handle incoming options pings.

This differs from the OOC scenario allowed previously where all incoming 
unsolicited messages were handled by the same 'call' irrespective of their 
call-id, making this option unusable for handling multiple simultaneous 
incoming calls.

The diff also includes three other minor changes:
 - the changes to makefile required to get sipp to compile in cygwin
 - the inclusion of setsockopt calls to set the IP4 TOS on outgoing SIPP, audio 
and video packets to the values specified in the sipp.hpp header file.
 - The commenting out of the 'kill existing pcap play streams' code which was 
breaking sipp functionality to play both auidio and video streams 
simultaneously.


Apologies for including all four modifications together.  Let me know if you 
want me to post them separately.




Diff against SIPP v3.2 attached below:

================================


diff -bruN ../orig/sipp.svn/Makefile sipp.svn/Makefile
--- ../orig/sipp.svn/Makefile   2008-10-30 01:20:06.000000000 +1300
+++ sipp.svn/Makefile   2011-12-17 09:28:00.796875000 +1300
@@ -153,7 +153,7 @@
 INCDIR_hpux=-I. -I/usr/local/include -I/opt/openssl/include
 INCDIR_tru64=-I. -I/opt/openssl/include
 INCDIR_SunOS=-I. -I/usr/local/ssl/include/
-INCDIR_Cygwin=-I. -I/usr/include/openssl -I/usr/include 
-I/usr/lib/WpdPack/Include
+INCDIR_Cygwin=-I. -I/usr/include/openssl -I/usr/include 
-I/usr/lib/WpdPack/Include -I/usr/include/ncurses
 INCDIR_Darwin=-I. -I/usr/local/ssl/include
 INCDIR=$(INCDIR_$(SYSTEM))

diff -bruN ../orig/sipp.svn/call.cpp sipp.svn/call.cpp
--- ../orig/sipp.svn/call.cpp   2010-11-09 02:02:28.000000000 +1300
+++ sipp.svn/call.cpp   2011-12-17 15:03:16.921875000 +1300
@@ -249,6 +249,8 @@
         (_RCAST(struct sockaddr_in *, &(play_args_a.to)))->sin_family = 
AF_INET;
         (_RCAST(struct sockaddr_in *, &(play_args_a.to)))->sin_port = 
audio_port;
         (_RCAST(struct sockaddr_in *, &(play_args_a.to)))->sin_addr.s_addr = 
ip_media;
+        play_args_a.tos = AUDIO_TOS;
+
       }
       video_port = get_remote_port_media(msg, PAT_VIDEO);
       if (video_port) {
@@ -256,6 +258,7 @@
         (_RCAST(struct sockaddr_in *, &(play_args_v.to)))->sin_family = 
AF_INET;
         (_RCAST(struct sockaddr_in *, &(play_args_v.to)))->sin_port = 
video_port;
         (_RCAST(struct sockaddr_in *, &(play_args_v.to)))->sin_addr.s_addr = 
ip_media;
+        play_args_v.tos = VIDEO_TOS;
       }
       hasMediaInformation = 1;
     }
@@ -311,12 +314,12 @@
 }

 /******************* Call class implementation ****************/
-call::call(char *p_id, bool use_ipv6, int userId, struct sockaddr_storage 
*dest) : listener(p_id, true) {
-  init(main_scenario, NULL, dest, p_id, userId, use_ipv6, false, false);
+call::call(scenario * call_scenario, char *p_id, bool use_ipv6, int userId, 
struct sockaddr_storage *dest) : listener(p_id, true) {
+  init(call_scenario, NULL, dest, p_id, userId, use_ipv6, false, false);
 }

-call::call(char *p_id, struct sipp_socket *socket, struct sockaddr_storage 
*dest) : listener(p_id, true) {
-  init(main_scenario, socket, dest, p_id, 0 /* No User. */, socket->ss_ipv6, 
false /* Not Auto. */, false);
+call::call(scenario * call_scenario, char *p_id, struct sipp_socket *socket, 
struct sockaddr_storage *dest) : listener(p_id, true) {
+  init(call_scenario, socket, dest, p_id, 0 /* No User. */, socket->ss_ipv6, 
false /* Not Auto. */, false);
 }

 call::call(scenario * call_scenario, struct sipp_socket *socket, struct 
sockaddr_storage *dest, char * p_id, int userId, bool ipv6, bool isAutomatic, 
bool isInitialization) : listener(p_id, true) {
@@ -3811,12 +3814,12 @@
 #define PTHREAD_STACK_MIN      16384
 #endif
       //pthread_attr_setstacksize(&attr, PTHREAD_STACK_MIN);
-      if (media_thread != 0) {
+      //if (media_thread != 0) {
         // If a media_thread is already active, kill it before starting a new 
one
-        pthread_cancel(media_thread);
-        pthread_join(media_thread, NULL);
-        media_thread = 0;
-      }
+      //  pthread_cancel(media_thread);
+      //  pthread_join(media_thread, NULL);
+      //  media_thread = 0;
+     // }
       int ret = pthread_create(&media_thread, &attr, send_wrapper,
          (void *) play_args);
       if(ret)
diff -bruN ../orig/sipp.svn/call.hpp sipp.svn/call.hpp
--- ../orig/sipp.svn/call.hpp   2009-04-16 00:10:03.000000000 +1200
+++ sipp.svn/call.hpp   2011-12-17 15:02:12.593750000 +1300
@@ -68,8 +68,8 @@
 public:
   /* These are wrappers for various circumstances, (private) init does the 
real work. */
   //call(char * p_id, int userId, bool ipv6, bool isAutomatic);
-  call(char *p_id, bool use_ipv6, int userId, struct sockaddr_storage *dest);
-  call(char *p_id, struct sipp_socket *socket, struct sockaddr_storage *dest);
+  call(scenario * call_scenario, char *p_id, bool use_ipv6, int userId, struct 
sockaddr_storage *dest);
+  call(scenario * call_scenario, char *p_id, struct sipp_socket *socket, 
struct sockaddr_storage *dest);
   static call *add_call(int userId, bool ipv6, struct sockaddr_storage *dest);
   call(scenario * call_scenario, struct sipp_socket *socket, struct 
sockaddr_storage *dest, char * p_id, int userId, bool ipv6, bool isAutomatic, 
bool isInitCall);

diff -bruN ../orig/sipp.svn/scenario.cpp sipp.svn/scenario.cpp
--- ../orig/sipp.svn/scenario.cpp       2009-04-16 00:10:03.000000000 +1200
+++ sipp.svn/scenario.cpp       2011-12-18 09:58:29.515625000 +1300
@@ -142,6 +142,7 @@

 /******** Global variables which compose the scenario file **********/

+scenario      *rx_scenario;
 scenario      *main_scenario;
 scenario      *ooc_scenario;
 scenario      *display_scenario;
@@ -1208,7 +1209,7 @@
   bool isRecvCmdFound = false;
   bool isSendCmdFound = false;

-  creationMode = -1;
+  if (creationMode!=MODE_MIXED) creationMode = -1;
   sendMode = -1;
   thirdPartyMode = MODE_3PCC_NONE;

diff -bruN ../orig/sipp.svn/scenario.hpp sipp.svn/scenario.hpp
--- ../orig/sipp.svn/scenario.hpp       2008-08-23 07:08:05.000000000 +1200
+++ sipp.svn/scenario.hpp       2011-12-17 14:45:30.859375000 +1300
@@ -42,6 +42,7 @@

 #define MODE_CLIENT        0
 #define MODE_SERVER        1
+#define MODE_MIXED         2

 #define MODE_3PCC_NONE         0
 #define MODE_3PCC_CONTROLLER_A  2
@@ -223,6 +224,7 @@

 /* There are external variable containing the current scenario */
 extern scenario      *main_scenario;
+extern scenario      *rx_scenario;
 extern scenario      *ooc_scenario;
 extern scenario      *display_scenario;
 extern int           creationMode;
diff -bruN ../orig/sipp.svn/send_packets.c sipp.svn/send_packets.c
--- ../orig/sipp.svn/send_packets.c     2009-05-28 23:01:17.000000000 +1200
+++ sipp.svn/send_packets.c     2011-12-18 11:23:49.640625000 +1300
@@ -139,6 +139,8 @@
   struct sockaddr_in6 to6, from6;
   char buffer[PCAP_MAXPACKET];
   int temp_sum;
+  u_int8_t tos = play_args->tos;
+  int toslen = sizeof(tos);

 #ifndef MSG_DONTWAIT
   int fd_flags;
@@ -159,8 +161,14 @@
     }
     from_port = &(((struct sockaddr_in *)(void *) from )->sin_port);
     to_port = &(((struct sockaddr_in *)(void *) to )->sin_port);
+
+    if ( setsockopt(sock, IPPROTO_IP, IP_TOS, (char *) &tos, toslen) < 0 )
+      ERROR("Setsockopt failed to set IPv4 TOS");
+
+      // Note: in cygwin need to create following windows registry key to get 
TOS to work: IgnoreUserTOSSetting = 0
   }

+
 #ifndef MSG_DONTWAIT
   fd_flags = fcntl(sock, F_GETFL , NULL);
   fd_flags |= O_NONBLOCK;
diff -bruN ../orig/sipp.svn/send_packets.h sipp.svn/send_packets.h
--- ../orig/sipp.svn/send_packets.h     2006-06-06 08:07:17.000000000 +1200
+++ sipp.svn/send_packets.h     2011-12-17 09:28:02.093750000 +1300
@@ -115,6 +115,7 @@
   /* Used in send_packets thread */
     struct sockaddr_storage to;
   struct sockaddr_storage from;
+  unsigned char tos;
 } play_args_t;

 #ifdef __cplusplus
diff -bruN ../orig/sipp.svn/sipp.cpp sipp.svn/sipp.cpp
--- ../orig/sipp.svn/sipp.cpp   2010-11-12 23:12:32.000000000 +1300
+++ sipp.svn/sipp.cpp   2011-12-18 11:22:48.421875000 +1300
@@ -130,6 +130,8 @@
 #define SIPP_OPTION_LFNAME       36
 #define SIPP_OPTION_LFOVERWRITE          37
 #define SIPP_OPTION_PLUGIN       38
+#define SIPP_OPTION_RX_SCENARIO   39
+#define SIPP_OPTION_RX_INPUT_FILE 40

 /* Put Each option, its help text, and type in this table. */
 struct sipp_option options_table[] = {
@@ -176,6 +178,9 @@
        {"fd", "Set the statistics dump log report frequency. Default is 60 and 
default unit is seconds.", SIPP_OPTION_TIME_SEC, &report_freq_dumpLog, 1},

        {"i", "Set the local IP address for 'Contact:','Via:', and 'From:' 
headers. Default is primary host IP address.\n", SIPP_OPTION_IP, local_ip, 1},
+       {"rxinf", "Inject values from an external CSV file during calls into 
the scenarios.\n"
+                "First line of this file say whether the data is to be read in 
sequence (SEQUENTIAL), random (RANDOM), or user (USER) order.\n"
+               "Each line corresponds to one call and has one or more ';' 
delimited data fields. Those fields can be referred as [field0], [field1], ... 
in the xml scenario file.  Several CSV files can be used simultaneously 
(syntax: -inf f1.csv -inf f2.csv ...)", SIPP_OPTION_RX_INPUT_FILE, NULL, 1},
        {"inf", "Inject values from an external CSV file during calls into the 
scenarios.\n"
                 "First line of this file say whether the data is to be read in 
sequence (SEQUENTIAL), random (RANDOM), or user (USER) order.\n"
                "Each line corresponds to one call and has one or more ';' 
delimited data fields. Those fields can be referred as [field0], [field1], ... 
in the xml scenario file.  Several CSV files can be used simultaneously 
(syntax: -inf f1.csv -inf f2.csv ...)", SIPP_OPTION_INPUT_FILE, NULL, 1},
@@ -261,6 +266,7 @@
        {"s", "Set the username part of the resquest URI. Default is 
'service'.", SIPP_OPTION_STRING, &service, 1},
        {"sd", "Dumps a default scenario (embeded in the sipp executable)", 
SIPP_OPTION_SCENARIO, NULL, 0},
        {"sf", "Loads an alternate xml scenario file.  To learn more about XML 
scenario syntax, use the -sd option to dump embedded scenarios. They contain 
all the necessary help.", SIPP_OPTION_SCENARIO, NULL, 2},
+       {"sfrx", "Loads an alternate receive xml scenario file as the second 
scenario - enabling a mixture of originating and terminating calls to be 
executed. If this is included then the second scenario MUST be a server mode 
scenario, and the first scenario (specified in -sf / -sn) MUST be a client-mode 
scenario. If both -snrx and -sfrx are ommitted then only a single scenario is 
executed.\n", SIPP_OPTION_RX_SCENARIO, NULL, 2},
        {"shortmessage_file", "Set the name of the short message log file.", 
SIPP_OPTION_LFNAME, &shortmessage_lfi, 1},
        {"shortmessage_overwrite", "Overwrite the short message log file 
(default true).", SIPP_OPTION_LFOVERWRITE, &shortmessage_lfi, 1},
        {"oocsf", "Load out-of-call scenario.", SIPP_OPTION_OOC_SCENARIO, NULL, 
2},
@@ -280,7 +286,7 @@
                "- '3pcc-C-B' : Controller B side.\n"
                "- '3pcc-A'   : A side.\n"
                "- '3pcc-B'   : B side.\n", SIPP_OPTION_SCENARIO, NULL, 2},
-
+       {"snrx", "Use a default scenario (embedded in the sipp executable) for 
the second scenario - enabling a mixture of originating and terminating calls 
to be executed. If this is included then the second scenario MUST be a server 
mode scenario, and the first scenario (specified in -sf / -sn) MUST be a 
client-mode scenario. If both -snrx and -sfrx are ommitted then only a single 
scenario is executed.\n", SIPP_OPTION_RX_SCENARIO, NULL, 2},
        {"stat_delimiter", "Set the delimiter for the statistics file", 
SIPP_OPTION_STRING, &stat_delimiter, 1},
        {"stf", "Set the file name to use to dump statistics", 
SIPP_OPTION_ARGI, &argiFileName, 1},

@@ -778,7 +784,7 @@
     sprintf(temp_str, "%3.1f(%d ms)/%5.3fs", rate, duration, 
(double)rate_period_ms / 1000.0);
   }
   unsigned long long total_calls = 
display_scenario->stats->GetStat(CStat::CPT_C_IncomingCallCreated) + 
display_scenario->stats->GetStat(CStat::CPT_C_OutgoingCallCreated);
-  if( creationMode == MODE_SERVER) {
+  if(( creationMode == MODE_SERVER) || ((creationMode == MODE_MIXED) and 
(display_scenario==rx_scenario))) {
     fprintf
       (f,
        "  Port   Total-time  Total-calls  Transport"
@@ -790,7 +796,7 @@
        total_calls,
        TRANSPORT_TO_STRING(transport));
   } else {
-    assert(creationMode == MODE_CLIENT);
+    assert((creationMode == MODE_CLIENT) || ((creationMode == MODE_MIXED) and 
(display_scenario==main_scenario)));
     if (users >= 0) {
       fprintf(f, "     Users (length)");
     } else {
@@ -827,7 +833,7 @@
          (clock_tick-last_report_time) / divisor);

   /* 2nd line */
-  if( creationMode == MODE_SERVER) {
+  if(( creationMode == MODE_SERVER) || ((creationMode == MODE_MIXED) and 
(display_scenario==rx_scenario))) {
     sprintf(temp_str, "%llu calls", 
display_scenario->stats->GetStat(CStat::CPT_C_CurrentCall));
   } else {
     sprintf(temp_str, "%llu calls (limit %d)", 
display_scenario->stats->GetStat(CStat::CPT_C_CurrentCall), open_calls_allowed);
@@ -844,7 +850,8 @@
   sprintf(temp_str,"%llu dead call msg (discarded)",
       display_scenario->stats->GetStat(CStat::CPT_G_C_DeadCallMsgs));
   fprintf(f,"  %-37s", temp_str);
-  if( creationMode == MODE_CLIENT) {
+  if ((creationMode == MODE_CLIENT) || ((creationMode == MODE_MIXED) and 
(display_scenario==main_scenario)))
+  {
     sprintf(temp_str,"%llu out-of-call msg (discarded)",
             display_scenario->stats->GetStat(CStat::CPT_G_C_OutOfCallMsgs));
     fprintf(f,"  %-37s", temp_str);
@@ -944,7 +951,7 @@
        sprintf(temp_str, "%s", src->getMethod());
       }

-      if(creationMode == MODE_SERVER) {
+      if((creationMode == MODE_SERVER) || ((creationMode == MODE_MIXED) and 
(display_scenario==rx_scenario))) {
         fprintf(f,"  <---------- %-10s ", temp_str);
       } else {
         fprintf(f,"  %10s ----------> ", temp_str);
@@ -971,7 +978,7 @@
                "" /* Unexpected. */);
       }
     } else if(curmsg -> recv_response) {
-      if(creationMode == MODE_SERVER) {
+      if((creationMode == MODE_SERVER) || ((creationMode == MODE_MIXED) and 
(display_scenario==rx_scenario))) {
        fprintf(f,"  ----------> %-10d ", curmsg -> recv_response);
       } else {
        fprintf(f,"  %10d <---------- ", curmsg -> recv_response);
@@ -1014,7 +1021,7 @@
       }
       int len = strlen(desc) < 9 ? 9 : strlen(desc);

-      if(creationMode == MODE_SERVER) {
+      if((creationMode == MODE_SERVER) || ((creationMode == MODE_MIXED) and 
(display_scenario==rx_scenario))) {
        fprintf(f,"  [%9s] Pause%*s", desc, 23 - len > 0 ? 23 - len : 0, "");
       } else {
        fprintf(f,"       Pause [%9s]%*s", desc, 18 - len > 0 ? 18 - len : 0, 
"");
@@ -1023,7 +1030,7 @@
       fprintf(f,"%-9d", curmsg->sessions);
       fprintf(f,"                     %-9lu" , curmsg->nb_unexp);
     } else if(curmsg -> recv_request) {
-      if(creationMode == MODE_SERVER) {
+      if((creationMode == MODE_SERVER) || ((creationMode == MODE_MIXED) and 
(display_scenario==rx_scenario))) {
        fprintf(f,"  ----------> %-10s ", curmsg -> recv_request);
       } else {
        fprintf(f,"  %10s <---------- ", curmsg -> recv_request);
@@ -1268,6 +1275,10 @@
       default:
        ERROR("Internal error: creationMode=%d, thirdPartyMode=%d", 
creationMode, thirdPartyMode);
       }
+    } else if((creationMode == MODE_MIXED) and (display_scenario == 
main_scenario)) {
+        fprintf(f,"----------------Sipp Mixed Mode - main -  call originating 
scenario------------" SIPP_ENDL);
+    } else if((creationMode == MODE_MIXED) and (display_scenario == 
rx_scenario)) {
+        fprintf(f,"-----------------Sipp Mixed mode - rx - call terminating 
screnario-------------" SIPP_ENDL);
     } else {
       assert(creationMode == MODE_SERVER);
       switch(thirdPartyMode) {
@@ -1672,6 +1683,8 @@
       display_scenario = main_scenario;
     } else if (!strcmp(rest, "ooc")) {
       display_scenario = ooc_scenario;
+    } else if (!strcmp(rest, "rx")) {
+      display_scenario = rx_scenario;
     } else {
        WARNING("Unknown display scenario: %s", rest);
     }
@@ -3041,6 +3054,7 @@
               CStat::formatTime(&currentTime),call_id, 
get_incoming_header_content(msg,"CSeq:"), get_incoming_first_line(msg));
           }

+  /* got as message not relating to a known call */
   if(!listener_ptr)
   {
     if(thirdPartyMode == MODE_3PCC_CONTROLLER_B || thirdPartyMode == 
MODE_3PCC_A_PASSIVE
@@ -3048,7 +3062,7 @@
     {
       // Adding a new OUTGOING call !
       main_scenario->stats->computeStat(CStat::E_CREATE_OUTGOING_CALL);
-      call *new_ptr = new call(call_id, is_ipv6, 0, use_remote_sending_addr ? 
&remote_sending_sockaddr : &remote_sockaddr);
+      call *new_ptr = new call(main_scenario, call_id, is_ipv6, 0, 
use_remote_sending_addr ? &remote_sending_sockaddr : &remote_sockaddr);
       if (!new_ptr) {
        ERROR("Out of memory allocating a call!");
       }
@@ -3089,7 +3103,23 @@

       // Adding a new INCOMING call !
       main_scenario->stats->computeStat(CStat::E_CREATE_INCOMING_CALL);
-      listener_ptr = new call(call_id, socket, use_remote_sending_addr ? 
&remote_sending_sockaddr : src);
+      listener_ptr = new call(main_scenario, call_id, socket, 
use_remote_sending_addr ? &remote_sending_sockaddr : src);
+      if (!listener_ptr) {
+       ERROR("Out of memory allocating a call!");
+      }
+    }
+    else if(creationMode == MODE_MIXED)
+    {
+/*  Ignore quitting for now ... as this is triggered when all tx calls are 
active
+      if (quitting >= 1) {
+        CStat::globalStat(CStat::E_OUT_OF_CALL_MSGS);
+        TRACE_MSG("Discarded message for new calls while quitting\n");
+        return;
+      }
+*/
+      // Adding a new INCOMING call !
+      rx_scenario->stats->computeStat(CStat::E_CREATE_INCOMING_CALL);
+      listener_ptr = new call(rx_scenario, call_id, socket, 
use_remote_sending_addr ? &remote_sending_sockaddr : src);
       if (!listener_ptr) {
        ERROR("Out of memory allocating a call!");
       }
@@ -3118,6 +3148,7 @@
       } else {
        CStat::globalStat(CStat::E_OUT_OF_CALL_MSGS);
        WARNING("Discarding message which can't be mapped to a known SIPp 
call:\n%s", msg);
+
       }
     }
   }
@@ -3131,6 +3162,7 @@
   {
     listener_ptr -> process_twinSippCom(msg);
   }
+  /* This is a message on a known call - process it */
   else
   {
     listener_ptr -> process_incoming(msg, src);
@@ -3862,6 +3894,9 @@
 int socket_fd(bool use_ipv6, int transport) {
   int socket_type;
   int fd;
+  u_int8_t tos = SIP_TOS;
+  int toslen = sizeof(tos);
+

   switch(transport) {
     case T_UDP:
@@ -3880,6 +3915,10 @@
     ERROR("Unable to get a %s socket (3)", TRANSPORT_TO_STRING(transport));
   }

+  if(!use_ipv6) {
+    if ( setsockopt(fd, IPPROTO_IP, IP_TOS, (char *) &tos, toslen) < 0 )
+      ERROR("Setsockopt");
+  }
   return fd;
 }

@@ -4302,6 +4341,28 @@
            }
          }
          break;
+       case SIPP_OPTION_RX_INPUT_FILE:
+         {
+           REQUIRE_ARG();
+           CHECK_PASS();
+           FileContents *rxData = new FileContents(argv[argi]);
+           char *name = argv[argi];
+           if (strrchr(name, '/')) {
+             name = strrchr(name, '/') + 1;
+           } else if (strrchr(name, '\\')) {
+             name = strrchr(name, '\\') + 1;
+           }
+           assert(name);
+           inFiles[name] = rxData;
+           /* By default, the first file is used for IP address input. */
+           if (!rx_ip_file) {
+             rx_ip_file = name;
+           }
+           if (!rx_default_file) {
+             rx_default_file = name;
+           }
+         }
+         break;
        case SIPP_OPTION_INDEX_FILE:
          REQUIRE_ARG();
          REQUIRE_ARG();
@@ -4479,7 +4540,6 @@
            main_scenario->stats->setFileName(scenario_file, (char*)".csv");
          } else if (!strcmp(argv[argi - 1], "-sn")) {
            int i = find_scenario(argv[argi]);
-
            main_scenario = new scenario(0, i);
            scenario_file = new char [strlen(argv[argi])+1] ;
            sprintf(scenario_file,"%s", argv[argi]);
@@ -4492,6 +4552,26 @@
            ERROR("Internal error, I don't recognize %s as a scenario 
option\n", argv[argi] - 1);
          }
          break;
+       case SIPP_OPTION_RX_SCENARIO:
+         REQUIRE_ARG();
+         CHECK_PASS();
+          creationMode=MODE_MIXED;
+         if (!strcmp(argv[argi - 1], "-rxsf")) {
+           rx_scenario_file = new char [strlen(argv[argi])+1] ;
+           sprintf(rx_scenario_file,"%s", argv[argi]);
+           rx_scenario_file = remove_pattern (rx_scenario_file, (char*)".xml");
+           rx_scenario = new scenario(argv[argi], 0);
+           rx_scenario->stats->setFileName(rx_scenario_file, (char*)".csv");
+         } else if (!strcmp(argv[argi - 1], "-rxsn")) {
+           int i = find_scenario(argv[argi]);
+           rx_scenario = new scenario(0, i);
+           rx_scenario_file = new char [strlen(argv[argi])+1] ;
+           sprintf(rx_scenario_file,"%s", argv[argi]);
+           rx_scenario->stats->setFileName(argv[argi], (char*)".csv");
+         } else {
+           ERROR("Internal error, I don't recognize %s as a scenario 
option\n", argv[argi] - 1);
+         }
+          break;
        case SIPP_OPTION_OOC_SCENARIO:
          REQUIRE_ARG();
          CHECK_PASS();
@@ -4900,7 +4980,8 @@

   /* Setting the rate and its dependant params (open_calls_allowed) */
   /* If we are a client, then create the task to open new calls. */
-  if (creationMode == MODE_CLIENT) {
+  if ((creationMode == MODE_CLIENT) || ((creationMode == MODE_MIXED) and 
(display_scenario==main_scenario)))
+  {
     opentask::initialize();
     opentask::set_rate(rate);
   }
Files ../orig/sipp.svn/sipp.exe and sipp.svn/sipp.exe differ
diff -bruN ../orig/sipp.svn/sipp.hpp sipp.svn/sipp.hpp
--- ../orig/sipp.svn/sipp.hpp   2010-11-09 02:02:28.000000000 +1300
+++ sipp.svn/sipp.hpp   2011-12-17 13:16:42.859375000 +1300
@@ -178,6 +178,13 @@

 #define DEFAULT_BEHAVIOR_ALL        (DEFAULT_BEHAVIOR_BYE | 
DEFAULT_BEHAVIOR_ABORTUNEXP | DEFAULT_BEHAVIOR_PINGREPLY)

+
+/************ Matt's TOS parameters  **********************/
+#define AUDIO_TOS 0xb8
+#define VIDEO_TOS 0x88
+#define SIP_TOS 0x68
+
+
 /************ User controls and command line options ***********/

 extern int                duration                _DEFVAL(0);
@@ -306,6 +313,8 @@
 typedef std::map<string, FileContents *> file_map;
 extern file_map inFiles;
 typedef std::map<string, str_int_map *> file_index;
+extern char *rx_ip_file _DEFVAL(NULL);
+extern char *rx_default_file _DEFVAL(NULL);
 extern char *ip_file _DEFVAL(NULL);
 extern char *default_file _DEFVAL(NULL);

@@ -461,8 +470,9 @@
 extern bool   dumpInFile                          _DEFVAL(0);
 extern bool   dumpInRtt                           _DEFVAL(0);
 extern bool   useCountf                           _DEFVAL(0);
-extern char * scenario_file;
 extern char * slave_cfg_file;
+extern char * scenario_file;
+extern char * rx_scenario_file;

 extern unsigned long long max_log_size           _DEFVAL(0);
 extern unsigned long long ringbuffer_size        _DEFVAL(0);


------------------------------------------------------------------------------
Learn Windows Azure Live!  Tuesday, Dec 13, 2011
Microsoft is holding a special Learn Windows Azure training event for 
developers. It will provide a great way to learn Windows Azure and what it 
provides. You can attend the event by watching it streamed LIVE online.  
Learn more at http://p.sf.net/sfu/ms-windowsazure
_______________________________________________
Sipp-users mailing list
Sipp-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sipp-users

Reply via email to