How to send apple push notification in mule 3.9.1? - http

I am using apple push connector.
I get the following error:
INFO 2019-04-15 17:12:50,934 [Thread-11] com.notnoop.apns.internal.ApnsConnectionImpl: Exception while waiting for error code
java.io.IOException: Unexpected command byte 0
at com.notnoop.apns.internal.ApnsConnectionImpl$1MonitoringThread.run(ApnsConnectionImpl.java:118) ~[mule-module-apple-push-4.1.0.jar:?]
DEBUG 2019-04-15 17:12:50,955 [[api-gateway].standardHTTPS.worker.01] org.mule.module.http.internal.HttpMessageLogger: LISTENER
HTTP/1.1 200
Content-Length: 0
Date: Mon, 15 Apr 2019 22:12:50 GMT
How to resolve this and get the connector to work?
Thanks
Reference: https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/sending_notification_requests_to_apns
http://mulesoft.github.io/apple-push-connector/mule/apple-push.html

I have used pushy library instead and could successfully send apple push notification.

Related

Invalid HTTP Header in a response

I have some URL and make a request to that URL but a response is invalid. I checked requests in Chrome dev tools and Chrome didn't find something wrong. I make a request in Postman but I receive "Parse Error: There seems to be an invalid character in response header key or value". Also I make requests in Axios in Node.js and I receive an error again.
After all, I checked request in chrome dev tools again and then I saw that:
Accept-Ranges: bytes
Connection: close
Date: Wed, 30 Jun 2021 12:05:28 GMT
Server: Boa/0.94.14rc21
There are parsed headers from the response and I clicked on a "View source" and saw that:
HTTP/1.1 200 OK
Date: Wed, 30 Jun 2021 12:05:28 GMT
Server: Boa/0.94.14rc21
Accept-Ranges: bytes
Connection: close
<Content-Type:text/html>
Is it normal or I should receive content-type without angle brackets? Maybe it's documented somewhere as a standart?
UPD. I made requests to a dashboard of Yeastar TG200
UPD 2. Also I made POST-requests and I received valid content-type in response headers without angle brackets
Angle brackets in a field name are definitively invalid (see https://greenbytes.de/tech/webdav/rfc7230.html#rule.token.separators).

Exception should not appear in prod

I have this kind of exception, on a production environnement:
Fatal error: Uncaught RuntimeException: Unable to create the cache
directory
(/app/ezplatform/var/cache/prod/a6d61d85393d8924b6a2d32272d325510651f125)
in
/app/ezplatform/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php:765
Stack trace: #0
/app/ezplatform/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(642):
Symfony\Component\HttpKernel\Kernel->buildContainer() #1
/app/ezplatform/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(135):
Symfony\Component\HttpKernel\Kernel->initializeContainer() #2
/app/ezplatform/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(195):
Symfony\Component\HttpKernel\Kernel->boot() #3
/app/ezplatform/web/app.php(64):
Symfony\Component\HttpKernel\Kernel->handle(Object(Symfony\Component\HttpFoundation\Request))
4 {main} thrown in /app/ezplatform/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php
on line 765
I don't understand why the response http code is 200 instead of 500, is it because a server low level exception ? How to customize the error page for this kind of situation.
This the response header:
HTTP/2.0 200 OK
content-type: text/html; charset=UTF-8
date: Wed, 18 Dec 2019 08:32:40 GMT
strict-transport-security: max-age=0
x-debug-info: eyJyZXRyaWVzIjowfQ==
x-request-id: z7m5kvoqa4smukjgb74pxhqd
x-robots-tag: noindex, nofollow
content-length: 982
X-Firefox-Spdy: h2
This error is caused by the Symfony cache generator, not by your application.
The application will try to generate it's cache on a folder, from the directory, but it can't access it. The folder var/cache/ must be allowed to be written by the user that is running the application, maybe your server user.
Changing this with a simple chmod USER_RUNNING_THE_APP +w var/cache -R will solve the issue most likely.
As for the issue about the the response header being 200 instead of 500, this is because the server can respond, and responses using the application. The application will return a response as 200 because will this:
route the response to the application
application does it's thing to generate an output
generates that error message
we have content, so this means it's 200, cause nothing else is specified
return 200 with the error message

nginx response status variable

I have a question. We use nginx+uwsgi stack and see many errors like:
Aug 30 00:00:55 imfmce-va-81-2 uwsgi: Tue Aug 30 00:00:55 2016 - SIGPIPE: writing to a closed pipe/socket/fd (probably the client disconnected) on request /provisioning/user/f205970b-6a9f-42b5-830f-c2bec9967b32 (ip 10.216.153.254) !!!
I understand that error occurs when client close connection before reading response or by uwsgi_read_timeout, but I don't understand why in access log I cannt see any error, nginx just log 200 OK:
Aug 30 00:00:55 imfmce-va-81-2 provisioning: active [ 55544 ] 10.216.153.254 Sync-Wopi-SyncLocksTask hostpilot 73af65e4-5984-4b2c-baf4-c88cf8385898 - ECDHE-RSA-AES256-GCM-SHA384 GET /provisioning/user/f205970b-6a9f-42b5-830f-c2bec9967b32 - 0,0,1,0 200 - 1 OK - 321 515 844
We use next format log line:
log_format ss_log_format "active\t[ \$pid ]\t\$remote_addr\t\$http_user_agent\t\$upstream_http_x_user_identity\t\$http_x_client_id\t\$http_x_request_id\t\$ssl_cipher\t\$request_method\t\$uri\t\$args\t\$upstream_http_x_durations\t\$status\t\$upstream_status\t\$http_x_error_code\t\$connection_requests\t\$request_completion\t\$content_length\t\$request_length\t\$body_bytes_sent\t\$bytes_sent";
I would like you to understand that,
we don't need to fix this error, we just need have right access logs.

How to configure asterisk instant messaging to work with linphone?

I have followed the instructions provided in the answer of this thread how to configure asterisk instant messaging to configure the asterisk for instant messaging. However, the instant message feature doesn't seem to work. I am using asterisk version 11.16.0 and the soft-phone I used to test is linphone/blink/CSipSimple and the instant message feature doesn't work on either of them (Note: the voice call feature is working properly on all those soft-phone).
On the asterisk server, I connected to its console using command "asterisk -rvvvvvvvvvvv" but didn't see any error/warning message on the asterisk console when sending the instant message on the soft-phone. Looking at the debug console of linphone (iOS version), I saw the following log:
2015-09-14 16:30:50.464 linphone[1018:85779] I Skipping top route of initial route-set because same as request-uri.
2015-09-14 16:30:50.465 linphone[1018:85779] I Changing [client] [MESSAGE] transaction [0x7f9dd3f1def0], from state [INIT] to [TRYING]
2015-09-14 16:30:50.465 linphone[1018:85779] I channel [0x7f9dcb9e8400]: message sent to [UDP://192.168.103.138:5060], size: [422] bytes
MESSAGE sip:6003#192.168.103.138 SIP/2.0
Via: SIP/2.0/UDP 192.168.103.8:55607;branch=z9hG4bK.RYHnb2K0p;rport
From: ;tag=V4jhkvcy7
To: sip:6003#192.168.103.138
CSeq: 20 MESSAGE
Call-ID: crwxS4~~~w
Max-Forwards: 70
Supported: outbound
Content-Type: text/plain
Content-Length: 9
Date: Mon, 14 Sep 2015 09:30:50 GMT
User-Agent: LinphoneIphone/2.3-47-gb47c75d (belle-sip/1.4.1)
hi there?
2015-09-14 16:30:50.479 linphone[1018:85779] I channel [0x7f9dcb9e8400]: starting recv background task with id=[56].
2015-09-14 16:30:50.479 linphone[1018:85779] I channel [0x7f9dcb9e8400]: received [437] new bytes from [UDP://192.168.103.138:5060]:
SIP/2.0 404 Not Found
Via: SIP/2.0/UDP 192.168.103.8:55607;branch=z9hG4bK.RYHnb2K0p;received=192.168.103.8;rport=55607
From: ;tag=V4jhkvcy7
To: sip:6003#192.168.103.138;tag=as5562adfb
Call-ID: crwxS4~~~w
CSeq: 20 MESSAGE
Server: FPBX-AsteriskNOW-12.0.76(11.16.0)
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0
2015-09-14 16:30:50.480 linphone[1018:85779] I channel [0x7f9dcb9e8400] [437] bytes parsed
2015-09-14 16:30:50.480 linphone[1018:85779] I Found transaction matching response.
2015-09-14 16:30:50.481 linphone[1018:85779] I Changing [client] [MESSAGE] transaction [0x7f9dd3f1def0], from state [TRYING] to [COMPLETED]
Is there anyone experience similar issue? Any idea on how I should do further troubleshooting to pinpoint the cause of the issue and fix it? It seems to me that something on the asterisk is not yet configured properly but without any error/warning on the console, I am not sure what else to do for further troubleshooting.
It turns out that the issue is because the Asterisk version I used is AsteriskNow (FreeBPX). So, the SIP configuration I need to add into sip_general_custom.conf instead of sip.conf.

Email issues with Wordpress running on AWS Elastic Beanstalk

I'm running Wordpress 4.2 on AWS Elastic Beanstalk. I'm using a plugin that sends emails using the WP email API, which uses the server's (i.e. Elastic Beanstalk's) internal mail system.
The problem: emails that the app attempts to send to my university email (let's call it .uni.edu) fail, and they do work when sent to my standard gmail.
What's interesting is that I have no issues running the same application locally. The emails associated with the app send fine -- so obviously there's some issue with the way Elastic Beanstalk in particular is attempting to relay the messages to the .uni.edu server. Perhaps the .uni.edu server is picking it up as spam (when sent from Elastic Beanstalk, not when being sent through my local system) and bouncing it back, but I'm not experienced enough to diagnose this.
Does anyone have suggestions for either directly applying some kind of fix to this problem, or creating some sort of setup that is a workaround (e.g. setting something up on Elastic Beanstalk to send emails in a non-default way that is less likely to have issues working with the university email server)?
Here's a log from /var/mail:
From MAILER-DAEMON#ip-172-31-41-109.ec2.internal Fri Apr 24 21:39:52 2015
Return-Path: <MAILER-DAEMON#ip-172-31-41-109.ec2.internal>
Received: from localhost (localhost)
by ip-172-31-41-109.ec2.internal (8.14.4/8.14.4) id t3OLdq1k026047;
Fri, 24 Apr 2015 21:39:52 GMT
Date: Fri, 24 Apr 2015 21:39:52 GMT
From: Mail Delivery Subsystem <MAILER-DAEMON#ip-172-31-41-109.ec2.internal>
Message-Id: <201504242139.t3OLdq1k026047#ip-172-31-41-109.ec2.internal>
To: <webapp#ip-172-31-41-109.ec2.internal>
MIME-Version: 1.0
Content-Type: multipart/report; report-type=delivery-status;
boundary="t3OLdq1k026047.1429911592/ip-172-31-41-109.ec2.internal"
Subject: Returned mail: see transcript for details
Auto-Submitted: auto-generated (failure)
This is a MIME-encapsulated message
--t3OLdq1k026047.1429911592/ip-172-31-41-109.ec2.internal
The original message was received at Fri, 24 Apr 2015 21:39:42 GMT
from localhost [127.0.0.1]
----- The following addresses had permanent fatal errors -----
<univstudent#uni.edu>
(reason: 553 5.1.8 <webapp#ip-172-31-41-109.ec2.internal>... Domain of sender address webapp#ip-172-31-41-109.ec2.internal does not exist)
----- Transcript of session follows -----
... while talking to apathy.uni.edu.:
>>> MAIL From:<webapp#ip-172-31-41-109.ec2.internal> SIZE=1191
<<< 553 5.1.8 <webapp#ip-172-31-41-109.ec2.internal>... Domain of sender address webapp#ip-172-31-41-109.ec2.internal does not exist
501 5.6.0 Data format error
--t3OLdq1k026047.1429911592/ip-172-31-41-109.ec2.internal
Content-Type: message/delivery-status
Reporting-MTA: dns; ip-172-31-41-109.ec2.internal
Received-From-MTA: DNS; localhost
Arrival-Date: Fri, 24 Apr 2015 21:39:42 GMT
Final-Recipient: RFC822; univstudent#uni.edu
Action: failed
Status: 5.1.8
Diagnostic-Code: SMTP; 553 5.1.8 <webapp#ip-172-31-41-109.ec2.internal>... Domain of sender address webapp#ip-172-31-41-109.ec2.internal does not exist
Last-Attempt-Date: Fri, 24 Apr 2015 21:39:52 GMT
--t3OLdq1k026047.1429911592/ip-172-31-41-109.ec2.internal
Content-Type: message/rfc822
Return-Path: <webapp#ip-172-31-41-109.ec2.internal>
Received: from ip-172-31-41-109.ec2.internal (localhost [127.0.0.1])
by ip-172-31-41-109.ec2.internal (8.14.4/8.14.4) with ESMTP id t3OLdg1k026045
for <univstudent#uni.edu>; Fri, 24 Apr 2015 21:39:42 GMT
Received: (from webapp#localhost)
by ip-172-31-41-109.ec2.internal (8.14.4/8.14.4/Submit) id t3OLdgcq026044;
Fri, 24 Apr 2015 21:39:42 GMT
To: univstudent#uni.edu
Subject: [classifiedads] Password Reset
X-PHP-Originating-Script: 498:class-phpmailer.php
Date: Fri, 24 Apr 2015 21:39:42 +0000
From: WordPress <wordpress#classifiedads-test.elasticbeanstalk.com>
Message-ID: <bace4f13cdc099117cd4ac9c70e2531c#classifiedads-test.elasticbeanstalk.com>
X-Priority: 3
X-Mailer: PHPMailer 5.2.7 (https://github.com/PHPMailer/PHPMailer/)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Someone requested that the password be reset for the following account:
http://classifiedads-test.elasticbeanstalk.com/
Username: univstudentseas
If this was a mistake, just ignore this email and nothing will happen.
To reset your password, visit the following address:
<http://classifiedads-test.elasticbeanstalk.com/wp-login.php?action=rp&key=dzaUvJpcjAe243gNOysZ&login=univstudentseas>
--t3OLdq1k026047.1429911592/ip-179-35-41-109.ec2.internal--
This sounds very similar to another recent question about email:
http://stackoverflow.com/questions/29808262/unable-to-send-emails-from-linux/29810884#29810884
Does your ec2 instance have an associated external DNS? Is there a public IP associated with it. You'll need to apply some type of fix so that your outgoing email message has a domain other than webapp#ip-172-31-41-109.ec2.internal

Resources