<p>There is always a result to originate and its always in a background job event success or fail. In the body of the event you will find the return value.</p>
<div class="gmail_quote">On May 14, 2011 1:52 PM, &quot;Anton VG&quot; &lt;<a href="mailto:anton.vazir@gmail.com">anton.vazir@gmail.com</a>&gt; wrote:<br type="attribution">&gt; Yes, it does :) And I can use it to test is gw is up or down.<br>
&gt; But question digs slightly deeper, it looks a kind odd, that when I<br>&gt; issue the non-working &#39;originate&#39; or &#39;bridge&#39;  - there is no ERROR<br>&gt; event at least. So seems there is no way to determine in ESL, that<br>
&gt; &#39;originate&#39; or other command have fauiled have failed. On successful<br>&gt; execution - there is &quot;BACKGROUD_JOB&quot; event. But no event on error.<br>&gt; Don&#39;t you think that errors should fire events either, to inform ESL<br>
&gt; dialplan that issued command have failed?<br>&gt; <br>&gt; <br>&gt; 2011/5/14 Anthony Minessale &lt;<a href="mailto:anthony.minessale@gmail.com">anthony.minessale@gmail.com</a>&gt;:<br>&gt;&gt; It works with mod sofia dialplan app to test if a gw is down.<br>
&gt;&gt; That&#39;s your hint ;)<br>&gt;&gt;<br>&gt;&gt; On May 14, 2011 1:19 PM, &quot;Anton VG&quot; &lt;<a href="mailto:anton.vazir@gmail.com">anton.vazir@gmail.com</a>&gt; wrote:<br>&gt;&gt;&gt; If I&#39;m not wrong mod_distribute just provides a list for dialing the<br>
&gt;&gt;&gt; set of gateways, but not generating events itself. So seems not for<br>&gt;&gt;&gt; the case anyway...<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; 2011/5/14 Anton VG &lt;<a href="mailto:anton.vazir@gmail.com">anton.vazir@gmail.com</a>&gt;:<br>
&gt;&gt;&gt;&gt; That good one, but not for the my case.<br>&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt; i use originate &amp;park, and than bridge_uuid, when there is an<br>&gt;&gt;&gt;&gt; early_media.<br>&gt;&gt;&gt;&gt; I have a number of gateways, which support specific destinations each,<br>
&gt;&gt;&gt;&gt; so it&#39;s up to my billing to decide what gateway should be dialed and<br>&gt;&gt;&gt;&gt; in which order. But I still need to determine if gateway could be<br>&gt;&gt;&gt;&gt; reached or not, or if while calling, it gives an error, and which one.<br>
&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt; I see gwlist down could be used for bridge, but bridge does not give<br>&gt;&gt;&gt;&gt; flexibility I try to achieve. Will see what it gives if used for<br>&gt;&gt;&gt;&gt; originate...<br>
&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt; So, considering your brief reply, there just no support for the case I<br>&gt;&gt;&gt;&gt; need, so will try to get inside sofia.c ...<br>&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt; Regards,<br>
&gt;&gt;&gt;&gt; Anton.<br>&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt; 2011/5/14 Anthony Minessale &lt;<a href="mailto:anthony.minessale@gmail.com">anthony.minessale@gmail.com</a>&gt;:<br>&gt;&gt;&gt;&gt;&gt; Read up on mod distributor on the wiki.<br>
&gt;&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt;&gt; On May 14, 2011 12:12 PM, &quot;Anton VG&quot; &lt;<a href="mailto:anton.vazir@gmail.com">anton.vazir@gmail.com</a>&gt; wrote:<br>&gt;&gt;&gt;&gt;&gt;&gt; You did not understand. I INTENTIONALLY dialing the bad gateway, and<br>
&gt;&gt;&gt;&gt;&gt;&gt; I&#39;m looking for a proper way to determine that gateway is bad in my<br>&gt;&gt;&gt;&gt;&gt;&gt; ESL dialplan, by catching the proper event/reply/whatever,<br>&gt;&gt;&gt;&gt;&gt;&gt; And much preferably without tricks, like esl.api(&#39;sofia status gateway<br>
&gt;&gt;&gt;&gt;&gt;&gt; GatewayWhichIsDown&#39;)<br>&gt;&gt;&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt;&gt;&gt; When in production, and there is more than a single route, there will<br>&gt;&gt;&gt;&gt;&gt;&gt; be plenty of cases, when you dial a bad gateway, so there should be a<br>
&gt;&gt;&gt;&gt;&gt;&gt; way for ESL dialplan to determine that a gateway is not callable for a<br>&gt;&gt;&gt;&gt;&gt;&gt; moment, the reason WHY and to retry with another one.<br>&gt;&gt;&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt;&gt;&gt; The trick above is bad, since:<br>
&gt;&gt;&gt;&gt;&gt;&gt; 1. blocking api query, before evey single gateway call attempt.<br>&gt;&gt;&gt;&gt;&gt;&gt; 2. Gateway maybe known in UP state, but the state is stale, in dial in<br>&gt;&gt;&gt;&gt;&gt;&gt; fact will go to DOWN gateway. So, dialplan will screw<br>
&gt;&gt;&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt;&gt;&gt; Possibly I should ask in DEV list...<br>&gt;&gt;&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt;&gt;&gt; 2011/5/14 Madovsky &lt;<a href="mailto:infos@madovsky.org">infos@madovsky.org</a>&gt;:<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; maybe your gateway is blocking some numbers<br>&gt;&gt;&gt;&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt;&gt;&gt;&gt; ----- Original Message -----<br>&gt;&gt;&gt;&gt;&gt;&gt;&gt; From: &quot;Anton VG&quot; &lt;<a href="mailto:anton.vazir@gmail.com">anton.vazir@gmail.com</a>&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; To: &quot;FreeSWITCH Users Help&quot; &lt;<a href="mailto:freeswitch-users@lists.freeswitch.org">freeswitch-users@lists.freeswitch.org</a>&gt;<br>&gt;&gt;&gt;&gt;&gt;&gt;&gt; Sent: Saturday, May 14, 2011 12:23 PM<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; Subject: Re: [Freeswitch-users] ESL: No events fired when there is<br>&gt;&gt;&gt;&gt;&gt;&gt;&gt; error<br>&gt;&gt;&gt;&gt;&gt;&gt;&gt; on<br>&gt;&gt;&gt;&gt;&gt;&gt;&gt; submitted API command, like originate sofia to non-existent gateway<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; The same goes for gateway, which is just down. No events, signalling<br>&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; that call will not succeed. And no events fired.<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; 2011-05-14 21:19:32.002929 [ERR] mod_sofia.c:4050 Gateway is down!<br>&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; 2011-05-14 21:19:32.002929 [ERR] switch_ivr_originate.c:2447 Cannot<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; create outgoing channel of type [sofia] cause: [NETWORK_OUT_OF_ORDER]<br>&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; Am I missing the way to get info in the ESL about gateways, which are<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; out of order, or there is simple no way, without hacking the code?<br>&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; _______________________________________________<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; FreeSWITCH-users mailing list<br>&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; <a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; <a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; <a href="http://www.freeswitch.org">http://www.freeswitch.org</a><br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt;&gt;&gt;&gt; _______________________________________________<br>&gt;&gt;&gt;&gt;&gt;&gt;&gt; FreeSWITCH-users mailing list<br>&gt;&gt;&gt;&gt;&gt;&gt;&gt; <a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; <a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>&gt;&gt;&gt;&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt;&gt;&gt;&gt; UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; <a href="http://www.freeswitch.org">http://www.freeswitch.org</a><br>&gt;&gt;&gt;&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt;&gt;&gt; _______________________________________________<br>
&gt;&gt;&gt;&gt;&gt;&gt; FreeSWITCH-users mailing list<br>&gt;&gt;&gt;&gt;&gt;&gt; <a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>&gt;&gt;&gt;&gt;&gt;&gt; <a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
&gt;&gt;&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt;&gt;&gt; UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>&gt;&gt;&gt;&gt;&gt;&gt; <a href="http://www.freeswitch.org">http://www.freeswitch.org</a><br>
&gt;&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt;&gt; _______________________________________________<br>&gt;&gt;&gt;&gt;&gt; FreeSWITCH-users mailing list<br>&gt;&gt;&gt;&gt;&gt; <a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>
&gt;&gt;&gt;&gt;&gt; <a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>&gt;&gt;&gt;&gt;&gt; UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
&gt;&gt;&gt;&gt;&gt; <a href="http://www.freeswitch.org">http://www.freeswitch.org</a><br>&gt;&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; _______________________________________________<br>
&gt;&gt;&gt; FreeSWITCH-users mailing list<br>&gt;&gt;&gt; <a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>&gt;&gt;&gt; <a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
&gt;&gt;&gt; UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>&gt;&gt;&gt; <a href="http://www.freeswitch.org">http://www.freeswitch.org</a><br>
&gt;&gt;<br>&gt;&gt; _______________________________________________<br>&gt;&gt; FreeSWITCH-users mailing list<br>&gt;&gt; <a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>
&gt;&gt; <a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>&gt;&gt; UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
&gt;&gt; <a href="http://www.freeswitch.org">http://www.freeswitch.org</a><br>&gt;&gt;<br>&gt;&gt;<br>&gt; <br>&gt; _______________________________________________<br>&gt; FreeSWITCH-users mailing list<br>&gt; <a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>
&gt; <a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>&gt; UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
&gt; <a href="http://www.freeswitch.org">http://www.freeswitch.org</a><br></div>