<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Helvetica;
        panose-1:2 11 6 4 2 2 2 2 2 4;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
p.msonormal0, li.msonormal0, div.msonormal0
        {mso-style-name:msonormal;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-GB" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;mso-fareast-language:EN-US">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:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;mso-fareast-language:EN-US">if (is_method("BYE”)) {<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;mso-fareast-language:EN-US">    http_query(……)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;mso-fareast-language:EN-US">}<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;mso-fareast-language:EN-US">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.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;mso-fareast-language:EN-US">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.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:black">Phil</span><span style="font-size:7.5pt;font-family:"Calibri",sans-serif;color:black"><o:p></o:p></span></p>
</div>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif"> sr-users [mailto:sr-users-bounces@lists.sip-router.org]
<b>On Behalf Of </b>Jay Li<br>
<b>Sent:</b> 14 June 2016 16:54<br>
<b>To:</b> sr-users@lists.sip-router.org<br>
<b>Subject:</b> [SR-Users] HTTP query at the end of a phone call<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div id="yui_3_16_0_ym19_1_1465918851795_15803">
<p class="MsoNormal" style="background:white"><span style="font-family:"Helvetica",sans-serif;color:black">Dear All,<o:p></o:p></span></p>
</div>
<div id="yui_3_16_0_ym19_1_1465918851795_15803">
<p class="MsoNormal" style="background:white"><span style="font-family:"Helvetica",sans-serif;color:black"><o:p> </o:p></span></p>
</div>
<div id="yui_3_16_0_ym19_1_1465918851795_15803">
<p class="MsoNormal" style="background:white"><span style="font-family:"Helvetica",sans-serif;color:black">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.<o:p></o:p></span></p>
</div>
<div id="yui_3_16_0_ym19_1_1465918851795_15803">
<p class="MsoNormal" style="background:white"><span style="font-family:"Helvetica",sans-serif;color:black"><o:p> </o:p></span></p>
</div>
<div id="yui_3_16_0_ym19_1_1465918851795_15803">
<p class="MsoNormal" style="background:white"><span style="font-family:"Helvetica",sans-serif;color:black">Regards,<o:p></o:p></span></p>
</div>
<div id="yui_3_16_0_ym19_1_1465918851795_15803">
<p class="MsoNormal" style="background:white"><span style="font-family:"Helvetica",sans-serif;color:black">Jay <o:p></o:p></span></p>
</div>
</div>
</div>
</body>
</html>