Thanks, it helps.
However, if I create a timer and specify mode to 1, I will only have one extra process to send all PUSH notifications. Therefore, at some point, this extra process will be continuously busy handling messages in the queue, and the queue will grow over and over.
Is it possible to have a pool of timers fetching from the same message queue?
From: Daniel-Constantin Mierla [mailto:miconda@gmail.com] Sent: Thursday, March 19, 2015 10:28 AM To: Mickael Marrache; 'Kamailio (SER) - Users Mailing List' Subject: Re: [SR-Users] Sending PUSH notification asynchronously
You can delegate to send of the push to a rtimer process using mqueue -- see same presentation, the section about tweeting.
Cheers, Daniel
On 19/03/15 09:14, Mickael Marrache wrote:
I already looked at your presentation, the PUSH is send synchronously.
What I'm trying to achieve is sending the PUSH asynchronously. So, when I receive an incoming call and the callee has no registration, I would like to suspend the transaction and then delegate PUSH sending to another process.
In your presentation, I see the following:
route[PUSHASYNC] {
if (!is_method("INVITE"))
return;
if(registered("location"))
return;
route(SENDPUSH);
if(!t_suspend()) {
xlog("failed suspending trasaction [$T(id_index):$T(id_label)]\n");
send_reply("501", "Unknown destination");
exit;
}
xdbg("suspended transaction [$T(id_index):$T(id_label)] $fU => $rU\n");
$sht(vtp=>join::$rU) = "" + $T(id_index) + ":" + $T(id_label);
xdbg("htale key value [$sht(vtp=>join::$rU)]\n");
exit;
}
The route block is not execute asynchronously since it is called by the calling block using regular way (i.e. route(PUSHASYNC)). Therefore, all these operations are executed by the same process which is a worker process. I would like to delegate execution of all the route block to a separate process (at least execution of the SENDPUSH route block).
Mickael
From: sr-users [mailto:sr-users-bounces@lists.sip-router.org] On Behalf Of Daniel-Constantin Mierla Sent: Thursday, March 19, 2015 10:04 AM To: Kamailio (SER) - Users Mailing List Subject: Re: [SR-Users] Sending PUSH notification asynchronously
Hello,
don't do explicit t_suspend() if you are calling the async_task_route() because it is done internally.
I presented a way for async push notifications during the Kamailio World Conference 2014, see:
- http://www.kamailio.org/events/2014-KamailioWorld/day2/26-Daniel-Constantin. Mierla-Kamailio.cfg-Async.pdf
A video should be also on youtube.
Cheers, Daniel
On 19/03/15 08:49, Mickael Marrache wrote:
Hi,
I'm trying to add PUSH support to my system using Kamailio.
When a call is received and the callee has no active registration, a PUSH is sent to the callee endpoint. In order to send this PUSH, my proxy sends an HTTP requests to another server that will send the PUSH.
So, my route block is as follows:
route[PUSH] {
#Send PUSH notification using a custom module I wrote
#Suspend transaction execution.
t_on_failure("MANAGE_FAILURE");
if(!t_suspend()) {
send_reply("503", "Service Unavailable");
exit;
}
$sht(push=>join::$rU) = "" + $T(id_index) + ":" + $T(id_label);
exit;
}
I would like to execute this route block asynchronously (i.e. in a separate process).
I tried using the async_task_route command, and I can see the route block is execute in a separate process, however some stuffs are broken (e.g. transaction timeout, failure route). So, I thought it may be related to the fact asynchronous execution is implemented using t_suspend/t_continue and in this case, t_suspend/t_continue would be called twice.
The important point is to make the interaction with the PUSH server asynchronous.
Any idea?
Thanks,
Mickael
_______________________________________________ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users