<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p>Hi.</p>
<p><br>
</p>
<p>Thank all of you! <br>
</p>
<p>I'm getting success to execute some actions in my OpenSIPS when it get some responses as 4xx, 5xx, 6xx.</p>
<p>I have read about routes and some functions to detect such responses that come from the callee peer.</p>
<p><br>
</p>
<p>In my code I have something like this:</p>
<p><br>
</p>
<p>-------------------------------------------------------------------------------------------</p>
<p><br>
</p>
<p>failure_route[missed_call] {<br>
<br>
<br>
if (t_check_status("4[0-9][0-9]")||t_check_status("5[0-9][0-9]")||t_check_status("6[0-9][0-9]") ) {<br>
<br>
if(($fU=="porteirinho") || ($fU=="porteirinho2") || ($tU=="porteirinho") || ($tU=="porteirinho2")){<br>
<br>
<br>
do some actions for me...<br>
<br>
}<br>
}<br>
}</p>
<p>--------------------------------------------------------------------------------------------<br>
</p>
<p><br>
</p>
<p><br>
</p>
<p>However, some responses seems to be generated internally in OpenSIPS. Ex: 420 (bad extension), 404 (not found), 477, etc. For these internally generated responses, I still have to find a way of detecting it. I will look for it on documentation. However,
I suspect that maybe this detection has to be done in another type of route.</p>
<p><br>
</p>
<p>Should I use another type of route, shouldn't I? If yes, is there a function there that will tells me about the type of response too?</p>
<p><br>
</p>
<p>Any hint will be very helpful!<br>
</p>
<br>
<p><br>
</p>
<p>Best regards.</p>
<p><br>
</p>
<p><br>
</p>
<div id="Signature">
<div name="divtagdefaultwrapper" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:; margin:0">
<div class="BodyFragment"><font size="2">
<div class="PlainText">RODRIGO PIMENTA CARVALHO<br>
Inatel Competence Center<br>
Software<br>
Ph: +55 35 3471 9200 RAMAL 979<br>
</div>
</font></div>
</div>
</div>
<br>
<br>
<div style="color: rgb(0, 0, 0);">
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" color="#000000" face="Calibri, sans-serif"><b>De:</b> users-bounces@lists.opensips.org <users-bounces@lists.opensips.org> em nome de Annus Fictus <annusfictus@gmail.com><br>
<b>Enviado:</b> sexta-feira, 6 de novembro de 2015 12:22<br>
<b>Para:</b> OpenSIPS users mailling list<br>
<b>Assunto:</b> Re: [OpenSIPS-Users] How to identify a 4xx, or 5xx, or 6xx SIP response in OpenSIPS script?</font>
<div> </div>
</div>
<div>Hello Rodrigo,<br>
<br>
you have to use failure route:<br>
<br>
<a id="LPlnk933274" class="moz-txt-link-freetext" href="http://www.opensips.org/Documentation/Script-Routes-2-2#toc3">http://www.opensips.org/Documentation/Script-Routes-2-2#toc3</a>
<div style="margin-top: 20px; margin-bottom: 20px; overflow: auto; width: 100%;" id="LPBorder_GT_14470749435600.8699498733567448">
<table style="border-top: 1px solid rgb(204, 204, 204); border-bottom: 1px solid rgb(204, 204, 204); width: 80%; background-color: rgb(255, 255, 255); position: relative; overflow: auto;" id="LPContainer_14470749435580.0005199356938120347">
<tbody>
<tr style="border-spacing: 0px;" valign="top">
<td colspan="1" style="width: 250px; position: relative; display: table-cell; vertical-align: middle; padding-right: 20px;" id="ImageCell_14470749435590.5207518091247045">
<div style="margin-top: 12px; background-color: rgb(255, 255, 255); height: 88px; width: 250px; position: relative; padding: 0px; display: table;" id="LPImageContainer_14470749435590.5032880996184133">
<a target="_blank" href="http://www.opensips.org/Documentation/Script-Routes-2-2#toc3" style="display: table-cell; text-align: center;" id="LPImageAnchor_14470749435590.6506071333528669"><img aria-label="Imagem de visualização com link selecionado. Toque duas vezes para abrir o link." style="display: inline-block; margin-left: auto; margin-right: auto; max-width: 250px; max-height: 250px; height: 84px; width: 250px; border-width: 0px;" height="84" width="250" src="http://www.opensips.org/pub/skins/opensips/images/logo2.jpg"></a></div>
</td>
<td>
<div style="top: 0px; margin-top: 8px; font-size: 21px; font-family: "wf_segoe-ui_semilight","Segoe UI Semilight","Segoe WP Semilight","Segoe UI","Segoe WP",Tahoma,Arial,sans-serif; color: rgb(51, 51, 51); margin-left: 14px; margin-right: 14px;" id="LPTitle_14470749435600.37927044401357846">
openSIPS | Documentation / Types of routes - 2.2</div>
<div style="margin-top: 8px; font-size: 13px; font-family: "wf_segoe-ui_normal","Segoe UI","Segoe WP",Tahoma,Arial,sans-serif; color: rgb(102, 102, 102); margin-left: 14px; margin-right: 14px;" id="LPDescription_14470749435600.6939038954231516">
OpenSIPS routing logic uses several types of routes. Each type of route is triggered by a certain event and allows you to process a certain type of message (request ...</div>
<div style="margin: 8px 14px 10px; height: 18px; text-overflow: ellipsis; overflow: hidden; white-space: nowrap;" id="LPUrlContainer_14470749435600.8724474736097807">
<a target="_blank" href="http://www.opensips.org/Documentation/Script-Routes-2-2#toc3" style="font-size: 11px; font-family: "wf_segoe-ui_normal","Segoe UI","Segoe WP",Tahoma,Arial,sans-serif; text-decoration: none;" id="LPUrlAnchor_14470749435600.7296886187292517">Leia
mais...</a></div>
</td>
</tr>
</tbody>
</table>
</div>
<br>
<br>
Regards<br>
<br>
<div class="moz-cite-prefix">El 06/11/2015 a las 15:07, Rodrigo Pimenta Carvalho escribió:<br>
</div>
<blockquote type="cite">
<div id="divtagdefaultwrapper" style="font-size:12pt; color:#000000; background-color:#FFFFFF; font-family:Calibri,Arial,Helvetica,sans-serif">
<p><br>
</p>
<p>Hi OpenSIPS-users,</p>
<p><br>
</p>
<p>In the OpenSIPS script I can identify SIP requests, like is_method("INVITE") or is_method("BYE").</p>
<p><br>
</p>
<p>How to identify SIP responses, based on its codes that can be 4xx, or 5xx, or 6xx?</p>
<p>For example, how to identify that occurred a SIP response with code 483?</p>
<p><br>
</p>
<p>I just need to know that a SIP INVITE didn't succeeded.</p>
<p><br>
</p>
<p>What could be a elegant way to detect that a SIP INVITE was not answered?<br>
</p>
<p><br>
</p>
<p><br>
</p>
<p>Best regards.<br>
</p>
<p><br>
</p>
<div id="Signature">
<div name="divtagdefaultwrapper" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:; margin:0">
<div class="BodyFragment"><font size="2">
<div class="PlainText">RODRIGO PIMENTA CARVALHO<br>
Inatel Competence Center<br>
Software<br>
Ph: +55 35 3471 9200 RAMAL 979<br>
</div>
</font></div>
</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset> <br>
<pre>_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>
<a class="moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
</blockquote>
<br>
</div>
</div>
</div>
</body>
</html>