Connecting Asterisk boxes with SIP

Hello

I am planning to do some performance testing on my Asterisk box, and I am planning to use a couple Asterisk boxes as traffic generators that are connected to the main test server via SIP. In order to simulate the traffic and CPU/memory load of processing a lot of SIP Register messages of connected SIP peers (allong with the load of active calls), I set up the Main Test Asterisk server as SIP Server and Traffic Generator Asterisk boxes as SIP Client (for simulation of SIP clients). These are the SIP config files for the first test setup (3 SIP clients, Main Test server and one Traffic Generator).

Main Test server :

bindport=5060
bindaddr=0.0.0.0
srvlookup=no
defaultexpiry=600

[accounts](!)
type=friend
context=test_calls
host=dynamic
disallow=all
allow=alaw
allow=ulaw
dtmfmode=inband
qualify=yes
call-limit=5
canreinvite=no
nat=no
defaultexpiry=600
insecure=no

[1000](accounts)
secret=1000
callerid=1000<1000>

[1001](accounts)
secret=1001
callerid=1001<1001>

[1002](accounts)
secret=1002
callerid=1002<1002>

Traffic Generator server:

[general]
bindport=5060
bindaddr=0.0.0.0
srvlookup=no
defaultexpiry=600

register => 1000:1000@192.168.99.230/1000
register => 1001:1001@192.168.99.230/1001
register => 1002:1002@192.168.99.230/1002

[accounts](!)
type=peer
context=test_calls
host=192.168.99.230
disallow=all
allow=alaw
allow=ulaw
dtmfmode=inband
qualify=yes
call-limit=5
canreinvite=no
nat=no
defaultexpiry=600
insecure=no

[1000](accounts)
username=1000
secret=1000
callerid=1000<1000>

[1001](accounts)
username=1001
secret=1001
callerid=1001<1001>

[1002](accounts)
username=1002
secret=1002
callerid=1002<1002>

The main problem that I have are the SIP OPTIONS meesages that are exchanged between Asterisk boxes because of “qualify=yes”. This is the debug of the communication (Main Test server - 192.168.99.230, Traffc Generator server - 192.168.99.233):

SIP Debugging Enabled for IP: 192.168.99.230
Reliably Transmitting (no NAT) to 192.168.99.230:5060:
OPTIONS sip:192.168.99.230 SIP/2.0
Via: SIP/2.0/UDP 192.168.99.233:5060;branch=z9hG4bK322e2d12
Max-Forwards: 70
From: "asterisk" <sip:asterisk@192.168.99.233>;tag=as6c633483
To: <sip:192.168.99.230>
Contact: <sip:asterisk@192.168.99.233:5060>
Call-ID: 0d4d1a405293b8f57ad3e73e1e7237af@192.168.99.233:5060
CSeq: 102 OPTIONS
User-Agent: Asterisk PBX 1.8.1.1
Date: Wed, 12 Jan 2011 19:23:18 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Content-Length: 0


---

<--- SIP read from UDP:192.168.99.230:5060 --->
SIP/2.0 404 Not Found
Via: SIP/2.0/UDP 192.168.99.233:5060;branch=z9hG4bK322e2d12;received=192.168.99.233
From: "asterisk" <sip:asterisk@192.168.99.233>;tag=as6c633483
To: <sip:192.168.99.230>;tag=as4480ce0e
Call-ID: 0d4d1a405293b8f57ad3e73e1e7237af@192.168.99.233:5060
CSeq: 102 OPTIONS
Server: Asterisk PBX 1.6.2.0
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO
Supported: replaces, timer
Accept: application/sdp
Content-Length: 0

------------->
--- (11 headers 0 lines) ---
Really destroying SIP dialog '0d4d1a405293b8f57ad3e73e1e7237af@192.168.99.233:5060' Method: OPTIONS
Reliably Transmitting (no NAT) to 192.168.99.230:5060:
OPTIONS sip:192.168.99.230 SIP/2.0
Via: SIP/2.0/UDP 192.168.99.233:5060;branch=z9hG4bK5f54e364
Max-Forwards: 70
From: "asterisk" <sip:asterisk@192.168.99.233>;tag=as7bc10e98
To: <sip:192.168.99.230>
Contact: <sip:asterisk@192.168.99.233:5060>
Call-ID: 7dc4f1371060034339313aff56da851c@192.168.99.233:5060
CSeq: 102 OPTIONS
User-Agent: Asterisk PBX 1.8.1.1
Date: Wed, 12 Jan 2011 19:23:18 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Content-Length: 0


---
Reliably Transmitting (no NAT) to 192.168.99.230:5060:
OPTIONS sip:192.168.99.230 SIP/2.0
Via: SIP/2.0/UDP 192.168.99.233:5060;branch=z9hG4bK181192cf
Max-Forwards: 70
From: "asterisk" <sip:asterisk@192.168.99.233>;tag=as1ae1c71f
To: <sip:192.168.99.230>
Contact: <sip:asterisk@192.168.99.233:5060>
Call-ID: 6e5d96060035cfec1f46a2647eb3d2ee@192.168.99.233:5060
CSeq: 102 OPTIONS
User-Agent: Asterisk PBX 1.8.1.1
Date: Wed, 12 Jan 2011 19:23:18 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Content-Length: 0


---

<--- SIP read from UDP:192.168.99.230:5060 --->
SIP/2.0 404 Not Found
Via: SIP/2.0/UDP 192.168.99.233:5060;branch=z9hG4bK5f54e364;received=192.168.99.233
From: "asterisk" <sip:asterisk@192.168.99.233>;tag=as7bc10e98
To: <sip:192.168.99.230>;tag=as1448e622
Call-ID: 7dc4f1371060034339313aff56da851c@192.168.99.233:5060
CSeq: 102 OPTIONS
Server: Asterisk PBX 1.6.2.0
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO
Supported: replaces, timer
Accept: application/sdp
Content-Length: 0

------------->
--- (11 headers 0 lines) ---
Really destroying SIP dialog '7dc4f1371060034339313aff56da851c@192.168.99.233:5060' Method: OPTIONS

<--- SIP read from UDP:192.168.99.230:5060 --->
SIP/2.0 404 Not Found
Via: SIP/2.0/UDP 192.168.99.233:5060;branch=z9hG4bK181192cf;received=192.168.99.233
From: "asterisk" <sip:asterisk@192.168.99.233>;tag=as1ae1c71f
To: <sip:192.168.99.230>;tag=as2d88b8ec
Call-ID: 6e5d96060035cfec1f46a2647eb3d2ee@192.168.99.233:5060
CSeq: 102 OPTIONS
Server: Asterisk PBX 1.6.2.0
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO
Supported: replaces, timer
Accept: application/sdp
Content-Length: 0

------------->
--- (11 headers 0 lines) ---
Really destroying SIP dialog '6e5d96060035cfec1f46a2647eb3d2ee@192.168.99.233:5060' Method: OPTIONS

<--- SIP read from UDP:192.168.99.230:5060 --->
OPTIONS sip:1002@192.168.99.233:5060 SIP/2.0
Via: SIP/2.0/UDP 192.168.99.230:5060;branch=z9hG4bK1673fa45;rport
Max-Forwards: 70
From: "asterisk" <sip:asterisk@192.168.99.230>;tag=as3490f1c0
To: <sip:1002@192.168.99.233:5060>
Contact: <sip:asterisk@192.168.99.230>
Call-ID: 1325c5de12b7e248644db9316f6afe72@192.168.99.230
CSeq: 102 OPTIONS
User-Agent: Asterisk PBX 1.6.2.0
Date: Wed, 12 Jan 2011 21:23:56 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO
Supported: replaces, timer
Content-Length: 0

<------------->
--- (13 headers 0 lines) ---
Looking for 1002 in default (domain 192.168.99.233:5060)

<--- Transmitting (no NAT) to 192.168.99.230:5060 --->
SIP/2.0 404 Not Found
Via: SIP/2.0/UDP 192.168.99.230:5060;branch=z9hG4bK1673fa45;rport;received=192.168.99.230
From: "asterisk" <sip:asterisk@192.168.99.230>;tag=as3490f1c0
To: <sip:1002@192.168.99.233:5060>;tag=as4f64373a
Call-ID: 1325c5de12b7e248644db9316f6afe72@192.168.99.230
CSeq: 102 OPTIONS
Server: Asterisk PBX 1.8.1.1
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Accept: application/sdp
Content-Length: 0


<------------>
Scheduling destruction of SIP dialog '1325c5de12b7e248644db9316f6afe72@192.168.99.230' in 32000 ms (Method: OPTIONS)

<--- SIP read from UDP:192.168.99.230:5060 --->
OPTIONS sip:1001@192.168.99.233:5060 SIP/2.0
Via: SIP/2.0/UDP 192.168.99.230:5060;branch=z9hG4bK41e530e3;rport
Max-Forwards: 70
From: "asterisk" <sip:asterisk@192.168.99.230>;tag=as61f987ca
To: <sip:1001@192.168.99.233:5060>
Contact: <sip:asterisk@192.168.99.230>
Call-ID: 58f271d5652a87700966bdd209ad2a00@192.168.99.230
CSeq: 102 OPTIONS
User-Agent: Asterisk PBX 1.6.2.0
Date: Wed, 12 Jan 2011 21:23:56 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO
Supported: replaces, timer
Content-Length: 0

<------------->
--- (13 headers 0 lines) ---
Looking for 1001 in default (domain 192.168.99.233:5060)

<--- Transmitting (no NAT) to 192.168.99.230:5060 --->
SIP/2.0 404 Not Found
Via: SIP/2.0/UDP 192.168.99.230:5060;branch=z9hG4bK41e530e3;rport;received=192.168.99.230
From: "asterisk" <sip:asterisk@192.168.99.230>;tag=as61f987ca
To: <sip:1001@192.168.99.233:5060>;tag=as6d2146c9
Call-ID: 58f271d5652a87700966bdd209ad2a00@192.168.99.230
CSeq: 102 OPTIONS
Server: Asterisk PBX 1.8.1.1
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Accept: application/sdp
Content-Length: 0

Here you can clearly see the SIP OPTION messges that are exchaned between the servers (are initiated by both servers separately). If the SIP OPTION is initiated from the Traffic Generator SIP server, the FROM header is a bit strange (To: sip:192.168.99.230), but if the SIP OPTION is initiated from the Main Test server, the FROM header is a bit more loggical (To: sip:1002@192.168.99.233:5060). Is this OK, or should both FOM headers be in a form To: sip:ext@server_ip:port.

I do not understand why the reply of the SIP OPTION messages is 404 Not Found, but I bet that that is the reason that after the SIP OPTION/404 messages are exchanged, I see some strange SIP Channels with “sip show channels” command on both servers:

Main Test Server:

sip show channels
Peer             User/ANR         Call ID          Format           Hold     Last Message    Expiry     Peer
192.168.99.230   (None)           7c56a01c2c705bb  0x0 (nothing)    No       Rx: OPTIONS                <guest>
192.168.99.230   (None)           742375cf74ea3b2  0x0 (nothing)    No       Rx: OPTIONS                <guest>
192.168.99.230   (None)           71f2c57e6a26ed6  0x0 (nothing)    No       Rx: OPTIONS                <guest>
3 active SIP dialogs

Traffice Generator Server:

sip show channels
Peer             User/ANR    Call ID          Format           Hold     Last Message    Expiry
192.168.99.233   (None)      2f8f7f91038a1d3  0x0 (nothing)    No       Rx: OPTIONS
192.168.99.233   (None)      76175329242c7c9  0x0 (nothing)    No       Rx: OPTIONS
192.168.99.233   (None)      002732801b269f4  0x0 (nothing)    No       Rx: OPTIONS
3 active SIP dialogs

To make a long story a bit shorter, has someone any suggestion for the settings that would mean that qualify=yes messagins would be like this?:

1. SIP OPTIONS -> server
2. SIP OK <-server

Does anyone have an explanation about the SIP channels being up even though there are no active calls on the PBX?

The reason I am getting into details about this is that I got some strange results on the first perfomance test (Asterisk crash after about 65 concurrent calls (does not matter if I simulate 500, 1000 or 2000 active peers on the main server with traffic generators)), and I think it has something to do with the active SIP channels because of problematic qualify=yes operation …

I think that there must be a way for interconnecting two Asterisk servers in SIP Server - Client setup in a way that the SIP Options messages are replyed with OK. If nobody here has a clear answer to this question, could you atleast point me to a direction that I can explore in?