Hi Dhaval,<br>I have`nt known you recieved my mail yet?if you did and you can answer my question then please rely to you, i am looking forward to listening your reply.<br>Have a good nice.<br>Thanks and best regards!<br>Phuong.<br>
<br><div class="gmail_quote">On Tue, Jan 11, 2011 at 2:11 AM, Phuong Hoang <span dir="ltr"><<a href="mailto:ducphuongbk200586@gmail.com">ducphuongbk200586@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div class="im"><br><div>Hi Dhaval,<br>I fired originate action on AMI and everything is ok but redirect action not ok.<br>here the channel i set is available and context also exists on file extension.conf .<br></div>I will send manager.conf,extensions.conf and sip.conf (in Extension.rar) to you.<div>
I registered a sip phone with account <b>0976468586 </b>and context "<b>TestAMQ</b>" on asterisk =>ok<br>When i call with extension of "<b>TestAMQ</b>"(<b>this case extension is 999</b> ) by sip phone account<b> 0976468586</b> and simultaneously run above java program (AMI) that i sent to you to redirect the number <b>0976468586</b> to context <b>"from-smg"</b> then received the error.<br>
</div>
Do you use yahoo or skype?if you do, can you let me know <b>your ID yahoo or skype</b> to say something easier. My Yahoo ID is : <b><a href="mailto:ducphuongbk200586@yahoo.com" target="_blank">ducphuongbk200586@yahoo.com</a></b><br>
Thanks and best regard<br><font color="#888888">
Phuong</font><br><br></div><div><div></div><div class="h5"><div class="gmail_quote">On Tue, Jan 11, 2011 at 2:05 AM, Phuong Hoang <span dir="ltr"><<a href="mailto:ducphuongbk200586@gmail.com" target="_blank">ducphuongbk200586@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<br><div><div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div><div><br><div class="gmail_quote">
On Tue, Jan 11, 2011 at 1:18 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="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">Hi <font color="#888888">Phuong,<br><br>i see your code is looking nice and there is no problem in implementation , if you have any problem <br>
then first send me manager.conf file then try to connect through manager using telnet and then fire same action on this in that you can get proper error codes .<br>
<br>one more thing the channel you set is this channel is available to redirected???<br><br>regards<br>Dhavak<br></font><div><div><br><div class="gmail_quote">On Tue, Jan 11, 2011 at 2:05 PM, Phuong Hoang <span dir="ltr"><<a href="mailto:ducphuongbk200586@gmail.com" target="_blank">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 Dhaval,<br>Can you say how to fire action on AMI in this case and recieve response on AMI. I also tried to do with HangupAction and RedirectAction action (using asterisk-java library) in application java (AMI) to hang up or redirect a channel that is online at the extension on asterisk but not successfully. This is my code:<br>
<br><br><br>package Test;<br><br>import java.io.IOException;<br><br>import org.asteriskjava.manager.AuthenticationFailedException;<br>import org.asteriskjava.manager.ManagerConnection;<br>import org.asteriskjava.manager.ManagerConnectionFactory;<br>
import org.asteriskjava.manager.TimeoutException;<br>import org.asteriskjava.manager.action.HangupAction;<br>import org.asteriskjava.manager.action.OriginateAction;<br>import org.asteriskjava.manager.action.RedirectAction;<br>
import org.asteriskjava.manager.response.ManagerResponse;<br><br>public class TestOriginate {<br><br> /**<br> * @param args<br> */<br> private ManagerConnection managerConnection;<br><br> public TestOriginate() throws IOException {<br>
ManagerConnectionFactory factory = new ManagerConnectionFactory(<br> "192.168.0.178", "manager", "pa55w0rd");<br><br> this.managerConnection = factory.createManagerConnection();<br>
<br> }<br> public void run() {<br> RedirectAction redirectAction;<br> ManagerResponse originateResponse;<br> String state = "";<br> String receiver = "0976468586";<br>
redirectAction = new RedirectAction();<br> redirectAction.setContext("from-smg");<br> redirectAction.setExten("9220");<br> redirectAction.setPriority(new Integer(1));<br> redirectAction.setChannel("SIP/"+ receiver);<br>
<br> try {<br> System.out.println("Starting login 192.168.0.178");<br> managerConnection.login();<br><br> System.out.println("After login 192.168.0.178");<br>
<br> } catch (IllegalStateException e) {<br><br> } catch (TimeoutException e) {<br><br> } catch (IOException e) {<br><br> } catch (AuthenticationFailedException e) {<br><br> }<br> try {<br>
originateResponse = managerConnection.sendAction(redirectAction,<br> 30000);<br> state = originateResponse.getResponse();<br> System.out.println("State value is :" + state);<br>
} catch (IllegalArgumentException e) {<br> // TODO Auto-generated catch block<br> e.printStackTrace();<br> } catch (IllegalStateException e) {<br> // TODO Auto-generated catch block<br>
e.printStackTrace();<br> } catch (IOException e) {<br> // TODO Auto-generated catch block<br> e.printStackTrace();<br> } catch (TimeoutException e) {<br> // TODO Auto-generated catch block<br>
e.printStackTrace();<br> }<br><br> managerConnection.logoff();<br> }<br><br> public static void main(String[] args) throws IOException {<br> // TODO Auto-generated method stub<br><br>
TestOriginate test = new TestOriginate();<br> test.run();<br> }<br><br>}<br><br><b>While i run above code, the result printed on console likes following:</b><br><br><br><span style="color: rgb(255, 0, 0);">Starting login 192.168.0.178</span><br>
Jan 11, 2011 3:26:01 PM org.asteriskjava.manager.internal.ManagerConnectionImpl connect<br>INFO: Connecting to <a href="http://192.168.0.178:5038" target="_blank">192.168.0.178:5038</a><br>Jan 11, 2011 3:26:02 PM org.asteriskjava.manager.internal.ManagerConnectionImpl setProtocolIdentifier<br>
INFO: Connected via Asterisk Call Manager/1.1<br>Jan 11, 2011 3:26:02 PM org.asteriskjava.manager.internal.ManagerConnectionImpl setProtocolIdentifier<br>WARNING: Unsupported protocol version 'Asterisk Call Manager/1.1'. Use at your own risk.<br>
Jan 11, 2011 3:26:02 PM org.asteriskjava.manager.internal.ManagerConnectionImpl doLogin<br><span style="color: rgb(255, 0, 0);">INFO: Successfully logged in</span><br>Jan 11, 2011 3:26:04 PM org.asteriskjava.manager.internal.ManagerConnectionImpl doLogin<br>
INFO: Determined Asterisk version: Asterisk 1.0<br><span style="color: rgb(255, 0, 0);">After login 192.168.0.178</span><br style="color: rgb(255, 0, 0);"><span style="color: rgb(255, 0, 0);">State value is :Error</span><br>
Jan 11, 2011 3:26:04 PM org.asteriskjava.manager.internal.ManagerConnectionImpl disconnect<br>INFO: Closing socket.<br>Jan 11, 2011 3:26:04 PM org.asteriskjava.manager.internal.ManagerReaderImpl run<br>INFO: Terminating reader thread: socket closed<br>
<br>I hope you can spend your time to read what i have written above and help me solve this problem. <br><br>Can you contact with me by my yahoo nick : <a href="mailto:ducphuongbk200586@yahoo.com" target="_blank">ducphuongbk200586@yahoo.com</a><div>
<br>
Thanks and best regards.<br>Phuong<br><br></div><div><div><div class="gmail_quote">On Mon, Jan 10, 2011 at 10:48 PM, 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;">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" target="_blank">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><font color="#888888">Dhaval</font><div><div><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" target="_blank">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><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>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 size="2" face="Monaco"><span style="font-size: 10px;"><br>
</span></font></div></div><br>
</div>
<br></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>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 size="2" face="Monaco"><span style="font-size: 10px;"><br></span></font></div>
</div></span><br>
</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><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><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>
</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>
</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></blockquote><br></div><br>
</div></div></blockquote></div><br>
</div></div></blockquote></div><br>