HI Phuong,<br><br>JIM is right way but if you want to use extension state then there is a simple way of achiving through <br>AMI, you need to fire this action on AMI and response have your answer ,<br><br>Please read about Action ExtensionState.<br>
<br><a href="http://www.voip-info.org/wiki/view/Asterisk+Manager+API+Action+ExtensionState">http://www.voip-info.org/wiki/view/Asterisk+Manager+API+Action+ExtensionState</a><br><br>If you are looking for extension state just pass extension and you will receive perfect response of that extension then you cans code as you want.<br>
<br>regards<br>Dhaval<br><br><div class="gmail_quote">On Tue, Jan 11, 2011 at 9:56 AM, Phuong Hoang <span dir="ltr"><<a href="mailto:ducphuongbk200586@gmail.com">ducphuongbk200586@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi Jim,<br>Really, I have`nt understood what you said yet. I am building a system on asterisk, and want to check a number online, offline or unreachable. If number is online on the extension then i want to redirect other extension. Redirecting is done by application java using AMI. can you help me do it?<br>
Thanks and best regards!<br><font color="#888888">Phuong</font><div><div></div><div class="h5"><br><br><div class="gmail_quote">On Mon, Jan 10, 2011 at 7:09 PM, Jim Dickenson <span dir="ltr"><<a href="mailto:dickenson@cfmc.com" target="_blank">dickenson@cfmc.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div style="">If you do an AMI packet like this:<div><br></div><div><div>Action: Originate</div><div>Channel: Local/get_info@some_context</div><div>Exten: do_noop</div><div>Context: some_context</div>
<div>Priority: 1</div><div>ActionID: GetInfo</div><div>Async: true</div><div><br></div><div>and then have a couple extensions that do what you want. Here is what I do in my case:</div><div><br></div><div><div>exten => get_info,1,Answer()</div>
<div>exten => get_info,n,UserEvent(GetInfo,Version:ABE & DateTime:${STRFTIME(${EPOCH},,%Y%m%d%H%M%S)} & CfMC:83351)</div><div>exten => get_info,n,Hangup()</div><div><br></div><div>exten => do_noop,1,Answer()</div>
<div>exten => do_noop,n,Wait(1)</div><div>exten => do_noop,n,Hangup()</div></div><div><br></div><div>You would then do what you need to do in your extensions.</div><div><div><br></div><div><br></div><div>
<br></div><div>
<div style="font-family: Helvetica;"><div style="margin: 0px;">-- </div><div style="margin: 0px;">Jim Dickenson</div><div style="margin: 0px;"><a href="mailto:dickenson@cfmc.com" target="_blank">mailto:dickenson@cfmc.com</a></div>
<div style="margin: 0px; min-height: 14px;"><br></div><div style="margin: 0px;">CfMC</div><div style="margin: 0px;"><a href="http://www.cfmc.com/" target="_blank">http://www.cfmc.com/</a></div><div><font face="Monaco" size="2"><span style="font-size: 10px;"><br>
</span></font></div></div><br>
</div>
<br></div><div><div></div><div><div><div>On Jan 10, 2011, at 6:16 PM, Phuong Hoang wrote:</div><br><blockquote type="cite">Thanks Jim,<br>Can you say about your idea clearlier? I want to use AMI in an application java to check a number online, offline or unreachable and result is returned to the appliction java. If the number is online now, i will use AMI to hangup it, else i do nothing.<br>
Best regards,<br>Phuong.<br><br><div class="gmail_quote">On Mon, Jan 10, 2011 at 8:50 AM, Jim Dickenson <span dir="ltr"><<a href="mailto:dickenson@cfmc.com" target="_blank">dickenson@cfmc.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div style="">You can always place a "call" to an extension that sends a user event from AMI. If there are no native AMI commands that can return what you want originate a call to a local extension that returns a user event.<br>
<div>
<span style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><div>
<div style="margin: 0px;">-- </div><div style="margin: 0px;">Jim Dickenson</div><div style="margin: 0px;"><a href="mailto:dickenson@cfmc.com" target="_blank">mailto:dickenson@cfmc.com</a></div><div style="margin: 0px; min-height: 14px;">
<br></div><div style="margin: 0px;">CfMC</div><div style="margin: 0px;"><a href="http://www.cfmc.com/" target="_blank">http://www.cfmc.com/</a></div><div><font face="Monaco" size="2"><span style="font-size: 10px;"><br></span></font></div>
</div></span><br>
</div><div><div></div><div>
<br><div><div>On Jan 10, 2011, at 7:48 AM, Phuong Hoang wrote:</div><br><blockquote type="cite">Thanks Dhaval,<br>My purpose is that i want to use java application (using Asterisk Manager Interface) to check a number online, offline or unreachable. Your suggest uses function DEVICE_STATE but this is written in dialplan not application java. Do you know other way to do this for me?thanks and looks forward to listening your reply.<br>
Regards!<br>Phuong<br><br><div class="gmail_quote">On Mon, Jan 10, 2011 at 3:13 AM, DHAVAL INDRODIYA <span dir="ltr"><<a href="mailto:dhaval.it01034@gmail.com" target="_blank">dhaval.it01034@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>Hello ,<br><br>You can use Dialplan function DEVICE_STATE, which will gives you perfect status of DEVICE.<br><br>regards<br><font color="#888888">Dhaval</font><div><div></div><div><br><br><div class="gmail_quote">
On Mon, Jan 10, 2011 at 4:11 PM, Steve Howes <span dir="ltr"><<a href="mailto:steve-lists@geekinter.net" target="_blank">steve-lists@geekinter.net</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><br>
On 10 Jan 2011, at 10:37, Phuong Hoang wrote:<br>
I found the link you have just sent to me but it do`nt help me to resolve this. Can you say clearlier for me?<br>
<br>
</div>Not really. It's a list of manager commands. There is 'SIPshowpeer' which will work for sip stuff. Try the command 'Command' action and you can send any CLI command, like sip/iax2 show peers etc. 'ExtensionState' might work in some cases..<br>
<div><div></div><div><br>
S<br>
--<br>
_____________________________________________________________________<br>
-- Bandwidth and Colocation Provided by <a href="http://www.api-digital.com/" target="_blank">http://www.api-digital.com</a> --<br>
New to Asterisk? Join us for a live introductory webinar every Thurs:<br>
<a href="http://www.asterisk.org/hello" target="_blank">http://www.asterisk.org/hello</a><br>
<br>
asterisk-users mailing list<br>
To UNSUBSCRIBE or update options visit:<br>
<a href="http://lists.digium.com/mailman/listinfo/asterisk-users" target="_blank">http://lists.digium.com/mailman/listinfo/asterisk-users</a><br>
</div></div></blockquote></div><br>
</div></div><br>--<br>
_____________________________________________________________________<br>
-- Bandwidth and Colocation Provided by <a href="http://www.api-digital.com/" target="_blank">http://www.api-digital.com</a> --<br>
New to Asterisk? Join us for a live introductory webinar every Thurs:<br>
<a href="http://www.asterisk.org/hello" target="_blank">http://www.asterisk.org/hello</a><br>
<br>
asterisk-users mailing list<br>
To UNSUBSCRIBE or update options visit:<br>
<a href="http://lists.digium.com/mailman/listinfo/asterisk-users" target="_blank">http://lists.digium.com/mailman/listinfo/asterisk-users</a><br></blockquote></div><br>
--<br>_____________________________________________________________________<br>-- Bandwidth and Colocation Provided by <a href="http://www.api-digital.com/" target="_blank">http://www.api-digital.com</a> --<br>New to Asterisk? Join us for a live introductory webinar every Thurs:<br>
<a href="http://www.asterisk.org/hello" target="_blank">http://www.asterisk.org/hello</a><br><br>asterisk-users mailing list<br>To UNSUBSCRIBE or update options visit:<br> <a href="http://lists.digium.com/mailman/listinfo/asterisk-users" target="_blank">http://lists.digium.com/mailman/listinfo/asterisk-users</a></blockquote>
</div><br></div></div></div><br>--<br>
_____________________________________________________________________<br>
-- Bandwidth and Colocation Provided by <a href="http://www.api-digital.com/" target="_blank">http://www.api-digital.com</a> --<br>
New to Asterisk? Join us for a live introductory webinar every Thurs:<br>
<a href="http://www.asterisk.org/hello" target="_blank">http://www.asterisk.org/hello</a><br>
<br>
asterisk-users mailing list<br>
To UNSUBSCRIBE or update options visit:<br>
<a href="http://lists.digium.com/mailman/listinfo/asterisk-users" target="_blank">http://lists.digium.com/mailman/listinfo/asterisk-users</a><br></blockquote></div><br>
--<br>_____________________________________________________________________<br>-- Bandwidth and Colocation Provided by <a href="http://www.api-digital.com" target="_blank">http://www.api-digital.com</a> --<br>New to Asterisk? Join us for a live introductory webinar every Thurs:<br>
<a href="http://www.asterisk.org/hello" target="_blank">http://www.asterisk.org/hello</a><br><br>asterisk-users mailing list<br>To UNSUBSCRIBE or update options visit:<br> <a href="http://lists.digium.com/mailman/listinfo/asterisk-users" target="_blank">http://lists.digium.com/mailman/listinfo/asterisk-users</a></blockquote>
</div><br></div></div></div></div><br>--<br>
_____________________________________________________________________<br>
-- Bandwidth and Colocation Provided by <a href="http://www.api-digital.com" target="_blank">http://www.api-digital.com</a> --<br>
New to Asterisk? Join us for a live introductory webinar every Thurs:<br>
<a href="http://www.asterisk.org/hello" target="_blank">http://www.asterisk.org/hello</a><br>
<br>
asterisk-users mailing list<br>
To UNSUBSCRIBE or update options visit:<br>
<a href="http://lists.digium.com/mailman/listinfo/asterisk-users" target="_blank">http://lists.digium.com/mailman/listinfo/asterisk-users</a><br></blockquote></div><br>
</div></div><br>--<br>
_____________________________________________________________________<br>
-- Bandwidth and Colocation Provided by <a href="http://www.api-digital.com" target="_blank">http://www.api-digital.com</a> --<br>
New to Asterisk? Join us for a live introductory webinar every Thurs:<br>
<a href="http://www.asterisk.org/hello" target="_blank">http://www.asterisk.org/hello</a><br>
<br>
asterisk-users mailing list<br>
To UNSUBSCRIBE or update options visit:<br>
<a href="http://lists.digium.com/mailman/listinfo/asterisk-users" target="_blank">http://lists.digium.com/mailman/listinfo/asterisk-users</a><br></blockquote></div><br>