Jasmin HttpConnector for MT - python

Is there any way to implement http connector for sending messages(MT) in Jasmin? According to documentation jasmin HTTP API supports smpp connector only.
Update 1:
More information of scenario:
I have 4 sms providers that I need to implement using Jasmin.
one of them is using SMPP protocol and is working fine with jasmin using smpp connector.
Other 3 have http protocol (call url with params to send SMS).
I want to use http protocol with jasmin to use its routing and other stuff.

Jasmin only supports HTTP client connectors for MO (mobile originated) messages.
Having found myself with the same scenario as yourself, I found the simplest solution was to write an SMPP-to-HTTP service which allows Jasmin to connect to it and relay MT messages via HTTP. Hope that helps

Here is the overview for adding Http MT support in Jasmin:
Add connector class and manager for http MT connector
Add router manager
Modify smpp protocol module and detach http mt call from this module before it is dispatched to smpp queue. Detachment will be done after router has selected your custom connector and user balance etc is deducted from user account but before transaction is queued.
By detachment means use your own queue (rabbitmq queue) and and publish your transaction on this.
Create subscriber for rabbitmq and response back as required.
Using this method will return same message id and responses like smpp.
For more details or help please comment.

Related

Creating a Unix socket based authentication server for dovecot in Python

I am in the process of building a custom authentication for email accounts. The imap/pop3 server is dovecot. The dovecout have an easy option to use Key-value authentication (dict) database via socket. The have the documentation and perl socket server example in https://doc.dovecot.org/configuration_manual/authentication/dict/
I need a socket server in python to enable authentication via socket url
uri = proxy:/var/run/auth_proxy_dovecot/socket:somewhere
What inputs are need to send the socket?
What is the format of the input ?
What are the output format expected ?
I was unable to find any such developer documentations regarding it .
The only documentation they say is it use the protocol https://github.com/dovecot/core/blob/master/src/lib-dict/dict-client.h
I understand it is a simple script , but if some one wrote such python script or socket program , it will be good to know where to find those documentations.
I wrote a python server using the socketserver class To read data from the socket and process it.

Implementing WebSockets with Sony's Audio Control API in Python

Sony's website provided a example to use WebSockets to works with their api in Node.js
https://developer.sony.com/develop/audio-control-api/get-started/websocket-example#tutorial-step-3
it worked fine for me. But when i was trying to implement it in Python, it does not seems to work
i use websocket_client
import websocket
ws = websocket.WebSocket()
ws.connect("ws://192.168.0.34:54480/sony/avContent",sslopt={"cert_reqs": ssl.CERT_NONE})
gives
websocket._exceptions.WebSocketBadStatusException: Handshake status 403 Forbidden
but in their example code, there is not any kinds of authrization or authentication
I recently had the same problem. Here is what I found out:
Normal HTTP responses can contain Access-Control-Allow-Origin headers to explicitly allow other websites to request data. Otherwise, web browsers block such "cross-origin" requests, because the user could be logged in there for example.
This "same-origin-policy" apparently does not apply to WebSockets and the handshakes can't have these headers. Therefore any website could connect to your Sony device. You probably wouldn't want some website to set your speaker/receiver volume to 100% or maybe upload a defective firmware, right?
That's why the audio control API checks the Origin header of the handshake. It always contains the website the request is coming from.
The Python WebSocket client you use assumes http://192.168.0.34:54480/sony/avContent as the origin by default in your case. However, it seems that the API ignores the content of the Origin header and just checks whether it's there.
The WebSocket#connect method has a parameter named suppress_origin which can be used to exclude the Origin header.
TL;DR
The Sony audio control API doesn't accept WebSocket handshakes that contain an Origin header.
You can fix it like this:
ws.connect("ws://192.168.0.34:54480/sony/avContent",
sslopt={"cert_reqs": ssl.CERT_NONE},
suppress_origin=True)

How to use mqtt websocket api in python

I am trying to use mqtt protocol in this websocket api address wss://meri.digitraffic.fi:61619/mqtt .
It has username and password userName:digitraffic
password:digitrafficPassword.
plus (ssl needs to be enable) and i need to subscribe the message vessels/# from that websocket api address .
I have found some links MQTT over websocket in python.
I have also followed documentation of this one https://pypi.org/project/paho-mqtt/ and it works if i put the exact address given in the documentation but fails when I put my above address with username and password.
How can i use my websocket address in that paho-mqtt. Can this achieve using simple websocket library ? I am new in this stuff and any kind of help would be helpful.

Fetch mails via POP3, but keep them on the server

I'd like to fetch mails from a server, but I also want to control when to delete them.
Is there a way to do this?
I know this setting is very usual in mail clients, but it seems this option is not well supported by POPv3 specification and/or server implementations.
(I'm using python, but I'm ok with other languages/libraries, Python's poplib seems very simplistic)
Most POP3 clients may delete successfully retrieved messages automatically, but that's a feature of the client itself, not the protocol. POPv3 supports four basic operations during the transaction phase of a session:
Listing all available messages in the mailbox. (LIST)
Retrieving a specific message (RETR)
Flagging a message for deletion (DELE)
Clearing all deletion flags (RSET)
After the client ends the session with the QUIT command, any messages still flagged for deletion are deleted during the update phase. Note, though, that the RETR command (based on my reading of RFC1939 does not flag a message for deletion; that needs to be done explicitly with the DELE command.
Note, however, that a particular POP3 server may have a policy of deleting retrieved messages, whether or not the client requested they be deleted. Whether such a server provides an operation to bypass that is beyond the scope of the protocol. (A discussion of this point is mentioned in section 8 of the RFC, but is not part of the protocol itself.)
POP3 by design downloads and removes mail from a server after it's successfully fetched. If you don't want that, then use the IMAP protocol instead. That protocol has support to allow you to delete mail at your leisure as opposed to when it's synced to your machine.

Twilio Taskrouter: How do I configure my JS client (Worker) to receive voice calls after a reservation has been accepted?

I am referring to the example code here.
I am able to get the client running, task is assigned and reservation created and accepted as well. But then the call is not connected and the client keeps listening the default waiting tune.
I have tried reservation.dequeue() and reservation.call() but to no avail.
I am using Python-flask and twilio library 6.3.0.
Any help would be great.
Twilio developer evangelist here.
From the comments, you are looking to answer this call within the browser.
You do need to include the Twilio Client JS for this, alongside the TaskRouter JS. Check out the quick start on using Twilio Client to get familiar with it.
In order to connect up TaskRouter and Twilio Client you don't need to combine the tokens. What you do need to do is set your worker's contact_uri attribute to "client:" + YOUR_CLIENTS_NAME (for example { "contact_uri": "client:Bob" }).
Then when your worker dequeues the assignment, Twilio will look at the worker's contact_uri address and route the call there.
Let me know if this helps at all.

Categories

Resources