better solution possible? => lookup and routing with 2 location databases

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

better solution possible? => lookup and routing with 2 location databases

Uwe Kastens
Hi,

Perhaps somebody has a better idea to solve the following issue. I have
two opensips servers. UA can register at both opensips with different
domains and credentials.

opensips1 will get the calls from pstn and should route them to
opensips2 , if the UA is registered as well with opensips2.

I would like to have parallel invites to all registered UAs. But the
invites should come from that opensips, with which the UA is registered.

1st I was wondering, why a call is forked to opensips2 as well, even if
no UA is registered there. I think it might be caused by the
rewritehostport("domain2.de") which is working on the current URI?

route[1] {
if (!loose_route()){
 rewritehostport("domain1.de");
 if lookup("locinternal") {
  append_branch();
  }
  rewritehostport("domain2.de");
    if (registered("location")) {
      append_branch("$[hidden email]");
     }
}

   if (!t_relay()) {
    sl_reply_error();
    };
  t_on_reply("1");
}


BR

Uwe
--

kiste lat: 54.322684, lon: 10.13586

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: better solution possible? => lookup and routing with 2 location databases

Bogdan-Andrei Iancu
Hi Uwe,

I think the problem is in the branch management. If I get is right, you
get the records from locinternal table and if records are present in
location, you fork a branch to the other server, right ?

If so, you do something like :

route[1] {
if (!loose_route()){
 rewritehostport("domain1.de");
 $var(x) = $rU+"@domain2.de";
 lookup("locinternal");
 if (registered("location","$var(x)")) {
      $rb = $var(x);
 }
}

See: http://www.opensips.org/html/docs/modules/1.5.x/registrar.html#id271315

Regards,
Bogdan

Uwe Kastens wrote:

> Hi,
>
> Perhaps somebody has a better idea to solve the following issue. I have
> two opensips servers. UA can register at both opensips with different
> domains and credentials.
>
> opensips1 will get the calls from pstn and should route them to
> opensips2 , if the UA is registered as well with opensips2.
>
> I would like to have parallel invites to all registered UAs. But the
> invites should come from that opensips, with which the UA is registered.
>
> 1st I was wondering, why a call is forked to opensips2 as well, even if
> no UA is registered there. I think it might be caused by the
> rewritehostport("domain2.de") which is working on the current URI?
>
> route[1] {
> if (!loose_route()){
>  rewritehostport("domain1.de");
>  if lookup("locinternal") {
>   append_branch();
>   }
>   rewritehostport("domain2.de");
>     if (registered("location")) {
>       append_branch("$[hidden email]");
>      }
> }
>
>    if (!t_relay()) {
>     sl_reply_error();
>     };
>   t_on_reply("1");
> }
>
>
> BR
>
> Uwe
>  


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: better solution possible? => lookup and routing with 2 location databases

Uwe Kastens
Hi Bogdan,

Thanks for your answer.

If I understood you scripting correctly, the lookup("locinternal"); will
 have the value of the 1st lookup, if there is an entry in locinternal.
If the 2nd if (registered("location ...) will match, than I will have
the entry from location only, correct?

BR

Uwe

Bogdan-Andrei Iancu schrieb:

> Hi Uwe,
>
> I think the problem is in the branch management. If I get is right, you
> get the records from locinternal table and if records are present in
> location, you fork a branch to the other server, right ?
>
> If so, you do something like :
>
> route[1] {
> if (!loose_route()){
> rewritehostport("domain1.de");
> $var(x) = $rU+"@domain2.de";
> lookup("locinternal");
> if (registered("location","$var(x)")) {
>      $rb = $var(x);
> }
> }
>
> See:
> http://www.opensips.org/html/docs/modules/1.5.x/registrar.html#id271315
>
> Regards,
> Bogdan
>
> Uwe Kastens wrote:
>> Hi,
>>
>> Perhaps somebody has a better idea to solve the following issue. I have
>> two opensips servers. UA can register at both opensips with different
>> domains and credentials.
>>
>> opensips1 will get the calls from pstn and should route them to
>> opensips2 , if the UA is registered as well with opensips2.
>>
>> I would like to have parallel invites to all registered UAs. But the
>> invites should come from that opensips, with which the UA is registered.
>>
>> 1st I was wondering, why a call is forked to opensips2 as well, even if
>> no UA is registered there. I think it might be caused by the
>> rewritehostport("domain2.de") which is working on the current URI?
>>
>> route[1] {
>> if (!loose_route()){
>>  rewritehostport("domain1.de");
>>  if lookup("locinternal") {
>>   append_branch();
>>   }
>>   rewritehostport("domain2.de");
>>     if (registered("location")) {
>>       append_branch("$[hidden email]");
>>      }
>> }
>>
>>    if (!t_relay()) {
>>     sl_reply_error();
>>     };
>>   t_on_reply("1");
>> }
>>
>>
>> BR
>>
>> Uwe
>>  
>
>


--

kiste lat: 54.322684, lon: 10.13586

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: better solution possible? => lookup and routing with 2 location databases

Bogdan-Andrei Iancu
Hi Uwe,

yes, it will fetch everything from the locinternal (if any) (first
lookup) and if there are contact in the second table (location), it will
add a branch to point to the other server.

Regards,
Bogdan

Uwe Kastens wrote:

> Hi Bogdan,
>
> Thanks for your answer.
>
> If I understood you scripting correctly, the lookup("locinternal"); will
>  have the value of the 1st lookup, if there is an entry in locinternal.
> If the 2nd if (registered("location ...) will match, than I will have
> the entry from location only, correct?
>
> BR
>
> Uwe
>
> Bogdan-Andrei Iancu schrieb:
>  
>> Hi Uwe,
>>
>> I think the problem is in the branch management. If I get is right, you
>> get the records from locinternal table and if records are present in
>> location, you fork a branch to the other server, right ?
>>
>> If so, you do something like :
>>
>> route[1] {
>> if (!loose_route()){
>> rewritehostport("domain1.de");
>> $var(x) = $rU+"@domain2.de";
>> lookup("locinternal");
>> if (registered("location","$var(x)")) {
>>      $rb = $var(x);
>> }
>> }
>>
>> See:
>> http://www.opensips.org/html/docs/modules/1.5.x/registrar.html#id271315
>>
>> Regards,
>> Bogdan
>>
>> Uwe Kastens wrote:
>>    
>>> Hi,
>>>
>>> Perhaps somebody has a better idea to solve the following issue. I have
>>> two opensips servers. UA can register at both opensips with different
>>> domains and credentials.
>>>
>>> opensips1 will get the calls from pstn and should route them to
>>> opensips2 , if the UA is registered as well with opensips2.
>>>
>>> I would like to have parallel invites to all registered UAs. But the
>>> invites should come from that opensips, with which the UA is registered.
>>>
>>> 1st I was wondering, why a call is forked to opensips2 as well, even if
>>> no UA is registered there. I think it might be caused by the
>>> rewritehostport("domain2.de") which is working on the current URI?
>>>
>>> route[1] {
>>> if (!loose_route()){
>>>  rewritehostport("domain1.de");
>>>  if lookup("locinternal") {
>>>   append_branch();
>>>   }
>>>   rewritehostport("domain2.de");
>>>     if (registered("location")) {
>>>       append_branch("$[hidden email]");
>>>      }
>>> }
>>>
>>>    if (!t_relay()) {
>>>     sl_reply_error();
>>>     };
>>>   t_on_reply("1");
>>> }
>>>
>>>
>>> BR
>>>
>>> Uwe
>>>  
>>>      
>>    
>
>
>  


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users