[OpenSIPS-Users] How opensis can manage different ports.
mayamatakeshi
mayamatakeshi at gmail.com
Sat Sep 18 05:19:01 CEST 2010
On Sat, Sep 18, 2010 at 11:49 AM, mayamatakeshi <mayamatakeshi at gmail.com>wrote:
>
> 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).
>
>
I looked at the docs. I'm not sure but maybe, the socket where the message
was received will be available in the branch_route as $(branch(socket)):
http://www.opensips.org/Resources/DocsCoreVar16#toc16
At least I can see this info being stored in the location table and I expect
the branch processing to load it as it does with the bflags.
So maybe you can use just $(branch(socket)) in the call to
force_send_socket:
force_send_socket($(branch(socket)));
(I don't know if it is necessary to remove the "sip:" prefix from the socket
info).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.opensips.org/pipermail/users/attachments/20100918/da512620/attachment.htm
More information about the Users
mailing list