pjsua automation

KD
Klaus Darilion
Fri, Feb 19, 2010 12:58 PM

Hi!

For testing early media I often use pjsua with --play-file= --auto-play
and --auto-answer=183.

Is there a method to automate pjsua even more, e.g. to tell pjsua to:
wait 1 second, send 183 and early media, wait 3 seconds, send 200, wait
10 seconds, hangup.

thanks
Klaus

Hi! For testing early media I often use pjsua with --play-file= --auto-play and --auto-answer=183. Is there a method to automate pjsua even more, e.g. to tell pjsua to: wait 1 second, send 183 and early media, wait 3 seconds, send 200, wait 10 seconds, hangup. thanks Klaus
MW
Mark Webster
Tue, Feb 23, 2010 1:07 PM

Hi Klaus, it seems you've had no replies yet so I'll just add my 2c.

I haven't used pjsua much so I'm not sure how much control you have over
each message in the SIP dialog. However, you can automate it pretty easily
on the commandline. Here's an example shell script:

#!/bin/sh
params="--app-log-level=3 --local-port=5060 --null-audio"
dest="sip:destination@host"
output=cat commands.txt | ./pjsua $params $dest || (echo Error: $output;
exit 1);

process the $output here, for example if i want to determine whether the

call was successful
confirmed=echo $output | grep -oE 'Call .*CONFIRMED'
sipcode=echo $output | grep -oE 'reason=[0-9]+' | grep -oE '[0-9]+'
[ "$confirmed" ] && echo -n "Call succeeded" || echo -n "Call failed"
echo ", SIP code=$sipcode"

Then in commands.txt you can list the in-call commands you want to run. This
example would be something simple:
**sleep 10
q

If you need to do more complicated logic than just a sequential set of
commands (eg, you want to read the output in real  time), you could learn
how to use fifo pipes in linux, and the shell "read" command.

Hope that helps a little.
-Mark

On Fri, Feb 19, 2010 at 12:58 PM, Klaus Darilion <
klaus.mailinglists@pernau.at> wrote:

Hi!

For testing early media I often use pjsua with --play-file= --auto-play and
--auto-answer=183.

Is there a method to automate pjsua even more, e.g. to tell pjsua to:
wait 1 second, send 183 and early media, wait 3 seconds, send 200, wait 10
seconds, hangup.

thanks
Klaus


Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip@lists.pjsip.org
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org

Hi Klaus, it seems you've had no replies yet so I'll just add my 2c. I haven't used pjsua much so I'm not sure how much control you have over each message in the SIP dialog. However, you can automate it pretty easily on the commandline. Here's an example shell script: #!/bin/sh params="--app-log-level=3 --local-port=5060 --null-audio" dest="sip:destination@host" output=`cat commands.txt | ./pjsua $params $dest` || (echo Error: $output; exit 1); # process the $output here, for example if i want to determine whether the call was successful confirmed=`echo $output | grep -oE 'Call .*CONFIRMED'` sipcode=`echo $output | grep -oE 'reason=[0-9]+' | grep -oE '[0-9]+'` [ "$confirmed" ] && echo -n "Call succeeded" || echo -n "Call failed" echo ", SIP code=$sipcode" Then in commands.txt you can list the in-call commands you want to run. This example would be something simple: **sleep 10 q If you need to do more complicated logic than just a sequential set of commands (eg, you want to read the output in real time), you could learn how to use fifo pipes in linux, and the shell "read" command. Hope that helps a little. -Mark On Fri, Feb 19, 2010 at 12:58 PM, Klaus Darilion < klaus.mailinglists@pernau.at> wrote: > Hi! > > For testing early media I often use pjsua with --play-file= --auto-play and > --auto-answer=183. > > Is there a method to automate pjsua even more, e.g. to tell pjsua to: > wait 1 second, send 183 and early media, wait 3 seconds, send 200, wait 10 > seconds, hangup. > > thanks > Klaus > > _______________________________________________ > Visit our blog: http://blog.pjsip.org > > pjsip mailing list > pjsip@lists.pjsip.org > http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org >
KD
Klaus Darilion
Mon, Mar 1, 2010 7:39 AM

Hi Mark!

Thank's for you 2c.

Using FIFOs is indeed a solution for my problem.

regards
Klaus

Am 23.02.2010 14:07, schrieb Mark Webster:

Hi Klaus, it seems you've had no replies yet so I'll just add my 2c.

I haven't used pjsua much so I'm not sure how much control you have over
each message in the SIP dialog. However, you can automate it pretty
easily on the commandline. Here's an example shell script:

#!/bin/sh
params="--app-log-level=3 --local-port=5060 --null-audio"
dest="sip:destination@host"
output=cat commands.txt | ./pjsua $params $dest || (echo Error:
$output; exit 1);

process the $output here, for example if i want to determine whether

the call was successful
confirmed=echo $output | grep -oE 'Call .*CONFIRMED'
sipcode=echo $output | grep -oE 'reason=[0-9]+' | grep -oE '[0-9]+'
[ "$confirmed" ] && echo -n "Call succeeded" || echo -n "Call failed"
echo ", SIP code=$sipcode"

Then in commands.txt you can list the in-call commands you want to run.
This example would be something simple:
//sleep 10
q

If you need to do more complicated logic than just a sequential set of
commands (eg, you want to read the output in real  time), you could
learn how to use fifo pipes in linux, and the shell "read" command.

Hope that helps a little.
-Mark

On Fri, Feb 19, 2010 at 12:58 PM, Klaus Darilion
<klaus.mailinglists@pernau.at mailto:klaus.mailinglists@pernau.at> wrote:

 Hi!

 For testing early media I often use pjsua with --play-file=
 --auto-play and --auto-answer=183.

 Is there a method to automate pjsua even more, e.g. to tell pjsua to:
 wait 1 second, send 183 and early media, wait 3 seconds, send 200,
 wait 10 seconds, hangup.

 thanks
 Klaus

 _______________________________________________
 Visit our blog: http://blog.pjsip.org

 pjsip mailing list
 pjsip@lists.pjsip.org <mailto:pjsip@lists.pjsip.org>
 http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org

Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip@lists.pjsip.org
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org

Hi Mark! Thank's for you 2c. Using FIFOs is indeed a solution for my problem. regards Klaus Am 23.02.2010 14:07, schrieb Mark Webster: > Hi Klaus, it seems you've had no replies yet so I'll just add my 2c. > > I haven't used pjsua much so I'm not sure how much control you have over > each message in the SIP dialog. However, you can automate it pretty > easily on the commandline. Here's an example shell script: > > #!/bin/sh > params="--app-log-level=3 --local-port=5060 --null-audio" > dest="sip:destination@host" > output=`cat commands.txt | ./pjsua $params $dest` || (echo Error: > $output; exit 1); > > # process the $output here, for example if i want to determine whether > the call was successful > confirmed=`echo $output | grep -oE 'Call .*CONFIRMED'` > sipcode=`echo $output | grep -oE 'reason=[0-9]+' | grep -oE '[0-9]+'` > [ "$confirmed" ] && echo -n "Call succeeded" || echo -n "Call failed" > echo ", SIP code=$sipcode" > > > Then in commands.txt you can list the in-call commands you want to run. > This example would be something simple: > //sleep 10 > q > > If you need to do more complicated logic than just a sequential set of > commands (eg, you want to read the output in real time), you could > learn how to use fifo pipes in linux, and the shell "read" command. > > Hope that helps a little. > -Mark > > On Fri, Feb 19, 2010 at 12:58 PM, Klaus Darilion > <klaus.mailinglists@pernau.at <mailto:klaus.mailinglists@pernau.at>> wrote: > > Hi! > > For testing early media I often use pjsua with --play-file= > --auto-play and --auto-answer=183. > > Is there a method to automate pjsua even more, e.g. to tell pjsua to: > wait 1 second, send 183 and early media, wait 3 seconds, send 200, > wait 10 seconds, hangup. > > thanks > Klaus > > _______________________________________________ > Visit our blog: http://blog.pjsip.org > > pjsip mailing list > pjsip@lists.pjsip.org <mailto:pjsip@lists.pjsip.org> > http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org > > > > > _______________________________________________ > Visit our blog: http://blog.pjsip.org > > pjsip mailing list > pjsip@lists.pjsip.org > http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org