[SIP Beyond VoIP] push failed with code 400: Bad Request Invalid JSON payload received

Tijmen de Mes tijmen at ag-projects.com
Fri Jan 27 21:07:37 CET 2023


Hi Vasilios,

If you use ‘linphone' as app_type, it will send out a JSON like in your pastebin. For the latest google messaging api this format is clearly not a supported format and it should look more like your test push notification.

The format for the linphone app_type is taken from their wiki and I guess can only be used with https://fcm.googleapis.com/fcm/send <https://fcm.googleapis.com/fcm/send>.

Is your client based on linphone?

If you just want to send a JSON like the one from your test push notification, you can fairly easy do this by adding a custom application. 

A skeleton app for this is already given in the config dir (myapp.py). If you just want use Firebase, you can need to customise the FirebasePayload and return a dict which contains the required structure. I made this gist for your app and can can further customise it if you want: 

https://gist.github.com/tijmenNL/73ca3c3bc8275540e8500b9e3ab35ebc <https://gist.github.com/tijmenNL/73ca3c3bc8275540e8500b9e3ab35ebc>

You can place this file in /etc/config/applications and change your config to have app_type = customapp

Hope this helps you.

Best regards,

Tijmen de Mes
--
AG Projects

> Op 27 jan. 2023, om 18:33 heeft Vasilios Tzanoudakis <vtzanoudakis at gmail.com> het volgende geschreven:
> 
> Dear Tijmen de Mes,
> 
> Thank you for your previous response.
> 
> Following our previous conversation here --> https://lists.ag-projects.com/pipermail/sipbeyondvoip/2023-January/003571.html <https://lists.ag-projects.com/pipermail/sipbeyondvoip/2023-January/003571.html>
> 
> I have verified with my mobile dev team that for our mobile app to receive push notification we should send the push notification using "only" using the latest google messaging api. (push url --> https://fcm.googleapis.com/v1/projects/voiceland-dev/messages:send <https://fcm.googleapis.com/v1/projects/voiceland-dev/messages:send>) and not this one --> https://fcm.googleapis.com/fcm/send <https://fcm.googleapis.com/fcm/send>
> 
> As I can see in applications.ini both urls seems to be supported.
> 
> Our applications.ini config is this :
> =======================================================
> [com.voiceland.voiceland]
> app_id = com.voiceland.voiceland
> app_type = linphone
> app_platform = firebase
> firebase_authorization_file = key.json
> firebase_push_url = https://fcm.googleapis.com/v1/projects/voiceland-dev/messages:send <https://fcm.googleapis.com/v1/projects/voiceland-dev/messages:send>
> =======================================================
> 
> but when we are sending out a push notification request it seems to be a problem from firebase to accept the request from the sylkpushserver. 
> 
> 2023-01-27 17:18:30 ERROR    outgoing Firebase response for incoming_session-com.voiceland.voiceland-B2B.252.7430759.1674839908, push failed with code 400: Bad Request Invalid JSON payload received. Unknown name "to": Cannot find field.
> Invalid JSON payload received. Unknown name "time_to_live": Cannot find field.
> Invalid JSON payload received. Unknown name "priority": Cannot find field.
> Invalid JSON payload received. Unknown name "data": Cannot find field.
> 
> full debug logs here --> https://pastebin.com/tsqZifBW <https://pastebin.com/tsqZifBW>
> 
> I am using the latest sylkpushserver version (commit: c84f4347285f7480de2f6b1d1aaf1dd9b817e263)
> 
> from our side we have verified that push service from our mobile app is working using postman url --> https://fcm.googleapis.com/v1/projects/voiceland-dev/messages:send <https://fcm.googleapis.com/v1/projects/voiceland-dev/messages:send> and this json data on body --> https://pastebin.com/pP9Rtyyn <https://pastebin.com/pP9Rtyyn>
> 
> Thank you in advance for your help on this.
> 
> Best Regards
> Vasilios Tzanoudakis
> _______________________________________________
> SIPBeyondVoIP mailing list
> SIPBeyondVoIP at lists.ag-projects.com
> https://lists.ag-projects.com/mailman/listinfo/sipbeyondvoip

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ag-projects.com/pipermail/sipbeyondvoip/attachments/20230127/1ddde9f1/attachment.htm>


More information about the SIPBeyondVoIP mailing list