BelledonneCommunications / linphone-android

Linphone.org mirror for linphone-android (https://gitlab.linphone.org/BC/public/linphone-android)
https://linphone.org
GNU General Public License v3.0
1.11k stars 680 forks source link

Outgoing SMS receives 415 Unsupported Media Type: How disable "cpim_in_basic_chat_rooms_enabled" #2147

Closed aGrimRepoMan closed 5 months ago

aGrimRepoMan commented 5 months ago

Hello, I hope you are doing well.

Problem Description Using Linphone Android chat capability with VoIP.ms, I can receive SMS, but sending SMS always fails.

TL;DR: The Voip.ms SMS service seemingly doesn't support receiving SIP MESSAGE method with content-type header = “message/cpim”. It replies with a 415 “Unsupported Media Type” response and Linphone Android then marks the SMS (chat) message as failed.

I discovered a configuration option on Linphone Desktop called “cpim_in_basic_chat_rooms_enabled”. When I set that to 0 in linphonerc to disable CPIM (RFC 3862) behaviour, I can send SMS messages via voip.ms with no issues.

I then confirmed via “view config” that my Linphone Android app indeed has cpim_in_basic_chat_rooms_enabled=1. I can’t find how to set it to 0 via the UI. How can I disable CPIM in basic chat rooms, without building the android app myself?

Thanks in advance for considering this.

To Reproduce Starting conditions: Linphone android app open & registered with VoIP.ms. a. Click on desired contact, then click on chat icon to display contact’s cell phone number b. Type desired text message, tap send icon. c. Shortly after, a small red exclamation mark shows up against the text message’s bubble, indicating message delivery failure. The recipient never receives the message.

Expected behaviour Steps a & b as above. Step c should result in the SMS being delivered to the recipient.

Version information

SDK logs Relevant logs attached. [Aside: As seen in the logs, the MESSAGE method with "Content-Type: application/im-iscomposing+xml" also receives 415 error from voip.ms, but that is not what is causing the SMS failure (confirmed via Linphone desktop config file experimentation). In this issue, I’m only concerned with how to configure Linphone Android to send the actual SMS message using "content-type: plain/text" instead of "Content-Type: message/cpim".

redacted CPIM logs.txt

Viish commented 5 months ago

Duplicate of https://github.com/BelledonneCommunications/liblinphone/issues/137

aGrimRepoMan commented 5 months ago

Hi Sylvain,

Thanks for your response.

https://github.com/BelledonneCommunications/liblinphone/issues/137 is a different issue. It deals with the typing indicator message (has "Content-Type: application/im-iscomposing+xml"). Although I do see that problem with my SIP service provider, it does not impact my main concern, which is the success or failure of the SMS message itself (which is sent later, after the "isComposing" message, i.e. once user finishes typing their text and taps the send button).

What I'm asking in this issue (2147) is how to configure Linphone-Android to not use SIP MESSAGE method with content-type header = “message/cpim” when sending the chat (SMS) message to a server that only supports "Content-Type: plain/text". See the MESSAGE method with call-id = cI0mvDIAA4 in the trace file.

On Linphone-Desktop, I achieve that by changing the linphonerc config parm "cpim_in_basic_chat_rooms_enabled" from 1 to 0, but I haven't found a way to do that from the android app's UI. Is there any way? If not, could it be created in a future release (feature request) to allow users to control whether RFC 3862 CPIM or plain text is used? Note that I don't build my own app, I download from F-Droid.

Thanks again for considering this.

Viish commented 5 months ago

HI @aGrimRepoMan,

No, it's not currently possible to change that setting through the UI at the moment. However you can alter the configuration like you did on desktop using remote provisioning.

Cheers,

Viish commented 5 months ago

FYI, there will be a UI setting for that in 6.0 release of Linphone Android.

aGrimRepoMan commented 5 months ago

Nice to hear and I look forward to 6.0.

Regarding remote provisioning, that's an interesting approach. I started to read about it and in preparation for trying it out, I created a new test account on my VoIP service provider's portal, and added it into Linphone-Android using the Account Assistant. I decided to check the config settings using Debug "view config" before doing anything else. The "cpim_in_basic_chat_rooms_enabled" is set to 0. So I tested SMS sending and it works on this newly installed test account.

So now I'm curious... If there's no UI pre-6.0, and if default setting of cpim_in_basic_chat_rooms_enabled is 0 for new acccounts created by Account Assistant, how did I manage to get "cpim_in_basic_chat_rooms_enabled=1" on my daily driver (non-test) account? Strange! Perhaps earlier software versions had a different default? I've been using Linphone for many years now.

In any case, I'm sure you have more important things to worry about - From my perspective, I have a few options now for my daily driver account, so I'm good to go:

  1. Delete & re-add my daily driver account on android (I haven't tried, but seems hopeful),
  2. If that fails, I can convert aforementioned test account to be my daily driver.
  3. Implement remote provisioning
  4. Longer term, v6.0 will help me should the config parm somehow ever get toggled again after doing option 1 or 2.
Viish commented 5 months ago

No, I guess there was a mistake at some point. There is two files "linphone_default_values" and a "default_values" that contains default settings for accounts, and CPIM is only enabled in the "linphone_default_values" file, but some bug must have loaded it instead of the other and causing your account to have it enabled when it shouldn't have...