<div dir="ltr">How to send push notification using mid_registrar module?<div>The push notification is not getting send using this code:</div><div><br></div><div>if (is_method("INVITE|MESSAGE") && $si == "X.X.X.X" && $sp == 1443) {<br> if (!mid_registrar_lookup("location")) {<br> t_reply(404, "Not Found");<br> exit;<br> }<br> t_newtran();<br> t_wait_for_new_branches();<br> $avp(filter) = "aor="+$rU+"@"+$rd;<br> notify_on_event("E_UL_CONTACT_INSERT", $avp(filter),"users_registered",60);<br> route(PN_SEND);<br><br> t_relay();<br> exit;<br> }<br></div></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Fri, 7 Feb 2025 at 17:12, Prathibha B <<a href="mailto:prathibhab.tvm@gmail.com">prathibhab.tvm@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">The above error is resolved after changing the websocket path from "ws" to "" in asterisk source code.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, 6 Feb 2025 at 13:14, Prathibha B <<a href="mailto:prathibhab.tvm@gmail.com" target="_blank">prathibhab.tvm@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">when I use <div>$ru = "sip:<a href="http://10.214.0.18:1443/" target="_blank">x.x.xx.x:1443</a>;transport=wss";</div><div><br></div><div>I get the below errors:</div><div><br></div><div>ERROR:proto_wss:ws_parse_rpl_http_fl: invalid first line: reply code <302 Moved Temporarily><br>Feb 6 13:14:34 [390173] ERROR:proto_wss:ws_parse_rpl_handshake: cannot parse the first line of the message<br>Server: Asterisk/18.18.0<br>Date: Thu, 06 Feb 2025 07:44:34 GMT<br>Cache-Control: no-cache, no-store<br>Location: /static/index.html<br>Content-Length: 0<br><br><br>Feb 6 13:14:34 [390173] ERROR:proto_wss:ws_client_handshake: invalid WebSocket reply <HTTP/1.1 302 Moved Temporarily<br>Server: Asterisk/18.18.0<br>Date: Thu, 06 Feb 2025 07:44:34 GMT<br>Cache-Control: no-cache, no-store<br>Location: /static/index.html<br>Content-Length: 0<br><br>><br>Feb 6 13:14:34 [390173] ERROR:proto_wss:ws_connect: cannot complete WebSocket handshake<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, 6 Feb 2025 at 10:59, Prathibha B <<a href="mailto:prathibhab.tvm@gmail.com" target="_blank">prathibhab.tvm@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Now I'm not getting any error but the request is not getting forwarded to the main registrar.<div><br></div><div>if (is_method("REGISTER")) {</div><div> mid_registrar_save("location");<br> switch ($retcode) {<br> case 1:<br> xlog("forwarding REGISTER to main registrar ($$ci=$ci$ru)\n");<br> $ru = "sip:<a href="http://10.214.0.18:1443" target="_blank">10.214.0.18:1443</a>";<br> if (!t_relay()) {<br> send_reply(500, "Server Internal Error 1");<br> }<br> break;<br> case 2:<br> xlog("absorbing REGISTER! ($$ci=$ci)\n");<br> break;<br> default:<br> xlog("failed to save registration! ($$ci=$ci)\n");<br> }<br><br> exit;<br> }<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, 5 Feb 2025 at 15:06, Prathibha B <<a href="mailto:prathibhab.tvm@gmail.com" target="_blank">prathibhab.tvm@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">These issues are resolved. I download ca_list from lets encrypt site. Now I get the following errors:<div><br></div><div>ERROR:proto_wss:ws_parse_rpl_http_fl: invalid first line: reply code <302 Moved Temporarily><br>ERROR:proto_wss:ws_parse_rpl_handshake: cannot parse the first line of the message</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, 5 Feb 2025 at 13:03, Prathibha B <<a href="mailto:prathibhab.tvm@gmail.com" target="_blank">prathibhab.tvm@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Now I'm using midregistrar. I get the following errors:<div><br></div><div>ERROR:proto_wss:wss_conn_init: no TLS client domain found<br>Feb 5 13:01:44 [36844] ERROR:core:tcp_conn_create: failed to do proto 6 specific init for conn 0x7fdb7ffb4870<br>Feb 5 13:01:44 [36844] DBG:core:tcpconn_destroy: delaying (0x7fdb7ffb4870, flags 0018) ref = -1 ...<br>Feb 5 13:01:44 [36844] ERROR:proto_wss:ws_sync_connect: tcp_conn_create failed, closing the socket<br>Feb 5 13:01:44 [36844] ERROR:proto_wss:ws_connect: connect failed<br>Feb 5 13:01:44 [36844] ERROR:proto_wss:proto_wss_send: connect failed<br>Feb 5 13:01:44 [36844] ERROR:tm:msg_send: send() to <a href="http://10.214.0.18:1443" target="_blank">10.214.0.18:1443</a> for proto wss/6 failed<br>Feb 5 13:01:44 [36844] ERROR:tm:t_forward_nonack: sending request failed<br>Feb 5 13:01:44 [36844] ERROR:tm:w_t_relay: t_forward_nonack failed<br></div><div><br></div><div>In asterisk, I get the errors:</div><div> tcptls.c:179 handle_tcptls_connection: Unable to set up ssl connection with peer '<a href="http://10.214.0.18:34529" target="_blank">10.214.0.18:34529</a>'<br>[Feb 5 13:01:44] ERROR[36873]: iostream.c:552 ast_iostream_close: SSL_shutdown() failed: error:00000001:lib(0)::reason(1), Internal SSL error<br>[Feb 5 13:03:49] ERROR[37370]: iostream.c:647 ast_iostream_start_tls: Problem setting up ssl connection: error:00000001:lib(0)::reason(1), Internal SSL error<br></div><div><br></div><div>How to resolve these errors?</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, 4 Feb 2025 at 13:44, Prathibha B <<a href="mailto:prathibhab.tvm@gmail.com" target="_blank">prathibhab.tvm@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><font size="4">How to fwd the INVITE from opensips to Asterisk?</font><div><font size="4"><br></font></div><div><font size="4">I tried using </font></div><div><font size="4">sethostport("ip:port");</font></div><div><font size="4">t_relay();</font></div><div><font size="4"><br></font></div><div><font size="4">But it is not working.</font></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, 3 Feb 2025 at 13:08, Bogdan-Andrei Iancu <<a href="mailto:bogdan@opensips.org" target="_blank">bogdan@opensips.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><u></u>
<div>
<font face="monospace">Hi,<br>
<br>
Yes, it is, maybe we should do that length configurable as
modparam and not compile option.<br>
<br>
Regards,<br>
Bogdan<br>
</font>
<pre cols="72">Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
<a href="https://www.opensips-solutions.com" target="_blank">https://www.opensips-solutions.com</a>
<a href="https://www.siphub.com" target="_blank">https://www.siphub.com</a></pre>
<div>On 03.02.2025 06:15, Prathibha B wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">Is this the correct solution?</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Mon, 3 Feb 2025 at 09:45,
Prathibha B <<a href="mailto:prathibhab.tvm@gmail.com" target="_blank">prathibhab.tvm@gmail.com</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">This issue is resolved after changing
MAX_HEADER_FIELD_LEN to 2048</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Mon, 3 Feb 2025 at
06:28, Prathibha B <<a href="mailto:prathibhab.tvm@gmail.com" target="_blank">prathibhab.tvm@gmail.com</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>
<div dir="auto">In <a rel="noreferrer noopener" href="https://github.com/OpenSIPS/opensips/blob/master/modules/rest_client/rest_cb.h" target="_blank">https://github.com/OpenSIPS/opensips/blob/master/modules/rest_client/rest_cb.h</a>,
the MAX_HEADER_FIELD_LEN is only 1024.</div>
<div><br>
</div>
<div id="m_1443767329252253594m_-8641146678374198956m_-4204331469518293081m_8012466218785476386m_7501255635368633798m_-6306239927675001159m_697097329965494400m_-2264136945601082926m_6281819389899074189ms-outlook-mobile-signature" dir="auto">Sent from <a href="https://aka.ms/AAb9ysg" target="_blank">
Outlook for Android</a></div>
<hr style="display:inline-block;width:98%">
<div id="m_1443767329252253594m_-8641146678374198956m_-4204331469518293081m_8012466218785476386m_7501255635368633798m_-6306239927675001159m_697097329965494400m_-2264136945601082926m_6281819389899074189divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>From:</b> Prathibha B <<a href="mailto:prathibhab.tvm@gmail.com" target="_blank">prathibhab.tvm@gmail.com</a>><br>
<b>Sent:</b> Sunday, February 2, 2025 8:13:31 PM<br>
<b>To:</b> Bogdan-Andrei Iancu <<a href="mailto:bogdan@opensips.org" target="_blank">bogdan@opensips.org</a>><br>
<b>Cc:</b> OpenSIPS users mailling list <<a href="mailto:users@lists.opensips.org" target="_blank">users@lists.opensips.org</a>><br>
<b>Subject:</b> Re: [OpenSIPS-Users] SIP Push
Notification</font>
<div> </div>
</div>
<div>
<div dir="ltr"><font size="4">The bearer token is
lengthy.</font></div>
<br>
<div>
<div dir="ltr">On Sun, 2 Feb 2025 at 20:10,
Prathibha B <<a href="mailto:prathibhab.tvm@gmail.com" target="_blank">prathibhab.tvm@gmail.com</a>>
wrote:<br>
</div>
<blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr"><font size="4">How yo increase the
buffer size in Opensips?</font></div>
<br>
<div>
<div dir="ltr">On Sun, 2 Feb 2025 at 20:04,
Prathibha B <<a href="mailto:prathibhab.tvm@gmail.com" target="_blank">prathibhab.tvm@gmail.com</a>>
wrote:<br>
</div>
<blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr"><font size="4">i'e corrected
the third param.still getting this error:</font><span style="color:rgb(80,0,80)">
<div><font size="4">rest_client:rest_append_hf_method:
header field buffer too small</font></div>
<div><font size="4"><br>
</font></div>
<div>
<div dir="ltr" style="color:rgb(34,34,34)"><font size="4">i tried increasing the
shared memory using -m switch to
7192, still opensips crashes with
the buffer too small error.</font></div>
<div style="color:rgb(34,34,34)">
<div style="margin:5px 0px">
<div id="m_1443767329252253594m_-8641146678374198956m_-4204331469518293081m_8012466218785476386m_7501255635368633798m_-6306239927675001159m_697097329965494400m_-2264136945601082926m_6281819389899074189x_m_2269089026250066021m_-2689446984930908997gmail-q_155" style="background-color:rgb(232,234,237);border:none;clear:both;line-height:6px;outline:none;width:24px;color:rgb(80,0,80);font-size:11px;border-radius:5.5px">
<br>
</div>
</div>
</div>
</div>
</span></div>
<br>
<div>
<div dir="ltr">On Fri, 31 Jan 2025 at 15:30,
Bogdan-Andrei Iancu <<a href="mailto:bogdan@opensips.org" target="_blank">bogdan@opensips.org</a>>
wrote:<br>
</div>
<blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div><font face="monospace">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!<br>
<br>
Regards,<br>
</font>
<pre cols="72">Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
<a href="https://www.opensips-solutions.com" target="_blank">https://www.opensips-solutions.com</a>
<a href="https://www.siphub.com" target="_blank">https://www.siphub.com</a></pre>
<div>On 30.01.2025 09:25, Prathibha B
wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<div>this is my route for sending
Push Notification:
<div><br>
</div>
<div>route [PN_SEND]<br>
{<br>
# send a PN using, for
example, exec or rest_client<br>
# Define FCM URL<br>
$var(fcm_url) = "<a href="https://fcm.googleapis.com/v1/projects/asterisk-push-notificaiton/messages:send" target="_blank">https://fcm.googleapis.com/v1/projects/xxx/messages:send</a>";<br>
<br>
# Set HTTP headers<br>
rest_append_hf("Authorization:
Bearer ya29.c.c0AS...");<br>
#rest_append_hf("Content-Type:
application/json");<br>
rest_append_hf("Content-Type:
\"application/json\"");<br>
<br>
# Create JSON payload<br>
$var(json_payload) =
'{\"message\": {\"token\":
\"xxx\",\"notification\":
{\"title\": \"Notification
Title\",\"body\": \"Notification
Body\"}}}';<br>
<br>
# Send REST POST request<br>
if
(launch(rest_post($var(fcm_url),
"$var(json_payload)",
$avp(response_body),
$avp(response_code)))) {<br>
xlog("L_INFO", "Push
notification sent successfully.
Response code:
$avp(response_code)\n");<br>
} else {<br>
xlog("L_ERR", "Failed to
send push notification. Response
code: $avp(response_code)\n");<br>
}<br>
}<br>
</div>
<div><br>
</div>
<div>But I get the following error
while running Opensips:</div>
<div>ERROR:rest_client:rest_append_hf_method:
header field buffer too small<br>
Jan 30 12:29:09 ngdcs
opensips[102753]:
ERROR:core:get_cmd_fixups:
Variable in param [3] is not a
string<br>
Jan 30 12:29:09 ngdcs
opensips[102753]:
ERROR:core:do_action: Failed to
get fixups for launch command
<rest_post></div>
<div><br>
</div>
<div>Can you pls help to resolve
the issue?</div>
</div>
<div><br>
</div>
<span>-- </span><br>
<div dir="ltr">
<div dir="ltr">
<div>Regards,</div>
<div>B.Prathibha<br>
</div>
</div>
</div>
</div>
<br>
<fieldset></fieldset>
<pre>_______________________________________________
Users mailing list
<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
</blockquote>
<br>
</div>
</blockquote>
</div>
<div><br clear="all">
</div>
<div><br>
</div>
<span>-- </span><br>
<div dir="ltr">
<div dir="ltr">
<div>Regards,</div>
<div>B.Prathibha<br>
</div>
</div>
</div>
</blockquote>
</div>
<div><br clear="all">
</div>
<div><br>
</div>
<span>-- </span><br>
<div dir="ltr">
<div dir="ltr">
<div>Regards,</div>
<div>B.Prathibha<br>
</div>
</div>
</div>
</blockquote>
</div>
<div><br clear="all">
</div>
<div><br>
</div>
<span>-- </span><br>
<div dir="ltr">
<div dir="ltr">
<div>Regards,</div>
<div>B.Prathibha<br>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<div><br clear="all">
</div>
<div><br>
</div>
<span class="gmail_signature_prefix">-- </span><br>
<div dir="ltr" class="gmail_signature">
<div dir="ltr">
<div>Regards,</div>
<div>B.Prathibha<br>
</div>
</div>
</div>
</blockquote>
</div>
<div><br clear="all">
</div>
<div><br>
</div>
<span class="gmail_signature_prefix">-- </span><br>
<div dir="ltr" class="gmail_signature">
<div dir="ltr">
<div>Regards,</div>
<div>B.Prathibha<br>
</div>
</div>
</div>
</blockquote>
<br>
</div>
</blockquote></div><div><br clear="all"></div><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Regards,</div><div>B.Prathibha<br></div></div></div>
</blockquote></div><div><br clear="all"></div><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Regards,</div><div>B.Prathibha<br></div></div></div>
</blockquote></div><div><br clear="all"></div><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Regards,</div><div>B.Prathibha<br></div></div></div>
</blockquote></div><div><br clear="all"></div><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Regards,</div><div>B.Prathibha<br></div></div></div>
</blockquote></div><div><br clear="all"></div><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Regards,</div><div>B.Prathibha<br></div></div></div>
</blockquote></div><div><br clear="all"></div><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Regards,</div><div>B.Prathibha<br></div></div></div>
</blockquote></div><div><br clear="all"></div><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Regards,</div><div>B.Prathibha<br></div></div></div>