That depends on when you want to trigger the notification. The easiest thing to do would
be to trigger it when one party sends a BYE. The best place to do this would probably be
after you have relayed the BYE to the UA (in the RELAY route after the t_relay() call).
This seems most logical as what may be a slow HTTP request will not hold up the relaying
of the BYE to the UA. The config might look something like this:
if (is_method("BYE”)) {
http_query(……)
}
The call is technically not ended until the BYE has gotten a response. If it’s important
to you to only trigger on this occurrence, the logic needs to go in the MANAGE_REPLY reply
route. The logic there is a bit more tricky. You’ll need to check for a valid response
code as well as ensure it is a response to the BYE. Not sure off hand of the code logic,
but I’m sure it’s not too tricky.
Having just discussed internally, we’re not aware of any legitimate scenario when the
response to a BYE changes the originating UA’s decision on whether to end the call. Others
may be able to advise more on this. As such, it’s probably not necessary to trigger your
request on the response but rather go with the simple option and trigger it when you see a
BYE. The only thing to bear in mind is that you may see two BYEs for a single call in the
event something went awry (e.g. UA2 did not receive the BYE from UA1 and thus timed out).
You’ll need some duplication protection for this.
Phil
From: sr-users [mailto:sr-users-bounces@lists.sip-router.org] On Behalf Of Jay Li
Sent: 14 June 2016 16:54
To: sr-users(a)lists.sip-router.org
Subject: [SR-Users] HTTP query at the end of a phone call
Dear All,
I'd like to send a HTTP call to a HTTP server whenever a call routed through a
Kamailio server ends. By looking at the document, seems I should use http_query() function
in the utils module. I wonder which route function I should put the http_query() in
assuming we use the default kamailio.cfg. Thanks.
Regards,
Jay