[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [screen-users] automatically sending key to window

From: Gerald Young
Subject: Re: [screen-users] automatically sending key to window
Date: Wed, 28 Dec 2011 12:45:22 -0500
User-agent: KMail/1.9.9

On Monday 26 December 2011 1:30:10 am 蔡文博 wrote:
> Hello,
> I am using screen to run sipp (a SIP testing tool).
> Pressing "+" when sipp is running can increase call rate.
> I want to increase the call rate every 10 minutes.
> So I wonder if I can let screen to send a key to a window (which runs
> sipp) automatically after each interval.
> Appreciate if you can help, other solution is also welcome.
> Regards,
> Wenbo


This is quite easy to do with Expect. Take for example the following script:
#!/usr/bin/expect -f 

set sending 0
set CTRLA \001
set CTRLZ \032

spawn sipp -sn uac
interact {
        timeout 1       { if {$sending} { send "+" } }
        $CTRLA          { set sending 1 }
        $CTRLZ          { set sending 0 }

When executed, Expect will internally spawn SIPp using the embedded UAC 
scenario. When Control+A is pressed, it will start sending a "+" to SIPp (ie. 
increasing call rate) every second. Pressing Control+Z stops the sending 
of "+" to SIPp. All other SIPp interactive commands work as usual.

You will probably want to edit the timeout value to 600 seconds (ie. 10 
minutes) and edit the sipp command line with your own parameters.

Gerald Young

reply via email to

[Prev in Thread] Current Thread [Next in Thread]