开发者

sipp generate random string in scenario

I have created a program that uses sipp for sip trafic generation. would like to generate a random numver for the destination randomly and at run time without injecting from external csv. Currently I am doing the same for the originator using the [service] command. Is there another command I can use from comma开发者_如何学Cn line? Can I generate a random number from inside the scenario?


I don't think it is possible to make SIPp directly generate a random number. But if you have access to common Unix utilities, you can provide it via the command line.

But I am not sure what you want to do.

If you want to perform one call, you can provide the random destination in the command line thanks to set command line parameter.

Example:

mydest=`n=8; rand -M $((10**${n})) | awk "{ printf(\"%0${n}u\", \\$1) }"`
sipp ... -set service_route mydest $mydest

(replace n=8 by the number of digits you want. If you don't want a fixed number of digits, just remove the awk part)

Then you declare your variable at the beginning of your SIPp script:

<Global variables="mydest" />
<Reference variables="mydest" />

Afterwards you can place it in SIP messages by using [$mydest].

But if you want to perform lots of calls from the same SIPp launch, you can generate on the fly a CSV file with random numbers.

Example:

n=8; echo "RANDOM" > zrandom; rand -e -N 1000000 -d "\n" -M $((10**${n})) | awk "{ printf(\"%0${n}u\n\", \$1) }" >> zrandom
sipp ... -inf zrandom

(same remark: replace n=8 by the number of digits you want. If you don't want a fixed number of digits, just remove the awk part)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜