[Asterisk-code-review] res_pjsip/pjsip_message_filter: set preferred transport in pjsip_mess... (asterisk[16])

Bernd Zobl asteriskteam at digium.com
Mon May 3 09:37:20 CDT 2021


Bernd Zobl has posted comments on this change. ( https://gerrit.asterisk.org/c/asterisk/+/15630 )

Change subject: res_pjsip/pjsip_message_filter: set preferred transport in pjsip_message_filter
......................................................................


Patch Set 5:

(1 comment)

https://gerrit.asterisk.org/c/asterisk/+/15630/5/res/res_pjsip/pjsip_message_filter.c 
File res/res_pjsip/pjsip_message_filter.c:

https://gerrit.asterisk.org/c/asterisk/+/15630/5/res/res_pjsip/pjsip_message_filter.c@242 
PS5, Line 242: if ((tdata->tp_info.transport->key.type != PJSIP_TRANSPORT_UDP) &&
             : 		(tdata->tp_info.transport->key.type != PJSIP_TRANSPORT_UDP6)) {
             : 		sel.type = PJSIP_TPSELECTOR_LISTENER;
             : 		sel.u.listener = tdata->tp_info.transport->factory;
             : 		prm.tp_sel = &sel;
             : 	}
> Are we sure this works for both outgoing requests and outgoing responses? […]
I'm not entirely sure whether you mean whether `tdata->tpinfo.transport` is always accessible or whether applying the found factory's bind address is valid for requests and responses.

---

Concerning the former:
This function, `filter_on_tx_message` is passed as the module's .on_rx_request and .on_tx_response callback. Both are called by pjsip's `endpt_on_tx_msg` function, which in turn is called by the respective transport's `pjsip_transport_send()` (and this is, as far as I can tell) the only call site. `tdata->tp_info.transport` is always set there.
Hence, we can access it here.

---

Concerning the latter:

I think it works for both.

The function touches the Via, From, and Contact headers, the former two are only changed for requests. I've checked INVITE, INFO, OPTIONS, REGISTER and BYE and all three headers seem to be correct in all of those requests.

For responses I could observe the Contact header only in
1) "Session Progress" / "Ringing" in reply to an inbound INVITE
2) "OK" in reply to an inbound INVITE
3) "OK" in reply to an inbound REGISTER

In those it seems correct (1) and 2) showing the bind port of the respective transport). 3) shows the ephemeral port (instead of the bind port). This, however, is the case without my patch as well, and conclusive with the peer's AOR (see below), therefore I did not attempt to change it.

registration of phone 9099
>    Request-Line: REGISTER sip:10.193.0.1:9060 SIP/2.0
>        Via: SIP/2.0/TCP 10.193.10.120:5060;branch=z9hG4bK478793071;rport;alias
>        From: <sip:9099 at 10.193.0.1:9060>;tag=1851488811
>        To: <sip:9099 at 10.193.0.1:9060>
>        CSeq: 2218 REGISTER
>        Contact: <sip:9099 at 10.193.10.120:5060;transport=tcp>;reg-id=5;+sip.instance="<urn:uuid:00000000-0000-1000-8000-000B82BEE60E>"
>        Max-Forwards: 70
>        User-Agent: Grandstream GXV3240 1.0.3.227
>        Expires: 3600
> 
> 
>    Status-Line: SIP/2.0 200 OK
>        Via: SIP/2.0/TCP 10.193.10.120:5060;rport=59203;received=10.193.10.120;branch=z9hG4bK478793071;alias
>       From: <sip:9099 at 10.193.0.1>;tag=1851488811
>       To: <sip:9099 at 10.193.0.1>;tag=z9hG4bK478793071
>       Contact: <sip:9099 at 10.193.10.120:59203;transport=TCP>;expires=3599
>       Expires: 3600

the phone's aor
>       Aor:  9099                                                 1
>    Contact:  9099/sip:9099 at 10.193.10.120:59203;transport= 4ebcb43bbd NonQual         nan



-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/15630
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 16
Gerrit-Change-Id: I598e60257a7f92b29efce1fb3e9a2fc06f1439b6
Gerrit-Change-Number: 15630
Gerrit-PatchSet: 5
Gerrit-Owner: Florian Floimair <f.floimair at commend.com>
Gerrit-Reviewer: Bernd Zobl <b.zobl at commend.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.com>
Gerrit-Comment-Date: Mon, 03 May 2021 14:37:20 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: George Joseph <gjoseph at digium.com>
Gerrit-MessageType: comment
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20210503/c34028c0/attachment-0001.html>


More information about the asterisk-code-review mailing list