Discussion:
[SR-Users] Simplest config possible [cont]
White, Phil
2014-10-05 15:51:03 UTC
Permalink
Hi All,

I've had an 'interesting' weekend reading RFCs and playing with kamailio.
I'm making progress - however, I would be grateful for a little
clarification.

I have sorted out a very basic stateless redirect proxy (config file
below). I have cut it down to the absolute basic minimum - and it mostly
appears to do what I would expect it to do. It does allow me to call any
registered extension from my SIP softphone.

Problem 1: I have a Grandstream Budgetone 200, which will happily receive
calls, but will not initiate any. Looking at a ngrep, it is ignoring the
redirect, and sends out a flood of UDP INVITEs (also see below for details)
Question: Is this the fault of my configuration, or the Grandstream
behaving incorrectly?

Problem 2: I am having difficulty in working out which module and command I
require to perform a function. Could someone please indicate the INVITE
route in this file for a stateful proxy?

Many thanks,

Phil

---

## WARNING - DO NOT USE THIS IN A PRODUCTION SERVER. FOR TESTING & EDUCTION ONLY

debug=2
fork=no
log_stderror=yes

listen=192.168.1.254:5060

####### Modules Section ########

mpath="/usr/lib/kamailio/modules/"
loadmodule "pv.so"
loadmodule "sl.so"
loadmodule "usrloc"
modparam("usrloc", "db_mode", 0)
loadmodule "xlog.so"
loadmodule "registrar.so"

####### Routing Logic ########

route{
if(method=="REGISTER") {
if (!save("location")) {
xlog("L_ERR", "**REGISTER: save failed \n");
sl_reply_error();
} else {
xlog("L_NOTICE", " REGISTER rcvd $si:$sp \n");
};
};

if(method=="INVITE") {
lookup("location");
switch ($retcode) {
case -1:
case -3:
sl_send_reply("404", "Not Found");
exit;
case -2:
sl_send_reply("405", "Not Found");
exit;
};
sl_send_reply("302","Redirect");
};

if(method=="PUBLISH" || method=="SUBSCRIBE"){
xlog("L_INFO","REJECTION. We do not process $rm requests. \n");
route(No);
};
}
route[No] {
sl_send_reply(503, "Service Unavailable");
}


---

U 2014/10/05 16:38:04.925388 192.168.123.16:5060 -> 192.168.123.254:5060
INVITE sip:105-***@public.gmane.org:58833;rinstance=0d82c786ca88f460;transport=UDP
SIP/2.0.
Via: SIP/2.0/UDP 192.168.123.16:5060;branch=z9hG4bKaf202530a743a053.
From: "01782478349" <sip:111-Q0ErXNX1RubIU/***@public.gmane.org
;user=phone>;tag=905632682e68e9b5.
To: <sip:105-***@public.gmane.org:58833;rinstance=0d82c786ca88f460;transport=UDP>.
Contact: <sip:111-***@public.gmane.org:5060;transport=udp;user=phone>.
Supported: replaces, timer, 100rel, path.
Session-Expires: 180.
Min-SE: 90.
Call-ID: 358a9652404b14ad-***@public.gmane.org
CSeq: 63317 INVITE.
User-Agent: Grandstream BT200 1.1.6.32.
Max-Forwards: 70.
Allow:
INVITE,ACK,CANCEL,BYE,NOTIFY,REFER,OPTIONS,INFO,SUBSCRIBE,UPDATE,PRACK.
Content-Type: application/sdp.
Content-Length: 407.
<...SNIP...>
U 2014/10/05 16:38:04.925895 192.168.123.254:5060 -> 192.168.123.16:5060
SIP/2.0 302 Redirect.
Via: SIP/2.0/UDP 192.168.123.16:5060
;branch=z9hG4bKaf202530a743a053;rport=5060.
From: "01782478349" <sip:111-Q0ErXNX1RubIU/***@public.gmane.org
;user=phone>;tag=905632682e68e9b5.
To: <sip:105-***@public.gmane.org:58833
;rinstance=0d82c786ca88f460;transport=UDP>;tag=71d9875c03b727cbe0217d2db6ac2a49.422e.
Call-ID: 358a9652404b14ad-***@public.gmane.org
CSeq: 63317 INVITE.
Contact: <sip:105-***@public.gmane.org:58833
;rinstance=0d82c786ca88f460;transport=UDP>.
Server: My SIP Server.
Content-Length: 0.U 2014/10/05 16:38:04.954405 192.168.123.16:5060 ->
192.168.123.254:5060
ACK sip:105-***@public.gmane.org:58833;rinstance=0d82c786ca88f460;transport=UDP
SIP/2.0.
Via: SIP/2.0/UDP 192.168.123.16:5060;branch=z9hG4bKaf202530a743a053.
From: "01782478349" <sip:111-Q0ErXNX1RubIU/***@public.gmane.org
;user=phone>;tag=905632682e68e9b5.
To: <sip:105-***@public.gmane.org:58833
;rinstance=0d82c786ca88f460;transport=UDP>;tag=71d9875c03b727cbe0217d2db6ac2a49.422e.
Contact: <sip:111-***@public.gmane.org:5060;transport=udp;user=phone>.
Supported: path.
Call-ID: 358a9652404b14ad-***@public.gmane.org
CSeq: 63317 ACK.
User-Agent: Grandstream BT200 1.1.6.32.
Max-Forwards: 70.
Allow:
INVITE,ACK,CANCEL,BYE,NOTIFY,REFER,OPTIONS,INFO,SUBSCRIBE,UPDATE,PRACK.
Content-Length: 0.
.

U 2014/10/05 16:38:04.975398 192.168.123.16:5060 -> 192.168.123.254:5060
INVITE sip:105-***@public.gmane.org:58833;rinstance=0d82c786ca88f460;transport=UDP
SIP/2.0.
Via: SIP/2.0/UDP 192.168.123.16:5060;branch=z9hG4bKa55f284fa742ad32.
From: "01782478349" <sip:111-Q0ErXNX1RubIU/***@public.gmane.org
;user=phone>;tag=9a25392722276c54.
To: <sip:105-***@public.gmane.org:58833;rinstance=0d82c786ca88f460;transport=UDP>.
Contact: <sip:111-***@public.gmane.org:5060;transport=udp;user=phone>.
Supported: replaces, timer, 100rel, path.
Session-Expires: 180.
Min-SE: 90.
Call-ID: f2989990cfa8525c-***@public.gmane.org
CSeq: 1445 INVITE.
User-Agent: Grandstream BT200 1.1.6.32.
Max-Forwards: 70.
Allow:
INVITE,ACK,CANCEL,BYE,NOTIFY,REFER,OPTIONS,INFO,SUBSCRIBE,UPDATE,PRACK.
Content-Type: application/sdp.
Content-Length: 407.
.
.
. etc...
Google - One
2014-10-05 17:42:56 UTC
Permalink
Scrub question 2 - I think I have started on the stateful proxy... (still need to do ACK, BYE & CANCEL)

Diagnosis and analysis help still needed

Thanks
Post by White, Phil
Hi All,
I've had an 'interesting' weekend reading RFCs and playing with kamailio. I'm making progress - however, I would be grateful for a little clarification.
I have sorted out a very basic stateless redirect proxy (config file below). I have cut it down to the absolute basic minimum - and it mostly appears to do what I would expect it to do. It does allow me to call any registered extension from my SIP softphone.
Problem 1: I have a Grandstream Budgetone 200, which will happily receive calls, but will not initiate any. Looking at a ngrep, it is ignoring the redirect, and sends out a flood of UDP INVITEs (also see below for details)
Question: Is this the fault of my configuration, or the Grandstream behaving incorrectly?
Problem 2: I am having difficulty in working out which module and command I require to perform a function. Could someone please indicate the INVITE route in this file for a stateful proxy?
Many thanks,
Phil
---
## WARNING - DO NOT USE THIS IN A PRODUCTION SERVER. FOR TESTING & EDUCTION ONLY
debug=2
fork=no
log_stderror=yes
listen=192.168.1.254:5060
####### Modules Section ########
mpath="/usr/lib/kamailio/modules/"
loadmodule "pv.so"
loadmodule "sl.so"
loadmodule "usrloc"
modparam("usrloc", "db_mode", 0)
loadmodule "xlog.so"
loadmodule "registrar.so"
####### Routing Logic ########
route{
if(method=="REGISTER") {
if (!save("location")) {
xlog("L_ERR", "**REGISTER: save failed \n");
sl_reply_error();
} else {
xlog("L_NOTICE", " REGISTER rcvd $si:$sp \n");
};
};
if(method=="INVITE") {
lookup("location");
switch ($retcode) {
sl_send_reply("404", "Not Found");
exit;
sl_send_reply("405", "Not Found");
exit;
};
sl_send_reply("302","Redirect");
};
if(method=="PUBLISH" || method=="SUBSCRIBE"){
xlog("L_INFO","REJECTION. We do not process $rm requests. \n");
route(No);
};
}
route[No] {
sl_send_reply(503, "Service Unavailable");
}
---
U 2014/10/05 16:38:04.925388 192.168.123.16:5060 -> 192.168.123.254:5060
Via: SIP/2.0/UDP 192.168.123.16:5060;branch=z9hG4bKaf202530a743a053.
Supported: replaces, timer, 100rel, path.
Session-Expires: 180.
Min-SE: 90.
CSeq: 63317 INVITE.
User-Agent: Grandstream BT200 1.1.6.32.
Max-Forwards: 70.
Allow: INVITE,ACK,CANCEL,BYE,NOTIFY,REFER,OPTIONS,INFO,SUBSCRIBE,UPDATE,PRACK.
Content-Type: application/sdp.
Content-Length: 407.
<...SNIP...>
U 2014/10/05 16:38:04.925895 192.168.123.254:5060 -> 192.168.123.16:5060
SIP/2.0 302 Redirect.
Via: SIP/2.0/UDP 192.168.123.16:5060;branch=z9hG4bKaf202530a743a053;rport=5060.
CSeq: 63317 INVITE.
Server: My SIP Server.
Content-Length: 0.U 2014/10/05 16:38:04.954405 192.168.123.16:5060 -> 192.168.123.254:5060
Via: SIP/2.0/UDP 192.168.123.16:5060;branch=z9hG4bKaf202530a743a053.
Supported: path.
CSeq: 63317 ACK.
User-Agent: Grandstream BT200 1.1.6.32.
Max-Forwards: 70.
Allow: INVITE,ACK,CANCEL,BYE,NOTIFY,REFER,OPTIONS,INFO,SUBSCRIBE,UPDATE,PRACK.
Content-Length: 0.
.
U 2014/10/05 16:38:04.975398 192.168.123.16:5060 -> 192.168.123.254:5060
Via: SIP/2.0/UDP 192.168.123.16:5060;branch=z9hG4bKa55f284fa742ad32.
Supported: replaces, timer, 100rel, path.
Session-Expires: 180.
Min-SE: 90.
CSeq: 1445 INVITE.
User-Agent: Grandstream BT200 1.1.6.32.
Max-Forwards: 70.
Allow: INVITE,ACK,CANCEL,BYE,NOTIFY,REFER,OPTIONS,INFO,SUBSCRIBE,UPDATE,PRACK.
Content-Type: application/sdp.
Content-Length: 407.
.
.
. etc...
Daniel Tryba
2014-10-06 08:07:44 UTC
Permalink
Post by White, Phil
Looking at a ngrep, it is ignoring the
redirect, and sends out a flood of UDP INVITEs (also see below for details)
Question: Is this the fault of my configuration, or the Grandstream
behaving incorrectly?
It is your configuration, you are redirecting to the same destination (since
you aren't modifiying $ru

INVITE sip:105-***@public.gmane.org:58833;rinstance=0d82c786ca88f460;transport=UDP
SIP/2.0.
...

$ru=sip:105-***@public.gmane.org:58833;....

SIP/2.0 302 Redirect.
Contact:
<sip:105-***@public.gmane.org:58833;rinstance=0d82c786ca88f460;transport=UDP>.

$ru is still 105-***@public.gmane.org:58833;....
--
POCOS B.V. - Croy 9c - 5653 LC Eindhoven
Telefoon: 040 293 8661 - Fax: 040 293 8658
http://www.pocos.nl/ - http://www.sipo.nl/
K.v.K. Eindhoven 17097024
Daniel-Constantin Mierla
2014-10-06 08:10:20 UTC
Permalink
Post by Daniel Tryba
Post by White, Phil
Looking at a ngrep, it is ignoring the
redirect, and sends out a flood of UDP INVITEs (also see below for details)
Question: Is this the fault of my configuration, or the Grandstream
behaving incorrectly?
It is your configuration, you are redirecting to the same destination (since
you aren't modifiying $ru
SIP/2.0.
...
SIP/2.0 302 Redirect.
I think the r-uri is updated first time, after lookup location, but then
I assume the grandstream is using the sip server as outbound proxy
always ... just my guesses...

Cheers,
Daniel
--
Daniel-Constantin Mierla
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Daniel-Constantin Mierla
2014-10-06 08:11:31 UTC
Permalink
Hello,
Post by White, Phil
Hi All,
I've had an 'interesting' weekend reading RFCs and playing with
kamailio. I'm making progress - however, I would be grateful for a
little clarification.
I have sorted out a very basic stateless redirect proxy (config file
below). I have cut it down to the absolute basic minimum - and it
mostly appears to do what I would expect it to do. It does allow me to
call any registered extension from my SIP softphone.
Problem 1: I have a Grandstream Budgetone 200, which will happily
receive calls, but will not initiate any. Looking at a ngrep, it is
ignoring the redirect, and sends out a flood of UDP INVITEs (also see
below for details)
Question: Is this the fault of my configuration, or the Grandstream
behaving incorrectly?
Problem 2: I am having difficulty in working out which module and
command I require to perform a function. Could someone please indicate
the INVITE route in this file for a stateful proxy?
for 2, look at kamailio-basic.cfg, it is a stateful proxy
implementations (plus some few other features).


Cheers,
Daniel
Post by White, Phil
Many thanks,
Phil
---
## WARNING - DO NOT USE THIS IN A PRODUCTION SERVER. FOR TESTING & EDUCTION ONLY
debug=2
fork=no
log_stderror=yes
listen=192.168.1.254:5060 <http://192.168.1.254:5060>
####### Modules Section ########
mpath="/usr/lib/kamailio/modules/"
loadmodule "pv.so"
loadmodule "sl.so"
loadmodule "usrloc"
modparam("usrloc", "db_mode", 0)
loadmodule "xlog.so"
loadmodule "registrar.so"
####### Routing Logic ########
route{
if(method=="REGISTER") {
if (!save("location")) {
xlog("L_ERR", "**REGISTER: save failed \n");
sl_reply_error();
} else {
xlog("L_NOTICE", " REGISTER rcvd $si:$sp \n");
};
};
if(method=="INVITE") {
lookup("location");
switch ($retcode) {
sl_send_reply("404", "Not Found");
exit;
sl_send_reply("405", "Not Found");
exit;
};
sl_send_reply("302","Redirect");
};
if(method=="PUBLISH" || method=="SUBSCRIBE"){
xlog("L_INFO","REJECTION. We do not process $rm requests. \n");
route(No);
};
}
route[No] {
sl_send_reply(503, "Service Unavailable");
}
---
U 2014/10/05 16:38:04.925388 192.168.123.16:5060
<http://192.168.123.16:5060> -> 192.168.123.254:5060
<http://192.168.123.254:5060>
INVITE
SIP/2.0.
Via: SIP/2.0/UDP 192.168.123.16:5060;branch=z9hG4bKaf202530a743a053.
Supported: replaces, timer, 100rel, path.
Session-Expires: 180.
Min-SE: 90.
CSeq: 63317 INVITE.
User-Agent: Grandstream BT200 1.1.6.32.
Max-Forwards: 70.
INVITE,ACK,CANCEL,BYE,NOTIFY,REFER,OPTIONS,INFO,SUBSCRIBE,UPDATE,PRACK.
Content-Type: application/sdp.
Content-Length: 407.
<...SNIP...>
U 2014/10/05 16:38:04.925895 192.168.123.254:5060
<http://192.168.123.254:5060> -> 192.168.123.16:5060
<http://192.168.123.16:5060>
SIP/2.0 302 Redirect.
Via: SIP/2.0/UDP
192.168.123.16:5060;branch=z9hG4bKaf202530a743a053;rport=5060.
CSeq: 63317 INVITE.
Server: My SIP Server.
Content-Length: 0.U 2014/10/05 16:38:04.954405 192.168.123.16:5060
<http://192.168.123.16:5060> -> 192.168.123.254:5060
<http://192.168.123.254:5060>
ACK
SIP/2.0.
Via: SIP/2.0/UDP 192.168.123.16:5060;branch=z9hG4bKaf202530a743a053.
Supported: path.
CSeq: 63317 ACK.
User-Agent: Grandstream BT200 1.1.6.32.
Max-Forwards: 70.
INVITE,ACK,CANCEL,BYE,NOTIFY,REFER,OPTIONS,INFO,SUBSCRIBE,UPDATE,PRACK.
Content-Length: 0.
.
U 2014/10/05 16:38:04.975398 192.168.123.16:5060
<http://192.168.123.16:5060> -> 192.168.123.254:5060
<http://192.168.123.254:5060>
INVITE
SIP/2.0.
Via: SIP/2.0/UDP 192.168.123.16:5060;branch=z9hG4bKa55f284fa742ad32.
Supported: replaces, timer, 100rel, path.
Session-Expires: 180.
Min-SE: 90.
CSeq: 1445 INVITE.
User-Agent: Grandstream BT200 1.1.6.32.
Max-Forwards: 70.
INVITE,ACK,CANCEL,BYE,NOTIFY,REFER,OPTIONS,INFO,SUBSCRIBE,UPDATE,PRACK.
Content-Type: application/sdp.
Content-Length: 407.
.
.
. etc...
_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
--
Daniel-Constantin Mierla
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Daniel Tryba
2014-10-06 08:30:25 UTC
Permalink
Post by Daniel-Constantin Mierla
Post by White, Phil
SIP/2.0 302 Redirect.
I think the r-uri is updated first time, after lookup location,
I just assumed lookup() failed, but indeed the switch should have taken care
of that.
--
POCOS B.V. - Croy 9c - 5653 LC Eindhoven
Telefoon: 040 293 8661 - Fax: 040 293 8658
http://www.pocos.nl/ - http://www.sipo.nl/
K.v.K. Eindhoven 17097024
Loading...