ONVIF PullMessages Fault - onvif

I understand that cameras that do not have WSBaseNotification feature do not support push-style notifications (Notify), so I have to do the pull-style way (CreatePullPointSubscription and PullMessages).
First I obtain the SubscriptionReference address from CreatePullPointSubscription and pass it to the "To" address in PullMessages. This has succeeded with one of the three cameras I have tested but failed with the other.
Here is a sample of response for CreatePullPointSubscription:
<SOAP-ENV:Header><wsa5:MessageID>urn:uuid:18764990-3fd8-4175-b074-bfdd6816d5a2</
wsa5:MessageID><wsa5:RelatesTo>urn:uuid:1adbe268-c822-eb58-8560-b07639671351</wsa5:RelatesTo><wsa5:To SOAP-
ENV:mustUnderstand="true">http://www.w3.org/2005/08/addressing/anonymous</wsa5:To><wsa5:Action SOAP-
ENV:mustUnderstand="true">http://www.onvif.org/ver10/events/wsdl/EventPortType/
CreatePullPointSubscriptionResponse</wsa5:Action></SOAP-ENV:Header><SOAP-
ENV:Body><tev:CreatePullPointSubscriptionResponse><tev:SubscriptionReference><wsa5:Address>http://172.22.22.35:80/
onvif/device_service?Idx=0</wsa5:Address></tev:SubscriptionReference><wsnt:CurrentTime>2015-11-26T17:05:55Z</
wsnt:CurrentTime><wsnt:TerminationTime>2038-01-19T03:14:07Z</wsnt:TerminationTime></
tev:CreatePullPointSubscriptionResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
And PulMessagesRequest:
<s:Header><wsa:To>http://172.22.22.35:80/onvi /device_service?Idx=0</wsa:To><wsse:Security><wsse:UsernameToken>
<wsse:Username>admin</wsse:Username><wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-
profile-1.0#PasswordDigest">XWhDcuw3cztspGCLlpQfVaqM1mU=</wsse:Password><wsse:Nonce>NTY1NmNiODFjYTk4MWZlNjFmNDA=</wsse:Nonce>
<wsu:Created>2015-11-26T09:06:09Z</wsu:Created></wsse:UsernameToken></wsse:Security></s:Header><s:Body><tev:PullMessages>
<tev:Timeout>PT5S</tev:Timeout><tev:MessageLimit>2</tev:MessageLimit></tev:PullMessages></s:Body></s:Envelope>
And PullMessagesResponse:
<SOAP-ENV:Header><wsa5:To SOAP-ENV:mustUnderstand="true">http://172.22.22.35:80/onvif
/device_service?Idx=0</wsa5:To></SOAP-ENV:Header><SOAP-ENV:Body><SOAP-ENV:Fault><SOAP-ENV:Code><SOAP-ENV:Value>SOAP-ENV:Sender</SOAP-ENV:Value>
<SOAP-ENV:Subcode><SOAP-ENV:Value>InvalidArgVal</SOAP-ENV:Value></SOAP-ENV:Subcode></SOAP-ENV:Code><SOAP-ENV:Reason><SOAP-ENV:Text
xml:lang="en">InvalidArgVal</SOAP-ENV:Text></SOAP-ENV:Reason><SOAP-
ENV:Detail>There is no subscribe.</SOAP-ENV:Detail></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>

From the ONVIF core specs:
9.1.2 Pull messages
The device shall provide the following PullMessages command for all SubscriptionManager endpoints returned by the CreatePullPointSubscription command.
Therefore you need to pull the messages from the address returned int the CreatePullPointSubscription . Populating the wsa5:To field in the body of the request but using the URL of the event service is in general not enough.
You posted only the body of the soap requests and not the head, thus it's impossible to check the URL you're using.

Related

How do I use ResponseEntity<Mono<String>> to do a get call via webclient?

Documentaion says:-
ResponseEntity<Mono> or ResponseEntity<Flux> -- this makes the response status and headers known immediately while the body is provided asynchronously at a later point. Whether the body is Mono or Flux depends on how many values the response has.
My usecase is I want the headers right away so that I can do some processes while I wait for the body.
Can anyone help me with a method that would make use of this ?

NiFi - InvokeHTTP not making GET calls while taking parameter from incoming FlowFile

I have an InvokeHTTP processor that makes a GET that accepts an author variable from an incoming FlowFile as input. However, InvokeHTTP does not appear to be doing anything with the input: https://www.pastepic.xyz/image/LKc34
I tested the Remote URL in a browser with an author from one of the input flowfiles, and it returns JSON as expected.
Remote URL: https://www.reddit.com/user/${author:urlEncode()}/comments/.json?limit=100
Data Provenance shows only DROP and ATTRIBUTES_MODIFIED events. Shouldn't there be FETCH, CLONE, and/or FORK events?
The author from the incoming FlowFile is in those DROP and ATTRIBUTES_MODIFIED events. The input processor is an EvaluateJsonPath whose only output is the author field, and the property name is author.
Also, I tested hardcoding a username in the Remote URL and disconnecting the input FlowFile. That worked and made the request as expected, returning output. So appears there's something wrong with the interaction between the input FlowFile and InvokeHTTP.
I should be getting back JSON from InvokeHTTP. But it appears that the requests are not being made in the first place, failing silently so to speak. Read/Write and Out are empty, and I'm not getting errors.

Gmail IMAP via php ouath2 Zend_Mail_Protocol_Imap - getting the X-GM-THRID

I'm accessing GMail via IMAP using OAuth2 authentication and Zend_Mail_Protocol_Imap.
It all works great.
What I need to do is present emails in thread form just like the GMail interface. Google make this really easy because they have an X-GM-THRID header that links a conversation with a 64-bit unsigned integer.
My problem is: when presented with a single email, how do I find out what X-GM-THRID it belongs to?
First off Google says that there is a server extension X-GM-EXT-1 which is active. You can check it is there using the CAPABILITY command (and I have).
All the information suggests that if this is active then the X-GM-THRID will simply be returned as a header, but it isn't.
Perhaps I need to ask Google to return it via the fetch command. Google does describe a simple fetch process here:
https://developers.google.com/google-apps/gmail/imap_extensions
My code is sending TAG5 FETCH 3673 (FLAGS RFC822.HEADER X-GM-THRID) but the headers do not include an entry for X-GM-THRID.
I've even simplified it to TAG6 FETCH 3673 (X-GM-THRID) to be exactly as described in the google example. In this case no headers are returned.
I'm not massively familiar with IMAP commands and I'm not sure if Zend_Mail_Protocol_Imap is abstracting some handling which means this header is being removed.
But I do know that this is driving me mad.
Am I missing something? Is it not a header?
Okay, so it looks like it is not a header. It is an attribute in the IMAP command and response.
The standard fetch command sent by Zend_Mail_Protocol_Imap is "TAG5 FETCH 3673 (FLAGS RFC822.HEADER)"
The code that handles the response only expects to be dealing with 'FLAGS' and 'RFC822.HEADER'. It passes this information to a Zend_Mail_Message object which extends Zend_Mail_Part.
Zend_Mail_Part parses information about flag. It also parses the header.
The additional 'X-GM-THRID' attribute that I added does actually get a response. but since it is not passed back to Zend_Mail_Message there is no way for me to use it. It gets lost in the ether (at around line 171 of Zend_Mail_Storage_Imap in my Zend Library to be exact).
So I've hacked the core... Zend_Mail_Storage_Imap::getMessage now expects $data['X-GM-THRID'] and passes it to the constructor Zend_Mail_Part. And I now have a method Zend_Mail_Part::getXGmThrid which solves all my problems. I'll obviously refactor them into my own classes extending Zend_Mail_Storage_Imap and Zend_Mail_Part in the not too distant... but for now I know this works.

Using RMAIL to send an e-mail

I'm struggling to find documentation that gives a clear example of how to enter a message in the rmail application.
I need to specify who the email is from, the subject of the email, and then follow that with some content. It's for a small school assignment where we are relaying "status updates" from imaginary machines on an imaginary factory floor.
This is the closest I've found, but it is not very clear: http://www.s-gms.ms.edus.si/cgi-bin/man-cgi?rmail+1
Can anyone give me an example of how I would send a message that looked like this? (obviously not including the comments...)
/* header stuff */
From: something#something.com
Subject: Status update for machine 5
/* message content */
Machine ID: 7
Status Reported: Machine going offline (status 6)
Status effective: 2012-06-02 12:30:23
I am opening rmail via software controlled pipe in my application without problems, I'm just not sure how to format the data I am feeding to it since I can't find any examples online.
Thanks!
You are probably interested in using /usr/bin/mail on most modern Unixes, not rmail.
You should read the man page, but generally, it would be sufficient to use the "-s" flag to set the subject of the mail, and input the content of the message on stdin. There is no need to set the From: line, as the system will do that for you (and in the general case, the system will not let you specify arbitrary from addresses to prevent forgeries.)

[Asterisk]Attended transfer using hook flash on a SIP channel

Within our organisation we use quite a few different models of telephone sets. The only thing they have in common, apart from the dialpad, is the ability to "send" hook flash. I prefer using this type of signaling for attended transfers above combinations of the usual dialpad keys to prevent the other end from receiving DTMF-tones (to prevent unwanted interactions with IVRs or bothering people on the other end).
2 questions:
How is a flash hook represented in features.conf? According to RFC2833 section 3.10 (DTMF Events) and this article (which is about a ZAP- instead of SIP-configuration, thus my doubt... see next question, also), it should be just "flash".
From my Google-quest I've learned that hook flash gets ignored by the PBX when using the SIP-protocol in Asterisk... I do get an error message when sending it: "WARNING[26159]: chan_sip.c:6487 sip_indicate: Don't know how to indicate condition 9". Is there a way to fix it/work around it?
Asterisk version: 1.8.3.2
Using "info" for dtmfmode
Tnx in advance!
In most cases you have in you adapter settings what to do with hook. IF you have, you can change that to transfer code.
Update: after code review i can say that DTMF 16 received ok and sended in 1.8.x. BUT features.c have no any action on flash(event 16)
So posible create audiohook application for asterisk to change that DTMF 16 to 2 DTMF values or invoke transfer. Will work for DTMF method SIPInfo, and such patch complexity is below-average(5-6 hours for expert)

Resources