[asterisk-bugs] [JIRA] (ASTERISK-28513) Should To: be rewritten when forwarding to a phone

Brian J. Murrell (JIRA) noreply at issues.asterisk.org
Tue Oct 1 09:43:48 CDT 2019


    [ https://issues.asterisk.org/jira/browse/ASTERISK-28513?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=248201#comment-248201 ] 

Brian J. Murrell commented on ASTERISK-28513:
---------------------------------------------

{quote}
I think the best way to handle this would be an option on either the endpoint (if you think you'll need to modify the behavior on an endpoint-by-endpoint basis)
{quote}

I don't see this as being endpoint specific.

In all honesty and straightforwardness, this doesn't feel like it should \[have to\] be a configurable item.  The (at least, default) behaviour should be the behaviour I have in my PoC, which is to maintain the domain name in the outgoing message's {{To:}} header as it was in the incoming message.

To illustrate with an example, if an Asterisk server is named (i.e. in DNS) _pbx.example.com_, SIP clients wanting to send a message to alice, registered on that Asterisk server, would send their message {{To: alice at pbx.example.com}}.  Those messages, when sent from the Asterisk server to the SIP client alice registered from, should still be {{To: alice at pbx.example.com}}.  That's what I have working in my PoC.

It seems that an Asterisk server, ought to know (as a global attribute) what (canonical) domain name people are using to refer to it and that that information should be available in {{res/res_pjsip_messaging.c}} (as well as everywhere else in SIP message handling code).  It seems odd to me that this is not already the case.  Although I suspect it is the case.  I don't recall anywhere in the myriad of configuration files where it can be told that.

Of course, an Asterisk server could take steps to try to figure that out.  At a pjsip level for example, if a transport is bound to an IP address, with any hope of a proper DNS configuration for that IP address:

{noformat}
# host 10.75.22.8
8.22.75.10.in-addr.arpa domain name pointer pbx.example.com.
{noformat}

{quote}
Do you think this behavior should also apply to SIP message types other than MESSAGE?
{quote}

I think that is what the Linphone developers are suggesting.  But frankly, for say, {{INVITE}} messages this doesn't seem to be as critical as it is for {{MESSAGE}} so I'm inclined to not worry about it as much.

> Should To: be rewritten when forwarding to a phone
> --------------------------------------------------
>
>                 Key: ASTERISK-28513
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-28513
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Resources/res_pjsip_messaging
>    Affects Versions: 13.28.0
>            Reporter: Brian J. Murrell
>            Assignee: Brian J. Murrell
>            Severity: Minor
>              Labels: pjsip
>
> I have run into a problem with {{MESSAGE}} s and the [Linphone Android client|https://github.com/BelledonneCommunications/linphone-android].
> The [issue|https://github.com/BelledonneCommunications/linphone-android/issues/605] as described in their tracker is that when {{MESSAGE}} s come to the linphone client from the same sender, they can be "filed" into many different threads, rather than all in one chat/thread.  This is because linphone separates chats based on both the From: and To: headers.
> As I am sure you know, the {{To:}} header of a client can vary wildly based on the IP address it's connecting from.  This means that every time the IP address of the SIP client changes, a new chat for the same sender is created.
> But the problem is that Asterisk is setting the {{To:}} header of the {{MESSAGE}} to the {{user at ip_address}} of the remote SIP client and so this means that every time the IP address of the remote SIP client changes, a new To: header is created, and so is a new chat in the SIP client.
> Linphone defends this behaviour by insisting that the {{To:}} header value is a logical value of the recipient for a given domain and should always remain it's logical value no matter whether it's being forwarded on to a SIP client or not.
> So for example, if my Asterisk server is at pbx.example.com and somebody (my VOIP provider for example) send a {{MESSAGE}} to 555-555-1212 at ip-address-of-my-asterisk, when my Asterisk server receives that message and then wants to forward it on to a SIP client, the To: should be {{To:  _recipient_]@pbx.example.com}}, not {{To: _recipient_ at ip-address-of-SIP-client}}.
> They quote [RFC 3261 section 8.1.1.2|https://tools.ietf.org/html/rfc3261#section-8.1.1.2] further in defending this behaviour.  My reading of it doesn't leave me with much to argue against their defence.
> I don't see any way to make Asterisk (with PJSIP) to follow this behaviour.



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list