Re: [SR-Users] Combining lookup_branches() and t_(next|load)_contacts()

2018-06-09 Thread Nathan Ward
Hi all,

I’ve worked around this by walking through $branches() and removing entries 
where dst_uri is $null. This works OK, but feels like a hack:

  # Walk through all the branches, and nuke any which have not resolved - i.e. 
they do not have a dst_uri set.
  $var(i) = 0;
  while($var(i)<$branch(count))
  {
xlog('L_DBG', "Looking at branch [$var(i)] with dst_uri 
[$(branch(dst_uri)[$var(i)])] and ru [$(branch(uri)[$var(i)])]\n");
if ($(branch(dst_uri)[$var(i)]) == $null) {
  xlog('L_DBG', "Branch [$var(i)] has a null dst_uri, so removing\n");
  $(branch(uri)[$var(i)]) = $null;
} else {
  $var(i) = $var(i) + 1;
}
  }

I’d be keen to know if there’s any other ways to achieve this.

I also note that I’m getting a "BUG: freeing already freed pointer” message 
when the dialog is getting cleaned up. How can I debug this, or, what sort of 
information is useful to provide for something like this? I’m on 5.1.3.

> On 4/05/2018, at 1:51 PM, Nathan Ward  wrote:
> 
> Hi,
> 
> About a year ago I posted this, but haven’t had much chance to follow up on 
> it:
> https://lists.kamailio.org/pipermail/sr-users/2017-March/096337.html
> 
> I’ve been doing some work on this issue (we worked around it until now), and 
> have reduced the config right down to see where things are going wonky.
> 
> The scenario I have, is inbound calls (to let’s say “A@domain") which I have 
> aliased to two or more different numbers (let’s say “B@domain” and 
> “C@domain”). Both B and C are registering, but are not always registered.
> I resolve the aliases with alias_db_lookup() (in my sample below, I use 
> seturi() and append_branch() to avoid any confusion about where things may be 
> going weird), then look them up in the location table with lookup_branches().
> I then need to do t_load_contacts() and t_next_contacts(), as in some call 
> scenarios I add a serial fork before or after the main call (pre-call 
> announcements etc.).
> Then, I call t_relay().
> 
> This works great most of the time - however, if for example B is registered, 
> but C is not registered, lookup_branches() notes that B is "Not found in 
> usrloc”, and then t_load_contacts() seems to not realise that this isn’t 
> usable, and it attempts to do a DNS lookup for the domain and so on, which I 
> don’t really want it to be doing.
> 
> Should lookup_branches() be removing a branch it can’t resolve? I would 
> expect it to behave like that, anyway. Can I configure it to do that, or do I 
> need to manually loop through them or something to make sure they resolved, 
> and remove the ones that didn’t?
> 
> I’ve tried swapping it around, so I call lookup_branches() after 
> t_next_contacts() but the behaviour is the same.
> 
> I imagine I can’t be the only person trying to do this - how have others made 
> it work?
> 
> 
> Config sample:
> 
> seturi('sip:a@domain');
> append_branch('sip:b@domain');
> xlog("L_DBG", "1 ds: [$ds]\n");
> lookup_branches('location');
> xlog("L_DBG", "2 ds: [$ds]\n");
> t_load_contacts();
> xlog("L_DBG", "3 ds: [$ds]\n");
> t_next_contacts();
> xlog("L_DBG", "4 ds: [$ds]\n");
> 
> --
> Nathan Ward
> 


___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


[SR-Users] Combining lookup_branches() and t_(next|load)_contacts()

2018-05-04 Thread Nathan Ward
Hi,

About a year ago I posted this, but haven’t had much chance to follow up on it:
https://lists.kamailio.org/pipermail/sr-users/2017-March/096337.html

I’ve been doing some work on this issue (we worked around it until now), and 
have reduced the config right down to see where things are going wonky.

The scenario I have, is inbound calls (to let’s say “A@domain") which I have 
aliased to two or more different numbers (let’s say “B@domain” and “C@domain”). 
Both B and C are registering, but are not always registered.
I resolve the aliases with alias_db_lookup() (in my sample below, I use 
seturi() and append_branch() to avoid any confusion about where things may be 
going weird), then look them up in the location table with lookup_branches().
I then need to do t_load_contacts() and t_next_contacts(), as in some call 
scenarios I add a serial fork before or after the main call (pre-call 
announcements etc.).
Then, I call t_relay().

This works great most of the time - however, if for example B is registered, 
but C is not registered, lookup_branches() notes that B is "Not found in 
usrloc”, and then t_load_contacts() seems to not realise that this isn’t 
usable, and it attempts to do a DNS lookup for the domain and so on, which I 
don’t really want it to be doing.

Should lookup_branches() be removing a branch it can’t resolve? I would expect 
it to behave like that, anyway. Can I configure it to do that, or do I need to 
manually loop through them or something to make sure they resolved, and remove 
the ones that didn’t?

I’ve tried swapping it around, so I call lookup_branches() after 
t_next_contacts() but the behaviour is the same.

I imagine I can’t be the only person trying to do this - how have others made 
it work?


Config sample:

seturi('sip:a@domain');
append_branch('sip:b@domain');
xlog("L_DBG", "1 ds: [$ds]\n");
lookup_branches('location');
xlog("L_DBG", "2 ds: [$ds]\n");
t_load_contacts();
xlog("L_DBG", "3 ds: [$ds]\n");
t_next_contacts();
xlog("L_DBG", "4 ds: [$ds]\n");

--
Nathan Ward


___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


[SR-Users] dispatcher/carrierroute and branches across SBC and remote peer

2017-11-27 Thread Nathan Ward
Hi,

We use Kamailio as a SIP server, and SEMS as an SBC. We have a need to use the 
dispatcher/carrierroute modules to provide HA/load sharing across two different 
parts of our environment:
1) Our SBCs
2) Our peer’s SIP servers

We have pairs of SBCs (for now) and they have the same network connectivity - 
different IPs of course, but they can reach the same things.
Our peer’s network has 2 SIP servers (again, for now) reachable through either 
SBC.
We select which SBC pair to use based on where the calls are going, in a branch 
route. In some cases, we use parallel forking, in others we use serial forking 
(i.e. to a media server for a prompt, then sending the call to wherever it 
needs to go).

Right now there is no automatic failover or load sharing, so this is all simple 
logic - if call is to x peer or y customer, use x SBC or y SBC. I’m trying to 
add the failover/loadbalancing now.

I have a few half baked ideas about how to achieve a network like this, but 
thought I’d ask if anyone else had done this first before I went too overboard.

Currently I’m thinking of calling cr_route to figure out which peer SIP server, 
from there figuring out which SBC pair, and then calling ds_select_dst to 
select which SBC in the pair to set $du. I’m being tripped up though, as I 
can’t call cr_route or ds_select_dst in a branch route, but, as far as I’m 
aware that’s where I’d need to do so in order to handle this for multiple 
branches. Should I be looping the request through the SIP server to achieve 
this (i.e. force $du = 127.0.0.1 in my branch_route), or, can I avoid that 
complexity?

--
Nathan Ward


___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] caller id display through pstn

2017-06-09 Thread Nathan Ward

> On 9/06/2017, at 11:13 PM, 赵国杰 <zhaoguojie2...@163.com> wrote:
> 
> Hello all.
>  I have a kamailio server routing request to a pstn gw and I want to 
> change the number displayed on callee side. Say the caller's user name is 
> "test", and it calls the number 18512345678, and I want the incoming all 
> number displayed on callee side to be 13587654321. How can I achieve this?

https://www.google.co.nz/search?client=safari=en=kamailio+replace+caller+id=UTF-8=UTF-8_rd=cr=c4Y6WYH5DcbN8gfGjo6IBg
 
<https://www.google.co.nz/search?client=safari=en=kamailio+replace+caller+id=UTF-8=UTF-8_rd=cr=c4Y6WYH5DcbN8gfGjo6IBg>

First result is great.

--
Nathan Ward

___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] user management of kamailio cluster

2017-06-09 Thread Nathan Ward
Hi,

Developing such a solution is going to be quite complicated any way you look at 
it, and will require deep understanding of a number of things in order to 
operate it, and there are a number of tradeoffs you’ll need to make based on 
your exact use case. I don’t think a mailing list discussion is a going to get 
you the skills required to build a solution like this - you have quite a bit of 
study ahead of you.

However, if you cannot use DNS (why?) I can think of a few other options - 
these are presented merely as a starting point for your investigations - you’ll 
need to have a strong understanding of these in order to make decisions about 
which is appropriate for you:
1) Anycast - this uses IP routing to get to the closest instance of an IP 
address. You might want to combine that with a redirect if the message is sent 
to the anycast IP, to have the client do subsequent things by talking to the 
“real” IP of the server.
2) Use geoip to figure out where a user is, and redirect them to the closest 
instance if they are not already talking to that. Client will need to be 
configured to one of the servers? Or all of them with some sort of preference? 
Not sure what is appropriate for you here.
3) Use geoip like (2) but with a single central server, which replies with 301. 
This may work for some use cases - i.e. inbound heavy, and may not work with 
all clients.

There are a bunch of considerations - for example, what is “closest” ? I don’t 
expect you to answer that to me, but, you will need to have a clear definition 
before you can embark on this project.

> On 9/06/2017, at 6:30 PM, 赵国杰  wrote:
> 
> That's the thing. I'm not be able to use dns, just raw ip.
> 
> Cheers,
> Jesse
> 
> 在 2017-06-09 14:24:33,"David Villasmil"  写道:
> You'd need geographical dns resolution, the dns returns the ip closest to the 
> request's location... I thought that's how you're deciding what ip to give to 
> the users...
> ᐧ
> 
> Regards,
> 
> David Villasmil
> email: david.villasmil.w...@gmail.com 
> phone: +34669448337
> 
> On Fri, Jun 9, 2017 at 2:20 AM, 赵国杰  > wrote:
> Hi David,
>  Does that mean the user send the request to a randomly selected kamailio 
> first, and then use it as a hop to direct to the closest one? How can I 
> direct the users to their closest kamailio? Is there any doc that I can refer 
> to ??
> 
> Thanks
> Jesse
> 
> 在 2017-06-09 14:09:51,"David Villasmil"  > 写道:
> You can use the 
> alias=udp:myglobaldomain:5060
> 
> to use a single domain, and direct the users to their closest ip.
> ᐧ
> 
> Regards,
> 
> David Villasmil
> email: david.villasmil.w...@gmail.com 
> phone: +34669448337 
> On Fri, Jun 9, 2017 at 1:59 AM, 赵国杰  > wrote:
> hello David,
> I want the user to register to the kamailio server which is closest to 
> the user. Each user(aka subscriber) has a unique domain, but my kamailio 
> servers have 10 different domains which are their public ip. Let's say, based 
> on user's ip, the closest kamailio server's domain is 35.185.3.4. I can use 
> the one account which has the domain 35.185.3.4 to register to that kamailio 
> server. I don't think I can do that with just 1 account. If i'm wrong, please 
> tell me the write way.
> 
> Thanks
> Jesse
> 
> 在 2017-06-08 22:46:33,"David Villasmil"  > 写道:
> Sorry, i have to ask: why not just 1 account for all servers? There are many 
> solutions to replicate the dbs, share the dbs amongst all kamailios, etc... 
> just wondering 
> On Thu, Jun 8, 2017 at 8:42 AM zhaoguojie2...@163.com 
>   > wrote:
> Hi all.
> I have 10 kamailio servers across the world. Each of them has a public ip 
> which is also their SIP DOMAIN. When a user register on my service, I'd use 
> their username and password to generate 10 sip accounts, one for each 
> kamailio server so that they can register to any of them.  So for each user I 
> will have to insert 10 records in the subscriber table. Is there a better way 
> to do this?
> 
> Cheers
> Jesse
> ___
> Kamailio (SER) - Users Mailing List
> sr-users@lists.kamailio.org 
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users 
> 
> 
> 
>  
> 
> ___
> Kamailio (SER) - Users Mailing List
> sr-users@lists.kamailio.org 
>