hi all,
i have configure carrierroute in kamailio as bellow.
=========
kamailio.cfg
===
route[1] {
# route calls based on hash over callid
# choose route domain 0 of the default carrier
if(!cr_route("default", "default", "$rU", "$rU", "call_id")){
sl_send_reply("403", "Not allowed");
} else {
# In case of failure, re-route the
request
t_on_failure("1");
# Relay the request to the gateway
t_relay();
}
}
failure_route[1] {
# In case of failure, send it to an alternative route:
if (t_check_status("408|5[0-9][0-9]")) {
#choose route domain 1 of the default carrier
if(!cr_route("default", "default", "$rU", "$rU", "call_id")){
} else {
xlog("failure
2");
t_on_failure("2");
t_relay();
}
}
}
=========\
in database:
mysql> select * from carrierroute;
+----+---------+--------+-------------+-------+------+------+-------+--------------+----------------+----------------+-------------+
| id | carrier | domain | scan_prefix | flags | mask | prob | strip | rewrite_host | rewrite_prefix | rewrite_suffix | description |
+----+---------+--------+-------------+-------+------+------+-------+--------------+----------------+----------------+-------------+
| 1
| 1 | 1 | 1000 | 0 | 0 | 1 | 0 | 192.168.1.42 | | | FRANCE |
+----+---------+--------+-------------+-------+------+------+-------+--------------+----------------+----------------+-------------+
1 row in set (0.00 sec)
mysql> select * from carrier_name;
+----+---------+
| id | carrier |
+----+---------+
| 1 | default |
+----+---------+
mysql> select * from domain_name;
+----+---------+
| id | domain |
+----+---------+
| 1 | default |
+----+---------+
================
in server 192.168.1.40
: subscriber table:
mysql> select * from subscriber;
+----+----------+--------------+----------+---------------+----------------------------------+----------------------------------+------+
| id | username | domain | password | email_address | ha1 | ha1b | rpid |
+----+----------+--------------+----------+---------------+----------------------------------+----------------------------------+------+
| 1 | 1 | 192.168.1.40 | 1
| | b8ee4a7080092d7fd27357de1799b111 | d1343e4f0259199ed6b06d6338d39903 | NULL |
| 2 | 2 | 192.168.1.40 | 2 | | 25f61f90a19afe508629127838c11509 | 7f4ec87f39f48d0d8f8a537cfc34c5c9 | NULL |
| 3 | 3 | kamailio.com | 3 | | 63a131bf02b4123073970731a4525470 | 64e49a4f89317c5ee757ba0366ec9307 | NULL |
| 4 | 1000 | 192.168.1.40 | 1000 | | 8e9f00da8e49cc8b844b6cee1752b949 |
2bff4783b0ce3412bf33e7400fbbedce | NULL |
| 5 | 4 | 192.168.1.40 | 4 | | 037cf4277ce31c104e4b1bc7bbcf8ad4 | cb2321d9ac8bfe749cedc1d66cad5d73 | NULL |
| 6 | 1 | kamailio.com | 1 | | 31fb6891a2fcb9b13a952ce3f12359c9 | 84add6cffd100f8ca3c8660c3c9617b5 | NULL |
| 7 | 1 | 192.168.1.42 | 1 | | ad57b2abdf288984bc4a897a9e7f2ba9 | 60b9ab690724e5a535df794131e2345f | NULL |
| 8 | 1000 | 192.168.1.42 |
1000 | | 0a9fb3a1de135a32b9090798a0dcb240 | bf5a95934a59b480dbf85abe386144b6 | NULL |
+----+----------+--------------+----------+---------------+----------------------------------+----------------------------------+------+
I try to make call from 1@192.168.1.40 to 1000@192.168.1.42
but the call failed.
sip client 1@192.168.1.40 show that : server failure
and sip client 1000@192.168.1.42 ringing.
============
sip trace for 192.168.1.40:
U 192.168.1.40:5060 -> 192.168.1.42:5060
INVITE sip:1000@192.168.1.42 SIP/2.0.
Record-Route: <sip:192.168.1.40;lr=on>.
Via: SIP/2.0/UDP 192.168.1.40;branch=z9hG4bKf92a.649f39e3.0.
Via: SIP/2.0/UDP 192.168.1.10:50495;branch=z9hG4bK-d8754z-ec188605061deb73-1---d8754z-;rport=50495.
Max-Forwards: 69.
Contact:
<sip:1@192.168.1.10:50495;rinstance=9a88ebaf62e2a935>.
To: <sip:1000@192.168.1.40:5060>.
From: <sip:1@192.168.1.40:5060>;tag=fd3fe92e.
Call-ID: MmNjYTZjMjNmOWZkN2RkZWE3NWUxOWZlNWUyOTY3ZmM..
CSeq: 2 INVITE.
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REGISTER, SUBSCRIBE, NOTIFY, REFER, INFO.
Content-Type: application/sdp.
Supported: replaces.
User-Agent: 3CXPhone 4.0.10858.0.
Content-Length: 279.
.
v=0.
o=3cxVCE 96031755 384028260 IN IP4 192.168.1.10.
s=3cxVCE Audio Call.
c=IN IP4 192.168.1.10.
t=0 0.
m=audio 40002 RTP/AVP 0 8 3 101.
a=rtpmap:0 PCMU/8000.
a=rtpmap:8 PCMA/8000.
a=rtpmap:3 GSM/8000.
a=rtpmap:101 telephone-event/8000.
a=fmtp:101 0-15.
a=ptime:20.
a=sendrecv.
U 192.168.1.40:5060 -> 192.168.1.10:50495
SIP/2.0 500 I'm terribly sorry, server error occurred (6/SL).
Via: SIP/2.0/UDP
192.168.1.10:50495;branch=z9hG4bK-d8754z-ec188605061deb73-1---d8754z-;rport=50495.
To: <sip:1000@192.168.1.40:5060>;tag=ae07808f44ebda0182a54cf170e36dbe.ba60.
From: <sip:1@192.168.1.40:5060>;tag=fd3fe92e.
Call-ID: MmNjYTZjMjNmOWZkN2RkZWE3NWUxOWZlNWUyOTY3ZmM..
CSeq: 2 INVITE.
Server: kamailio (3.0.1 (i386/linux)).
Content-Length: 0.
.
U 192.168.1.10:50495 -> 192.168.1.40:5060
ACK sip:1000@192.168.1.40:5060 SIP/2.0.
Via: SIP/2.0/UDP 192.168.1.10:50495;branch=z9hG4bK-d8754z-ec188605061deb73-1---d8754z-;rport.
Max-Forwards: 70.
To: <sip:1000@192.168.1.40:5060>;tag=ae07808f44ebda0182a54cf170e36dbe.ba60.
From: <sip:1@192.168.1.40:5060>;tag=fd3fe92e.
Call-ID: MmNjYTZjMjNmOWZkN2RkZWE3NWUxOWZlNWUyOTY3ZmM..
CSeq: 2 ACK.
Content-Length: 0.
and sip trace in 192.168.1.42:
====
U 192.168.1.40:5060 -> 192.168.1.42:5060
INVITE sip:1000@192.168.1.42
SIP/2.0.
Record-Route: <sip:192.168.1.40;lr=on>.
Via: SIP/2.0/UDP 192.168.1.40;branch=z9hG4bKc4e.5ee44227.0.
Via: SIP/2.0/UDP 192.168.1.10:50495;branch=z9hG4bK-d8754z-7e347d55637cf134-1---d8754z-;rport=50495.
Max-Forwards: 69.
Contact: <sip:1@192.168.1.10:50495;rinstance=9a88ebaf62e2a935>.
To: <sip:1000@192.168.1.40:5060>.
From: <sip:1@192.168.1.40:5060>;tag=722dc40c.
Call-ID: ZGY0YTY5YmYzM2E2MzEzNDgzODhkMTllN2RiY2ExOGM..
CSeq: 2 INVITE.
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REGISTER, SUBSCRIBE, NOTIFY, REFER, INFO.
Content-Type: application/sdp.
Supported: replaces.
User-Agent: 3CXPhone 4.0.10858.0.
Content-Length: 280.
.
v=0.
o=3cxVCE 227296140 367695825 IN IP4 192.168.1.10.
s=3cxVCE Audio Call.
c=IN IP4 192.168.1.10.
t=0 0.
m=audio 40000 RTP/AVP 0 8 3 101.
a=rtpmap:0 PCMU/8000.
a=rtpmap:8 PCMA/8000.
a=rtpmap:3 GSM/8000.
a=rtpmap:101
telephone-event/8000.
a=fmtp:101 0-15.
a=ptime:20.
a=sendrecv.
U 192.168.1.42:5060 -> 192.168.1.40:5060
SIP/2.0 100 trying -- your call is important to us.
Via: SIP/2.0/UDP 192.168.1.40;branch=z9hG4bKc4e.5ee44227.0.
Via: SIP/2.0/UDP 192.168.1.10:50495;branch=z9hG4bK-d8754z-7e347d55637cf134-1---d8754z-;rport=50495.
To: <sip:1000@192.168.1.40:5060>.
From: <sip:1@192.168.1.40:5060>;tag=722dc40c.
Call-ID: ZGY0YTY5YmYzM2E2MzEzNDgzODhkMTllN2RiY2ExOGM..
CSeq: 2 INVITE.
Server: kamailio (3.0.1 (i386/linux)).
Content-Length: 0.
.
U 192.168.1.42:5060 -> 192.168.1.10:6872
INVITE sip:1000@192.168.1.10:6872;rinstance=c308344d9524d1a4 SIP/2.0.
Record-Route: <sip:192.168.1.42;lr=on>.
Record-Route: <sip:192.168.1.40;lr=on>.
Via: SIP/2.0/UDP 192.168.1.42;branch=z9hG4bKc4e.f9fad397.0.
Via: SIP/2.0/UDP 192.168.1.40;branch=z9hG4bKc4e.5ee44227.0.
Via: SIP/2.0/UDP
192.168.1.10:50495;branch=z9hG4bK-d8754z-7e347d55637cf134-1---d8754z-;rport=50495.
Max-Forwards: 68.
Contact: <sip:1@192.168.1.10:50495;rinstance=9a88ebaf62e2a935>.
To: <sip:1000@192.168.1.40:5060>.
From: <sip:1@192.168.1.40:5060>;tag=722dc40c.
Call-ID: ZGY0YTY5YmYzM2E2MzEzNDgzODhkMTllN2RiY2ExOGM..
CSeq: 2 INVITE.
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REGISTER, SUBSCRIBE, NOTIFY, REFER, INFO.
Content-Type: application/sdp.
Supported: replaces.
User-Agent: 3CXPhone 4.0.10858.0.
Content-Length: 280.
.
v=0.
o=3cxVCE 227296140 367695825 IN IP4 192.168.1.10.
s=3cxVCE Audio Call.
c=IN IP4 192.168.1.10.
t=0 0.
m=audio 40000 RTP/AVP 0 8 3 101.
a=rtpmap:0 PCMU/8000.
a=rtpmap:8 PCMA/8000.
a=rtpmap:3 GSM/8000.
a=rtpmap:101 telephone-event/8000.
a=fmtp:101 0-15.
a=ptime:20.
a=sendrecv.
U 192.168.1.10:6872 -> 192.168.1.42:5060
SIP/2.0 180
Ringing.
Via: SIP/2.0/UDP 192.168.1.42;branch=z9hG4bKc4e.f9fad397.0.
Via: SIP/2.0/UDP 192.168.1.40;branch=z9hG4bKc4e.5ee44227.0.
Via: SIP/2.0/UDP 192.168.1.10:50495;branch=z9hG4bK-d8754z-7e347d55637cf134-1---d8754z-;rport=50495.
Record-Route: <sip:192.168.1.42;lr>.
Record-Route: <sip:192.168.1.40;lr=on>.
Contact: <sip:1000@192.168.1.10:6872;rinstance=c308344d9524d1a4>.
To: <sip:1000@192.168.1.40:5060>;tag=660be63a.
From: <sip:1@192.168.1.40:5060>;tag=722dc40c.
Call-ID: ZGY0YTY5YmYzM2E2MzEzNDgzODhkMTllN2RiY2ExOGM..
CSeq: 2 INVITE.
User-Agent: PortGo v6.0, Build 07282010.
Content-Length: 0.
========================
and in server 192.168.1.42:subscriber table:
mysql> select * from subscriber;
+----+----------+--------------+----------+---------------+----------------------------------+----------------------------------+------+
| id | username | domain | password | email_address |
ha1 | ha1b |
rpid |
+----+----------+--------------+----------+---------------+----------------------------------+----------------------------------+------+
| 1 | 1000 | 192.168.1.42 | 1000 | |
0a9fb3a1de135a32b9090798a0dcb240 | bf5a95934a59b480dbf85abe386144b6 |
NULL |
| 2 | 1 | 192.168.1.42 | 1 | |
ad57b2abdf288984bc4a897a9e7f2ba9 | 60b9ab690724e5a535df794131e2345f |
NULL |
| 3 | 1 | 192.168.1.40 | 1 | |
b8ee4a7080092d7fd27357de1799b111 | d1343e4f0259199ed6b06d6338d39903 |
NULL |
please suggest to get correct configue.
thanks for looking.
TRUONG NGOC THANH
Telecommunications Engineer
Tel: 0984 480 646
Y!M: ngoc217thanh