[OpenSIPS-Users] How opensis can manage different ports.

mayamatakeshi mayamatakeshi at gmail.com
Sat Sep 18 04:49:54 CEST 2010


On Sat, Sep 18, 2010 at 7:57 AM, Stefano Pisani
<stefano.pisani at omnianet.it>wrote:

>  No I don't.
> I want that opensis uses same port of registration for INVITE.
> i.e. the client is register on port 5061, opensips uses from port 5061
> for INVITE
>

If you are dealing with more than 2 ports, this might get complicated.
But in case of just 2 ports, you could check the ReceivedPort and set a
bflag during handling of the REGISTER request:

if($Rp == 5060) {
  setbflag(BFLAG_RECEIVED_ON_PORT_5060);
}

The bflags are saved with the registration, so you can check them in a
branch_route called after lookup and force the port to be used to relay the
request:

if (lookup("location")) {
  t_on_branch("USER_BRANCH");
  if (!t_relay()) {
    sl_reply_error();
    exit;
  }
}

branch_route [USER_BRANCH] {
  if (isbflagset(BFLAG_RECEIVED_ON_PORT_5060)) {
    force_send_socket(MY_IP_ADDRESS:5060);
   } else {
    force_send_socket(MY_IP_ADDRESS:5061);
  }
}

(obs: I actually, never tested this. I'm writing from my recollections of
similar problems I had to deal with).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.opensips.org/pipermail/users/attachments/20100918/a3a431e1/attachment.htm 


More information about the Users mailing list