Hi Peter and all,

I just checked-in this very useful feature that Peter contributed.
SIPp has now the ability to take any parameter on the command line and inject the value in any SIP message, as a keyword.
Example:
sipp -foo this_is_a_test -bar yet_another_parameter ....
In the XML scenario, [foo] will be replaced by "this_is_a_test" and [bar] by "yet_another_parameter".

Some example applications of this:
- Pass parameters to scenarios on the command line (a shell/perl script can place calls very easily without using a CSV file or modify the XML file)
- SIP conferencing testing: One master SIPp (playing the role of chairmans) places a call to the conferencing system. In the scenario, SIPp starts a shell script (using exec action - http://sipp.sourceforge.net/doc1.1/reference.html#Execute+a+command) that in turns starts new SIPp calls (new participants joining the conference). As an argument of this shell script, the conference ID is given and re-used in the XML scenarios of the participants.

http://sipp.sourceforge.net/snapshots/sipp.2006-08-08.tar.gz

Thanks again Peter,
Olivier.


On 8/8/06, Peter Higginson <[EMAIL PROTECTED]> wrote:

Hi Olivier,

 

In sipp.hpp in the "command line options" section, add

 

extern char             **generic[100];

 

 

In sipp.cpp add this as the last help entry in help() – in latest public version needs to go before "Signal handling" I think.

 

// THIS ENTRY MUST BE LAST

     "   -xyz string      : Any other parameter used in SIP messages as [xyz].\n"

 

(Note my help got so long I took out the blank lines.)

 

At the start of main() add:

 

  unsigned int         generic_count = 0;

  generic[0] = NULL;

 

As the last decode of the command line parameters before the if(!processed) line put:

 

    // This must be the last test - generic parameter

    if(processed == 0 && *argv[argi] == '-') {

      if((++argi) < argc) {

        if (generic_count+1 >= sizeof(generic)/sizeof(generic[0])) {

          ERROR_P1("Too many generic parameters %d\n",generic_count+1);

        }

        processed = 1;

        generic[generic_count++] = &argv[argi-1];

        generic[generic_count] = NULL;

      } else {

        ERROR_P1("Missing argument for param '%s'.\n"

                 "Use 'sipp -h' for details\n",  argv[argi-1]);

      }

    }

 

In call.cpp in the routine createSendingMessage(), after testing for everything else

replace the existing unsupported keyword error test (this code);

 

        } else {

          ERROR_P1("Unsupported keyword '%s' in xml scenario file",

                   keyword);

        }

 

By this new code

 

        } else {   // scan for the generic parameters - must be last test

          int i = 0;

          while (generic[i]) {

            char *msg1 = *generic[i];

            char *msg2 = *(generic[i] + 1);

            if(!strcmp(keyword, msg1+1)) {

              dest += sprintf(dest, "%s", msg2);

              break;

            }

            ++i;

          }

          if (!generic[i]) {

            ERROR_P1("Unsupported keyword '%s' in xml scenario file\r\n",

                   keyword);

          }

        }

 

The other thing I then did was remove any existing parameters that were just passed through – but that is cosmetic.

 

Let me know if anything is not clear.

Regards,

Peter

 

Peter Higginson

Newport Networks Ltd,

Direct line 01494 470694

http://www.newport-networks.com/



--
HP OpenCall Software
http://www.hp.com/go/opencall/
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Sipp-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sipp-users

Reply via email to