This post was published initially with a a typo in the URL. blogger.com does not offer any tool to change the URL after first time publish, therefore the post was moved to a new page.
Click here to get to the SIP Communicator post.
Btw, reading the help pages for posts URLs, I really find it ugly solution to publish first your post with the title including only the words you want in URL (which becomes permalink, forever) and then edit again the title to what you want as title. Com'on G!, you can do a bit better here!
Kamailio Advanced Training
March 25-27, 2019, in Washington DC, USA
Click here for more details!
Learn how to build RTC services with Kamailio!
Wednesday, May 5, 2010
Saturday, May 1, 2010
Kamailio 3.0.x - DYK-09 - cancel and invite
Access INVITE attributes while processing the CANCEL
See also: Kamailio 3.0.x - DYK - Table of Content
Another enhancements brought by Kamailio 3.0.0 is the possibility of accessing the attributes of INVITE while processing the CANCEL. By loading the tmx module, you can use in your config file the pseudo-variable $T_inv(pv).
Instead of returning the values of pseudo-variables bound to CANCEL, $T_inv(pv) will return the value of pseudo-variables bound to INVITE. For example:
$T_inv($si) returns the source IP of INVITE, therefore checking if the CANCEL comes from same IP address as INVITE is:
See also: Kamailio 3.0.x - DYK - Table of Content
Another enhancements brought by Kamailio 3.0.0 is the possibility of accessing the attributes of INVITE while processing the CANCEL. By loading the tmx module, you can use in your config file the pseudo-variable $T_inv(pv).
Instead of returning the values of pseudo-variables bound to CANCEL, $T_inv(pv) will return the value of pseudo-variables bound to INVITE. For example:
$T_inv($si) returns the source IP of INVITE, therefore checking if the CANCEL comes from same IP address as INVITE is:
if (is_method("CANCEL"))
{
if (t_check_trans())
{
$var(ip) = $T_inv($si);
if($si != $var(ip))
{
send_reply("403", "CANCEL from a different IP than INVITE");
exit;
}
t_relay();
}
exit;
}
Thursday, April 29, 2010
Kamailio 3.0.x - DYK-08 - udp mtu
Fallback to other transport protocol based on UDP
See also: Kamailio 3.0.x - DYK - Table of Content
Kamailio 3.0.0 offers several options to control the outgoing transport protocol based on MTU of UDP packets.
Although the RFC3261 requires to use TCP (or TLS or SCTP) if the size of UDP payload exceeds 1300 bytes, this may bring some issues with SIP UA not supporting something else than UDP. Following the high-flexibility policy with the SER and Kamailio applications, this setting is customizable as global parameter or per SIP request.
Here are the parameters if you want to control globally:
See also: Kamailio 3.0.x - DYK - Table of Content
Kamailio 3.0.0 offers several options to control the outgoing transport protocol based on MTU of UDP packets.
Although the RFC3261 requires to use TCP (or TLS or SCTP) if the size of UDP payload exceeds 1300 bytes, this may bring some issues with SIP UA not supporting something else than UDP. Following the high-flexibility policy with the SER and Kamailio applications, this setting is customizable as global parameter or per SIP request.
Here are the parameters if you want to control globally:
- pmtu_discovery - set the bit for non-fragmentation to outbound packets, to enforce MTU if needed
- udp_mtu - the size in bytes when to switch to the fallback protocol if exceeded
- udp_mtu_try_proto - set the new transport protocol to be used if udp_mtu is exceeded
- udp_mtu_try_proto(proto)
pmtu_discovery = yesFor more about this topic, see the Core Cookbook.
udp_mtu = 1400
udp_mtu_try_proto = TCP
...
route {
...
if($rU=~"^\+49")
udp_mtu_try_proto(SCTP);
...
}
Friday, April 23, 2010
Kamailio 3.0.x - DYK - ToC
There are several neat enhancements in Kamailio 3.0.0 (released January 11, 2010) that make your config looking better and some operations optimized.
During the winter I wrote the series Best of New in Kamailio 3.0.0, focused on detailing major features brought by 3.0, this is going to be kind of mini-blogging series (max 15 lines about the topic itself?!?!), looking at tips for your config made possible only by 3.0.x, named: "Did you know?".
Here is the table of content:
The series is not finished, new posts will be published soon.
During the winter I wrote the series Best of New in Kamailio 3.0.0, focused on detailing major features brought by 3.0, this is going to be kind of mini-blogging series (max 15 lines about the topic itself?!?!), looking at tips for your config made possible only by 3.0.x, named: "Did you know?".
Here is the table of content:
The series is not finished, new posts will be published soon.
Kamailio 3.0.x - DYK-07 - custom cfg parameters
Define your own config parameters
See also: Kamailio 3.0.x - DYK - Table of Content
Kamailio 3.0.0 introduced custom config global parameters. These are variables that can be declared in the global parameters part and can be used inside the routing logic. Very useful as well is the features of being able to change its value at runtime via RPC commands, without SIP server restart.
Defining a new cfg parameter has a special format:
Example - define a variable that can be used to control printing of some custom log messages:
See also: Kamailio 3.0.x - DYK - Table of Content
Kamailio 3.0.0 introduced custom config global parameters. These are variables that can be declared in the global parameters part and can be used inside the routing logic. Very useful as well is the features of being able to change its value at runtime via RPC commands, without SIP server restart.
Defining a new cfg parameter has a special format:
group.id = value 'desc' descriptionThen you can get access to them via pseudo-variables as $sel(cfg_get.group.id) or selects as @cfg_get.group.id.
Example - define a variable that can be used to control printing of some custom log messages:
...You can update it at runtime with sercmd:
local.dbg = 0 desc "Custom debug mode"
...
route {
...
if($sel(cfg_get.local.dbg)==1)
xlog("My extra log message\n");
...
}
sercmd cfg.set_now_int local dbg 1I wrote a bit more in a previous post.
Thursday, April 22, 2010
Kamailio 3.0.x - DYK-06 - comments with define
Comment big blocks with defines
See also: Kamailio 3.0.x - DYK - Table of Content
Kamailio 3.0.0 brought #!define directive support. This can be used as a neat and easy way to comment big blocks of config. Using multi-lines comment format in between /* */ is not convenient for nested cases.
Trying to enclose in multi-line comment a snippet like next (well, not that big in this example) is not straightforward:
Enabling it is:
See also: Kamailio 3.0.x - DYK - Table of Content
Kamailio 3.0.0 brought #!define directive support. This can be used as a neat and easy way to comment big blocks of config. Using multi-lines comment format in between /* */ is not convenient for nested cases.
Trying to enclose in multi-line comment a snippet like next (well, not that big in this example) is not straightforward:
/* log time and method */Clearly is broken to do it like:
xlog("SIP $rm at $Tf\n");
/* log source ip and port */
xlog("SIP from $si:$sp\n");
/*The option in 3.0.x is:
/* log time and method */
xlog("SIP $rm at $Tf\n");
/* log source ip and port */
xlog("SIP from $si:$sp\n");
*/
#!ifdef EXTRACOMMENTYou can use anything you haven't defined instead of EXTRACOMMENT.
/* log time and method */
xlog("SIP $rm at $Tf\n");
/* log source ip and port */
xlog("SIP from $si:$sp\n");
#!endif
Enabling it is:
#!define EXTRACOMMENT
#!ifdef EXTRACOMMENT
/* log time and method */
xlog("SIP $rm at $Tf\n");
/* log source ip and port */
xlog("SIP from $si:$sp\n");
#!endif
Wednesday, April 21, 2010
Kamailio 3.0.x - DYK-05 - switch and break
Break out from inside case block within switch
See also: Kamailio 3.0.x - DYK - Table of Content
Another enhancement Kamailio 3.0.x brought is usage of break inside case branches of switch statement. With older versions, break can be used only at the end of case branch:
See also: Kamailio 3.0.x - DYK - Table of Content
Another enhancement Kamailio 3.0.x brought is usage of break inside case branches of switch statement. With older versions, break can be used only at the end of case branch:
switch($ru) {It was no way to break out from inside the actions list. With 3.0 you can do it:
case "101":
# actions here
break;
case "102":
# actions here
break;
}
switch($ru) {Very good to make the execution of switch more optimized and the actions list inside simpler.
case "101":
# some actions here
if(condition) {
break;
}
# other actions here
break;
case "102":
# some actions here
break;
}
Tuesday, April 20, 2010
Prosody - lightweight XMPP server
Thanks to volcano or not, this week I finally found the time to write about some projects present at FOSDEM 2010 (happened in Bruxelles, Belgium, February 6-7, 2010) which I like and use.
First is Prosody, a lightweight XMPP server, the second is SIP Communicator, a multi-protocol communication suite, mainly focusing on SIP.
Days before the conference I started to play a bit more with Lua (as a matter of fact Kamailio has now support for embedded Lua in config file). Moreover, I was looking for a simple to install and manage XMPP server for usage in small companies.
Guess what, I run into Prosody web site (iirc, via xmpp.org site) and discovered is written in Lua, which made my day, perfect match. From the project site:
"Prosody is a flexible communications server for Jabber/XMPP written in Lua. It aims to be easy to use, and light on resources. For developers it aims to be easy to extend and give a flexible system on which to rapidly develop added functionality, or prototype new protocols."
Back in 2003, SIP Express Router (SER) times, I coded first SIP-to-XMPP gateway for instant messaging and presence (even started an IETF draft about it). I used Jabberd server (v1.x), later I played with Jabberd2 and never got really into erlang to play with eJabberd, although looks an amazing application. Jabberd2 got a bit too complex for my taste, with all those specific processes running at the same time.
Back in January I was looking for something really light, not guided by performance, but more by simplicity and easiness in management - the motto of Prosody suited perfectly at first sight. Reading more about it and doing few tests, it became my favorite very shortly.
If it was a presentation about Prosody in XMPP dev room, then I missed it, however, I could spot Matthew Wild by t-shirt, greeting him just before running to my Kamailio talk. I changed some emails afterwards, looking to do a seamless integration between Kamailio and Prosody. Now I am looking forward to version 0.8 (0.7 rc is already out), hopefully to bring database support for user profiles and roster, which should make things much simpler.
Meanwhile, if you need your own XMPP server, enjoy Prosody, it has lot of extensions and support for secure communication via TLS.
There are many reasons I would strongly recommend using your own real-time communication server (XMPP or SIP), I will write more about that topic soon, this post is getting too long.
Check back this site in few days for SIP Communicator post, another amazing application out there.
First is Prosody, a lightweight XMPP server, the second is SIP Communicator, a multi-protocol communication suite, mainly focusing on SIP.

Guess what, I run into Prosody web site (iirc, via xmpp.org site) and discovered is written in Lua, which made my day, perfect match. From the project site:
"Prosody is a flexible communications server for Jabber/XMPP written in Lua. It aims to be easy to use, and light on resources. For developers it aims to be easy to extend and give a flexible system on which to rapidly develop added functionality, or prototype new protocols."
Back in 2003, SIP Express Router (SER) times, I coded first SIP-to-XMPP gateway for instant messaging and presence (even started an IETF draft about it). I used Jabberd server (v1.x), later I played with Jabberd2 and never got really into erlang to play with eJabberd, although looks an amazing application. Jabberd2 got a bit too complex for my taste, with all those specific processes running at the same time.
Back in January I was looking for something really light, not guided by performance, but more by simplicity and easiness in management - the motto of Prosody suited perfectly at first sight. Reading more about it and doing few tests, it became my favorite very shortly.
If it was a presentation about Prosody in XMPP dev room, then I missed it, however, I could spot Matthew Wild by t-shirt, greeting him just before running to my Kamailio talk. I changed some emails afterwards, looking to do a seamless integration between Kamailio and Prosody. Now I am looking forward to version 0.8 (0.7 rc is already out), hopefully to bring database support for user profiles and roster, which should make things much simpler.
Meanwhile, if you need your own XMPP server, enjoy Prosody, it has lot of extensions and support for secure communication via TLS.
There are many reasons I would strongly recommend using your own real-time communication server (XMPP or SIP), I will write more about that topic soon, this post is getting too long.
Check back this site in few days for SIP Communicator post, another amazing application out there.
Subscribe to:
Posts (Atom)