[OpenSIPS-Users] inbounts calls problems

Iñaki Baz Castillo ibc at aliax.net
Thu Jan 22 21:31:41 CET 2009


El Jueves, 22 de Enero de 2009, pjgonzalez escribió:
> The user has 3 form to receive his inbount calls base on the following
> preference:
>
> When the user is online:
>
> he can select one of the following state:
>
> 1-Receive his calls on his softphone.
> 2-Forward his calls to another number on PSTN.
>
> when user is offline:
>
> sent his calls to voicemail.


The problem is that you are using:
  if(!lookup("location")){
and later select if you want the INVITE arrives to the registered user or to a 
PSTN number.

But when a user is registered behind NAT and you do:
  lookup("location")
then $du variavle is set containing the public IP of the registered contact. 
$du is the **REAL** destination of the request, even if you later modify the 
RURI.

A workaround would be modifying $du if the user wants to receive the call in 
the PSTN number.
But a more ellegant way is using "is_registered()" function that just returns 
true or false but doesn't set $du and doesn't modify $ru. This is:

- INVITE received.
- Do "is_registered()".
- If true: route[13]
- If false: voicemail

in route[13]:

- If the user wants to receive the INVITE then do: lookup("location").
- If he prefers to receive in the PSTN phone then replace the RURI with the 
PSTN URI.

Regards.

PD: I suggest you to read about the $du variable in the OpenSIPS wiki 
(pseudo-variables section).


-- 
Iñaki Baz Castillo



More information about the Users mailing list