<html><div style='background-color:'><DIV class=RTE>
<P><FONT style="FONT-SIZE: 11px; FONT-FAMILY: tahoma,sans-serif">From: <I>Mitch Thompson <mitchthompson@satx.rr.com></I><BR>>I'm looking for some help from any Asterisk "heavy" who might be <BR>>doing something similar to what I'm trying to do...<BR>><BR>>Background:<BR>><BR>>I work for a research lab, testing telephony products and tools. <BR>>Historically, we used Ameritec Crescendos and Fortissimos to act as <BR>>load generators and call "sinks" when testing equipment. However, <BR>>the equipment we are testing gets more and more complex, and the <BR>>scripted scenarios the Ameritecs give have become a limiting factor <BR>>for testing. Therefore, Asterisk was chosen as a possible solution <BR>>(we're a cheap lab).<BR></FONT></P>
<P><FONT style="FONT-SIZE: 11px; FONT-FAMILY: tahoma,sans-serif">Mitch,</P></FONT>
<P><FONT style="FONT-SIZE: 11px; FONT-FAMILY: tahoma,sans-serif">I had exposure to both Ameritec and Hammer, and see how Ameritec could be limiting. But using a PBX as a test tool doesn't sound very sound even for a cheap lab, especially for load test. Race condition is just one side of the problem. You also have to spend a lot of time programming the PBX to do what test tools are designed to do. Have you looked into Sprient? They boast the highest density per $ in PSTN land but I don't know the scripting capability.</FONT></P>
<P><FONT style="FONT-SIZE: 11px; FONT-FAMILY: tahoma,sans-serif">Back to your condition. You can replace cat with test in priority 1 to reduce time consumed by the first system call by half, thus theoretically speed up branching to priority 102. But the bottleneck is likely in Asterisk's branch codes. Hence even if the system call takes no time, even if you store stuff in memory, you are still going to run into race conditions.</FONT></P>
<P>Yuan Liu</P>
<P><FONT style="FONT-SIZE: 11px; FONT-FAMILY: tahoma,sans-serif">>I've been learning Asterisk as I go, but I've learned a lot. Here's <BR>>the basic scenario:<BR>><BR>>We are using an Asterisk (AAH 2.8, specifically) to sink calls. I <BR>>do this by taking the ${EXTEN} and breaking it down by sections <BR>>until I get to the last 4 digits (i.e., 2105551212). Once I get to <BR>>the 4-digit extension, I am trying to set a flag, or semaphore, to <BR>>do Busy/Idle testing. Here is my extensions_custom.conf fragment:<BR>><BR>><BR>>[SATX_555_Extensions]<BR>><BR>>exten => 1212,1,System(cat /tmp/{orig_num}) ; ${orig_num} is set at <BR>>the beginning of [from-trunk-custom] to the full dialed digits in <BR>>${EXTEN}, before I break it down.<BR>>exten => 1212,n,Busy(); if the file exists,
someone else has already <BR>>called this number, return busy<BR>><BR>>exten => 1212,102,System(echo ${UNIQUEID} > /tmp/${orig_num}) ; <BR>>basically, create a file in /tmp whose name is the full number from <BR>>the beginning. In this case, the full<BR>>
<BR>> ; filename would be <BR>>/tmp/2105551212. I don't really care about the contents, though.<BR>>exten => 1212,103, Goto(Idle,1) ; from here, we jump to a new <BR>>extension called Idle, where we do a Random to decide whether to <BR>>simulate no one home (ring no answer) or<BR>> ; we send ring
<BR>>for about 10 seconds, then Answer() and play some .wav files, then <BR>>hangup. The last thing we do in either case is to delete<BR>> ; the <BR>>/tmp/${orig_num} file.<BR>><BR>>The above code works very well at low call volumes. However, I'm <BR>>running into race conditions at high call volumes where several <BR>>calls are getting through the test in priority 1 before the file is <BR>>created in priority 102 (n+101).<BR>><BR>>I've tried to implement semaphores by using both local and global <BR>>variables, but it
doesn't seem to work.<BR>><BR>>My ultimate question: Is anyone doing something similar, and what <BR>>did you do to implement the busy/idle.<BR>><BR>>I appreciate any help anyone can offer.<BR>><BR>>Mitch Thompson<BR></P></DIV></FONT></div></html>