Re: [SR-Users] How to disable retransmits via TCP connection? etc.

2015-06-25 Thread Vitaliy Aleksandrov

Hi,
Don't want to sound like a captain obvious, but what I can say after a 
quick look at your traces is that both client and server are behind NAT 
and either some entity drops big packets silently or somebody drops ICMP 
(fragmentation needed) which doesn't allow TCP to adjust max MSS. The 
other strange thing is that you said that you set server's MTU to 800 
bytes, but server has sent a huge TCP segment with a total length of 
1548 bytes and Don't fragment bit set.


On 24/06/15 17:30, Andrey Utkin wrote:

Thanks for all the suggestions.
Have taken pcap dumps with commands
tcpdump -i any -w /tmp/sip_tcp.pcap host counterpart host

http://whdd.org/sip_tcp_server.pcap
http://whdd.org/sip_tcp_client.pcap

The only obviously bad thing I see is [TCP Previous segment not
captured] mark on the packet client side dump which is the ending of
INVITE request body.
Googling on this message, I've found some advice at StackOverflow to
tune TCP socket TCP_MAXSEG option.


http://whdd.org/sip_tcp_mtu800_server.pcap
http://whdd.org/sip_tcp_mtu800_client.pcap

For this test I have set MTU to 800 on the server's only actual net
interface, and restarted Kamailio. The situation stays the same,
despite the packets show differently in wireshark.
On client side, there's still [TCP Previous segment not captured],
and on server side there's a mark [TCP segment of a reassembled
PDU].

Any review is greatly appreciated!




___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] How to disable retransmits via TCP connection? etc.

2015-06-25 Thread Vitaliy Aleksandrov

Hi,

But the fact that packet sent from a server to a client looks 
differently captured from both points says that somebody tries to help 
you (read SIP ALG). So I would join to Daniel's suggestion to try with TLS.


On 24/06/15 17:30, Andrey Utkin wrote:

Thanks for all the suggestions.
Have taken pcap dumps with commands
tcpdump -i any -w /tmp/sip_tcp.pcap host counterpart host

http://whdd.org/sip_tcp_server.pcap
http://whdd.org/sip_tcp_client.pcap

The only obviously bad thing I see is [TCP Previous segment not
captured] mark on the packet client side dump which is the ending of
INVITE request body.
Googling on this message, I've found some advice at StackOverflow to
tune TCP socket TCP_MAXSEG option.


http://whdd.org/sip_tcp_mtu800_server.pcap
http://whdd.org/sip_tcp_mtu800_client.pcap

For this test I have set MTU to 800 on the server's only actual net
interface, and restarted Kamailio. The situation stays the same,
despite the packets show differently in wireshark.
On client side, there's still [TCP Previous segment not captured],
and on server side there's a mark [TCP segment of a reassembled
PDU].

Any review is greatly appreciated!




___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] How to disable retransmits via TCP connection? etc.

2015-06-24 Thread Vitaliy Aleksandrov

Hi,

I would also add that if you see partial packets you can try to remove 
any transport protocol (udp/tcp) and port filters. It will help if you 
are dealing with IP fragmentation. Otherwise sniffer won't catch IP 
fragments since they don't have transport level headers.


Best Regards,
Vitaliy

___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] Recommended configuration for TCP support

2015-05-08 Thread Vitaliy Aleksandrov


What would happen in this case? If I understand correctly, the proxy 
will always forward the request but the last hop (before the UAS) will 
forward the request only if a connection is active?



correct.


If the last hop doesn't forward the request because no TCP connection 
exists, what happens? How the proxy will detect this situation?


It won't find any matching connection and won't try to establish a new 
one since you asked it to not. So it will just send a reply back to the 
registrar with an error. After receiving an error registrar in its turn 
can perform some smart actions like forwarding to a voicemail system.
___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] Recommended configuration for TCP support

2015-05-06 Thread Vitaliy Aleksandrov
*set_forward_no_connect()* called after lookup() prevents kamailio from 
making a new connection to a phone if there is no active connection.
This is useful when you are trying to call to a UA which kamailio still 
keeps registration record for, but TCP/TLS connect to this phone is 
already gone (due to timeout, network problem, etc...).


On 05/05/15 14:54, Mickael Marrache wrote:


In general, it happens in our network (as more and more Via headers 
are added).


Sorry, I didn't understand your last sentence. What do you mean by not 
connect if there is no active connection after location lookup?


*From:*sr-users [mailto:sr-users-boun...@lists.sip-router.org] *On 
Behalf Of *Daniel-Constantin Mierla

*Sent:* Monday, May 04, 2015 11:07 PM
*To:* Kamailio (SER) - Users Mailing List
*Subject:* Re: [SR-Users] Recommended configuration for TCP support

Hello,

where are typically those issues with truncated SDP? On the phones?

If you use tcp and have phones behind the nat, it is recommended to 
not connect if there is no active connection after location lookup -- 
see core functions for tcp.


Cheers,
Daniel

On 04/05/15 13:54, Mickael Marrache wrote:

Hi,

We sometimes get issues caused by truncated SDP bodies. Therefore,
we are looking at using TCP instead of UDP.

What is the recommended configuration when TCP is used?

Currently, I only have the following:

children=16

listen=udp:ip:5060

listen=tcp:ip:5060

disable_tcp=no

tcp_connection_lifetime=605 (registration expiry is 600)

Also, is there a difference with UDP regarding NAT handling?

Thanks,

Mickael




___

SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list

sr-users@lists.sip-router.org  mailto:sr-users@lists.sip-router.org

http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users



--
Daniel-Constantin Mierla
http://twitter.com/#!/miconda  http://twitter.com/#%21/miconda  
-http://www.linkedin.com/in/miconda
Kamailio World Conference, May 27-29, 2015
Berlin, Germany -http://www.kamailioworld.com


___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] LCR with gateway capabilities

2015-04-29 Thread Vitaliy Aleksandrov



On 29/04/15 12:34, Grant Bagdasarian wrote:


That sounds possible! Thanks.

That does this description mean: “Execution time of load_gws() 
function is O(N) * O(M), where N is number of different prefix lengths 
and M is number of collisions for matching prefix(es) in lcr rules 
hash table of the LCR instance.”?


Does this mean it loads the data from its internal memory or does it 
load the data from the database again?


load_gws() prepares an ordered list of gateways for current destination. 
It loads data only from internal in-memory gateways db (hash table).


How fast does it select a gateway after load_gws using next_gw()? Is 
it O(N) again?


O(1) since load_gws already prepared ordered (by price) list and 
next_gw() only takes next gw in a list.


What about multiple combinations of capabilities? For example caller 
id spoofing and g729 codec, or caller id spoofing and g711ulaw codec? Etc.


Wouldn’t this cause the data to grow exponentially?


It would.

Another idea:
You can also have only one lcr instance and keep gateways capabilities 
in the tag field (serialized somehow). Then you can just iterate through 
a list generated by load_gws() skipping gateways which don't match your 
criteria and in the end a call will be routed to the cheapest gateway 
with proper capabilities.


*From:*sr-users [mailto:sr-users-boun...@lists.sip-router.org] *On 
Behalf Of *Vitaliy Aleksandrov

*Sent:* Wednesday, April 29, 2015 10:36 AM
*To:* sr-users@lists.sip-router.org
*Subject:* Re: [SR-Users] LCR with gateway capabilities

What about configuring two LCR instances with different lcr_id.
The first one can use only gateways with requested capabilities and 
the second one all gateways.
Then you can make a decision about which instance to use during call 
routing process providing this lcr_id to load_gws() function.



Hello,

From what I understand about the LCR module is that the rules have
to be prioritized by the admin, be it manually or automatically by
an application.

Let’s say the LCR database has 10 gateways, each with their own
rules etc.

4 of these gateways support caller id spoofing and the others don’t.

But the other 6 are cheaper and Kamailio has to route a call using
a gateway which support caller id spoofing and is the cheapest of
the 4.

Would it be possible to tell the LCR module to select a gateway
based on certain capabilities and is the cheapest of the ones
which support a certain capability?




___

SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list

sr-users@lists.sip-router.org  mailto:sr-users@lists.sip-router.org

http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users



___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] LCR with gateway capabilities

2015-04-29 Thread Vitaliy Aleksandrov

What about configuring two LCR instances with different lcr_id.
The first one can use only gateways with requested capabilities and the 
second one all gateways.
Then you can make a decision about which instance to use during call 
routing process providing this lcr_id to load_gws() function.



Hello,

From what I understand about the LCR module is that the rules have to 
be prioritized by the admin, be it manually or automatically by an 
application.


Let’s say the LCR database has 10 gateways, each with their own rules 
etc.


4 of these gateways support caller id spoofing and the others don’t.

But the other 6 are cheaper and Kamailio has to route a call using a 
gateway which support caller id spoofing and is the cheapest of the 4.


Would it be possible to tell the LCR module to select a gateway based 
on certain capabilities and is the cheapest of the ones which support 
a certain capability?




___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] LCR with gateway capabilities

2015-04-29 Thread Vitaliy Aleksandrov


The Tag column size is 64. If I make this larger in the database, will 
it be truncated once it is loaded into memory?


According to modules source code Tag's max size is hardcoded and will be 
truncated. But this is not a bit problem. You can keep capabilities list 
in htable and only put a key for this htable info to the tag.


Through which list do I need to iterate? You mentioned the data is 
stored in a hash table, what is the name of this hash table?



load_gws() creates a list of gateways and next_gw() fetches them one by one.
After calling load_gws() you can just call next_gw() which puts gateways 
tag to the tag_avp. If current gateway doesn't have requested 
capabilities just call next_gw() again.


Basically for each call I need to call the load_gws() function, which 
is O(N) * O(M).


What if I take a different approach and call a stored procedure (for 
each call) which does the selection of a gateway based on the supplied 
criteria.


Of course the tables would be optimized with indices for the best 
possible performance.


When comparing load_gws() (O(N) * O(M)) with the stored procedure 
approach, would there be a huge performance loss when taking the 
stored procedure approach?



Who knows.. You can test it and share results with community :)


I know this approach brings a whole new set of problem with 
availability and the loss of features, but for now I’m only interested 
in the performance aspect of both methods.


Actually going this way you don't need LCR module at all. You can call 
stored procedure, lua/python/perl/... script, or request an external 
system using radius/xmlrpc. But be careful making blocking operations 
from a script or have enough number of kamailio processes.


___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] Expect the kamailio's sip account is unregistered state when the client app is shutdown

2015-04-28 Thread Vitaliy Aleksandrov

Hi,

You can take a look at this option:
http://kamailio.org/docs/modules/4.2.x/modules/usrloc.html#usrloc.p.handle_lost_tcp

It's a bit limited and doesn't work for:
- usrloc db only mode
- if you have separated edge proxy and registrar


Thank you for information..
What can Kamailio do about clients, that exit abnormally (e.g. crash, turn off, ..) which 
do unregister properly? Can Kamailio send this expire=0 on behalf of these 
clients?
Can Kamailio determine that a client got offline based on e.g. TLS connection or other 
heartbeats?
On 20.04.2015 10:16, Daniel Grotti wrote:

Hi,
here you are:

https://tools.ietf.org/html/rfc3665#section-2.4



--
Daniel Grotti
VoIP Engineer


Sipwise GmbH
Europaring F15 | 2345 Brunn am Gebirge, Austria | www.sipwise.com

On 04/20/2015 10:10 AM, Mickael Marrache wrote:

Hi,

  


You need to configure your client to un register when the app is closed.

  


For that, your client must send a REGISTER with Expires: 0.

  


Mickael

  


*From:*sr-users [mailto:sr-users-boun...@lists.sip-router.org] *On
Behalf Of *xuefeng zhang
*Sent:* Monday, April 20, 2015 10:58 AM
*To:* Daniel-Constantin Mierla; Kamailio (SER) - Users Mailing List
*Subject:* [SR-Users] Expect the kamailio's sip account is unregistered
state when the client app is shutdown

  


Hi Daniel,

  


When the client's app is closed,the sip account may be registered
state,because the expired time may have some rest time.I want to
implement when the client's app is closed,the account also unregister.

  


How can I implement this function?Would you give me some advices?

  


Thanks!

  


Xuefeng Zhang



___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users



___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users



___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] Routing PSTN calls from Asterisk through Kamailio to UAC loose_route

2015-03-26 Thread Vitaliy Aleksandrov
According to your description BYE was sent using the information from 
R-URI which had no 5080 port.
Asterisk should have added port 5080 to the outgoing Invite contact so 
that it could be used for in-dialog routing.


Can you show a full trace with sip traffic between kamailio and 
asterisk. To catch sip traffic on all interfaces use -i any option for 
tcpdump or -d any for ngrep.



I've been working on integration of Asterisk and Kamailio, currently on the
same host with different ports, and have come across a problem with calls that
originate from the Asterisk side (PSTN/DAHDI) and route through Kamailio to a
SIP UAC.  In short, when the SIP UAC (10.1.1.9) sends the BYE, loose_route()
is returning -1 and the BYE is routed back to Kamailio (10.1.1.1:5060) instead
of Asterisk (10.1.1.1:5080).  I am using the stock WITHINDLG route
configuration.

RR module settings are as follows:
modparam(rr, enable_full_lr, 1)
modparam(rr, append_fromtag, 1)

The BYE from the SIP UAC contains the following Route header which only
contains the contents of Kamailio's Record-Route header.  I have attached the
full sip trace for review as well.

Route: sip:10.1.1.1;lr=on;ftag=2400d939-de0b-4456-9e01-f9a3302f3e25;nat=yes.

What would be the best method to resolve this issue in either Asterisk or
Kamailio?  Should I manually add a Record-Route header for the Asterisk
host:port to Kamailio config? Is there something to be done in Asterisk?

Thanks.  -A



___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] missing BYE when 2 redundant kamailio servers share the same database

2015-03-20 Thread Vitaliy Aleksandrov



We use TLS for SIP. The Wireshark pcap would be encrypted. I’ll try to 
get a pcap anyway. Wonder if there is a way to dump pcap from inside 
kamailio.
Wireshark can decrypt SIP signalling sent over TLS connections if you 
provide server's private key to it.




All the requests within dialog are routed through 2 kamailio 
instances. We want to make sure each phone only sends requests through 
its registrar.


I have included pjsua logs in subsequent emails in this thread. Those 
logs have SIP messages, but only provide client perspective.


Thanks for the help,

Ding


On Mar 20, 2015, at 3:00 AM, Daniel-Constantin Mierla 
mico...@gmail.com mailto:mico...@gmail.com wrote:


Hello,

On 19/03/15 02:54, Ding Ma wrote:

[...]

My first question is why k1 loose_route sends the BYE to itself 
instead of the client. Is this a bug?




can you get the pcap of such call? We have to see the routing headers 
to say what is next hop address.


Are all the requests within dialog routed via same instance of kamailio?

My next question is whether the above location routing for BYE from 
peer kamailio a good/safe approach.


The SIP traces will be sent later to avoid exceeding email size limit.


Cheers,
Daniel
--
Daniel-Constantin Mierla
http://twitter.com/#!/miconda  -http://www.linkedin.com/in/miconda
Kamailio World Conference, May 27-29, 2015
Berlin, Germany -http://www.kamailioworld.com




___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] tcp_max_connection to 4096

2015-01-27 Thread Vitaliy Aleksandrov
You shouldn't feel any performance issues after increasing tcp_max_conn 
to 4096. Connections hash table size is pretty high (1024) so it's not a 
problem at all. Of course if you want to handle twice bigger number of 
simultaneous clients you need to check if you current hardware can 
handle it (RAM, CPU).



Hi Team,

We are seeing some errors in our kamilio for TCP max conn (ERROR) : 
2048 (the default).


We are thinking to double the TCP connection for our kamailio 
registrar server.


tcp_max_connections=4096
Is there any performance issue if we double the tcp_max_connections ?.


Currently we are setting these parameters for TCP.

tcp_connection_lifetime=3605
tcp_accept_no_cl=yes
tcp_rd_buf_size=16384

Do we need to tune any other variable if we are setting max tcp 
connections to 4096 for better performance  ?


Thanks for looking into this.

Regards

Varghese Paul


___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] async workers

2014-10-24 Thread Vitaliy Aleksandrov



Hi,

What is the practical limit to the number of async worker processes?

With SIP child processes, it seems to be about the number of available
CPUs in /proc/cpuinfo. After that--at least, per my testing--one
begins to hit the point of diminishing returns, presumably due to SHM
IPC and synchronisation issues.

Is the restriction similar in the async execution context?

no specific restriction. Also, I haven't seen any degradation when using
more sip worker processes that cpus, which I do have always (at least 2
per CPU), because a worker can do quite a lot of I/O.


I have seen such degradation, at least in my VM testing environment. I 
find that I get the highest CPS (e.g. with sipp) with the smallest 
number of workers.


Actually, I get as good throughput with 4 workers (in an 8 CPU 
scenario on a quad-core processor) as I do with 8! Increasing beyond 8 
leads to diminishing returns.


With real traffic some of workers can be busy on blocking operations 
such as database queries or host name resolution. So I prefer to add 
more workers to not get in situation when all my workers are blocked by 
something.


___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] How to uniquely identify SIP WS / WSS endpoint

2014-08-25 Thread Vitaliy Aleksandrov

On 22.08.14 03:26, Muhammad Shahzad wrote:
Sorry for putting this question on both dev and user mailing lists, as 
it is a rather theoretical question and i hope some SIP guru on either 
mail list will answer.


For non-WS endpoints which use TCP or UDP for SIP transport, each 
upstream request has top most VIA header pointing to the previous hop 
which forwarded the request to current hop while each downstream 
request has top most VIA header pointing to next hop to which it will 
be forwarded from current hop.


But for WS endpoints, the top most VIA has dummy static value, so 
there is no way to identify who sent this request or to whom the reply 
is going to.


Please note that i am not specifically interested in network address 
of remote endpoint (though VIA header is suppose to provide it), i 
only need to match requests and responses from / to a specific device 
using SIP v2.0 standard.


Any help is highly appreciated.

Thank you.



Can you provide an example of scenario you want to create ?
Do you want to understand how transaction and dialog matching works in SIP ?

___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] How to uniquely identify SIP WS / WSS endpoint

2014-08-25 Thread Vitaliy Aleksandrov
When kamailio processes a request script writer can check if there any 
Route header or valid  R-URI or R-URI alias parameter to determine the 
destination. You can check it manually maybe reusing kamailio sip parser.


As you've already said to find a destination where kamailio is going to 
send a reply you can parse via header or its received and rport 
parameters. Even when via doesn't have valid destination (ws/wss 
transport) it has correct received and rport parameters which 
kamailio adds during a request processing.


Via header in INVITE received from WSS client and forwarded to a 
destination looks like this:
Via: SIP/2.0/WSS 
df7jal23ls0d.invalid;received=1.2.3.4;branch=z9hG4bKTp9lzCApgHsdbRUrFcZ4XTCI49EZbbDf;rport=37213



Not really, the main context of this question is in reference to this 
thread,


https://www.mail-archive.com/sr-users@lists.sip-router.org/msg19962.html

A patched to allow network IO intercept in kamailio corex module was 
add to trunk as discussed in this thread,


https://www.mail-archive.com/sr-users@lists.sip-router.org/msg20183.html

Currently i am able to compress / decompress entire sip message coming 
from or going to remote endpoint in kamailio server. It works fine. 
Now i want to try ITV encryption algorithm for this on-wire data.


https://github.com/mshary/itv

For this i need to keep track of remote endpoint. At this low level, i 
only have raw data received from or being transmitted to remote UA, 
without even the remote socket address, so i have no choice but to 
look at this raw data to determine the identity of remote endpoint. 
For non-WS transport, i can easily  look at topmost VIA and extract 
network address to use as unique identification of endpoint who sent 
the data or would receive the data. However, for WS transport this 
topmost VIA is useless static constant string. So VIA checking is 
pointless (all remote endpoints will or may have same top most VIA).


So i was thinking if there is another way to do it? I thought of using 
GRUU, but it is not always present, especially in SIP replies.


Thank you.




On Mon, Aug 25, 2014 at 3:24 PM, Vitaliy Aleksandrov 
vitalik.v...@gmail.com mailto:vitalik.v...@gmail.com wrote:


On 22.08.14 03:26, Muhammad Shahzad wrote:

Sorry for putting this question on both dev and user mailing
lists, as it is a rather theoretical question and i hope some
SIP guru on either mail list will answer.

For non-WS endpoints which use TCP or UDP for SIP transport,
each upstream request has top most VIA header pointing to the
previous hop which forwarded the request to current hop while
each downstream request has top most VIA header pointing to
next hop to which it will be forwarded from current hop.

But for WS endpoints, the top most VIA has dummy static value,
so there is no way to identify who sent this request or to
whom the reply is going to.

Please note that i am not specifically interested in network
address of remote endpoint (though VIA header is suppose to
provide it), i only need to match requests and responses from
/ to a specific device using SIP v2.0 standard.

Any help is highly appreciated.

Thank you.


Can you provide an example of scenario you want to create ?
Do you want to understand how transaction and dialog matching
works in SIP ?

___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing
list
sr-users@lists.sip-router.org mailto:sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users




___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] pkg.stats

2014-07-21 Thread Vitaliy Aleksandrov

Hello,
If there are no changes in configuration script logic and in behavior of 
main modules I can try it.

Hello,

there were some issues with pkgstats that I worked on in master 
branch. Can you give it a try and see if works ok? If all fine, I will 
look at backporting, but there were other changes I did in master for 
a bit more optimizations for memory manager.


Cheers,
Daniel

On 18/07/14 18:22, Vitaliy Aleksandrov wrote:

Hi list,

I have a problem with pkg.stats for tcp.main process on kamailio 
4.1.2 73ea61-dirty.

kamailio has 64M of private memory for each process (-M 64).

pkg.stats for tcp.main process shows that is uses 75M and still has 
62M free:

{
entry:36
pid:10032
rank: -4
used: 73109720
free:  65891192
real_used: 79146048
}

root@webRTC:~# ps -p 10032 -o 
pid,tid,state,pcpu,pmem,rss,size,sz,vsz,args

PID  TID S  %CPU  RSSSIZESZ VSZ COMMAND
10032 10032 S  0 26420 67508 76821307284 
/.../kamailio -f /.../kamailio.cfg -P /.../kamailio.pid -m 128 -M 64 
-u kamailio -g kamailio


This server handles 1000+ tcp/tls connections and works just fine for 
the last two months. That's why i think this is not a memory leak and 
just a pkg.stats problem.


Does anybody else saw this or maybe somebody is already working to 
fix it ?


___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users





___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


[SR-Users] pkg.stats

2014-07-18 Thread Vitaliy Aleksandrov

Hi list,

I have a problem with pkg.stats for tcp.main process on kamailio 4.1.2 
73ea61-dirty.

kamailio has 64M of private memory for each process (-M 64).

pkg.stats for tcp.main process shows that is uses 75M and still has 62M 
free:

{
entry:36
pid:10032
rank: -4
used: 73109720
free:  65891192
real_used: 79146048
}

root@webRTC:~# ps -p 10032 -o pid,tid,state,pcpu,pmem,rss,size,sz,vsz,args
PID  TID S  %CPU  RSSSIZESZ  VSZ COMMAND
10032 10032 S  0 26420 67508 76821307284 
/.../kamailio -f /.../kamailio.cfg -P /.../kamailio.pid -m 128 -M 64 -u 
kamailio -g kamailio


This server handles 1000+ tcp/tls connections and works just fine for 
the last two months. That's why i think this is not a memory leak and 
just a pkg.stats problem.


Does anybody else saw this or maybe somebody is already working to fix it ?

___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


[SR-Users] How to remove attribute from SDP ?

2014-05-14 Thread Vitaliy Aleksandrov

Hello list,

Can anybody suggest the way to remove a line/attribute from SDP that 
matches some pattern (regexp), some kind of grep -v for SDP ?
I'm trying to remove unnecessary ICE candidates from the SDP body and 
only thing I know is the IP address of the candidate I need to remove.


I was trying to use avp_subst() + set_body() or subst_body() but didn't 
get valid SDP.


kamailio-3.2.4.

___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] How to remove attribute from SDP ?

2014-05-14 Thread Vitaliy Aleksandrov
I absolutely forgot about the possibility of embedding scripting 
languages to configuration.

Lua did the trick.

Thanks for the right direction and example.

I can share my solution, using app_python. I'm using this in 
production environment during 2 years.


loadmodule app_python.so
modparam(app_python, script_name, /opt/kamailio/python/sdp.py)
modparam(app_python, mod_init_function, mod_init)
modparam(app_python, child_init_method, child_init)

and put in route():
python_exec(ParseSDP, $mb);

Here I shared sdp.py:
http://paste.debian.net/99473/

Note, that it is just for reference only, you need to know what to 
remove/replace. That script is not exactly what are you're looking for!




___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] Does tls/wss actually work or What is required for tls/wss

2014-03-19 Thread Vitaliy Aleksandrov




Hi,

What are the requirements for connecting with tls/wss.

I have not come across any information or example for this.

My config is working when the client uses ws. However if I change this to use 
wss, (this is it only paramter I change) it does not work.
I understand Kamailio does not support DTLS, I set the jssip client 
DtlsSrtpKeyAgreement to false to disable this, I also set the tls option to not 
require or verify certicficates and it still does not work.

What if other considaerstion do I need to check?

Hi,

Kamailio has nothing to do with DTLS since it handles only sip signalling.

To enable wss support you have to:
- enable tls by enable_tls=yes
- add listening socket listen=tls:x.x.x.x:443 and use this port for 
wss connections

- configure tls module.

___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] Kamailio without tls

2014-02-01 Thread Vitaliy Aleksandrov
Just add listen=tcp:_kamailio_server_ip:5060 to the kamailio.cfg if 
don't have one and change sip settings of your SIP application to 
disable tls.
You can have both clear tcp and tls at the same time and application 
will choose which type of connection to use.


Hi Support,

I have recently kamailio 4.0.x version with tls on port 5061. Now our 
development team needs to connect to it using unencrypted on port 5060 
to test an app for features and then work towards connecting through 
tls connection.


So my question is how do I temporarily disable tls to test all the 
features on the kamailio server and then once feature testing is done 
revert back to tls connection?


Best Regards,

Neville D'Souza



___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] pkg.stats problem, possible memory leak in websockets.

2013-10-02 Thread Vitaliy Aleksandrov

On 10/01/2013 12:54 PM, Peter Dunkley wrote:

Done.

The patch is in master and the 4.0 branch.

Thanks,

Peter

Thanks for applying the patch. It looks like websockets in master are 
stable now. No memory leaks are detected for the last two days.
pks.stats still shows some strange numbers, but this is another issue. 
Hope to get some free time in the nearest future to dig more about 
memory stats.


___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] pkg.stats problem, possible memory leak in websockets.

2013-10-01 Thread Vitaliy Aleksandrov

Hello,

Thank you for the explanation.
Could somebody review the patch in the attachment ? I tried to fix the 
problem with a growing tcpconn-refcnt for websocket connections.



On 30 September 2013 17:14, Vitaliy Aleksandrov 
vitalik.v...@gmail.com mailto:vitalik.v...@gmail.com wrote:



Could you please share why nathelper aggregates both WS and WSS
transports to ws and then msg_translator have to detect the type
of a connection to a destination to build correct via ?

modules/nathelper/nathelper.c create_rcv_uri() function :
case PROTO_WS:
case PROTO_WSS:
proto.s = WS;
proto.len = 2;
break;


Because when the transport is WS (WebSockets over TCP) the URI has a 
transport parameter like this ;transport=ws and when the transport 
is WSS (Secure WebSockets over TLS over TCP) the URI has a transport 
parameter like this ;transport=ws.  In other words, the transport 
parameter is the same for both and you need to make the determination 
within Kamailio core by checking how the specified socket is actually 
used.


--
Peter Dunkley
Technical Director
Crocodile RCS Ltd


___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


diff --git a/msg_translator.c b/msg_translator.c
index b7d4894..b4581e7 100644
--- a/msg_translator.c
+++ b/msg_translator.c
@@ -2509,9 +2509,11 @@ char* via_builder( unsigned int *len,
 		} else if (con-rcv.proto==PROTO_WSS) {
 			memcpy(line_buf+MY_VIA_LEN-4, WSS , 4);
 		} else {
+			tcpconn_put(con);
 			LOG(L_CRIT, BUG: via_builder: unknown proto %d\n, con-rcv.proto);
 			return 0;
 		}
+		tcpconn_put(con);
 	}else if (send_info-proto==PROTO_WSS){
 		memcpy(line_buf+MY_VIA_LEN-4, WSS , 4);
 	}else{
___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] pkg.stats problem

2013-09-30 Thread Vitaliy Aleksandrov

I found one place where tcpconn_put() never called after tcpconn_get():
--- a/msg_translator.c
+++ b/msg_translator.c
@@ -2509,9 +2509,11 @@ char* via_builder( unsigned int *len,
} else if (con-rcv.proto==PROTO_WSS) {
memcpy(line_buf+MY_VIA_LEN-4, WSS , 4);
} else {
+   tcpconn_put(con);
LOG(L_CRIT, BUG: via_builder: unknown proto 
%d\n, con-rcv.proto);

return 0;
}
+   tcpconn_put(con);
}else if (send_info-proto==PROTO_WSS){
memcpy(line_buf+MY_VIA_LEN-4, WSS , 4);
}else{

I've tried this patch and it fixed my problem with constantly growing 
ref_count for WSS connections.


Could you please share why nathelper aggregates both WS and WSS 
transports to ws and then msg_translator have to detect the type of a 
connection to a destination to build correct via ?


modules/nathelper/nathelper.c create_rcv_uri() function :
case PROTO_WS:
case PROTO_WSS:
proto.s = WS;
proto.len = 2;
break;


___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] pkg.stats problem

2013-09-26 Thread Vitaliy Aleksandrov

At first thanks for trying to help.

It's my fault that I messed up top to this story, just wanted to show 
that while my system is working just fine:
1. used and real_used fields of a process (tcp receiver) is bigger 
that I set in -M

2. free hasn't changed from the last restart.

root@proxy:~# kamcmd pkg.stats | grep '2480' -A 4
pid: 2480
rank: 17
used: 34156336
free: 32611216
real_used: 35228672

root@proxy:~# ps aux|grep 2480
kamailio  2480  0.0  0.3 348160 15836 ?SSep23   0:10 
/usr/local/kamailio-master/sbin/kamailio -f /etc/kamailio/kamailio.cfg 
-P /var/run/kamailio/kamailio.pid -m 128 -M 32 -u kamailio -g kamailio


root@proxy:~# kamctl ps | grep 2480
Process::  ID=22 PID=2480 Type=tcp receiver (generic) child=6


___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] pkg.stats problem

2013-09-26 Thread Vitaliy Aleksandrov

Yes, I found you commit. That's why now I'm using latest master.

tcl_list shows 200+ tcp connections and only a few of them have 
ref_count bigger that 1. netstat shows the same number of established 
connections.
If lost tcp_conn structures are not shown in tcp_list how can I check if 
it is my problem and there are lost chunks of memory somewhere ?


When I was searching for the way how correctly decrement ref_count in 
tcp_conn I decided to call tcpconn_put(), as you did for webcoskets.

I found that there are several function to decrement it:
- tcpconn_put()
- tcpconn_chld_put()
- atomic_dec_and_test().

When I was looking for examples in other modules I saw that tcp_read.c 
uses tcpconn_chld_put(), but forward.h and msg_translator.c uses only 
tcpconn_get() without decrementing ref counter at all.


I hope someone who knows tcp implementation in kamailio can shed light 
on this question.




___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] pkg.stats problem

2013-09-25 Thread Vitaliy Aleksandrov
I switched to the latest master branch and it seems it works better, but 
unfortunately I can't understand how much PKG memory kamailio really 
uses to know it still has problems with PKG.


For instance kamcmd pkg.stats always shows that tcp_main process has 
free: 32627984 (started with -M 32), while real_used: 22560048 and RES 
in top output for the same process is 8904.


___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] unregister user when kamailio looses TCP connection.

2013-09-23 Thread Vitaliy Aleksandrov

On 09/23/2013 11:23 PM, Andreas Granig wrote:

Hi,

On 09/13/2013 11:27 AM, Daniel-Constantin Mierla wrote:

thanks, patch was commited and pushed to remote repository.


The patch only handles the case where a tcp connection is directly 
made to the registrar, as no event route is fired, right?
You are right. Current version works only when registrar accepts tcp 
connections.
Anyway it's a good idea to call event_route[] when kamailio looses a tcp 
connection to give user a chance to process it somehow.


On the one hand it's great when experienced user can achieve what he 
wants by different ways depending on the situation, but on the other it 
makes a mess for new kamailio users.


___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] pkg.stats problem

2013-09-21 Thread Vitaliy Aleksandrov

Additional info:
- kamailio-4.0.2 started with -m 128 -M 16
- Process::  ID=36 PID=2599 Type=tcp main process
- this server works as a websocket(ws,wss) to udp/tcp gateway.

PKG:
Also top output showed that RES column of tcp workers was constantly 
growing.


SHM:
After some time kamailio stoped to accept wss connections and printed 
ssl bug #1491 workaround: not enough memory for safe operation.

According to tls_server.c it's a sign of shm leak.

Master branch has a lot of fixes to websocket module which solve 
problems with pkg and shm memory:


Is it a good a good idea to use websocket module from the master branch 
with a 4.0 verion ?



Hello,

can you get the type of the process with 'kamctl ps'?

Cheers,
Daniel

On 9/20/13 6:51 PM, Vitaliy Aleksandrov wrote:
Didn't check master branch before writing previous email. There were 
some commits about memory leaks in websocket module. Will try master.


___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users





___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] pkg.stats problem

2013-09-20 Thread Vitaliy Aleksandrov
Didn't check master branch before writing previous email. There were 
some commits about memory leaks in websocket module. Will try master.


___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] unregister user when kamailio looses TCP connection.

2013-09-10 Thread Vitaliy Aleksandrov
Maybe when I opened the previous patch by a text editor to check if it 
has all I wanted to add tabs were accidentally replaced by spaces.

Anyway fixed version is in the attachment.
How did you generate the patch? Apparently the tabs in existing code 
were replaced by whitespaces and the patch fails to apply because it 
doesn't match any longer the context.


Can you resend in it raw format with 'git diff ../filename.patch'?

Cheers,
Daniel


On Fri, Sep 6, 2013 at 12:46 AM, Vitaliy Aleksandrov 
vitalik.v...@gmail.com mailto:vitalik.v...@gmail.com wrote:



Make the patch for master branch, 4.0 doesn't take any new
feature and I applied the patches to master branch anyhow.

Also, do not forget the patch for xml documentation.

Cheers,
Daniel

Patch for master branch is in the attachment.

Changelog:
- documentation is updated
- tcpconn_id initialized to -1 for contacts loaded from a
database during startup (Write-Back  Write-Through database modes).
- tcpconn_id is being updated when UA reconnects and refreshes its
registration.

___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing
list
sr-users@lists.sip-router.org mailto:sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users




--
Daniel-Constantin Mierla - http://www.asipto.com
http://twitter.com/#!/miconda http://twitter.com/#%21/miconda - 
http://www.linkedin.com/in/miconda

Kamailio Advanced Trainings - Berlin, Oct 21-24; Miami, Nov 11-13, 2013
   - more details about Kamailio trainings at http://www.asipto.com -


___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


diff --git a/modules/usrloc/doc/usrloc_admin.xml b/modules/usrloc/doc/usrloc_admin.xml
index ce7ddfb..4f7e3e5 100644
--- a/modules/usrloc/doc/usrloc_admin.xml
+++ b/modules/usrloc/doc/usrloc_admin.xml
@@ -875,6 +875,26 @@ modparam(usrloc, db_ops_ruid, 1)
 		/example
 	/section
 
+	section id=usrloc.p.handle_lost_tcp
+		titlevarnamehandle_lost_tcp/varname (int)/title
+		para
+			If set to 1, Kamailio will remove location records made via
+			TCP/TLS/WS/WSS transports when it looses corresponding tcp connections.
+		/para
+		para
+		emphasis
+			Default value is quote0/quote.
+		/emphasis
+		example
+		titleSet varnamehandle_lost_tcp/varname parameter/title
+		programlist format=linespecific
+...
+modparam(usrloc, handle_lost_tcp, 1)
+...
+programlisting
+		/example
+	/section
+
 	/section
 
 	section
diff --git a/modules/usrloc/ucontact.c b/modules/usrloc/ucontact.c
index e7f8938..9cc2e06 100644
--- a/modules/usrloc/ucontact.c
+++ b/modules/usrloc/ucontact.c
@@ -307,6 +307,7 @@ int mem_update_ucontact(ucontact_t* _c, ucontact_info_t* _ci)
 	_c-last_keepalive = _ci-last_modified;
 	_c-flags = _ci-flags;
 	_c-cflags = _ci-cflags;
+	_c-tcpconn_id = _ci-tcpconn_id;
 
 	return 0;
 }
diff --git a/modules/usrloc/udomain.c b/modules/usrloc/udomain.c
index f587c1b..244f8e7 100644
--- a/modules/usrloc/udomain.c
+++ b/modules/usrloc/udomain.c
@@ -351,6 +351,9 @@ static inline ucontact_info_t* dbrow2info( db_val_t *vals, str *contact)
 		ci.reg_id = VAL_UINT(vals+15);
 	}
 
+	/* tcp connection id */
+	ci.tcpconn_id = -1;
+
 	return ci;
 }
 
diff --git a/modules/usrloc/ul_mod.c b/modules/usrloc/ul_mod.c
index 7d88f67..b1be56b 100644
--- a/modules/usrloc/ul_mod.c
+++ b/modules/usrloc/ul_mod.c
@@ -161,7 +161,7 @@ int timer_interval  = 60;/*! Timer interval in seconds */
 int db_mode = 0;/*! Database sync scheme: 0-no db, 1-write through, 2-write back, 3-only db */
 int use_domain  = 0;/*! Whether usrloc should use domain part of aor */
 int desc_time_order = 0;/*! By default do not enable timestamp ordering */
-int handle_lost_tcp = 0;
+int handle_lost_tcp = 0;/*! By default do not remove contacts before expiration time */
 
 int ul_fetch_rows = 2000;/*! number of rows to fetch from result */
 int ul_hash_size = 9;
___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] unregister user when kamailio looses TCP connection.

2013-09-05 Thread Vitaliy Aleksandrov

This patch has a bug which leads to false contact removal.

This happens when UA reconnects to a proxy from the same src port and 
sends new REGISTER with the same Contact. In that case kamailio updates 
an existing contact and I forgot to update tcp connection id in the 
ucontact_t object.


I've fixed this bug in my production system (kamailio-3.2) and it works 
well.

The patch for 4.0.3 will be ready tonight.

Hello,

I applied your patches with some changes. There is no need to store 
tcp connection id in other structure in the core, it is stored in 
msg-rcv.proto_reserved1.


You have to add the documentation for the new usrloc parameter, in xml 
files from modules/usrloc/doc/ - send over the patch and I will commit 
it as well.


Cheers,
Daniel

On 8/29/13 12:47 PM, Vitaliy Aleksandrov wrote:

Thanks community for all replies.

I did the second try. Result is in the attachment.

This time a did it in the way proposed by Daniel-Constantin Mierla.
All job is done in timer process when it iterates through all 
registrations looking for expired ones.


It works for all database modes except DB_ONLY.

I'm not sure about tcpconn_get() / tcpconn_put() functions. 
tcpconn_get() increments ref counter, but there are several function 
to decrement it: tcpconn_put(), tcpconn_chld_put() and 
atomic_dec_and_test(). When I was looking for examples in other 
modules I saw that tcp_read.c uses tcpconn_chld_put(), but forward.h 
and msg_translator.c uses only tcpconn_get() without decrementing ref 
counter at all.


It would be great if somebody more experienced shed some light on this.





___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


--
Daniel-Constantin Mierla -http://www.asipto.com
http://twitter.com/#!/miconda  -http://www.linkedin.com/in/miconda
Kamailio Advanced Trainings - Berlin, Oct 21-24; Miami, Nov 11-13, 2013
   - more details about Kamailio trainings athttp://www.asipto.com  -


___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] unregister user when kamailio looses TCP connection.

2013-09-05 Thread Vitaliy Aleksandrov
Make the patch for master branch, 4.0 doesn't take any new feature and 
I applied the patches to master branch anyhow.


Also, do not forget the patch for xml documentation.

Cheers,
Daniel

Patch for master branch is in the attachment.

Changelog:
- documentation is updated
- tcpconn_id initialized to -1 for contacts loaded from a database 
during startup (Write-Back  Write-Through database modes).
- tcpconn_id is being updated when UA reconnects and refreshes its 
registration.
diff --git a/modules/usrloc/doc/usrloc_admin.xml b/modules/usrloc/doc/usrloc_admin.xml
index ce7ddfb..4f7e3e5 100644
--- a/modules/usrloc/doc/usrloc_admin.xml
+++ b/modules/usrloc/doc/usrloc_admin.xml
@@ -875,6 +875,26 @@ modparam(usrloc, db_ops_ruid, 1)
/example
/section
 
+   section id=usrloc.p.handle_lost_tcp
+   titlevarnamehandle_lost_tcp/varname (int)/title
+   para
+   If set to 1, Kamailio will remove location records made via
+   TCP/TLS/WS/WSS transports when it looses corresponding tcp connections.
+   /para
+   para
+   emphasis
+   Default value is quote0/quote.
+   /emphasis
+   example
+   titleSet varnamehandle_lost_tcp/varname parameter/title
+   programlist format=linespecific
+...
+modparam(usrloc, handle_lost_tcp, 1)
+...
+programlisting
+   /example
+   /section
+
/section
 
section
diff --git a/modules/usrloc/ucontact.c b/modules/usrloc/ucontact.c
index e7f8938..9cc2e06 100644
--- a/modules/usrloc/ucontact.c
+++ b/modules/usrloc/ucontact.c
@@ -307,6 +307,7 @@ int mem_update_ucontact(ucontact_t* _c, ucontact_info_t* _ci)
_c-last_keepalive = _ci-last_modified;
_c-flags = _ci-flags;
_c-cflags = _ci-cflags;
+   _c-tcpconn_id = _ci-tcpconn_id;
 
return 0;
 }
diff --git a/modules/usrloc/udomain.c b/modules/usrloc/udomain.c
index f587c1b..244f8e7 100644
--- a/modules/usrloc/udomain.c
+++ b/modules/usrloc/udomain.c
@@ -351,6 +351,9 @@ static inline ucontact_info_t* dbrow2info( db_val_t *vals, str *contact)
ci.reg_id = VAL_UINT(vals+15);
}
 
+   /* tcp connection id */
+   ci.tcpconn_id = -1;
+
return ci;
 }
 
diff --git a/modules/usrloc/ul_mod.c b/modules/usrloc/ul_mod.c
index 7d88f67..b1be56b 100644
--- a/modules/usrloc/ul_mod.c
+++ b/modules/usrloc/ul_mod.c
@@ -161,7 +161,7 @@ int timer_interval  = 60;   /*! Timer interval in seconds */
 int db_mode = 0;   /*! Database sync scheme: 0-no db, 1-write through, 2-write back, 3-only db */
 int use_domain  = 0;   /*! Whether usrloc should use domain part of aor */
 int desc_time_order = 0;   /*! By default do not enable timestamp ordering */
-int handle_lost_tcp = 0;
+int handle_lost_tcp = 0;   /*! By default do not remove contacts before expiration time */
 
 int ul_fetch_rows = 2000;  /*! number of rows to fetch from result */
 int ul_hash_size = 9;
___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] kamailio load balancing

2013-08-30 Thread Vitaliy Aleksandrov
As written many time in this mailing list it depends on what services 
you want to provide using such voice servers. If they are transparent 
media relays then rtpproxy or mediaproxy(-ng) can help. Also you can 
integrate it with your billing to authorize calls and limit their duration.


Though if you want to provide voicemail, call recording, transcoding, 
etc.. you have to use software like asterisk or freeswitch.

Hello, I have a question about the load balancing module of kamailio.
As the site http://kb.asipto.com/ say, Kamailio is as a SIP proxy 
router to scale Asterisk.
Can I run a kamailio instance as load balancer, and other several 
instances as voice server replace of Asterisk?
If I can do that, could you give me a tutorial? We are using kamailio 
as our server. Thank you very much.



___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] unregister user when kamailio looses TCP connection.

2013-08-29 Thread Vitaliy Aleksandrov

Thanks community for all replies.

I did the second try. Result is in the attachment.

This time a did it in the way proposed by Daniel-Constantin Mierla.
All job is done in timer process when it iterates through all 
registrations looking for expired ones.


It works for all database modes except DB_ONLY.

I'm not sure about tcpconn_get() / tcpconn_put() functions. 
tcpconn_get() increments ref counter, but there are several function to 
decrement it: tcpconn_put(), tcpconn_chld_put() and 
atomic_dec_and_test(). When I was looking for examples in other modules 
I saw that tcp_read.c uses tcpconn_chld_put(), but forward.h and 
msg_translator.c uses only tcpconn_get() without decrementing ref 
counter at all.


It would be great if somebody more experienced shed some light on this.



diff -uNpr kamailio-4.0.3/ip_addr.h sshfs_kamailio-4.0.3/ip_addr.h
--- kamailio-4.0.3/ip_addr.h	2013-08-15 16:42:39.0 +0300
+++ sshfs_kamailio-4.0.3/ip_addr.h	2013-08-28 18:28:08.0 +0300
@@ -142,6 +142,7 @@ struct receive_info{
 	struct socket_info* bind_address; /* sock_info structure on which 
 	  the msg was received*/
 	char proto;
+	int tcpconn_id; /* tcp_connnection-id */
 #ifdef USE_COMP
 	short comp; /* compression */
 #endif
diff -uNpr kamailio-4.0.3/modules/registrar/save.c sshfs_kamailio-4.0.3/modules/registrar/save.c
--- kamailio-4.0.3/modules/registrar/save.c	2013-08-15 16:42:39.0 +0300
+++ sshfs_kamailio-4.0.3/modules/registrar/save.c	2013-08-29 01:44:11.0 +0300
@@ -259,6 +259,14 @@ static inline ucontact_info_t* pack_ci(
 			ci.sock = _m-rcv.bind_address;
 		}
 
+		/* set tcp connection id */
+		if (_m-rcv.proto==PROTO_TCP || _m-rcv.proto==PROTO_TLS
+		|| _m-rcv.proto==PROTO_WS  || _m-rcv.proto==PROTO_WSS) {
+			ci.tcpconn_id = _m-rcv.tcpconn_id;
+		} else {
+			ci.tcpconn_id = -1;
+		}
+
 		/* additional info from message */
 		if (parse_headers(_m, HDR_USERAGENT_F, 0) != -1  _m-user_agent 
 		_m-user_agent-body.len0  _m-user_agent-body.lenUA_MAX_SIZE) {
@@ -488,7 +496,7 @@ static inline int insert_contacts(struct
 
 		/* hack to work with buggy clients having many contacts with same
 		 * address in one REGISTER - increase CSeq to detect if there was
-		 * one alredy added, then update */
+		 * one already added, then update */
 		ci-cseq++;
 		if ( r-contacts==0
 || ul.get_ucontact_by_instance(r, _c-uri, ci, c) != 0) {
diff -uNpr kamailio-4.0.3/modules/usrloc/ucontact.c sshfs_kamailio-4.0.3/modules/usrloc/ucontact.c
--- kamailio-4.0.3/modules/usrloc/ucontact.c	2013-08-15 16:42:39.0 +0300
+++ sshfs_kamailio-4.0.3/modules/usrloc/ucontact.c	2013-08-29 01:49:56.0 +0300
@@ -135,6 +135,7 @@ ucontact_t* new_ucontact(str* _dom, str*
 	c-reg_id = _ci-reg_id;
 	c-last_modified = _ci-last_modified;
 	c-last_keepalive = _ci-last_modified;
+	c-tcpconn_id = _ci-tcpconn_id;
 #ifdef WITH_XAVP
 	ucontact_xavp_store(c);
 #endif
diff -uNpr kamailio-4.0.3/modules/usrloc/ul_mod.c sshfs_kamailio-4.0.3/modules/usrloc/ul_mod.c
--- kamailio-4.0.3/modules/usrloc/ul_mod.c	2013-08-15 16:42:39.0 +0300
+++ sshfs_kamailio-4.0.3/modules/usrloc/ul_mod.c	2013-08-29 13:04:13.0 +0300
@@ -161,6 +161,7 @@ int timer_interval  = 60;/*! Timer
 int db_mode = 0;/*! Database sync scheme: 0-no db, 1-write through, 2-write back, 3-only db */
 int use_domain  = 0;/*! Whether usrloc should use domain part of aor */
 int desc_time_order = 0;/*! By default do not enable timestamp ordering */
+int handle_lost_tcp = 0;
 
 int ul_fetch_rows = 2000;/*! number of rows to fetch from result */
 int ul_hash_size = 9;
@@ -214,6 +215,7 @@ static param_export_t params[] = {
 	{fetch_rows,  INT_PARAM, ul_fetch_rows   },
 	{hash_size,   INT_PARAM, ul_hash_size},
 	{nat_bflag,   INT_PARAM, nat_bflag   },
+	{handle_lost_tcp, INT_PARAM, handle_lost_tcp },
 	{preload, STR_PARAM|USE_FUNC_PARAM, (void*)ul_preload_param},
 	{db_update_as_insert, INT_PARAM, ul_db_update_as_insert},
 	{timer_procs, INT_PARAM, ul_timer_procs},
@@ -387,6 +389,10 @@ static int mod_init(void)
 			return -1;
 		}
 	}
+
+	if (handle_lost_tcp  db_mode == DB_ONLY)
+		LM_WARN(handle_lost_tcp option makes nothing in DB_ONLY mode\n);
+
 	init_flag = 1;
 
 	return 0;
diff -uNpr kamailio-4.0.3/modules/usrloc/ul_mod.h sshfs_kamailio-4.0.3/modules/usrloc/ul_mod.h
--- kamailio-4.0.3/modules/usrloc/ul_mod.h	2013-08-15 16:42:38.0 +0300
+++ sshfs_kamailio-4.0.3/modules/usrloc/ul_mod.h	2013-08-29 02:06:38.0 +0300
@@ -84,6 +84,7 @@ extern int ul_hash_size;
 extern int ul_db_update_as_insert;
 extern int ul_db_check_update;
 extern int ul_keepalive_timeout;
+extern int handle_lost_tcp;
 
 /*! nat branch flag */
 extern unsigned int nat_bflag;
diff -uNpr kamailio-4.0.3/modules/usrloc/urecord.c sshfs_kamailio-4.0.3/modules/usrloc/urecord.c
--- kamailio-4.0.3/modules/usrloc/urecord.c	2013-08-15 16:42:39.0 +0300
+++ 

Re: [SR-Users] unregister user when kamailio looses TCP connection.

2013-08-28 Thread Vitaliy Aleksandrov

On 08/28/2013 06:45 PM, Juha Heinanen wrote:

Vitaliy Aleksandrov writes:


If anybody else except me need this It would be great to fix known
problems and add it to kamailio.

i don't know if this come already up, but why not use this in branch
failure route:

unregister(location, , $T_reply_rid);
Didn't know about $T_reply_rid variable and that unregister can remove 
only single contact.
In my case the problem with unregister is that stale contact will be 
removed only if somebody tries to call to a disconnected phone.


___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] unregister user when kamailio looses TCP connection.

2013-08-27 Thread Vitaliy Aleksandrov

On 08/27/2013 10:22 AM, Olle E. Johansson wrote:
Let's work on a description on the logic needed and see if Vitally's 
code is close:


1. Connection dies (tcp, tls, sctp)
2. Event-route activates
3. Check if there's a outbound flow with reg-id associated with the flow
4. If not, is there a registration associated with the flow
5. If 3 or 4 is true, do something

Do we have functions for 3 and 4? Can this be done in scripting?
Haven't seen functions which can do 3 and 4 at the last stable usrloc 
module.


___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] unregister user when kamailio looses TCP connection.

2013-08-27 Thread Vitaliy Aleksandrov

On 08/27/2013 11:57 AM, Daniel-Constantin Mierla wrote:

Hello,

thanks for the patch. Some remarks.

As you highlighted that the solution is not very efficient (due to no 
direct mapping between records and tcp connection), it should have a 
way to disable it (maybe via mod param for usrloc).


At this moment is hardcoded for 'location' table, but there can be 
other names used, since this value is given as parameter to 
save()/lookup(). It will have to iterate through all usrloc tables 
(called domains interanlly in the module).
Ok, I'll remove hardcoded location domain. It will search in all 
domains from dlist_t. Module parameter will be added too.
I understand that search through the all contacts is not for production 
use at all. I really need this feature and I'm sure everyone who uses 
tcp/tls/ws too so I wanted to start this discussion from a little peace 
of code to get feedback from community.
Also, if I didn't get it wrong, it works only with in-memory records, 
if the usrloc is configured in db-only mode, it does not work with 
current patch, right?


To remove old contacts i've used delete_ucontact from usrloc api. This 
function checks db_mode and removes contact from db in case of DB_ONLY 
mode and just updates expiration in case of WRITE_BACK.
I had in mind to implement such features, but using timer, to iterate 
through tcp connections and see if there is still an open connection 
for it. This will do delayed discovery, but I am not sure it will 
bring more benefits -- initially I thought is faster lookup done by a 
dedicated timer, presumly there are less tcp connections that usrloc 
records.


Anyhow, perhaps we should do some optimization here, we can store the 
connection id in usrloc structure and then match received address only 
if there is same conenction id. Or add received built from tcp 
connection close callback in a list that is used by usrloc expires timers.
Searching through a single list from a separate process sounds much 
better than my version. I'll try to implement this when I have free time.



The way Olle proposed looks more preferable as it can work in 
environment with separate registrar and outbound servers. But I have to 
read some theory about outbound before moving this way.
___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] unregister user when kamailio looses TCP connection.

2013-08-27 Thread Vitaliy Aleksandrov


Also, if I didn't get it wrong, it works only with in-memory records, 
if the usrloc is configured in db-only mode, it does not work with 
current patch, right?


To remove old contacts i've used delete_ucontact from usrloc api. 
This function checks db_mode and removes contact from db in case of 
DB_ONLY mode and just updates expiration in case of WRITE_BACK.


But the issue would be that the hash tables will not be in memory, so 
you will not get in this way to call the delete_ucontact() function. 
This function is called via a different code path for db only mode.
Tnx, good remark. It shows that I missed how DB_ONLY mode works. Will 
spent some time to examine it.
Just remembered that kamailio can close connection from its side due to 
tcp_connection_lifetime parameter. Haven't checked where how it works.


___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


[SR-Users] unregister user when kamailio looses TCP connection.

2013-08-26 Thread Vitaliy Aleksandrov

Hello,

I've made a patch to kamailio-4.0.3 which removes stale registration 
when kamailio looses an incoming tcp connection.

Of course this patch needs more work.

Since the are no direct references between user location contacts and 
tcp connections callback function uses linear search through the whole 
location table using received field as a key.


Can anybody more experienced in kamailio internals check if I chose the 
right place to get information about lost tcp connections ?
Another thing I wanted to ask is maybe somebody can suggest a better way 
to tie a tcp connection to the user location information without 
complicating usrloc module by any heavy data structures.


If anybody else except me need this It would be great to fix known 
problems and add it to kamailio.
diff -uNr kamailio-4.0.3/events.c sshfs-4.0.3/events.c
--- kamailio-4.0.3/events.c	2013-08-15 16:42:39.0 +0300
+++ sshfs-4.0.3/events.c	2013-08-26 17:02:15.0 +0300
@@ -106,6 +106,11 @@
 	_sr_events_list.tcp_ws_frame_out = f;
 else return -1;
 			break;
+		case SREV_TCP_CONN_LOST:
+if(_sr_events_list.tcp_conn_lost==0)
+	_sr_events_list.tcp_conn_lost = f;
+else return -1;
+			break;
 		default:
 			return -1;
 	}
@@ -209,6 +214,12 @@
 	ret = _sr_events_list.tcp_ws_frame_out(data);
 	return ret;
 } else return 1;
+		case SREV_TCP_CONN_LOST:
+if(unlikely(_sr_events_list.tcp_conn_lost!=0))
+{
+	ret = _sr_events_list.tcp_conn_lost(data);
+	return ret;
+} else return 1;
 		default:
 			return -1;
 	}
@@ -242,6 +253,8 @@
 return (_sr_events_list.tcp_ws_frame_in!=0)?1:0;
 		case SREV_TCP_WS_FRAME_OUT:
 return (_sr_events_list.tcp_ws_frame_out!=0)?1:0;
+		case SREV_TCP_CONN_LOST:
+return (_sr_events_list.tcp_conn_lost!=0)?1:0;
 	}
 	return 0;
 }
diff -uNr kamailio-4.0.3/events.h sshfs-4.0.3/events.h
--- kamailio-4.0.3/events.h	2013-08-15 16:42:39.0 +0300
+++ sshfs-4.0.3/events.h	2013-08-26 17:01:51.0 +0300
@@ -30,10 +30,11 @@
 #define SREV_PKG_SET_USED		5
 #define SREV_PKG_SET_REAL_USED	6
 #define SREV_NET_DGRAM_IN		7
-#define SREV_TCP_HTTP_100C		8
-#define SREV_TCP_MSRP_FRAME		9
-#define SREV_TCP_WS_FRAME_IN		10
-#define SREV_TCP_WS_FRAME_OUT		11
+#define SREV_TCP_HTTP_100C  8
+#define SREV_TCP_MSRP_FRAME 9
+#define SREV_TCP_WS_FRAME_IN10
+#define SREV_TCP_WS_FRAME_OUT   11
+#define SREV_TCP_CONN_LOST  12
 
 
 typedef int (*sr_event_cb_f)(void *data);
@@ -50,6 +51,7 @@
 	sr_event_cb_f tcp_msrp_frame;
 	sr_event_cb_f tcp_ws_frame_in;
 	sr_event_cb_f tcp_ws_frame_out;
+	sr_event_cb_f tcp_conn_lost;
 } sr_event_cb_t;
 
 void sr_event_cb_init(void);
diff -uNr kamailio-4.0.3/modules/usrloc/tcp_conn_cb.c sshfs-4.0.3/modules/usrloc/tcp_conn_cb.c
--- kamailio-4.0.3/modules/usrloc/tcp_conn_cb.c	1970-01-01 03:00:00.0 +0300
+++ sshfs-4.0.3/modules/usrloc/tcp_conn_cb.c	2013-08-26 18:36:16.0 +0300
@@ -0,0 +1,179 @@
+#include ../../dprint.h
+#include ../../tcp_conn.h
+#include ../../ip_addr.h
+#include tcp_conn_cb.h
+#include usrloc.h
+#include dlist.h
+#include udomain.h
+#include urecord.h
+#include ucontact.h
+
+/* result points to a static buffer.
+ * Ones should copy it before the next call to not loose data */
+static int
+create_rcv_uri(str* uri, struct tcp_connection *c)
+{
+	static char buf[MAX_URI_SIZE];
+	char *p;
+	str ip, port;
+	int len;
+	str proto;
+
+	if (!uri || !c) {
+		LM_ERR(invalid parameter value\n);
+		return -1;
+	}
+
+	ip.s = ip_addr2a(c-rcv.src_ip);
+	ip.len = strlen(ip.s);
+
+	port.s = int2str(c-rcv.src_port, port.len);
+
+	switch(c-rcv.proto) {
+	case PROTO_NONE:
+	case PROTO_UDP:
+		proto.s = 0; /* Do not add transport parameter, UDP is default */
+		proto.len = 0;
+		break;
+
+	case PROTO_TCP:
+		proto.s = TCP;
+		proto.len = 3;
+		break;
+
+	case PROTO_TLS:
+		proto.s = TLS;
+		proto.len = 3;
+		break;
+
+	case PROTO_SCTP:
+		proto.s = SCTP;
+		proto.len = 4;
+		break;
+
+	case PROTO_WS:
+	case PROTO_WSS:
+		proto.s = WS;
+		proto.len = 2;
+		break;
+
+	default:
+		LM_ERR(unknown transport protocol\n);
+		return -1;
+	}
+
+	/* sip: + ip + [only for ipv6] + : + port */
+	len = 4 + ip.len + 2*(c-rcv.src_ip.af==AF_INET6) + 1 + port.len;
+	if (proto.s) {
+		len += TRANSPORT_PARAM_LEN;
+		len += proto.len;
+	}
+
+	if (len  MAX_URI_SIZE) {
+		LM_ERR(buffer too small\n);
+		return -1;
+	}
+
+	p = buf;
+	memcpy(p, sip:, 4);
+	p += 4;
+
+	if (c-rcv.src_ip.af==AF_INET6)
+		*p++ = '[';
+	memcpy(p, ip.s, ip.len);
+	p += ip.len;
+	if (c-rcv.src_ip.af==AF_INET6)
+		*p++ = ']';
+
+	*p++ = ':';
+
+	memcpy(p, port.s, port.len);
+	p += port.len;
+
+	if (proto.s) {
+		memcpy(p, TRANSPORT_PARAM, TRANSPORT_PARAM_LEN);
+		p += TRANSPORT_PARAM_LEN;
+
+		memcpy(p, proto.s, proto.len);
+		p += proto.len;
+	}
+
+	uri-s = buf;
+	uri-len = len;
+
+	return 0;
+}
+
+static int remove_by_rcv(str *rcv)
+{
+	udomain_t *d = NULL;
+	urecord_t *r = NULL;
+	ucontact_t *c = NULL;
+	str d_name = {location, strlen(location)};
+	int 

Re: [SR-Users] Finding Destination IP:Port for 200 OK

2013-08-25 Thread Vitaliy Aleksandrov
AFAIK there is no any single pv that provides a destination for both sip 
message types (request/reply).
As you can see from my example $sel(next_hop.host) contains dst only for 
sip requests. To know where kamailio is going to send
a reply you can check the second VIA header parameters like received or 
host if received is not present.


BTW after calling such a route $var(next_hop) or any other you want to 
use has what you need in a single pv.



Thanks Vitaliy,
That seems working, I am testing with it..it's great.
Can I ask if there is any psuedo variable for this thing !

Best Regards,
Sammy



On Sat, Aug 24, 2013 at 3:10 PM, Vitaliy Aleksandrov 
vitalik.v...@gmail.com mailto:vitalik.v...@gmail.com wrote:


How about next config snippet:

/route[GET_NEXT_HOP]//
//{//
//$var(next_hop) = $null;//

//if (is_request()) {//
//$var(next_hop) = $sel(next_hop.host);//
//} else if (is_reply()) {//
// if ($sel(via[2].received) != $null)//
//$var(next_hop) = $sel(via[2].received);//
//else//
//$var(next_hop) = $sel(via[2].host);//
//}//
//}/

If you need to know what next hop kamailio will use to forward
current sip message (request/reply) you can just call
route(GET_NEXT_HOP) which puts what you need into $var(next_hop).


Dear list,

Its just a little thing to ask but I somehow can't seem to figure
out which psuedo variable to use to find out where a particular
200 OK is destined to go.

the scenario is I've multiple media servers in dispatcher and
calls are distributed. I need to capture a 200OK that is destined
to go to a particular ip!

I've tried using the dst_ip, $dd, $du but none of them are giving
any results for the 200 OK. I just need to know where do kamailio
is going to send this 200 since it is already a part of an
on-going INVITE/call.

Thanks,
Sammy




___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org  mailto:sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users



___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing
list
sr-users@lists.sip-router.org mailto:sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users




___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] Kamailio v4.0.2, iPhone, TCP connection and PJLIB

2013-08-14 Thread Vitaliy Aleksandrov

On 08/14/2013 07:32 PM, Roberto Fichera wrote:

On 08/14/2013 04:36 PM, Vitaliy Aleksandrov wrote:

If you won't be able to disable SIP ALG on your router you can fill 
$avp(received) manually before calling save():
 $avp(received)  = sip: + $si + : + $sp + ;transport= + $proto;

In this case all user location records will have the received attribut even 
if a UA isn't behind NAT, but I don't
see any problems with that.

This one looks working, but the callee doesn't answer correctly because the TCP 
isn't correct:

Contact::
sip:528@94.94.X.X:1380;transport=TCP;ob;q=;expires=294;flags=0x0;cflags=0x0;state=0;socket=tcp:178.79.X.X:5060;methods=0x1FDF;received=sip:94.94.X.X:37030;transport=tcp;user_agent=PJSUA
v2.1-svn Linux-3.10.5.201/x86_64/glibc-2.17;reg-id=0

The contact uses a port which isn't translated inside by the router, the 
received field shows the right one.
Should I change the Contact header instead? In case, how can I do that?


I didn't understand what callee doesn't answer correctly means.
Callee doesn't know what's in the received field of its registration.
The only problem I see is that your router changes ip in the contact 
field of REGISTER requests and then kamailio puts this value

(new_ip:old_port) to INVITEs destined to UAs behind your NAT router.

It's not likely, but maybe pjsip doesn't like INVITEs with RURI which 
differs from what it put to the contact during registration.
IIRC pjsua prints lots of debugging information. So you can check if 
pjsua shows anything when INVITE comes in its log and also attach a 
trace of such a call.


P.S. IMHO the best way to pass sip through such routers is sip over TLS.

___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] Two servers with shared registration database

2013-08-01 Thread Vitaliy Aleksandrov

On 08/01/2013 03:30 PM, Eugene Prokopiev wrote:

Hi,

Is it possible to configure two Kamailio servers with shared
registration database? Any SIP UA can be registered on any server but
it must transparently call another SIP UA which can be registered on
the same or on another Kamailio server.

Is where any example of this configuration?


Hello,

Yes it is possible. usrloc module has db_mode options. If it is set to 3 
(db only) mode it will be possible to call to a registered UA via either 
of sip servers.


Haven't used this scheme in practice. Community, correct me if I'm wrong.

___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


[SR-Users] websocket double record_route()

2013-07-31 Thread Vitaliy Aleksandrov

Hello.

I'm trying to configure kamailio as a gateway between Websocket and 
TCP/TLS transports.


When I call record_route() for an initial INVITE that comes via WS and 
will be forwarded via TCP to a registered UA kamailio inserts only a one 
record-route header with its IP and transport=ws instead of two 
record-route headers with both incoming/outgoing transports.


This behaviour breaks in-dialog requests routing.

rr module parameters are:
modparam(rr, enable_full_lr, 1)
modparam(rr, append_fromtag, 0)
modparam(rr, enable_double_rr, 1)

I use:
- kamailio-4.0.2
- sipml5 as sip client

Can anybody point me in the right direction to understand why it happens ?


___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] websocket double record_route()

2013-07-31 Thread Vitaliy Aleksandrov

Hello,
Thanks for a quick reply.

No, outbound module is not loaded. As I understood from RR docs 
double_rr won't work if outbound module is present.
I've added mhomed=1 to my config, but record_route() still inserts only 
one rr with transport=ws.



Are you using outbound?  If you are I suggest trying git master rather 
than the 4.0 branch.


Regards,

Peter


On 31 July 2013 10:53, Vitaliy Aleksandrov vitalik.v...@gmail.com 
mailto:vitalik.v...@gmail.com wrote:


Hello.

I'm trying to configure kamailio as a gateway between Websocket
and TCP/TLS transports.

When I call record_route() for an initial INVITE that comes via WS
and will be forwarded via TCP to a registered UA kamailio inserts
only a one record-route header with its IP and transport=ws
instead of two record-route headers with both incoming/outgoing
transports.

This behaviour breaks in-dialog requests routing.

rr module parameters are:
modparam(rr, enable_full_lr, 1)
modparam(rr, append_fromtag, 0)
modparam(rr, enable_double_rr, 1)

I use:
- kamailio-4.0.2
- sipml5 as sip client

Can anybody point me in the right direction to understand why it
happens ?


___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing
list
sr-users@lists.sip-router.org mailto:sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users




--
Peter Dunkley
Technical Director
Crocodile RCS Ltd


___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] websocket double record_route()

2013-07-31 Thread Vitaliy Aleksandrov



Hello,

does it add two record route headers when calling to an UDP 
destination? IIRC, the condition for double route is that incoming 
socket is different than outgoing socket and I am not sure if Peter 
updated it to detect a different sub-protocol type (as ws/wss are on 
top of tcp/tls).


Cheers,
Daniel

Hello,

That's it !
I've connected the phone using udp as transport and kamailio added two 
record route headers.



___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] websocket double record_route()

2013-07-31 Thread Vitaliy Aleksandrov

It works. Thanks a lot.

___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] websocket double record_route()

2013-07-31 Thread Vitaliy Aleksandrov

On 07/31/2013 04:18 PM, Vitaliy Aleksandrov wrote:

It works. Thanks a lot.
I'm going to test this with the latest master branch as Peter Dunkley 
proposed.
Should I add this issue to Jira if this behaviour is not fixed in the 
master ?


___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] Kamailio as a sip/rtp proxy

2013-07-31 Thread Vitaliy Aleksandrov
For example you can add dns records for 
customer{one,two,...}.whatever.com pointing to your proxy.
Then proxy can forward requests from outside world to asterisks based on 
uri domain part (customerone - 192.168.0.5, two- .10).
You can keep table of uri-ip conversions either in the kamailio.cfg or 
in any database you like.


Maybe it's not the best way but you can start from it.

IIRC carrierroute module can be used for such routing, so you can check 
it too.



Hi there,
I am trying to implement a sip/rtp proxy.
I have one public ip address with a domain name. example (whatever.com 
http://whatever.com)
On the lan side i have multiple asterisk instances all listening on 
5060 for sip requests. These instances will be assigned to different 
customers


I am hoping to run kamailio in front of these instances and route sip 
and rtp traffic to the correct asterisk instance.


So in this use case asterisk instances will be used as application 
servers and kamailio will be used as a sip/rtpproxy with nathelper


So my question is what would be the best way and using which modules 
can i route the requests for customerone.whatever.com 
http://customerone.whatever.com to the first asterisk instance and 
customertwo.whatever.com http://customertwo.whatever.com to the second.


is this achieved with the dispatcher module? and if so, where can it 
be defined that requests for cusomertone.whatever.com 
http://cusomertone.whatever.com is routed to the first asterisk 
instance.


Kind regards,
Cormac O'Loughlin


___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] How to tie Registration with Client TCP connection

2013-07-24 Thread Vitaliy Aleksandrov
Hello,

Is this option still not available ?
I'm asking because there was a message from, if I recall right, Olle
Johansson that removing stale registrations is on the todo list of someone
from the dev team.

So maybe someone already has this option in its devel branch ?



On Fri, Apr 5, 2013 at 10:48 AM, Daniel-Constantin Mierla mico...@gmail.com
 wrote:

 Hello,


 On 4/4/13 10:43 PM, Krishna Kurapati wrote:

 Hi,

 With TCP, there is no way Server can establish a TCP connection through
 client's Firewall/NAT.
 So, when Client connection is disconnected from the server due to Network
 issues, the Registration should be removed.

 I tried to handle this with a Event Route in tcp_read.c. However, There
 is not an easy way to find the Registration with TCP socket info (IP and
 Port of the Client).

 Could anyone suggest a solution?

 you can use set_forward_no_connect

 http://www.kamailio.org/wiki/**cookbooks/4.0.x/core#set_**
 forward_no_connecthttp://www.kamailio.org/wiki/cookbooks/4.0.x/core#set_forward_no_connect

 Local branches will be created, but not forwarded if no connection matches
 the destination.

 If you follow the code for this functionality, then you should see how the
 connection is associated with a destination.

 Cheers,
 Daniel

 --
 Daniel-Constantin Mierla - http://www.asipto.com
 http://twitter.com/#!/miconda - 
 http://www.linkedin.com/in/**micondahttp://www.linkedin.com/in/miconda
 Kamailio World Conference, April 16-17, 2013, Berlin
  - http://conference.kamailio.com -


 __**_
 SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
 sr-users@lists.sip-router.org
 http://lists.sip-router.org/**cgi-bin/mailman/listinfo/sr-**usershttp://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] Asterisk cluster with Kamailio for load balancing.

2013-07-12 Thread Vitaliy Aleksandrov

Indeed, this is a very good suggestion.

I can propose a little plan for the first step:
1. Learn how sip registration works
2. Configure kamailio as a sip registrar server.
3. Try to route calls between registered phones.
4. Read about in-dialog requests routing (record_route(), loose_route()) 
and configure calls between connected endpoint in a right way.


And if you want to learn mode:
5. Try to handle NAT issues at kamailio (symmetric sip / rtp relay)

Asterisk supports symmetric rtp pretty well, so if you want to route all 
calls through asterisk boxes you can skip rtp relay configuration step.



We use Kamailio for registration of users and loadbalancing.
I think you can start with next steps:
1. Single installation of kamailio with registration of users, fixing 
NAT problems etc.
2. After you get some experience with Kamailio - you can add Asterisk 
servers.
In asterisk servers - I accept all calls which comes from Kamailio - 
registration of users is purely Kamailio job.
In Kamailio - again I accept all calls which come from any of Asterisk 
servers.






___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] Why does Kamailio return many Contacts in Contact header in REGISTER response ?

2013-05-30 Thread Vitaliy Aleksandrov

Kamailio can do this but it doesn't by default.
http://kamailio.org/docs/modules/4.0.x/modules/registrar.html#idp110136


___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] How to make BLF work

2013-05-30 Thread Vitaliy Aleksandrov

I think you have missed the fact that you don't have PUA component.
PUA client is the thing that should send PUBLISH requests with 
dialoginfo body to kamailio. Kamailio in its turn will use mentioned 
PUBLISHes to send NOTIFY to your phones.



Hi again,

I doubt SCA module will work for me but let me get this a shot tonight 
and get back with a sipgrep trace. Meanwhile I was just thinking if 
the 'skype like service' blog at Asipto 
http://kb.asipto.com/kamailio:skype-like-service-in-less-than-one-hour 
might work straight away. I really don;t see any difference in my 
PRESENCE route but maybe I've missed anything.


Let me get back with more working on this.

Thanks for the reply.

Sammy Go.



On Wed, May 29, 2013 at 1:35 PM, Daniel-Constantin Mierla 
mico...@gmail.com mailto:mico...@gmail.com wrote:


Hello,

just to say that SCA module might be an alternative, not sure it
works for blf, could be only for bla/sla, but worth checking the
email.

Also, if you post ngrep output (sip traffic as sip), could be
easier to review the traces from a device that is not yet capable
of installing tcpdump/ngrep/etc ... tools, like tablets,
smartphones ... increasing your chance to get more people to an
answer.

Cheers,
Daniel


On 5/28/13 11:41 PM, SamyGo wrote:

Yeah, I'm getting your point.

So now, here are my loaded modules.

#!ifdef WITH_PRESENCE
loadmodule presence.so
loadmodule presence_xml.so
loadmodule presence_dialoginfo.so
loadmodule pua.so
loadmodule pua_dialoginfo.so
loadmodule pua_usrloc.so
#!endif

And of course:

loadmodule dialog.so

Attached are the relevant sip traces.


On Wed, May 29, 2013 at 2:32 AM, SamyGo govoi...@gmail.com
mailto:govoi...@gmail.com wrote:

Yeah, I'm getting your point.

So now, here are my loaded modules.

#!ifdef WITH_PRESENCE
loadmodule presence.so
loadmodule presence_xml.so
loadmodule presence_dialoginfo.so
loadmodule pua.so
loadmodule pua_dialoginfo.so
loadmodule pua_usrloc.so
#!endif

And of course:

loadmodule dialog.so

Attached are the relevant sip traces.




On Wed, May 29, 2013 at 1:00 AM, Vitaliy Aleksandrov
vitalik.v...@gmail.com mailto:vitalik.v...@gmail.com wrote:

You didn't receive any NOTIFY requests because you didn't
have a PUA client. rfc3903 describes what a PUA client is.

To make BLF work you can try to use the next modules:
1. dialog - to enable dialog awareness
2. pua + pua_dialoginfo - to enable a PUA client based on
active dialogs information provided by the dialog module
3. presence + presence_dialoginfo - to handle
subscriptions and send notifications to phones


Hi list,

I've been trying to make my Yealink phone to give BLF
indications but I haven't been able to achieve this
successfully yet so I need some expert advise here.
My Yealink phone, as soon as it registers to Asterisk,
gives me BLF lights. The same phone registering to
Kamailio sends SUBSCRIBE and nothing happens.

The Presence Handling is enabled in configurations and
yet no dialog-info+xml NOTIFY is received.

Please help.

Best Regards,
Sammy Go.



___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing 
list
sr-users@lists.sip-router.org  
mailto:sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users



___
SIP Express Router (SER) and Kamailio (OpenSER) -
sr-users mailing list
sr-users@lists.sip-router.org
mailto:sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users





___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org  mailto:sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


-- 
Daniel-Constantin Mierla -http://www.asipto.com

http://twitter.com/#!/miconda  http://twitter.com/#%21/miconda  
-http://www.linkedin.com/in/miconda
Kamailio Advanced Training, San Francisco, USA - June 24-27, 2013
   *http://asipto.com/u/katu  *


___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing
list
sr-users@lists.sip-router.org mailto:sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users




___
SIP

Re: [SR-Users] How to make BLF work

2013-05-30 Thread Vitaliy Aleksandrov

Have you checked presence_dialoginfo documentation ?
http://kamailio.org/docs/modules/devel/modules/presence_dialoginfo.html

The link above has a description of the way BLF can be implemented on 
kamailio and I think it has all the details you need to make it work.
I haven't used this scheme and know about it only from the mentioned 
paper, so I can't explain it in more detail.


Yes, As OEJ mentioned there were no Dialogs created so had to put the 
dlg_manage(); in the cfg and now in kamcmd the dlg.list command 
displays call data.

How can I add presence stuff now.
Vitaliy, please explain further how can I add the PUA component.

Thanks,
Sammy





On Thu, May 30, 2013 at 6:17 PM, Olle E. Johansson o...@edvina.net 
mailto:o...@edvina.net wrote:



30 maj 2013 kl. 13:07 skrev SamyGo govoi...@gmail.com
mailto:govoi...@gmail.com:


Hi again,

I doubt SCA module will work for me but let me get this a shot
tonight and get back with a sipgrep trace. Meanwhile I was just
thinking if the 'skype like service' blog at Asipto
http://kb.asipto.com/kamailio:skype-like-service-in-less-than-one-hour
might work straight away. I really don;t see any difference in my
PRESENCE route but maybe I've missed anything.

Let me get back with more working on this.

Start with making sure that the Dialog module works as expected
for you. Check with kamcmd that you have active dialogs when you
have active calls.
When that works, start with adding presence.

Cheers,
/O



Thanks for the reply.

Sammy Go.



On Wed, May 29, 2013 at 1:35 PM, Daniel-Constantin Mierla
mico...@gmail.com mailto:mico...@gmail.com wrote:

Hello,

just to say that SCA module might be an alternative, not sure
it works for blf, could be only for bla/sla, but worth
checking the email.

Also, if you post ngrep output (sip traffic as sip), could be
easier to review the traces from a device that is not yet
capable of installing tcpdump/ngrep/etc ... tools, like
tablets, smartphones ... increasing your chance to get more
people to an answer.

Cheers,
Daniel


On 5/28/13 11:41 PM, SamyGo wrote:

Yeah, I'm getting your point.

So now, here are my loaded modules.

#!ifdef WITH_PRESENCE
loadmodule presence.so
loadmodule presence_xml.so
loadmodule presence_dialoginfo.so
loadmodule pua.so
loadmodule pua_dialoginfo.so
loadmodule pua_usrloc.so
#!endif

And of course:

loadmodule dialog.so

Attached are the relevant sip traces.


On Wed, May 29, 2013 at 2:32 AM, SamyGo govoi...@gmail.com
mailto:govoi...@gmail.com wrote:

Yeah, I'm getting your point.

So now, here are my loaded modules.

#!ifdef WITH_PRESENCE
loadmodule presence.so
loadmodule presence_xml.so
loadmodule presence_dialoginfo.so
loadmodule pua.so
loadmodule pua_dialoginfo.so
loadmodule pua_usrloc.so
#!endif

And of course:

loadmodule dialog.so

Attached are the relevant sip traces.




On Wed, May 29, 2013 at 1:00 AM, Vitaliy Aleksandrov
vitalik.v...@gmail.com mailto:vitalik.v...@gmail.com
wrote:

You didn't receive any NOTIFY requests because you
didn't have a PUA client. rfc3903 describes what a
PUA client is.

To make BLF work you can try to use the next modules:
1. dialog - to enable dialog awareness
2. pua + pua_dialoginfo - to enable a PUA client
based on active dialogs information provided by the
dialog module
3. presence + presence_dialoginfo - to handle
subscriptions and send notifications to phones


Hi list,

I've been trying to make my Yealink phone to give
BLF indications but I haven't been able to achieve
this successfully yet so I need some expert advise
here.
My Yealink phone, as soon as it registers to
Asterisk, gives me BLF lights. The same phone
registering to Kamailio sends SUBSCRIBE and nothing
happens.

The Presence Handling is enabled in configurations
and yet no dialog-info+xml NOTIFY is received.

Please help.

Best Regards,
Sammy Go.



___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users 
mailing list
sr-users@lists.sip-router.org  
mailto:sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin

Re: [SR-Users] How to make BLF work

2013-05-28 Thread Vitaliy Aleksandrov
You didn't receive any NOTIFY requests because you didn't have a PUA 
client. rfc3903 describes what a PUA client is.


To make BLF work you can try to use the next modules:
1. dialog - to enable dialog awareness
2. pua + pua_dialoginfo - to enable a PUA client based on active dialogs 
information provided by the dialog module
3. presence + presence_dialoginfo - to handle subscriptions and send 
notifications to phones



Hi list,

I've been trying to make my Yealink phone to give BLF indications but 
I haven't been able to achieve this successfully yet so I need some 
expert advise here.
My Yealink phone, as soon as it registers to Asterisk, gives me BLF 
lights. The same phone registering to Kamailio sends SUBSCRIBE and 
nothing happens.


The Presence Handling is enabled in configurations and yet no 
dialog-info+xml NOTIFY is received.


Please help.

Best Regards,
Sammy Go.



___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] Serial forking

2013-05-10 Thread Vitaliy Aleksandrov
I missed that $branch(..) variable is r/w. I like this way more than 
playing with AVPs.
According to documentation $branch(..) variable gives access to 
additional branches.


Is it possible to change Q value for the first branch ?

___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


[SR-Users] Serial forking

2013-05-09 Thread Vitaliy Aleksandrov

Hello.

As I understand t_load_contacts() / t_next_contacts() can help only in 
case when branches have different q values.
The only way I see is to get all contacts via reg_fetch_contacts(), save 
the list to an AVP and then iterate through the list in the way 
described in tm module docs.


Does anybody know a better way of how serial forking can be implemented 
if all contacts have equal q values ?
___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] var vs avp...

2013-04-30 Thread Vitaliy Aleksandrov

On 04/29/2013 03:52 PM, Victor V. Kustov wrote:

В Mon, 29 Apr 2013 14:46:34 +0200
Olle E. Johansson o...@edvina.net пишет:


All functions of this module load AVPs from SIP-AVP reply items
received from RADIUS upon a successful request. Value of the SIP-AVP
reply item must be a string of form:

• value = SIP_AVP_NAME SIP_AVP_VALUE

• SIP_AVP_NAME = STRING_NAME | '#'ID_NUMBER

• SIP_AVP_VALUE = ':'STRING_VALUE | '#'NUMBER_VALUE



sorry its not clear for me.

$avp('next-hop-ip') is ok in my case? Or i need _special_ radius answer?
Not so special .. You need to add SIP-AVP attributes to an 
access-accept reply from radius. As I remember this attribute must be 
declared somewhere in dictionary.openser.





___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] [SR-users] Radius AAA

2013-04-23 Thread Vitaliy Aleksandrov

radius_load_caller_avps() from misc_radius module can help you.

Sorry can't find an example, but as I remember it's quite simple to use 
this function.
Radius can insert next-hop to its Access-Accept reply and then you can 
use it  to send an INVITE to right destination:
$rd = $avp(s:next-hop); # or avp's name is equal to attribute name you 
received in access-accept.

t_relay();


Hi again!

Need tips to some tricks with radius.

1. when receive sip message with REGISTER method - initiate auth with
radius. (Authentification)

- radius_www_authorize in auth_radius.so

2. when receive INVITE message - ask radius 'bout permissions and parse
answer: get permission and next hop IP. (Authorization)

 misc_radius 


3. when call
  a) before call send Acct-Status-Type = Start with attributes.
  b) after call send Acct-Status-Type = Stop with attributes.
  (Accounting)

- acc_radius.so

1,3 - clear, I understand how it works.

2 - ? Kamailio must send request to radius server, get answer and route
call to server from next-hop-IP field. Can I make it?






___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] What IP in REGISTER message does Kamalio use to store location ?

2013-04-03 Thread Vitaliy Aleksandrov
Save() function of the registrar module always saves Contact and can 
save real source to the received field of a location record.
lookup() function uses Contact to form R-URI and puts ip:port from the 
received field to the $du.
If $du is present t_relay() uses it to forward a request to a correct 
destination.




@Jason

I'm not using any NAT protocol (STUN, ICE, ...) at client. I'm using 
the default Kamalio config file 3.3.5. If it is the NAT helping code 
in Kamalio, it means that Kamalio is using 3. IP from IP packet ?



On Tue, Apr 2, 2013 at 1:19 PM, Jason Penton 
jason.pen...@smilecoms.com mailto:jason.pen...@smilecoms.com wrote:


There is probably some NAT helping code in your Kamailio config
file. Either that or you are using one the NAT protocols,
(STUN,ICE,etc).

cheers
Jason


On Tue, Apr 2, 2013 at 2:39 AM, Khoa Pham onmyway...@gmail.com
mailto:onmyway...@gmail.com wrote:

@Jason

Thanks, but it strange. I only send 1 REGISTER to the server,
with the Contact field contains my local IP address. How can I
still receive incoming call ?


On Mon, Apr 1, 2013 at 8:10 PM, Jason Penton
jason.pen...@smilecoms.com
mailto:jason.pen...@smilecoms.com wrote:

2

--
This email has been sent using my phone. It may be brief,
to the point or contain typos.
--

On 1 Apr 2013 14:57, Khoa Pham onmyway...@gmail.com
mailto:onmyway...@gmail.com wrote:

Hi, when client send REGISTER message to Kamalio.
Kamailio will save that client's IP to database.
But what is this IP ? Is is 1,2 or 3 ?
1. The IP from Via field
2. The IP from Contact field
3. The IP from the IP packet

Many thanks

-- 
Khoa Pham

HCMC University of Science
Faculty of Information Technology

___
SIP Express Router (SER) and Kamailio (OpenSER) -
sr-users mailing list
sr-users@lists.sip-router.org
mailto:sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

This email is subject to the disclaimer of Smile Communications 
(PTY) Ltd. athttp://www.smilecoms.com/disclaimer


___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users
mailing list
sr-users@lists.sip-router.org
mailto:sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users




-- 
Khoa Pham

HCMC University of Science
Faculty of Information Technology

___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users
mailing list
sr-users@lists.sip-router.org
mailto:sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users




-- 
Jason Penton

Senior Manager: Applications and Services
Smile Communications
Johannesburg, South Africa
Phone: +27 83 283 7000

This email is subject to the disclaimer of Smile Communications (PTY) Ltd. 
athttp://www.smilecoms.com/disclaimer


___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing
list
sr-users@lists.sip-router.org mailto:sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users




--
Khoa Pham
HCMC University of Science
Faculty of Information Technology


___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] KAMAILIO Config Hot/Live reload

2013-03-26 Thread Vitaliy Aleksandrov

On 03/25/2013 02:36 PM, Daniel-Constantin Mierla wrote:

Hello,

On 3/24/13 4:20 PM, Vitaliy Aleksandrov wrote:

On 03/21/2013 12:59 AM, Daniel-Constantin Mierla wrote:

Hello,

On 3/18/13 7:09 PM, Omar wrote:

Kamailio Team.

Was this feature added already or we still need to restart kamailio 
after we modify the Kamailio.cfg.
it is still required to restart after changing the config file. But 
some core and module parameters can be now changed at runtime, via 
rpc commands (e.g., lowering tcp connecting timeout).



Cheers,
Daniel



As I understand I have to edit kamailio.cfg to preserve values 
changed by rpc between reboots. Is it possible to save current 
state of config variables somewhere (db, tmp file) ?
theoretically there is a module that allows to load/reload the values 
from database. Unfortunately is not much documented, being inherited 
from SER past development. Look over it, at the end should not be 
impossible to get it work, we have the sources. See its readme at:


- http://kamailio.org/docs/modules/stable/modules/cfg_db.html

Thanks for giving me direction.


If you can contribute back some documentation, will be greatly 
appreciated.

I'll check what I can do.


Cheers,
Daniel




___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] KAMAILIO Config Hot/Live reload

2013-03-24 Thread Vitaliy Aleksandrov

On 03/21/2013 12:59 AM, Daniel-Constantin Mierla wrote:

Hello,

On 3/18/13 7:09 PM, Omar wrote:

Kamailio Team.

Was this feature added already or we still need to restart kamailio 
after we modify the Kamailio.cfg.
it is still required to restart after changing the config file. But 
some core and module parameters can be now changed at runtime, via rpc 
commands (e.g., lowering tcp connecting timeout).



Cheers,
Daniel



As I understand I have to edit kamailio.cfg to preserve values changed 
by rpc between reboots. Is it possible to save current state of config 
variables somewhere (db, tmp file) ?



___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] SIP debug.

2013-03-18 Thread Vitaliy Aleksandrov

On 03/18/2013 01:14 PM, Victor V. Kustov wrote:

В Mon, 18 Mar 2013 11:40:24 +0100
davy van de moere davy.van.de.mo...@gmail.com write:

funny, but not usable :)

debug=9

loaded debugger.so but in syslog no sip debugging info

What exactly you want to debug ?
Wireshark produces nice sip flows from captures made by tcpdump.




___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


[SR-Users] DNS error

2013-02-12 Thread Vitaliy Aleksandrov

Hi, all

Have a question about failure_routes.
As I remember if kamailio statefuly sent a request and didn't receive a 
reply script writer can handle this situation at a failure_route[] block.
But if kamailio can't resolve a destination from R-URI it sends back 478 
reply and finishes current transaction without reaching a failure_route[].


Is it possible to process such a request in a failure_route[] ?

Additional details:
version: kamailio-3.2.4
t_on_failure() is called before t_relay()
I have checked with REGISTER and INVITE transactions.


___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] Syslog

2013-02-05 Thread Vitaliy Aleksandrov

On 02/04/2013 06:07 PM, Klaus Darilion wrote:



On 04.02.2013 11:26, Vitaliy Aleksandrov wrote:

The problem was caused by memlog and memdbg options.


So, how the problem is triggered and how did you solved it?

regards
Klaus
Both memlog and memdbg were removed from a kamailio config as I don't 
need them for now.
Unfortunately I didn't have a chance to spent more time on resolving 
this issue yet.


___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] Syslog

2013-02-04 Thread Vitaliy Aleksandrov

The problem was caused by memlog and memdbg options.

___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] How to rewrite tu in CANCEL message ?

2013-02-01 Thread Vitaliy Aleksandrov
I had the same problem with CANCEL requests for transactions created by
an INVITE that was rewritten in a branch_route.
I sent a small patch to dev list in October and didn't receive any
comment. You can try to find it in sr-dev archive for October 2012.

 Yes, we know it's wrong.
 But if we really need it, is there a way to do it?


 -Original Message-
 From: sr-users-boun...@lists.sip-router.org
 [mailto:sr-users-boun...@lists.sip-router.org] On Behalf Of Alex Balashov
 Sent: Wednesday, January 30, 2013 4:36 PM
 To: sr-users@lists.sip-router.org
 Subject: Re: [SR-Users] How to rewrite tu in CANCEL message ?

 On 01/30/2013 09:31 AM, Julia wrote:
 We need some number manipulation for outgoing calls to PSTN GW.
 The same manipulations must be in ru and tu, because our PSTN GW adds
 redirection when tu ≠ ru.
 When we used INVITE re-parsing for CANCEL, modified tu is not included.
 I would say your PSTN GW is doing it wrong.  No routing should ever be
 done on To.  It is a purely cosmetic commentary on the intended logical
 destination of the call.  Only the RURI should be used for that.



___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


[SR-Users] Syslog

2013-02-01 Thread Vitaliy Aleksandrov

Hi list.

I have a strange problem with syslog.
Kamailio doesn't send any messages to syslog from UDP workers that are 
bound to sock=127.0.0.1:5060.

Neither LM_DBG() from a source code nor xlog(any level, ) works.

I use kamailio-3.2.4 with this opions:
log_stderror=no
debug=3.

With log_stderror=yes kamailio writes all debug messages to stderr 
without any problems.


___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] Syslog

2013-02-01 Thread Vitaliy Aleksandrov

On 02/01/2013 11:38 AM, Vitaliy Aleksandrov wrote:

Hi list.

I have a strange problem with syslog.
Kamailio doesn't send any messages to syslog from UDP workers that are 
bound to sock=127.0.0.1:5060.

Neither LM_DBG() from a source code nor xlog(any level, ) works.

I use kamailio-3.2.4 with this opions:
log_stderror=no
debug=3.

With log_stderror=yes kamailio writes all debug messages to stderr 
without any problems.

I was wrong in my conclusions
It looks like only the first udp listener has the described problem.
children parameter was set to 1 and after it was changed to 5 UDP 
syslog showed debug messages that were sent by newly added workers.


So the real problem in logging to a syslog from the first UDP worker 
regardless of interface it bound to (eth0, lo).


Does anybody have any idea what can cause this problem ?

___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] TLS questions

2013-01-11 Thread Vitaliy Aleksandrov

On 01/11/2013 05:03 PM, Fabian Borot wrote:


Hi, we need to implement TLS in our current setup and have some questions about 
it:

  1- We have a farm of Asterisk servers behind our kamailio proxy. The call flow is 
Customers/Providers -- Proxy -- Asterisks.
Is it possible to have TLS only between the Customers/Providers and the Proxy 
and then just regular SIP over UDP between the Proxy and
the Asterisks?

Yes you can.


2- Can we have TLS over both TCP and UDP at the same time?

Thank you a lot

TLS is working only via TCP.


___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] Regarding Kamailio Registrar

2012-12-11 Thread Vitaliy Aleksandrov

You are right after reboot registrar module takes registrations from a db.
If someone send UnRegister during outage, kamailio will keep active 
registration until occurence of expiration time that was calculated 
during registration.


To speed up user location cleaning you can decrease the expire value 
in registrations.



Dear all,

We are using Kamailio SIP Server in our application.

We want to know 1 thing:

We are using Kamailio SIP server as registrar and proxy server.

For registration database, we are using dbtext module.

We maintain record of SIP Extensions who have registered in

Our proprietary file too. Now when we boot the Kamailio SIP server,

At that time our file should be empty i.e. previously registered

Extension entries should be deleted or it must be kept as it is.

But if during power off, any extension had sent REGISTER request to

Unregister then it was not executed as kamailio SIP server was not ON.

But at boot time, as its entry was present, Kamailio SIP server will

Consider it a registered extension.

Please guide us for this situation.

Thank you,

Amit Shah.



___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] Kamailio 3.X.X + BLF configuration trouble

2012-11-27 Thread Vitaliy Aleksandrov

On 11/27/2012 06:30 AM, Hemanshu Patel wrote:

Hi vitaliy,

thank you very much for your reply.
Here I am not talking about kamailio as Presence server, I am asking about BLF 
handling

For SUBSCRIBE+NOTIFY+PUBLISH in case of presence, everything is working fine

In case of BFL, once the phone/user subcribes, he doesnt send any PUBLISH 
message, only Server sends him NOTIFY based upon the status of the user he 
subscribed for, like IDLE, TALKING, RINGING,etc,etc.
As I understand BLF is a subscription to a dialog event. So you need a 
source of PUBLISH requests with dialog event them.


What phone you are talking about ? Does it have an option to send its 
line status to a proxy via PUBLISH with a dialog event?
If your phones can't send PUBLISH requests with a dialog event you can 
try dialog + pua_dialoginfo modules.



___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] Kamailio 3.X.X + BLF configuration trouble

2012-11-26 Thread Vitaliy Aleksandrov
The NOTIFY without an XML body you received just after a subscription is 
correct.

rfc3265 says:

This SUBSCRIBE request will be confirmed with a final response.
   200-class responses indicate that the subscription has been accepted,
   and that a NOTIFY will be sent immediately.


You can disable such notifies via send_fast_notify presence module 
parameter.


What about further notifications. Kamailio handles subscriptions and 
sends notifications when it receives PUBLISH requests.
Using terms of the rfc3856 kamailio is a presence server and you need 
something to act as Presence User Agent.


You can take a look at pua_dialoginfo module. I haven't used it, but its 
documentation says it can send PUBLISH requests based on active dialogs 
from the dialog module.




___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] check if the sent reply was local

2012-11-13 Thread Vitaliy Aleksandrov

||I thought t_any_replied() can be used for that purpose.

For example in failure route I used:
if (t_any_replied()  t_check_status(408) ) {
xlog(L_DBG, 408 reply received\n);
}

or

if ( !(t_any_replied())  t_check_status(408)) {
xlog(L_DBG, Local timeout\n);
}

But I carefully read tm docs and found If called from a failure or 
onreply route, the __current__ reply is not taken into account.
According to t_any_replied() description my examples should not work, 
but they do (at production system for about one year).






On 11/11/12 1:54 PM, Uri Shacked wrote:

Hi,
what is the command to check if the reply was recieved or localy 
generated?
I assume you need that in failure_route, test the $T(reply_type), it 
should be 1 for local generated replies:


http://www.kamailio.org/wiki/cookbooks/3.3.x/pseudovariables#t_name

Cheers,
Daniel



___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] db_sqlite bugs

2012-10-29 Thread Vitaliy Aleksandrov

Hello,

Have you found the way to run SELECT COUNT(*) ?
I use kamailio 3.2.4 with sqlite 3.7.5-1 and it crashes on such queries too.

As a workaround I use $dbr(res=rows) with SELECT some_field FROM 
table query, but the bug is really exists.



Hello Timo,

We've done a basic test and it seems to solve the memory leak problem. 
We'll do exhaustive tests in a few days.


We'll keep you informed.

Thanks a lot,
Pedro




De: Timo Teras timo.te...@iki.fi
Para: SIP Router - Kamailio \(OpenSER\) and SIP Express Router 
\(SER\) - Users Mailing List sr-users@lists.sip-router.org

cc: pvsol...@amper.es
Fecha: 15/10/2012 16:13
Asunto: Re: [SR-Users] db_sqlite bugs
Enviado por: Timo Teräs timo.te...@gmail.com




On Thu, 11 Oct 2012 12:37:23 +0200 Pedro Antonio Vico Solano
pvsol...@amper.es wrote:

 Hello everyone,

 We are developing a solution based on the SQLite module for Kamailio
 and we've found some bugs/errors regarding it. We use kamailio 3.2.4
 and SQLite 3.7.14.1. The errors are about this:

 - Memory leaks on querys via sqlops. Kamailio main process leaks 4kB
 each 3 queries (aprox.) and that memory is never freed. [Attached
 basic example]
 - Segmentation fault when doing a SELECT COUNT(*) via sqlops.
 [Attached basic example 2]

 Can you help us?

Does this help for the memory leak?

diff --git a/modules_k/db_sqlite/dbase.c b/modules_k/db_sqlite/dbase.c
index 0b32e07..c1d3b71 100644
--- a/modules_k/db_sqlite/dbase.c
+++ b/modules_k/db_sqlite/dbase.c
@@ -543,7 +543,12 @@ int db_sqlite_update(const db1_con_t* _h, const 
db_key_t* _k, const db_op_t* _o,


int db_sqlite_raw_query(const db1_con_t* _h, const str* _s, 
db1_res_t** _r)

{
-   return db_do_raw_query(_h, _s, _r,
+   int rc;
+
+   rc = db_do_raw_query(_h, _s, _r,
  db_sqlite_submit_query,
  db_sqlite_store_result);
+   db_sqlite_cleanup_query(_h);
+
+   return rc;
}

Seems that all other database driver postpone the resource release to
free_results - but there's no reason why we couldn't do this right away
in sqlite. Since in sqlite free_results we just free cached result set.

Will take a look at the other bug later when I get the time to
reproduce it.

-Timo


ADVERTENCIA

Este mensaje y/o sus anexos, pueden contener información personal y 
confidencial cuyo uso, reproducción o distribución no autorizados 
están legalmente prohibidos. Por lo tanto, si Vd. no fuera su 
destinatario y, erróneamente, lo hubiera recibido, le rogamos que 
informe al remitente y lo borre de inmediato.


En cumplimiento de la Ley Orgánica 15/1999, de Protección de Datos de 
Carácter Personal le informamos de que su dirección de correo 
electrónico, así como sus datos personales y de empresa pasarán a 
formar parte de nuestro fichero de Gestión, y serán tratados con la 
única finalidad de mantenimiento de la relación adquirida con usted. 
Los datos personales que existen en nuestro poder están protegidos por 
nuestra Política de Seguridad, y no serán compartidos con ninguna otra 
empresa. Usted puede ejercitar los derechos de acceso, rectificación, 
cancelación y oposición dirigiéndose por escrito a la dirección arriba 
indicada.


This e-mail and its attachments may include confidential personal 
information which may be protected by any legal rules and cannot be 
used, copied, distributed or disclosed to any person without 
authorisation. If you are not the intended recipient and have received 
this e-mail by mistake, please advise the sender and erase it.


In compliance with the Spanish Organic Act 15/1999 on Personal Data 
Protection, we hereby inform you that your email address, as well as 
your personal and business information, will be included in our 
Management files and used solely for purposes corresponding to our 
commercial relationship. All personal data in our possession is 
protected by our Data Safety Policy and thus shall not be released to 
any other third party whatsoever. You may exercise your right to 
access, rectify, cancel and contest by writing to the address provided 
above.



___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] Message Routing To/From Gateway

2012-10-26 Thread Vitaliy Aleksandrov
If you want to receive any suggestions it would be better to show you 
config file with some comments.
It will reduce a time to understand you configuration and will increase 
a chance to get any help here.



After further testing it was found that setting the alias like this 
somehow broke outgoing messages. I'm not certain exactly how Kamailio 
handles aliases, but it seems like it is not as simple as I expected. 
I am working on figuring out a new solution now if anyone has any 
thoughts.



Thanks,
Ed




On Wed, Oct 24, 2012 at 12:27 AM, Ed Brady ebr...@talkforgood.com 
mailto:ebr...@talkforgood.com wrote:


I was able to resolve the issue by setting the return domain as a
local domain alias. With the previous setting I had made to
forward all non-local accounts to our gateway domain, this would
allow the improper return domain to be seamlessly switched to the
correct domain before being forwarded out of our server. Now users
can have normal two way conversations despite a poor design by our
vendor.

Thanks for a giant push in the right direction!


Ed





On Mon, Oct 22, 2012 at 4:02 PM, Ed Brady ebr...@talkforgood.com
mailto:ebr...@talkforgood.com wrote:

I have this all working now. I had previously configured this
as a gateway and once issues were fixed on our vendor's end,
it worked. Is there a disadvantage to using this method rather
than the permissions module?

On a related note (though maybe not related enough), when we
get responses from their system it comes back with a different
domain in the URI than what they require us to send to. When
questioned about this they said we would need to handle it on
our end. Is there a common method for checking the to URI for
a particular string (in this case the domain), changing it,
and then forwarding it?


Thanks,
Ed




On Sat, Oct 20, 2012 at 7:23 PM, Vitaliy Aleksandrov
vitalik.v...@gmail.com mailto:vitalik.v...@gmail.com wrote:

Permissions module should help you. If allowed ip
addresses are kept in a database you can reload them by MI
command without kamailio restart.
As I remember permissions module allows to create groups
of ip addresses, so you can create such a group for hosts
which you want to receive MESSAGE requests from.


I tested this example and it worked for me. I was
misunderstanding some of the values and thought they
applied to users being registered or not.

I am still uncertain what setting applies to allowing all
traffic inbound from a particular address. Any tips on
this would be appreciated.


Thanks,
Ed



On Fri, Oct 19, 2012 at 1:41 PM, Ed Brady
ebr...@talkforgood.com mailto:ebr...@talkforgood.com
wrote:

I was looking at this logic some more and wanted to
clarify my configuration. I need to base the R-URI
rewrite and MESSAGE forward based on whether the
account exists as a local subscriber or not rather
than whether the user is registered or not. This is
connecting to an SMS provider using SIP.

I excitedly looked into the SMS module but this
appears to only be if you are dealing with a GSM
modem and not sending/receiving SIP MESSAGEs with an
SMS gateway.

Any resources you can point me to would be extremely
helpful, thanks!


Ed



On Fri, Oct 19, 2012 at 10:42 AM, Ed Brady
ebr...@talkforgood.com
mailto:ebr...@talkforgood.com wrote:

Will this also permit incoming messages from this
domain? Do I need to add the gateway in any other
settings besides the one you outlined?


Thanks,
Ed




On Fri, Oct 19, 2012 at 6:17 AM, Vitaliy
Aleksandrov vitalik.v...@gmail.com
mailto:vitalik.v...@gmail.com wrote:

If I understood you right you just need to
rewrite R-URI domain and forward MESSAGE if a
user in not registered.

if (!lookup(location)) {
switch($retcode) {
case -1:
$rd = gatewaydomain.com
http://gatewaydomain.com;
t_relay();
exit;
default:
sl_send_reply(404, Not Found

Re: [SR-Users] Message Routing To/From Gateway

2012-10-20 Thread Vitaliy Aleksandrov
Permissions module should help you. If allowed ip addresses are kept 
in a database you can reload them by MI command without kamailio restart.
As I remember permissions module allows to create groups of ip 
addresses, so you can create such a group for hosts which you want to 
receive MESSAGE requests from.


I tested this example and it worked for me. I was misunderstanding 
some of the values and thought they applied to users being registered 
or not.


I am still uncertain what setting applies to allowing all traffic 
inbound from a particular address. Any tips on this would be appreciated.



Thanks,
Ed



On Fri, Oct 19, 2012 at 1:41 PM, Ed Brady ebr...@talkforgood.com 
mailto:ebr...@talkforgood.com wrote:


I was looking at this logic some more and wanted to clarify my
configuration. I need to base the R-URI rewrite and MESSAGE
forward based on whether the account exists as a local subscriber
or not rather than whether the user is registered or not. This is
connecting to an SMS provider using SIP.

I excitedly looked into the SMS module but this appears to only be
if you are dealing with a GSM modem and not sending/receiving SIP
MESSAGEs with an SMS gateway.

Any resources you can point me to would be extremely helpful, thanks!


Ed



On Fri, Oct 19, 2012 at 10:42 AM, Ed Brady ebr...@talkforgood.com
mailto:ebr...@talkforgood.com wrote:

Will this also permit incoming messages from this domain? Do I
need to add the gateway in any other settings besides the one
you outlined?


Thanks,
Ed




On Fri, Oct 19, 2012 at 6:17 AM, Vitaliy Aleksandrov
vitalik.v...@gmail.com mailto:vitalik.v...@gmail.com wrote:

If I understood you right you just need to rewrite R-URI
domain and forward MESSAGE if a user in not registered.

if (!lookup(location)) {
switch($retcode) {
case -1:
$rd = gatewaydomain.com
http://gatewaydomain.com;
t_relay();
exit;
default:
sl_send_reply(404, Not Found);
exit;
}
}



I am trying to route SIP messages to a gateway. I am
using SIP MESSAGE over UDP as well as the MSILO module
for storing messages for users that aren't currently
logged in. I have read through the Dynamic Routing module
info but am not able to determine the best way to
accomplish the routing I require. Our scenario is
outlined below.

User A sends a message addressed to
sip:12345678...@mydomain.com
mailto:sip%3a12345678...@mydomain.com
Kamailio at mydomain.com http://mydomain.com checks if
12345678900 tel:12345678900 is a registered user in the
system.
If not, the message header is translated to
sip:12345678...@gatewaydomain..com
mailto:sip:12345678...@gatewaydomain..com and forwarded.
Incoming messages need to be accepted from their IP as well.

It would also be useful if the address came as
sip:2345678...@mydomain.com
mailto:sip%3a2345678...@mydomain.com could be
translated to sip:_1_2345678...@gatewaydomain.com
mailto:2345678...@gatewaydomain.com.


Is there any built in functionality I can configure for
this, or will this need to be scripted?


Thanks,
Ed


___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing 
list
sr-users@lists.sip-router.org  
mailto:sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users



___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users
mailing list
sr-users@lists.sip-router.org
mailto:sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users






___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] Kamailio 3.2.4 presence

2012-10-17 Thread Vitaliy Aleksandrov

Readme at the link stated below said that db_mode is a valid parameter.
http://kamailio.org/docs/modules/3.2.x/modules_k/presence.html#id2546358

This patch fixes subscription restoration after kamailio-3.2.4 restart 
in case when db_mode of presence module is 0 (MEMORY_ONLY).


vitalik@work:~/src$ diff modules_k/presence/hash.c modules_k/presence/hash.c
264c264
 if(dbmode == DB_FALLBACK || dbmode == DB_MEMORY_ONLY) {
---
 if(dbmode == DB_FALLBACK) {

Now it saves subscriptions in memory and periodically(db_update_period 
parameter) dumps them to the active_watchers table.
After restart kamailio fills subscription hash table from the 
active_watchers db table.


Upgrade is a good suggestion as presence module of 3.3.х branch differs 
much from the one in the previous release and I hope it doesn't have 
described problems..

I have to port a few custom modules to switch to the new branch.


Vitaliy Aleksandrov writes:


db_mode is 0 (DB_MEMORY_ONLY) and according to comments in the
presence.h kamailio holds subscription in memory and periodically
updates to db, but retrieves from db only at startup.
And it's true, I see that kamailio tries to update the active_watchers
table, but it never inserts new subscriptions there.

i suggest you upgrade to 3.3.  according to its readme, subs_db_mode=0
means that db is disabled.  perhaps it was the same with 3.2, which
according to its readme does not have db_mode param.

-- juha

___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users




___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


[SR-Users] Kamailio 3.2.4 presence

2012-10-16 Thread Vitaliy Aleksandrov

Hi all,

I'm facing problems with active subscription restoration after sipproxy 
restart.


db_mode is 0 (DB_MEMORY_ONLY) and according to comments in the 
presence.h kamailio holds subscription in memory and periodically 
updates to db, but retrieves from db only at startup.
And it's true, I see that kamailio tries to update the active_watchers 
table, but it never inserts new subscriptions there.


There are no problems with access to the database since when db_mode is 
2 (DB_ONLY) kamailio inserts new records into the active_watchers 
without any problems.


Here are presence module settings:
modparam(presence, db_url, sqlite:var/db/presence.db)
modparam(presence, db_mode, 0)
modparam(presence, timeout_rm_subs, 1)
modparam(presence, pres_htable_size, 8)
modparam(presence, subs_htable_size, 8)
modparam(presence, max_expires, 3600)
modparam(presence, db_update_period, 60)
modparam(presence, clean_period, 60)

Does anybody have success with db_mode = DB_MEMORY_ONLY and 
active_watchers db table ?


___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


[SR-Users] Locate UA in usrloc table

2012-09-28 Thread Vitaliy Aleksandrov

Hi all.

Is there any easy method to find if somebody with $si:$sp is registered 
(usrloc-received.ip == $si, usrloc-received.port == $sp) ?

reg_fetch_contacts uses uri as search key, but in my case I don't have it.

The only way I know is to write a module that will use 
get_all_ucontacts function exported by usrloc module in its API.


___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] [ ... ] operator

2012-09-07 Thread Vitaliy Aleksandrov



Hello,

On 9/6/12 6:33 PM, Vitaliy Aleksandrov wrote:
Migrating kamailio v1.5.x to v.3.0.0 says that test operator no 
longer exists.
But it is mentioned in Core Cookbook 3.2 (and 3.3) and can confuse 
someone.


Can somebody remove it from the documentation ?
Indeed the operator was removed, same functionality can be obtained by 
simply removing the [ ].


You can create an account and update it yourself, captcha-based 
anonymous editing was disable due to spam bots going easy through the 
system.


https://www.kamailio.org/wiki/start?do=register

Cheers,
Daniel



Yes it works without [ ]. I didn't know that anyone can update 
documentation without any pre moderation.

Wiki is updated.

___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


[SR-Users] [ ... ] operator

2012-09-06 Thread Vitaliy Aleksandrov
Migrating kamailio v1.5.x to v.3.0.0 says that test operator no 
longer exists.

But it is mentioned in Core Cookbook 3.2 (and 3.3) and can confuse someone.

Can somebody remove it from the documentation ?

___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


[SR-Users] Why append_branch should be called in a failure route ?

2012-09-03 Thread Vitaliy Aleksandrov

Below is the example from http://kamailio.org/docs/modules/3.2.x/modules/tm.htm 
:

failure_route[0]{
if (t_check_status(5[0-9][0-9])){
# I do not like the 5xx responses,
# so I give another chance to foobar.com,
# and I drop all the replies to make sure that
# they are not forwarded to the caller.
t_drop_replies();

rewritehostport(foobar.com);
append_branch();
t_relay();
}
}

Why do append_branch() is present before t_relay().
I'm asking because I didn't used it in failure routes and call rerouting on 
various conditions worked great.



___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


[SR-Users] AVP string or integer ID

2012-08-28 Thread Vitaliy Aleksandrov

Hi all.

I'm working with kamailio for about 1 year and still don't understand 
difference between integer and string IDs of AVPs.

Is it just a question of usability ?


___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] Request for advice, running SIP-Router in OpenVZ Container

2012-08-19 Thread Vitaliy Aleksandrov

On 08/17/2012 03:42 PM, JR Richardson wrote:


Hi All,

I'm considering running Kamailio as a virtual machine, with such low 
utilization, it doesn't seem to make sense to keep running it on a 
physical host server.


I've been virtualizing Asterisk PBX's for years and run a host of 
other virtualized servers with OpenVZ, VMware and MS V-Server without 
issues.


I'd like any opinions or thoughts about pitfalls or caveats I should 
be aware of specific to virtualized SIP-Router/Kamailio.


Thanks in advanced.

JR



___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


It works great in VMware and XEN VMs without any issues.
In my experience i had only two problems with virtual environment:
- I/O (network, disc).
- timing precision.

Disc I/O can be a problem if you are going to write lots of logs and the 
VM running kamailio are connected to overloaded disc array or external 
storage. Use only async syslog mode otherwise kamailio process will be 
blocked in log operation and will be not available to process incoming 
sip traffic. So use fast drives and try to avoid time consuming 
operations (syslog, db queries, radius, etc...) during message 
processing as they block current process and kamailio has fixed number 
of running processes.


From my point of view timing precision is not a problem for a sip-proxy 
as it's not a big deal to send some re-transmit few milliseconds 
earlier/later.


___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] ACK and BYE messages uses wrong socket.

2012-07-03 Thread Vitaliy Aleksandrov

Have you specified interfaces with listen command ?
I had a problem as you described and have fixed it by moving a listen 
directive with a floating ip to the top of the list.
So you can try to specify interfaces you will use for SIP and set a 
virtual ip at the top of that list.



Kamailio 3.2.0

I am trying to setup kamailio to do the sip trunking. It  receive the 
sip traffic from customer and then send it to carrier.


I have two NIC interface's assigned with three IP's:

Interface 1: ( Public IP's)

x.x.130.34

x.x.130.36  floating IP

interface 2: (private IP's)

10.10.1.31

.36 is a floating IP  assigned by Linux-HA (heartbeat/pacemaker).

I only want to use .36 to receive and send sip traffic.

I uses  force_send_socket() to send INVITE with .36 IP.  But the ACK 
message always want to use .34 IP even the Route header has .36 in it 
unless I force it with force_send_socket() .


How can I fix this problem?

See below for the SIP messages: (x.x.128.205 is customer IP, 
x.x.129.200 is PSTN gateway IP)


U x.x.128.205:51694 - x.x.130.36:5060

  INVITE sip:5033441174@x.x.130.36:5060 SIP/2.0..Via: SIP/2.0/UDP  
x.x.128.205:5060;branch=z9hG


  4bK1D3CD1..From: sip:5024427578@x.x.128.205;tag=24513088-D59..To: 
sip:5033441174@x.x.130.3


  6..Date: Tue, 03 Jul 2012 13:37:41 GMT..Call-ID: 
1887588D-C44B11E1-BE38D697-98A3E39A@x.x.128.20


  5..Supported: 100rel,timer,replaces..Min-SE:  1800..Cisco-Guid: 
411443261-3293254113-3191264919-256


  0877466..User-Agent: Cisco-SIPGateway/IOS-12.x..Allow: INVITE, 
OPTIONS, BYE, CANCEL, ACK, PRACK, CO


  MET, REFER, SUBSCRIBE, NOTIFY, INFO, UPDATE, REGISTER..CSeq: 101 
INVITE..Max-Forwards: 70..Remote-P


  arty-ID: 
sip:5024427578@x.x.128.205;party=calling;screen=no;privacy=off..Timestamp: 
1341322661


  ..Contact: sip:5024427578@x.x.128.205:5060..Expires: 
180..Allow-Events: telephone-event..Conte


  nt-Type: application/sdp..Content-Length: 
366v=0..o=CiscoSystemsSIP-GW-UserAgent 9094 579 IN IP


  4 x.x.128.205..s=SIP Call..c=IN IP4 x.x.128.205..t=0 0..m=audio 
19312 RTP/AVP 125 0 18 100 10


  1..c=IN IP4 x.x.128.205..a=rtpmap:125 X-CCD/8000..a=rtpmap:0 
PCMU/8000..a=rtpmap:18 G729/8000..a


  =fmtp:18 annexb=yes..a=rtpmap:100 X-NSE/8000..a=fmtp:100 
192-194..a=rtpmap:101 telephone-event/8000


  ..a=fmtp:101 0-16..

#

U x.x.130.36:5060 - x.x.128.205:51694

  SIP/2.0 100 trying -- your call is important to us..Via: 
SIP/2.0/UDP  x.x.128.205:5060;branch=z9


  hG4bK1D3CD1;rport=51694..From: 
sip:5024427578@x.x.128.205;tag=24513088-D59..To: sip:502244117


  4@x.x.130.36..Call-ID: 
1887588d-c44b11e1-be38d697-98a3e...@x.x.128.205..cseq: 101 INVITE..Se


  rver: LVS Proxy 1.0..Content-Length: 0

#

U x.x.130.36:5060 - x.x.129.200:5060

  INVITE sip:15033441174@x.x.129.200:5060 SIP/2.0..Record-Route: 
sip:x.x.130.36;lr=on..Via: S


  IP/2.0/UDP x.x.130.36;branch=z9hG4bKc2ce.17a955a3.0..Via: 
SIP/2.0/UDP  x.x.128.205:5060;rport


  =51694;branch=z9hG4bK1D3CD1..From: 
sip:5024427578@x.x.128.205;tag=24513088-D59..To: sip:50224


  41174@x.x.130.36..Date: Tue, 03 Jul 2012 13:37:41 GMT..Call-ID: 
1887588D-C44B11E1-BE38D697-98A3


  E39A@x.x.128.205..Supported: 100rel,timer,replaces..Min-SE:  
1800..Cisco-Guid: 411443261-3293254


  113-3191264919-2560877466..User-Agent: 
Cisco-SIPGateway/IOS-12.x..Allow: INVITE, OPTIONS, BYE, CANC


  EL, ACK, PRACK, COMET, REFER, SUBSCRIBE, NOTIFY, INFO, UPDATE, 
REGISTER..CSeq: 101 INVITE..Max-Forw


  ards: 69..Remote-Party-ID: 
sip:5024427578@x.x.128.205;party=calling;screen=no;privacy=off..Tim


  estamp: 1341322661..Contact: 
sip:5024427578@x.x.128.205:51694..Expires: 180..Allow-Events: tel


  ephone-event..Content-Type: application/sdp..Content-Length: 
375v=0..o=CiscoSystemsSIP-GW-UserA


  gent 9094 579 IN IP4 10.200.1.51..s=SIP Call..c=IN IP4 
10.200.1.51..t=0 0..m=audio 20464 RTP/AVP 12


  5 0 18 100 101..c=IN IP4 10.200.1.51..a=rtpmap:125 
X-CCD/8000..a=rtpmap:0 PCMU/8000..a=rtpmap:18 G7


  29/8000..a=fmtp:18 annexb=yes..a=rtpmap:100 X-NSE/8000..a=fmtp:100 
192-194..a=rtpmap:101 telephone-


  event/8000..a=fmtp:101 0-16..a=nortpproxy:yes..

U x.x.129.200:5060 - x.x.130.36:5060

  SIP/2.0 100 Trying..Via: SIP/2.0/UDP 
x.x.130.36;branch=z9hG4bKc2ce.17a955a3.0,SIP/2.0/UDP  216.4


  9.128.205:5060;rport=51694;branch=z9hG4bK1D3CD1..From: 
sip:5024427578@x.x.128.205;tag=24513088


  -D59..To: sip:5033441174@x.x.130.36;tag=F0695368-74F..Date: Tue, 
03 Jul 2012 13:37:41 GMT..Cal


  l-ID: 1887588D-C44B11E1-BE38D697-98A3E39A@x.x.128.205..Timestamp: 
1341322661..Server: Cisco-SIPG


  ateway/IOS-12.x..CSeq: 101 INVITE..Allow-Events: 
telephone-event..Content-Length: 0


#

U x.x.129.200:5060 - x.x.130.36:5060

  SIP/2.0 183 Session Progress..Via: SIP/2.0/UDP 
x.x.130.36;branch=z9hG4bKc2ce.17a955a3.0,SIP/2.0/


  UDP  x.x.128.205:5060;rport=51694;branch=z9hG4bK1D3CD1..From: 
sip:5024427578@x.x.128.205;ta


  g=24513088-D59..To: 
sip:5033441174@x.x.130.36;tag=F0695368-74F..Date: Tue, 03 Jul 2012 
13:37:4


  1 

[SR-Users] cfgutils lock / unlock + $sht() variables.

2012-06-29 Thread Vitaliy Aleksandrov

Hi all,

I use $sht() pseudo-variabled provided by htable module for caching 
various information about sip customers. I thought that htable has some 
locking mechanism inside it and today while i was reading core-cookbook 
i payed attention to one example with the lock/unlock functions and $sht():


lock(calls-to::10.10.10.10);
$sht(a=calls-to::10.10.10.10) =
$sht(a=calls-to::10.10.10.10) + 1;
unlock(calls-to::10.10.10.10);

According to that example an explicit locking mechanism should be used 
when i want to write something to a hash table.

On the other hand there are no locks in htable documentation.

So the question is when do the explicit locks should be used and for 
what purpose ?



___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] default kamailio configuration.

2012-06-26 Thread Vitaliy Aleksandrov

I have lost in Route and Record-Route headers.
But now it's clear for me.  Huge thanks.


On 25.06.2012 14:44, Vitaliy Aleksandrov wrote:

Hi All,

After reading default kamailio configuration i can't understand why does
kamailio remove preloaded route headers from the incoming initial INVITE
before calling record_route().

remove_hf(Route);
if  (is_method(INVITE|SUBSCRIBE))
 record_route();


Pre-loaded route sets can be used to abuse the proxy as an open relay. 
This is bad. If a request hits my proxy, then I want to define how the 
message is routed, and I do not want to route the message like 
somebody else wants it.


What will happen if an INVITE comes from another SIP proxy which wants
to stay in the middle of the dialogue ?


Only Route headers are removed, not Record-Route headers which 
create the route-set.



For example, during Re-INVITE UA from our local site will construct
in-dialog INVITE with R-URI taken from the remote contact and send it to
our local proxy according to RR. Local proxy will process it in
route[WITHNDLG] where loose_route() function will remove top most RR
header because it points to us and since there is no more RR records
forward the request to a destination from the R-URI.  As i understand in
that case remote proxy will not receive any in-dialog requests from us.


Sure it does. As only the pre-loaded route is remove, not the 
Record-Route headers. Thus, the in-dialog route set is not affected, 
only the out-of-dialog route set (pre-loaded) is manipulated.


regards
Klaus

___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users



___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


[SR-Users] default kamailio configuration

2012-06-25 Thread Vitaliy Aleksandrov

Hi All,

After reading default kamailio configuration i can't understand why does 
kamailio remove preloaded route headers from the incoming initial INVITE 
before calling record_route().


remove_hf(Route);
if  (is_method(INVITE|SUBSCRIBE))
record_route();

What will happen if an INVITE comes from another SIP proxy which wants 
to stay in the middle of the dialogue ?


For example, during Re-INVITE UA from our local site will construct 
in-dialog INVITE with R-URI taken from the remote contact and send it to 
our local proxy according to RR. Local proxy will process it in 
route[WITHNDLG] where loose_route() function will remove top most RR 
header because it points to us and since there is no more RR records 
forward the request to a destination from the R-URI.  As i understand in 
that case remote proxy will not receive any in-dialog requests from us.







___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


[SR-Users] multiple t_on_branch[]

2012-06-01 Thread Vitaliy Aleksandrov

Hi all,

Does kamailio allow to configure more than one branch_route for an 
initial INVITE ?


I have tried to add:
t_on_branch(branch_r1);
t_on_branch(branch_r2);

before t_relay(). Mentioned branch routes write debug to the 
kamailio.log and it looks like that only the last 
branch_route[branch_r2] works.



___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


[SR-Users] Max registered users

2012-05-30 Thread Vitaliy Aleksandrov

Hi all,

I'm trying to find a way to get a number of the registered user 
locations and if it is bigger that some limit then kamailio will not 
save new registrations.


reg_fetch_contacts() from registrar module doesn't help as it can fetch 
contacts only for one user.
max_contacts parameter of the registrar module limits the number of 
contacts per AOR, but i need to limit max number of all contacts that 
proxy will keep in usrloc.



___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] Creating RURI ($ru) from Contact ($ct)

2012-05-26 Thread Vitaliy Aleksandrov

On 05/26/2012 05:39 PM, Aft nix wrote:

Hi,

I'm trying to create a ruri from contact header like following :

In request route I've saved contact header in a hashtable using htable module.
request_route{

-
-
#!ifdef WITH_HASH
  if (is_method(INVITE)  !has_totag()){
  xdbg (Contact [$ct] with Callid [$ci]);
  $sht(a=$ci) = $ct;
  }
  #!endif


}

And in route[WITHINDLG]

route[WITHINDLG] {

---
---
  #!ifdef WITH_HASH
  xdbg (ruri [$ru]);
  if ($sht(a=$ci) != $ru){
  $ru = ($sht(a=$ci));
  xdbg (rewriting ruri to [$ru]);
  }
  #!endif

But it log shows that its unable to parse the uri :

[4039]: DEBUG:core  [parser/parse_uri.c:1277]: parse_uri: bad uri,
state 0 parsed:sip  (4) /sip:2020@103.23.169.2:64358  (29)
: DEBUG:core  [parser/parse_uri.c:1327]: ERROR: parse_sip_msg_uri:
bad urisip:2020@103.23.169.2:64358
[4039]: ERROR: pv [pv_core.c:232]: failed to parse the R-URI
[4039]: DEBUG:script: rewriting ruri to [null]


I'm not understanding what's wrong with that. May be the port part
should be discarded, but how i'm gonna do that?


It looks like $sht(a=$ci) is empty. I see that you have xdbg (Contact 
[$ct] with Callid [$ci]);  line, but you didn't show us that line at 
the debug.
If you add $ci to the debug information at the route[WITHINDLG] and show 
full debug from INVITE to BYE it will help to find where the mistake is.


And i think it would be better if you change _if ($sht(a=$ci) != $ru)_ 
to _if ( $sht(a=$ci) != $null  $sht(a=$ci) != $ru)_ , because when 
$sht() is empty it always not equal to $ru.


___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] Hop by hop CANCEL, wrong to header

2012-05-25 Thread Vitaliy Aleksandrov

Hello Daniel,

Thanks for the reply.

Sorry i have made a typo. If E2E_CANCEL_HOP_BY_HOP is defined then 
e2e_cancel() from t_fwd.c calls cancel_branch() function for each branch 
it found at a t_invite transaction.
Then if cfg_get(tm, tm_cfg, reparse_invite) is true cancel_branch() 
calls build_local_reparse() which returns new CANCEL request buffer 
based on outgoing INVITE, but with original To header.


I've searched a bit deeper and found that if E2E_CANCEL_HOP_BY_HOP is 
not defined e2e_cancel() calls e2e_cancel_branch(), which then calls 
build_local_reparse() like in previous description when 
E2E_CANCEL_HOP_BY_HOP was defined.


So the main question is why does kamailio take To field from a 
transaction cell and not from outgoing buffer like it does with other 
headers ?


I'm using kamailio-3.0.2, but i have checked 3.2.2 sources and haven't 
found any changes at the functions mentioned above.


Cheers,
Vitaliy Aleksandrov


Hello,

On 5/23/12 5:22 PM, Vitaliy Aleksandrov wrote:

Hi all,

I have a question about CANCEL message processing.

My call sceraio:
When an INVITE request comes I need to rewrite a domain part of the 
several headers(to, from, contact, SDP ip) according to the outgoing 
interface.
I can do it before t_relay(), but when destination user has more then 
one locations and they are reachable through different interfaces all 
forked INVITEs will have the same domain.
To avoid that problem i have tried to move rewriting part(subst from 
the textops module) to the branch_route.


Unfortunately that solution didn't helped me, because To header of 
the outgoing CANCEL messages is wrong (unchanged. as it was at the 
moment when transaction was created by the t_relay() ).
As i understood from the documentation and mailing list kamailio 
builds CANCEL based on outgoing INVITE.


I did a small research and found that Kamailio really takes outgoing 
INVITE from each branch (invite_transaction_cell - 
uac[b_id].request.buffer) and builds CANCEL (build_local_reparse() 
from tm/t_msgbuilder.c) based on it.
But kamailio does an exception for the To header which is described 
below:
***cancel_branch* function (from t_cancel.c) calls 
*build_local_reparse*() and fills one of the parameters with a 
pointer to unmodified To header.
*build_local_reparse*() uses received To header to construct 
outgoing CANCEL.


I have changed:
cancel = build_local_reparse(t, branch, len, CANCEL, CANCEL_LEN, 
t-to, reason);

to:
cancel = build_local_reparse(t, branch, len, CANCEL, CANCEL_LEN, 
NULL, reason);

and it works for me now.

It looks like if E2E_CANCEL_HOP_BY_HOP *e2e_cancel()* (t_fwd.c) will 
call *e2e_cancel_branch()* which works as i want instead of 
*cancel_branch()*, but it is just my assumption.


do you mean if E2E_CANCEL_HOP_BY_HOP is defined? I quick grep at this 
time showed it is defined in t_fwd.h...


What is the version you are using?

Cheers,
Daniel



Why does kamailio generate CANCEL requests in such a way ? Did i miss 
something from the RFC3261 or kamailio documentation ?


Thanks in advance for any help !




___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


--
Daniel-Constantin Mierla -http://www.asipto.com
http://twitter.com/#!/miconda  -http://www.linkedin.com/in/miconda




___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] kamailioi is not relaying BYE message to UAC

2012-05-24 Thread Vitaliy Aleksandrov



Thanks for the reply.

We have already came to the same conclusion by some testing in our
lab. It seems its a bug in provider which not constructing BYE message
properly.

But i'm interested in if its possible to detect the fault in this BYE
and construct a new one and then relay it to the UAC.

I mean can i do this :

contact-header = INVITE's contact-header
if (contact-header != BYE's ruri)
{
   construct BYE message with contact header
   t_relay()
  }

Cheers
aft



Hi aft,

I think to do what you want you can save Contact field + callid pair 
taken from the INVITEs that comes from your side.
Then when BYE comes from such provider you should find a correct Contact 
for that call-id and if it exists and not equal to R-URI you can rewrite it.


For example to write to R-URI value from $var(correct_ruri) you can use 
*$ru = $var(correct_ruri);* statement.


What about a place where contact can be saved, i think htable will be 
the nice one.
Please pay attention to autoexpire parameter of htable module. You 
should take care about the staled records to avoid memory usage problems.


Cheers,
Vitaliy Aleksandrov
___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


[SR-Users] Hop by hop CANCEL, wrong to header

2012-05-23 Thread Vitaliy Aleksandrov

Hi all,

I have a question about CANCEL message processing.

My call sceraio:
When an INVITE request comes I need to rewrite a domain part of the 
several headers(to, from, contact, SDP ip) according to the outgoing 
interface.
I can do it before t_relay(), but when destination user has more then 
one locations and they are reachable through different interfaces all 
forked INVITEs will have the same domain.
To avoid that problem i have tried to move rewriting part(subst from the 
textops module) to the branch_route.


Unfortunately that solution didn't helped me, because To header of the 
outgoing CANCEL messages is wrong (unchanged. as it was at the moment 
when transaction was created by the t_relay() ).
As i understood from the documentation and mailing list kamailio builds 
CANCEL based on outgoing INVITE.


I did a small research and found that Kamailio really takes outgoing 
INVITE from each branch (invite_transaction_cell - 
uac[b_id].request.buffer) and builds CANCEL (build_local_reparse() from 
tm/t_msgbuilder.c) based on it.

But kamailio does an exception for the To header which is described below:
***cancel_branch* function (from t_cancel.c) calls 
*build_local_reparse*() and fills one of the parameters with a pointer 
to unmodified To header.
*build_local_reparse*() uses received To header to construct 
outgoing CANCEL.


I have changed:
cancel = build_local_reparse(t, branch, len, CANCEL, CANCEL_LEN, 
t-to, reason);

to:
cancel = build_local_reparse(t, branch, len, CANCEL, CANCEL_LEN, 
NULL, reason);

and it works for me now.

It looks like if E2E_CANCEL_HOP_BY_HOP *e2e_cancel()* (t_fwd.c) will 
call *e2e_cancel_branch()* which works as i want instead of 
*cancel_branch()*, but it is just my assumption.


Why does kamailio generate CANCEL requests in such a way ? Did i miss 
something from the RFC3261 or kamailio documentation ?


Thanks in advance for any help !


___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] Copy reason field from 503 to 500.

2012-04-27 Thread Vitaliy Aleksandrov
According to 
http://www.asipto.com/pub/kamailio-devel-guide/#c02message_processing; 
all replies comes to on_reply and if it is negative reply it will be 
processed in failure_route after onreply_route.

But that is not the point i tried failure_route too.

append_hf works great for forwarded replies. But as i understand when 
kamailio receives final 503 reply it sends 500 reply generated by 
build_res_buf_from_sip_req (it is part of tm code, not dialplan function).


Thanks for your tries to help.

||Well 5xx error codes are processed in failure_route and not 
onreply_route. Not sure though if you can append_hf there.. Give it a try.


FYI, for using a function in event_route (seems not possible for 
append_hf):


event_route[tm:local-request] {
  ...
  append_hf(...);
  ...
}


Reda

On 26 avr. 2012, at 18:10, Vitaliy Aleksandrov vitalik.v...@gmail.com 
mailto:vitalik.v...@gmail.com wrote:



I have tried to use append_hf in onreply_route.
How can i use it in local-request ? According to documentation it can 
be used from REQUEST_ROUTE, ONREPLY_ROUTE, FAILURE_ROUTE, BRANCH_ROUTE.


Sorry forgot to mention that kamailio version is 3.0.2, but i have 
looked at t_repy.c (tm module from 3.2) and didn't find any changes 
which can help me.



Hi,

In which route did you try append_hf ?
event_route[tm:local-request] is the route executed for locally 
generated requests, I think you should be trying to modify it there.


Reda



On Thu, Apr 26, 2012 at 16:10, Vitaliy Aleksandrov 
vitalik.v...@gmail.com mailto:vitalik.v...@gmail.com wrote:


Hi all,

I have Kamailio connected to PSTN gateway.

Sometimes gateway replies with 503 temporary unavailable. PSTN
gateway adds a reason header with ISUP code.
But according to RFC 3261 tel:3261 kamailio doesn't forward
503 replies transparently. When 503 reply is received Kamailio
replaces 503 with a 500 which is created from original request
(build_res_buf_from_sip_req).
I have tried append_hf from textops module, but it's not working
with a locally generated replies.

How can i copy Reason header from 503 to 500 ?


I will appreciate your help with this situation.

Best regards,
   Vitaliy Aleksandrov.


___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users
mailing list
sr-users@lists.sip-router.org mailto:sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users



___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org mailto:sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users



___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


[SR-Users] Copy reason field from 503 to 500.

2012-04-26 Thread Vitaliy Aleksandrov

Hi all,

I have Kamailio connected to PSTN gateway.

Sometimes gateway replies with 503 temporary unavailable. PSTN gateway 
adds a reason header with ISUP code.
But according to RFC 3261 kamailio doesn't forward 503 replies 
transparently. When 503 reply is received Kamailio replaces 503 with a 
500 which is created from original request (build_res_buf_from_sip_req).
I have tried append_hf from textops module, but it's not working with a 
locally generated replies.


How can i copy Reason header from 503 to 500 ?


I will appreciate your help with this situation.

Best regards,
Vitaliy Aleksandrov.


___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] Copy reason field from 503 to 500.

2012-04-26 Thread Vitaliy Aleksandrov

I have tried to use append_hf in onreply_route.
How can i use it in local-request ? According to documentation it can be 
used from REQUEST_ROUTE, ONREPLY_ROUTE, FAILURE_ROUTE, BRANCH_ROUTE.


Sorry forgot to mention that kamailio version is 3.0.2, but i have 
looked at t_repy.c (tm module from 3.2) and didn't find any changes 
which can help me.



Hi,

In which route did you try append_hf ?
event_route[tm:local-request] is the route executed for locally 
generated requests, I think you should be trying to modify it there.


Reda



On Thu, Apr 26, 2012 at 16:10, Vitaliy Aleksandrov 
vitalik.v...@gmail.com mailto:vitalik.v...@gmail.com wrote:


Hi all,

I have Kamailio connected to PSTN gateway.

Sometimes gateway replies with 503 temporary unavailable. PSTN
gateway adds a reason header with ISUP code.
But according to RFC 3261 tel:3261 kamailio doesn't forward 503
replies transparently. When 503 reply is received Kamailio
replaces 503 with a 500 which is created from original request
(build_res_buf_from_sip_req).
I have tried append_hf from textops module, but it's not working
with a locally generated replies.

How can i copy Reason header from 503 to 500 ?


I will appreciate your help with this situation.

Best regards,
   Vitaliy Aleksandrov.


___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing
list
sr-users@lists.sip-router.org mailto:sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users



___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] T1 timer

2011-10-28 Thread Vitaliy Aleksandrov

Yes, i tried to call t_set_retr from route block before t_relay.

On 10/27/11 6:15 PM, Vitaliy Aleksandrov wrote:
Thank you for your quick reply. t_set_retr doesn't affects 
transaction created by uac_req_send.


The second way proposed by you works great (tm settings for uac, 
t_set_retr for t_relay).


Just to be clear, you have tested t_set_retr only in route block, not 
in event_route[tm:local-request], right?


Cheers,
Daniel


Hello,

On 10/26/11 12:10 PM, Vitaliy wrote:

Hello,

How can i change T1 timeout for transaction created by the UAC 
module (uac_req_send).
Do i have to call t_set_retr before uac_req_send and then 
t_reset_retr() before t_relay ?


I use uac_req_send to send accounting to the remote server and i 
want to increase retransmit timeout for such signalling messages.


it is not a way dedicated for uac_req_send() and I haven't played 
with variants -- you can try what you wrote above and if does not 
work, try to set the timer parameters for tm to the one you want for 
uac and use for forwarded transactions t_set_retr. One other way to 
try is to make a event_route[tm:local-request] and use there the 
t_set_retr.


Let me know if any of it works, we can add to docs if so, otherwise 
I will look for implementing a solution for it.


Cheers,
Daniel




___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users





___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] T1 timer

2011-10-27 Thread Vitaliy Aleksandrov
Thank you for your quick reply. t_set_retr doesn't affects transaction 
created by uac_req_send.


The second way proposed by you works great (tm settings for uac, 
t_set_retr for t_relay).

Hello,

On 10/26/11 12:10 PM, Vitaliy wrote:

Hello,

How can i change T1 timeout for transaction created by the UAC module 
(uac_req_send).
Do i have to call t_set_retr before uac_req_send and then 
t_reset_retr() before t_relay ?


I use uac_req_send to send accounting to the remote server and i want 
to increase retransmit timeout for such signalling messages.


it is not a way dedicated for uac_req_send() and I haven't played with 
variants -- you can try what you wrote above and if does not work, try 
to set the timer parameters for tm to the one you want for uac and use 
for forwarded transactions t_set_retr. One other way to try is to make 
a event_route[tm:local-request] and use there the t_set_retr.


Let me know if any of it works, we can add to docs if so, otherwise I 
will look for implementing a solution for it.


Cheers,
Daniel




___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


  1   2   >