Is there any way to answer a call or originate a call by Kamailio? - kamailio

I know that Kamailio works as a SIP Proxy and I also know that Asterisk/FreeSWITCH or other similar products can do what I'm asking here, but still wondering if it's possible to use Kamailio to answer a call or originate a call?
Let's say, "User ---> Kamailio", Kamailio answer the call with "200 OK to INVITE", and then play an announcement "Thank you for using Kamailio", then BYE the call?
I can't find any related information so I guess the answer is no, but still want to double check.
Many thanks in advance.

You can answer and play message if you use kamailio with mediaproxy.
Mediaproxy docs have some samples.
Originate is problematic and unreasonable in most cases, but there is https://www.kamailio.org/docs/modules/devel/modules/rtimer.html
Much simple method is use SIPP or perl/python sip module(external), after that rewrite call in kamailio as you wish.

Related

Simulring with Voicemails

I've got a basic twilio setup using studio for a simple IVR (like less than 20 minute setup kind of simple).
One thing I'm doing is using simulring to hit multiple parties and whoever answers. The issue I'm having is that if there is a voicemail to be hit, it appears to be ok with that and then plays the endpoints custom voicemail.
That's not really good with our setup.
Do you guys know how I can trigger the calls to multiple phones, detect a real person and then transfer the call, otherwise trigger a voicemail?
I can't imagine this is unique.
Twilio developer evangelist here.
There are two options you can use here, either call screening/human detection, in which you ask the person answering the phone to, for example, dial 1. A voicemail won't do this and you can leave a message or hang up, a human will dial the number and you can then take them on to the rest of the call. Or there is answering machine detection (AMD). When making an outbound call with AMD, once detected Twilio will make the webhook callback with a parameter that describes whether the call was answered by a human or a machine.
I recommend reading this article on both options, which should help you to understand what will work best for your use-case.

Asynchronous HTTP(S) request in existing loop

I want to send a HTTPS request to a server but have a problem figuring out how. The best way for me to do it would be to initiate the request and regularly check back whether it has finished. How can I do this? It is even possible? What are the alternatives?
The best way to make asynchronous I/O is to use tokio.
You can find a example HTTP+TLS in doc : https://tokio.rs/docs/getting-started/tls/

How does nginx_redis2_module achieve non-blocking operation?

I need a nginx server that receives HTTP request and sends back response from Redis-store and this should be non-blocking. After Googling and going through forums, i came across the nginx_redis2_module. I tried going through the code but was not able to understand how it works. How have they achieved non-blocking operation? Have they achieved this by adding events to nginx's event loop ? Is there any document or sample code how this is done ?
source : https://github.com/openresty/redis2-nginx-module
The essence of nginx is non blocking modules.
It is complex area.
Here you may found some starting points: how to write Nginx module?
FYI:
When used in conjunction with lua-nginx-module, it is recommended to
use the lua-resty-redis library instead of this module though, because
the former is much more flexible and memory-efficient.

Http/REST method for starting a service

I want to design a REST API to start a database. I can't find a suitable http method (aka verb).
I currently consider:
START /databases/mysampledatabase
I've browsed through a few RFCs, but then I thought someone here might point me to a de-facto standard verb.
Methods I've discarded (before I got tired of looking):
RFC 2616
OPTIONS
GET
HEAD
POST
PUT
DELETE
TRACE
CONNECT
RFC 2518
PROPFIND
PROPPATCH
MKCOL
COPY
MOVE
LOCK
UNLOCK
RFC 3253
REPORT
CHECKOUT
CHECKIN
UNCHECKOUT
MKWORKSPACE
UPDATE
LABEL
MERGE
BASELINE-CONTROL
MKACTIVITY
There's a bunch of thinking flaws here.. first off, the additional HTTP verbs (aside from the CRUD ones) should be considered not-restful.
So there's two ways I can interpret this question, and I have an answer for both:
1. What's the most appropriate HTTP method for starting a service
There's nothing quite like what you need, and I would advise simply using POST.
2. What's a good RESTful way to start a service
First, you should not see 'starting the service' as the action. It's easier to think of the 'status' (being started or stopped) as the resource you are changing, and PUT to update the resource.
So in this case, each service should have a unique uri. A GET on that uri could return something like :
{ "status" : "stopped" }
You just change 'stopped' to 'started', PUT the new resource.. and then the service could automatically begin running.
I wonder how useful this is though.. I'm not a REST zealot, and I think a simple POST is the best way to go.
edit I can't delete accepted answers, but since 2013 my thoughts on what is and isn't RESTful has nuanced quite a bit. I still think my example to represent the changable state of each service as a property still holds.

Multiple replies from server for one client request

This may be a dumb question - and the title may need to be improved... I think my requirement is pretty simple: I want to send a request for data from a client to a server program, and the server (not the client) should respond with something like "Received your request - working on it". The client then does other work. Then when the server has obtained the data, it should send an asynchronous message (a popup?) saying "I've got your data; click on ... (presumably a URL) to obtain data". I have been assuming that the server could be written in Java and that client is html and JavaScript. I haven't been able to come up with a clean solution - help would be appreciated.
Try to employ "Websocket Method" by using "SuperWebSocket" for server side, and "WebSocket4Net" for client side. It is working perfectly for my current project.
Most of the work invovles the server being asynchronous. To do this you must
Have an ajax call to the server that starts a job and returns a confirmation the job has been started.
A page on the server that will return whether or not any jobs are complete for a user.
Have an ajax widget on your client side that pings that page on teh server every so often to see if any jobs have been completed. And if so make a pop up.
This is the only way unless you use Flex data services.
Are you trying to do this on the HTTP protocol? It sounds like you're talking about a web application here, but it's not clear from the question. If so, then there are a variety of techniques for accomplishing this using AJAX which collectively go under the name "Comet". Depending on exactly what you're trying to accomplish, a number of different implementation, on both the client and server side, may be appropriate.
for pure java i suggest something like jgroups (client+server are java)
for html, you should use ajax - there you have a timer that checks every X seconds
Nowadays you have an alternative technique to use: Websockets. These are used for server->client communication without polling or ajax-style delayed responses.

Resources