Asterisk Call File Bulk Call

Hi everyone,

I am trying to use Call File on Asterisk by providing ~/.call in my /lib/spool/asterisk/outgoing directory, but my goal is to test how many channels my Asterisk server can handle by providing virtual endpoints to make it similar to real scenario. I can test bulk calls using my stasis application but the problem is I get the events as one channel ringing and the rest will all be busy. Please tell me if my call file can achieve bulk calls on asterisk server.

Channel: PJSIP/6003/6003
MaxRetries: 2
RetryTime: 60
WaitTime: 30
Context: call_file
Extension: 6012


exten => _XX.,1,Ringing()
same => n,Dial(PJSIP/${EXTEN},2)
same => n,Wait(3)
same => n,Hangup()

Hello Amin,
I am not sure perhaps you can check the NAT configuration. May be in pjsip.conf you have to enable rewrite_contact =yes and ice =yes in the endpoints.

I don’t really understand what you mean by virtual channel.

In most cases the Asterisk daemon is limited by media rather than signalling, so if a virtual channel doesn’t have media, it is not a good test.

Why are you including a 3 second wit after a failed call? I’m wondering if you think that Dial exits as soon as dialing ends; it actually continues until one party hangs up, or the call fails. In the former case, unless specific options are set, it “returns non-zero” which causes the dialplan interpreter to stop.

Hello david,

My friend told me that using call files you can call as many endpoints as you like, even if they are not configured on pjsip.conf, this way we consider them as virtual endpoints and we can test how many channels are opening on my Asterisk server.

Hello Tito,

I will check these commands and apply them if needed, thank you.

PJSIP wlll fail calls to missing endpoints whether they originate via Dial() or via all files.

Similarly, if the end point is itself a telephony switch, it can accept dialed digits, for onward routing, from either source.

you can call any endpoint using callfile, same way as Dial() from dialpan,
by using correct SIP uri:

it will usee default options to send the call.

best results of your tests if when you have several external SIP servers 

(asterisk or any other SIP gateways ), and distribute calls by random
selection of EP.

I could not get more then 5 new calls per second ( 5 cps ) on asterisk 

with medium hardware (8GB RAM,i5 CPU)

moved to sipp tool, which could make 20cps (with streaming rtp from file 

), the best tool to test perfomance.

That is for chan_sip. PJSIP requires an endpoint. chan_sip doesn’t use the term “endpoint”.

For PJSIP, you have to use PJSIP/12543@192.l168.1.1:5060

In any case calling a non-existent destination will generate a failed, which is unlikely to use as much in the way of resources as a good one.

Thank you for your clarification @david551 regarding using PJSIP for callfiles. I assume I cannot test my server unless I use SIPP performance tool as stress testing my asterisk server is a major concern. My issue here is that I am trying to originate 2000 calls to my stasis application to make it similar to real life scenario but I am receiving the events one-by-one which is unlikely the case when the server is in production. I am expecting the calls or the events to process altogether and not receive them one-by-one. Please bear with me while I explain more in depth using an example:

As you can see the Channels are coming one-by-one and not altogether, that is why I need a test that can confirm that all calls that come through my stasis application and asterisk server arrive at the same time to test if my server can handle the traffic, keep in mind that here I am calling one endpoint on one phone

Here is the API that I am hitting to achieve this if it helps:

“object”: [
“source”: “971508268242”,
“destination”: “6003”,
“retryAttempts”: 1,
“secondsBeforeHangUp”: 3,
“applyBeepOnceBusyEnd”: true
“broker”: “call.input”,
“count”: 2000,
“publishAsList”: false

While testing with SIPP tool i noticed that there are active calls on my Asterisk server which I assume it can be a functional test for my server in terms of traffic load, here are the results:

PJSIP/sipp-00000187 700@sipp:1 Ring MusicOnHold()
PJSIP/sipp-00000180 700@sipp:1 Ring MusicOnHold()
950 active channels
950 of 1000 max active calls (95.00% of capacity)
950 calls processed

------------------------------ Scenario Screen -------- [1-9]: Change Screen –
Call-rate(length) Port Total-time Total-calls Remote-host
10.0(5000000 ms)/1.000s 5061 356.89 s 950 10.321.45.123:5120(UDP)

0 new calls during 1.007 s period 0 ms scheduler resolution
950 calls (limit 950) Peak was 950 calls, after 95 s
1 Running, 951 Paused, 3 Woken up
0 dead call msg (discarded) 0 out-of-call msg (discarded)
3 open sockets
0 Total echo RTP pckts 1st stream 0.000 last period RTP rate (kB/s)
0 Total echo RTP pckts 2nd stream 0.000 last period RTP rate (kB/s)

                             Messages  Retrans   Timeout   Unexpected-Msg
  INVITE ---------->         950       0         0                  
     100 <----------         950       0         0         0        
     180 <----------         0         0         0         0        
     183 <----------         0         0         0         0        
     200 <----------  E-RTD1 0         0         0         0        
     ACK ---------->         0         0                            
   Pause [  1:23:20]         0                             0        
     BYE ---------->         0         0         0                  
     200 <----------         0         0         0         0        

------ [+|-|*|/]: Adjust rate ---- [q]: Soft exit ---- [p]: Pause traffic -----

Have you configured SIPP to send RTP?

I have only used it for functional testing, not performance testing, so I’m not familiar with the details of simulating media.

I will test with RTP media and I will test another SIPP to listen to the calls and then update here.

Here is mine example of sipp to send calls RTP media:


You can get different RTP files : ,
which I’ve found and converted from wav using wav2rtp cli app.
( concatenate files to get longer duration )

This part of scenario makes the streaming of RTP :

To start just one call for test, with certain CallerID and destination
number, I used info files, and run it with command:

sipp -sf ./call.xml -inf ./cli/986533.csv -s 123456 -l 1 -m 1
-d 5000 -trace_logs -trace_msg -default_behaviors all -recv_timeout 5000
-cp 15762 -mp 34390 -aa

where - remote asterisk server.
-s 123456 - CallerID number
-recv_timeout - SIPP send call, and giving up if no answer during
first 5 sec
-d : max call duration of connected call./

The file cli/986533.csv has only two lines, and used in scenario as field0
( thats the only way to put Source Caller ID which I’ve found for sipp )

it was required to get a real duration of the call once it completed ( if
not connected - return 0 ), for billing. so this just a part of all script
which I’ve made for it.

The “bottle-neck” was how many connection per second asterisk is able to
i,e. if I generate longer duration calls ( 5 minutes ), 10 new call per
second - it could grow up to max 3000 concurrent calls on 1GB NIC card , it
made almost 250MBit/s of one way traffic (from sipp to asterisk ) .
if generate 20 calls per second, with 2m duration, asterisk dies (core
dump) after ~1000 concurrent calls ( while max should be 2400 with this
call rate!!)


Sorry for late reply but here are my results with sending calls RTP media. I assume I can conclude that my personal machine can hold up to 20 calls maximum?

sipp -sf /opt/sipp-3.3/sipp-scenarios/uac_pcap.xml -d 5000s -s 700 asterisk-ip -l 950 -r 10 -trace_err -error_file sipperror


exten => 700,1,Answer()
same => n,Playback(hello-world)
same => n,Hangup()

core show channels:

Channel Location State Application(Data)
PJSIP/sipp-00000573 700@rtp:1 Up Answer()
PJSIP/sipp-00000572 700@rtp:1 Up Answer()
PJSIP/sipp-00000571 700@rtp:1 Up Answer()
PJSIP/sipp-00000570 700@rtp:1 Up Answer()
PJSIP/sipp-00000568 700@rtp:2 Up Playback(hello-world)
PJSIP/sipp-00000569 700@rtp:2 Up Playback(hello-world)
PJSIP/sipp-00000566 700@rtp:2 Up Playback(hello-world)
PJSIP/sipp-00000567 700@rtp:2 Up Playback(hello-world)
PJSIP/sipp-00000564 700@rtp:2 Up Playback(hello-world)
PJSIP/sipp-00000565 700@rtp:2 Up Playback(hello-world)
PJSIP/sipp-00000562 700@rtp:2 Up Playback(hello-world)
PJSIP/sipp-00000563 700@rtp:2 Up Playback(hello-world)
PJSIP/sipp-00000561 700@rtp:2 Up Playback(hello-world)
PJSIP/sipp-0000056f 700@rtp:1 Up Answer()
PJSIP/sipp-0000056d 700@rtp:2 Up Playback(hello-world)
PJSIP/sipp-0000056e 700@rtp:2 Up Playback(hello-world)
PJSIP/sipp-0000056b 700@rtp:2 Up Playback(hello-world)
PJSIP/sipp-0000056c 700@rtp:2 Up Playback(hello-world)
PJSIP/sipp-0000056a 700@rtp:2 Up Playback(hello-world)
19 active channels
19 of 1000 max active calls ( 1.90% of capacity)
1794 calls processed


------------------------------ Scenario Screen -------- [1-9]: Change Screen –
Call-rate(length) Port Total-time Total-calls Remote-host
10.0(5000000 ms)/1.000s 5061 179.35 s 1793 (UDP)

10 new calls during 1.002 s period 0 ms scheduler resolution
19 calls (limit 950) Peak was 20 calls, after 2 s
1 Running, 20 Paused, 4 Woken up
0 dead call msg (discarded) 0 out-of-call msg (discarded)
3 open sockets
111938 Total RTP pckts sent 157.942 last period RTP rate (kB/s)

                             Messages  Retrans   Timeout   Unexpected-Msg
  INVITE ---------->         1793      0         0                  
     100 <----------         1793      0         0         0        
     180 <----------         0         0         0         0        
     200 <----------  E-RTD1 1793      0         0         0        

     ACK ---------->         1793      0                            
          [ NOP ]              
   Pause [   8000ms]         1793                          1774     
          [ NOP ]              
   Pause [   1000ms]         0                             0        
     BYE ---------->         0         0         0                  
     200 <----------         0         0         0         0        

------ [+|-|*|/]: Adjust rate ---- [q]: Soft exit ---- [p]: Pause traffic -----

Last Error: Aborting call on an unexpected BYE for call: 1774-154866@…