In 
https://github.com/OpenSIPS/opensips/blob/master/modules/rest_client/rest_cb.h, 
the MAX_HEADER_FIELD_LEN is only 1024.

Sent from Outlook for Android<https://aka.ms/AAb9ysg>
________________________________
From: Prathibha B <[email protected]>
Sent: Sunday, February 2, 2025 8:13:31 PM
To: Bogdan-Andrei Iancu <[email protected]>
Cc: OpenSIPS users mailling list <[email protected]>
Subject: Re: [OpenSIPS-Users] SIP Push Notification

The bearer token is lengthy.

On Sun, 2 Feb 2025 at 20:10, Prathibha B 
<[email protected]<mailto:[email protected]>> wrote:
How yo increase the buffer size in Opensips?

On Sun, 2 Feb 2025 at 20:04, Prathibha B 
<[email protected]<mailto:[email protected]>> wrote:
i'e corrected the third param.still getting this error:
rest_client:rest_append_hf_method: header field buffer too small

i tried increasing the shared memory using -m switch to 7192, still opensips 
crashes with the buffer too small error.


On Fri, 31 Jan 2025 at 15:30, Bogdan-Andrei Iancu 
<[email protected]<mailto:[email protected]>> wrote:
The error has nothing to do with PN, but with the way you use the rest_post() 
function. The error log is 100% clear - the third param you pass to the 
function is not a string!

Regards,

Bogdan-Andrei Iancu

OpenSIPS Founder and Developer
  https://www.opensips-solutions.com
  https://www.siphub.com

On 30.01.2025 09:25, Prathibha B wrote:
this is my route for sending Push Notification:

route [PN_SEND]
{
    # send a PN using, for example, exec or rest_client
    # Define FCM URL
    $var(fcm_url) = 
"https://fcm.googleapis.com/v1/projects/xxx/messages:send<https://fcm.googleapis.com/v1/projects/asterisk-push-notificaiton/messages:send>";

    # Set HTTP headers
    rest_append_hf("Authorization: Bearer ya29.c.c0AS...");
    #rest_append_hf("Content-Type: application/json");
    rest_append_hf("Content-Type: \"application/json\"");

    # Create JSON payload
    $var(json_payload) = '{\"message\": {\"token\": \"xxx\",\"notification\": 
{\"title\": \"Notification Title\",\"body\": \"Notification Body\"}}}';

    # Send REST POST request
    if (launch(rest_post($var(fcm_url), "$var(json_payload)", 
$avp(response_body), $avp(response_code)))) {
        xlog("L_INFO", "Push notification sent successfully. Response code: 
$avp(response_code)\n");
    } else {
        xlog("L_ERR", "Failed to send push notification. Response code: 
$avp(response_code)\n");
    }
}

But I get the following error while running Opensips:
ERROR:rest_client:rest_append_hf_method: header field buffer too small
Jan 30 12:29:09 ngdcs opensips[102753]: ERROR:core:get_cmd_fixups: Variable in 
param [3] is not a string
Jan 30 12:29:09 ngdcs opensips[102753]: ERROR:core:do_action: Failed to get 
fixups for launch command <rest_post>

Can you pls help to resolve the issue?

--
Regards,
B.Prathibha



_______________________________________________
Users mailing list
[email protected]<mailto:[email protected]>
http://lists.opensips.org/cgi-bin/mailman/listinfo/users




--
Regards,
B.Prathibha


--
Regards,
B.Prathibha


--
Regards,
B.Prathibha
_______________________________________________
Users mailing list
[email protected]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

Reply via email to