Hi, Lukas,
I followed your instruction above and modified a little in the sipp.cpp but
failed finally, I use a fedora 3 and sipp 01-20-2007 snapshot
I just want to run sipp as uac in background by crontab. Have you any better
solution for this moment?
Thanks!
kindly regards
laijun
On 2/11/07, Lukas Oberhuber <[EMAIL PROTECTED]> wrote:
I would suggest something like "--noscreen" as the option maybe, but
otherwise agree. I think this would be a very useful addition (especially
because sipp appears to work much better than sipsak in all other ways).
Since I don't have SVN check-in access I'll leave the few lines of code to
someone who does.
-Lukas
-----Original Message-----
From: Peter Higginson [mailto:[EMAIL PROTECTED]
Sent: 11 February 2007 10:13
To: 'Lukas Oberhuber'; 'Juan Antonio Alvarez';
[email protected]
Subject: RE: [Sipp-users] Cron using Sipp
What you have really done is create another mode that does everything that
background mode does except actually fork.
I suggest that the way to incorporate this into the mainstream would be to
create another option "-cron" (say), that sets backgroundMode = true and
crontabMode = true and then change the first line in the block indicated
to:
if (backgroundMode == true && crontabMode == false)
Peter
Peter Higginson
Newport Networks Ltd,
Direct line 01494 470694
http://www.newport-networks.com/
-----Original Message-----
From: Lukas Oberhuber [mailto:[EMAIL PROTECTED]
Sent: 07 February 2007 15:16
To: 'Peter Higginson'; 'Juan Antonio Alvarez';
[email protected]
Subject: RE: [Sipp-users] Cron using Sipp
All,
Success!
In order to allow sipp to run properly in the background and in cron, for
the purposes of testing if a sip server is available, the hack is to
recompile sipp with a slightly modified background mode.
You will now call sipp as follows:
sipp -m 1 -sn uac 127.0.0.1 -bg &
In normal version, this hangs, it modified version this works and does not
try to access the screen.
You will have to modify sipp.cpp such that the following code is commented
out. In 1.1rc6 this is around line 4095:
----------------
/* checking if we need to launch the tool in background mode */
#if 0 // Add this line to change background mode
if(backgroundMode == true)
{
pid_t l_pid;
switch(l_pid = fork())
{
case -1:
// error when forking !
ERROR_NO("Forking error");
exit(EXIT_FATAL_ERROR);
case 0:
// child process - poursuing the execution
break;
default:
// parent process - killing the parent - the child get the
parent
pid
printf("Background mode - PID=[%d]\n", l_pid);
exit(EXIT_OTHER);
}
}
#endif // Add this line to change background mode
--------------
Then run:
make
-Lukas
-----Original Message-----
From: Peter Higginson [mailto:[EMAIL PROTECTED]
Sent: 02 February 2007 22:01
To: 'Lukas Oberhuber'; 'Juan Antonio Alvarez';
[email protected]
Subject: RE: [Sipp-users] Cron using Sipp
I've avoided contributing to this so far because I tried for a long time
to
run SIPp from a cron job and failed. I even changed the code take stdin
out
of the poll set without success.
What we do that works is to run a TCL task from cron which connects back
to
the Linux (using the expect functions) and runs SIPp. The TCL is just one
option in a larger test control system so unfortunately I cannot extract
just the bit you need. (Anyone who can write Expect scripts in TCL could
do
a simple one fairly quickly - you just need to supply some input and put
any
output into a file - don't do console input in the TCL or you just end up
with the same problem.)
Peter
Peter Higginson
Newport Networks Ltd,
Direct line 01494 470694
http://www.newport-networks.com/
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Lukas
Oberhuber
Sent: 02 February 2007 19:46
To: 'Juan Antonio Alvarez'; [email protected]
Subject: Re: [Sipp-users] Cron using Sipp
Juan,
Here is the output of sipp -m 1 -sn uac 127.0.0.1
As you can see, sipp runs perfectly in the foreground.
Warning: open file limit > FD_SETSIZE; limiting max. # of open files to
FD_SETSIZE = 1024
Media: no
------------------------------ Scenario Screen -------- [1-4]: Change
Screen
--
Call-rate(length) Port Total-time Total-calls Remote-host
10.0(0 ms)/1.000s 5061 0.22 s 1 127.0.0.1:5060(UDP)
Call limit reached (-m 1), 0.226 s period 9 ms scheduler resolution
0 concurrent calls (limit 30) Peak was 1 calls, after 0 s
0 out-of-call msg (discarded)
1 open sockets
Messages Retrans Timeout
Unexpected-Msg
INVITE ----------> 1 0 0
100 <---------- 1 0 0
180 <---------- 0 0 0
183 <---------- 0 0 0
200 <---------- E-RTD 1 0 0
ACK ----------> 1 0
Var Pause [ 0ms] 1 0
BYE ----------> 1 0 0
200 <---------- 1 0 0
------------------------------ Test Terminated
--------------------------------
----------------------------- Statistics Screen ------- [1-4]: Change
Screen
--
Start Time | 2007-02-02 19:36:59
Last Reset Time | 2007-02-02 19:36:59
Current Time | 2007-02-02 19:36:59
-------------------------+---------------------------+----------------------
----
Counter Name | Periodic value | Cumulative value
-------------------------+---------------------------+----------------------
----
Elapsed Time | 00:00:00:228 | 00:00:00:228
Call Rate | 4.386 cps | 4.386 cps
-------------------------+---------------------------+----------------------
----
Incoming call created | 0 | 0
OutGoing call created | 1 | 1
Total Call created | | 1
Current Call | 0 |
-------------------------+---------------------------+----------------------
----
Successful call | 1 | 1
Failed call | 0 | 0
-------------------------+---------------------------+----------------------
----
Response Time | 00:00:00:112 | 00:00:00:112
Call Length | 00:00:00:112 | 00:00:00:112
------------------------------ Test Terminated
--------------------------------
Here is the output of
sipp -m 1 -sn uac 127.0.0.1 &
[EMAIL PROTECTED] sipp -m 1 -sn uac 127.0.0.1 &
[1] 6851
[EMAIL PROTECTED] jobs
[1]+ Stopped sipp -m 1 -sn uac 127.0.0.1
Here is the description of the problem:
I don't want to run sipp in the background, but I do want to run it from
an
automated script (the script of necessity needs to run in the background).
Below I've outlined the exact scenario which I am attempting to run. As
you
can see, I want to test that the sip server is up (in an automated
fashion)
and if it isn't, restart it. The below scenario does not work, because
sipp
does nothing if the script is run in crontab or if the script is run in
the
background. Sipp runs fine if I execute the script from the console.
Here is the exact script I want to run:
File /usr/src/sip_test.sh
--------------
#!/bin/sh
>/var/log/asterisk/sip_test.log
sipp -m 1 -sn uac 127.0.0.1 >& /dev/null
if test $? -ne 0
then
/etc/init.d/asterisk restart
echo Asterisk is down, restart >>/var/log/asterisk/sip_test.log
else
echo Asterisk is up >>/var/log/asterisk/sip_test.log
fi
exit 0
----------------
I want to run this script from cron:
crontab -e
* * * * * /usr/src/sip_test.sh
Specifically, sipp does nothing, and the result of the test of the outcome
is always success, regardless of if the sip server (asterisk) is running
or
not. Hopefully this explains the scenario fully and my goals of the
scenario.
-Lukas
Lukas Oberhuber
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Juan
Antonio
Alvarez
Sent: 02 February 2007 15:07
To: [email protected]
Subject: Re: [Sipp-users] Cron using Sipp
On 1/30/07, Lukas Oberhuber <[EMAIL PROTECTED]> wrote:
>
>
>
>
> Charles,
>
>
>
> I'm taking from this discussion that I will need to parse the output of
sipp
> in my script, and use the pid I glean from this to apply to the 'wait'
> command.
>
>
>
> I wish it weren't such a convoluted task as what I'm trying to do seems
> exactly what this tool could help with (i.e. test if a service is
running
or
> not, and take action based on the outcome)!
>
>
>
> Thank you for the help,
>
>
>
>
> -Lukas
>
Hi Lukas,
It should be much simpler, if I understand well what you are trying to
do. The script you sent, should be enough. Have you tried just running
the cli for sipp. i.e. sipp -m 1 -sn uac 127.0.0.1
My guess, you need to configure asterisk to answer to this call.
Probably, asterisk does not know how to react to the request you are
sending, and so the call is failing. And as you know (from sipp -h
output):
Exit code:
Upon exit (on fatal error or when the number of asked calls (-m
option) is reached, sipp exits with one of the following exit
code:
0: All calls were successful
1: At least one call failed
97: exit on internal command. Calls may have been processed
99: Normal exit without calls processed
-1: Fatal error
So please, give us the output of just running
sipp -m 1 -sn uac 127.0.0.1
You could also check with a
echo $?
In order to see the error code.
Finally, take a look at
http://sipp.sourceforge.net/wiki/index.php/Howto_test_an_Asterisk_server_usi
ng_SIPp
It could give you a hint...
Good luck,
Juan
-------------------------------------------------------------------------
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
-------------------------------------------------------------------------
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
----------------------------------------------------------------------------
-----------------
This e-mail may contain confidential and/or privileged information.
If you are not the intended recipient (or have received this e-mail in
error) please
notify the sender immediately and delete this e-mail. Any unauthorized
copying,
disclosure or distribution of the contents in this e-mail is strictly
forbidden.
----------------------------------------------------------------------------
-----------------
Newport Networks Limited is registered in England. Registration number
4067591.
Registered office: 6 St. Andrew Street, London EC4A 3LX
----------------------------------------------------------------------------
-----------------
----------------------------------------------------------------------------
-----------------
This e-mail may contain confidential and/or privileged information.
If you are not the intended recipient (or have received this e-mail in
error) please
notify the sender immediately and delete this e-mail. Any unauthorized
copying,
disclosure or distribution of the contents in this e-mail is strictly
forbidden.
----------------------------------------------------------------------------
-----------------
Newport Networks Limited is registered in England. Registration number
4067591.
Registered office: 6 St. Andrew Street, London EC4A 3LX
----------------------------------------------------------------------------
-----------------
-------------------------------------------------------------------------
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
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Sipp-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sipp-users