Thread: [Asterisk-java-users] originate a call and get user selected option
Brought to you by:
srt
From: Kelly G. <kel...@gm...> - 2013-01-02 15:50:08
|
Hi, I need to originate a call from java, this call is made to an extension which plays menu options to the user, like, press 1 to confirm and 2 to cancel. I originate a call to the extension 400@ivr that looks like this: [ivr] exten => 400,1,MP3Player(sound1.mp3) exten => 400,2,Background(menu.mp3) exten => 400,n,WaitExten(5) exten => 1,1,MP3Player(confirmed.mp3) exten => 2,1,MP3Player(cancel.mp3) exten => 3,1,MP3Player(later.mp3) exten => 4,1,Goto(ivr,400,2) exten => i,1,MP3Player(invalid.mp3) exten => t,1,Hangup() Is it possible to know if the user selected 1,2,3 or 4? If so, how can I do that? Thanks Kelly |
From: Mordechay K. <mka...@gm...> - 2013-01-02 16:27:53
|
B.H. On Wed, Jan 2, 2013 at 5:49 PM, Kelly Goedert <kel...@gm...>wrote: > Hi, Hello > > I need to originate a call from java, this call is made to an extension > which plays menu options to the user, like, press 1 to confirm and 2 to > cancel. > > I originate a call to the extension 400@ivr that looks like this: > > [ivr] > exten => 400,1,MP3Player(sound1.mp3) > exten => 400,2,Background(menu.mp3) > exten => 400,n,WaitExten(5) > > exten => 1,1,MP3Player(confirmed.mp3) > > exten => 2,1,MP3Player(cancel.mp3) > exten => 3,1,MP3Player(later.mp3) > exten => 4,1,Goto(ivr,400,2) > exten => i,1,MP3Player(invalid.mp3) > exten => t,1,Hangup() > > Is it possible to know if the user selected 1,2,3 or 4? If so, how can I > do that? > > Thanks > > Kelly > > AFAIK, Asterisk 1.4 sends NewExtenEvent on every priority in the dialplan but the later versions do not send this event. I would recommend to use cusom UserEvent like this on every extention of the menu: exten => s,n,UserEvent(MENU,uid: ${UNIQUEID},selection: ${EXTEN}) (you need to pass the channel's UNIQUEID because for some reason it is not passed automatically by asterisk for user events) Then you create a class MenuEvent (The class name matters!) which extends org.asteriskjava.manager.event.UserEvent and register it with your AMI connection: connection.registerUserEventClass(MenuEvent.class); Another solution whould be to use FastAGI, if it is applicable in your case > > > ------------------------------------------------------------------------------ > Master Java SE, Java EE, Eclipse, Spring, Hibernate, JavaScript, jQuery > and much more. Keep your Java skills current with LearnJavaNow - > 200+ hours of step-by-step video tutorials by Java experts. > SALE $49.99 this month only -- learn more at: > http://p.sf.net/sfu/learnmore_122612 > _______________________________________________ > Asterisk-java-users mailing list > Ast...@li... > https://lists.sourceforge.net/lists/listinfo/asterisk-java-users > > Best regards, Mordechay -- משיח NOW! Moshiach is coming very soon, prepare yourself! יחי אדוננו מורינו ורבינו מלך המשיח לעולם ועד! |
From: Kelly G. <kel...@gm...> - 2013-01-02 16:53:10
|
Hi, I implemented the MenuEvent class as you suggested, and I can see this line on the console Executing [1@ivr:1] UserEvent("SIP/eu-34001bd0", "Menu,uid:1357145308.1,selection:1") in new stack But in the java code, the event is not received. My class is as follows: public class AsteriskLive implements ManagerEventListener { private ManagerConnection managerConnection; public AsteriskLive() { } @Override public void onManagerEvent(ManagerEvent event) { if(event instanceof MenuEvent){ System.out.println(event); } } public void run() throws IOException, AuthenticationFailedException, TimeoutException, InterruptedException { ManagerConnectionFactory factory = new ManagerConnectionFactory("1.1.1.2", "a", "p"); ManagerConnection managerConnection = factory.createManagerConnection(); managerConnection.registerUserEventClass(MenuEvent.class); OriginateAction originateAction; originateAction = new OriginateAction(); originateAction.setChannel("SIP/eu"); originateAction.setContext("ivr"); originateAction.setExten("400"); originateAction.setPriority(new Integer(1)); managerConnection.addEventListener(this); managerConnection.login(); managerConnection.sendAction(originateAction, 30000); Thread.sleep(60); managerConnection.logoff(); } public static void main(String[] args) throws Exception { AsteriskLive helloLiveEvents = new AsteriskLive(); helloLiveEvents.run(); } } And the MenuEvent class public class MenuEvent extends UserEvent { public MenuEvent(Object source) { super(source); } private static final long serialVersionUID = 1L; } And the extensions.conf exten => 1,2,MP3Player(confirmed.mp3) exten => 1,1,UserEvent(Menu,uid:${UNIQUEID},selection:${EXTEN}) On Wed, Jan 2, 2013 at 2:27 PM, Mordechay Kaganer <mka...@gm...>wrote: > B.H. > > > > On Wed, Jan 2, 2013 at 5:49 PM, Kelly Goedert <kel...@gm...>wrote: > >> Hi, > > > Hello > > >> >> I need to originate a call from java, this call is made to an extension >> which plays menu options to the user, like, press 1 to confirm and 2 to >> cancel. >> >> I originate a call to the extension 400@ivr that looks like this: >> >> [ivr] >> exten => 400,1,MP3Player(sound1.mp3) >> exten => 400,2,Background(menu.mp3) >> exten => 400,n,WaitExten(5) >> >> exten => 1,1,MP3Player(confirmed.mp3) >> >> exten => 2,1,MP3Player(cancel.mp3) >> exten => 3,1,MP3Player(later.mp3) >> exten => 4,1,Goto(ivr,400,2) >> exten => i,1,MP3Player(invalid.mp3) >> exten => t,1,Hangup() >> >> Is it possible to know if the user selected 1,2,3 or 4? If so, how can I >> do that? >> >> Thanks >> >> Kelly >> >> > AFAIK, Asterisk 1.4 sends NewExtenEvent on every priority in the dialplan > but the later versions do not send this event. I would recommend to use > cusom UserEvent like this on every extention of the menu: > > exten => s,n,UserEvent(MENU,uid: ${UNIQUEID},selection: ${EXTEN}) > > (you need to pass the channel's UNIQUEID because for some reason it is not > passed automatically by asterisk for user events) > > Then you create a class MenuEvent (The class name matters!) which > extends org.asteriskjava.manager.event.UserEvent and register it with your > AMI connection: > > connection.registerUserEventClass(MenuEvent.class); > > Another solution whould be to use FastAGI, if it is applicable in your > case > > >> >> >> ------------------------------------------------------------------------------ >> Master Java SE, Java EE, Eclipse, Spring, Hibernate, JavaScript, jQuery >> and much more. Keep your Java skills current with LearnJavaNow - >> 200+ hours of step-by-step video tutorials by Java experts. >> SALE $49.99 this month only -- learn more at: >> http://p.sf.net/sfu/learnmore_122612 >> _______________________________________________ >> Asterisk-java-users mailing list >> Ast...@li... >> https://lists.sourceforge.net/lists/listinfo/asterisk-java-users >> >> > Best regards, Mordechay > > -- > משיח NOW! > Moshiach is coming very soon, prepare yourself! > יחי אדוננו מורינו ורבינו מלך המשיח לעולם ועד! > > > ------------------------------------------------------------------------------ > Master Java SE, Java EE, Eclipse, Spring, Hibernate, JavaScript, jQuery > and much more. Keep your Java skills current with LearnJavaNow - > 200+ hours of step-by-step video tutorials by Java experts. > SALE $49.99 this month only -- learn more at: > http://p.sf.net/sfu/learnmore_122612 > _______________________________________________ > Asterisk-java-users mailing list > Ast...@li... > https://lists.sourceforge.net/lists/listinfo/asterisk-java-users > > |
From: Mordechay K. <mka...@gm...> - 2013-01-02 18:52:53
|
B.H. First, you need to add the custom properties 'uid' and 'selection' to MenuEvent class, like explained in UserEvent class's docs. Maybe the event reader thread cannot instantiate your class because it doesn't find the setters. Then check the log output of your java code if you can see any errors or warnings there. I'm using this technique with asterisk-java and asterisk 1.8 quite widely and it works without problems. On Wed, Jan 2, 2013 at 6:52 PM, Kelly Goedert <kel...@gm...>wrote: > Hi, > > I implemented the MenuEvent class as you suggested, and I can see this > line on the console > > Executing [1@ivr:1] UserEvent("SIP/eu-34001bd0", > "Menu,uid:1357145308.1,selection:1") in new stack > > But in the java code, the event is not received. My class is as follows: > > public class AsteriskLive implements ManagerEventListener { > > private ManagerConnection managerConnection; > > public AsteriskLive() { > > } > > @Override > public void onManagerEvent(ManagerEvent event) { > if(event instanceof MenuEvent){ > System.out.println(event); > } > } > > public void run() throws IOException, AuthenticationFailedException, > TimeoutException, InterruptedException { > ManagerConnectionFactory factory = new > ManagerConnectionFactory("1.1.1.2", "a", "p"); > ManagerConnection managerConnection = factory.createManagerConnection(); > managerConnection.registerUserEventClass(MenuEvent.class); > > OriginateAction originateAction; > > originateAction = new OriginateAction(); > originateAction.setChannel("SIP/eu"); > originateAction.setContext("ivr"); > originateAction.setExten("400"); > originateAction.setPriority(new Integer(1)); > > managerConnection.addEventListener(this); > managerConnection.login(); > > managerConnection.sendAction(originateAction, 30000); > > Thread.sleep(60); > > managerConnection.logoff(); > } > > public static void main(String[] args) throws Exception { > AsteriskLive helloLiveEvents = new AsteriskLive(); > helloLiveEvents.run(); > } > > } > > And the MenuEvent class > > public class MenuEvent extends UserEvent { > > public MenuEvent(Object source) { > super(source); > } > > private static final long serialVersionUID = 1L; > > } > > > And the extensions.conf > exten => 1,2,MP3Player(confirmed.mp3) > exten => 1,1,UserEvent(Menu,uid:${UNIQUEID},selection:${EXTEN}) > > > > On Wed, Jan 2, 2013 at 2:27 PM, Mordechay Kaganer <mka...@gm...>wrote: > >> B.H. >> >> >> >> On Wed, Jan 2, 2013 at 5:49 PM, Kelly Goedert <kel...@gm...>wrote: >> >>> Hi, >> >> >> Hello >> >> >>> >>> I need to originate a call from java, this call is made to an extension >>> which plays menu options to the user, like, press 1 to confirm and 2 to >>> cancel. >>> >>> I originate a call to the extension 400@ivr that looks like this: >>> >>> [ivr] >>> exten => 400,1,MP3Player(sound1.mp3) >>> exten => 400,2,Background(menu.mp3) >>> exten => 400,n,WaitExten(5) >>> >>> exten => 1,1,MP3Player(confirmed.mp3) >>> >>> exten => 2,1,MP3Player(cancel.mp3) >>> exten => 3,1,MP3Player(later.mp3) >>> exten => 4,1,Goto(ivr,400,2) >>> exten => i,1,MP3Player(invalid.mp3) >>> exten => t,1,Hangup() >>> >>> Is it possible to know if the user selected 1,2,3 or 4? If so, how can I >>> do that? >>> >>> Thanks >>> >>> Kelly >>> >>> >> AFAIK, Asterisk 1.4 sends NewExtenEvent on every priority in the dialplan >> but the later versions do not send this event. I would recommend to use >> cusom UserEvent like this on every extention of the menu: >> >> exten => s,n,UserEvent(MENU,uid: ${UNIQUEID},selection: ${EXTEN}) >> >> (you need to pass the channel's UNIQUEID because for some reason it is >> not passed automatically by asterisk for user events) >> >> Then you create a class MenuEvent (The class name matters!) which >> extends org.asteriskjava.manager.event.UserEvent and register it with your >> AMI connection: >> >> connection.registerUserEventClass(MenuEvent.class); >> >> Another solution whould be to use FastAGI, if it is applicable in your >> case >> >> >>> >>> >>> ------------------------------------------------------------------------------ >>> Master Java SE, Java EE, Eclipse, Spring, Hibernate, JavaScript, jQuery >>> and much more. Keep your Java skills current with LearnJavaNow - >>> 200+ hours of step-by-step video tutorials by Java experts. >>> SALE $49.99 this month only -- learn more at: >>> http://p.sf.net/sfu/learnmore_122612 >>> _______________________________________________ >>> Asterisk-java-users mailing list >>> Ast...@li... >>> https://lists.sourceforge.net/lists/listinfo/asterisk-java-users >>> >>> >> Best regards, Mordechay >> >> -- >> משיח NOW! >> Moshiach is coming very soon, prepare yourself! >> יחי אדוננו מורינו ורבינו מלך המשיח לעולם ועד! >> >> >> ------------------------------------------------------------------------------ >> Master Java SE, Java EE, Eclipse, Spring, Hibernate, JavaScript, jQuery >> and much more. Keep your Java skills current with LearnJavaNow - >> 200+ hours of step-by-step video tutorials by Java experts. >> SALE $49.99 this month only -- learn more at: >> http://p.sf.net/sfu/learnmore_122612 >> _______________________________________________ >> Asterisk-java-users mailing list >> Ast...@li... >> https://lists.sourceforge.net/lists/listinfo/asterisk-java-users >> >> > > > ------------------------------------------------------------------------------ > Master Java SE, Java EE, Eclipse, Spring, Hibernate, JavaScript, jQuery > and much more. Keep your Java skills current with LearnJavaNow - > 200+ hours of step-by-step video tutorials by Java experts. > SALE $49.99 this month only -- learn more at: > http://p.sf.net/sfu/learnmore_122612 > _______________________________________________ > Asterisk-java-users mailing list > Ast...@li... > https://lists.sourceforge.net/lists/listinfo/asterisk-java-users > > -- משיח NOW! Moshiach is coming very soon, prepare yourself! יחי אדוננו מורינו ורבינו מלך המשיח לעולם ועד! |
From: Kelly G. <kel...@gm...> - 2013-01-03 10:04:02
|
Hi, I did put the properties as described on the docs, but it did not work. There are no errors in the log of the java code also. Maybe the problem is because I am using asterisk 1.6? On Wed, Jan 2, 2013 at 4:52 PM, Mordechay Kaganer <mka...@gm...>wrote: > B.H. > > First, you need to add the custom properties 'uid' and 'selection' to > MenuEvent class, like explained in UserEvent class's docs. Maybe the event > reader thread cannot instantiate your class because it doesn't find the > setters. > > Then check the log output of your java code if you can see any errors or > warnings there. > > I'm using this technique with asterisk-java and asterisk 1.8 quite widely > and it works without problems. > > > > On Wed, Jan 2, 2013 at 6:52 PM, Kelly Goedert <kel...@gm...>wrote: > >> Hi, >> >> I implemented the MenuEvent class as you suggested, and I can see this >> line on the console >> >> Executing [1@ivr:1] UserEvent("SIP/eu-34001bd0", >> "Menu,uid:1357145308.1,selection:1") in new stack >> >> But in the java code, the event is not received. My class is as follows: >> >> public class AsteriskLive implements ManagerEventListener { >> >> private ManagerConnection managerConnection; >> >> public AsteriskLive() { >> >> } >> >> @Override >> public void onManagerEvent(ManagerEvent event) { >> if(event instanceof MenuEvent){ >> System.out.println(event); >> } >> } >> >> public void run() throws IOException, AuthenticationFailedException, >> TimeoutException, InterruptedException { >> ManagerConnectionFactory factory = new >> ManagerConnectionFactory("1.1.1.2", "a", "p"); >> ManagerConnection managerConnection = factory.createManagerConnection(); >> managerConnection.registerUserEventClass(MenuEvent.class); >> >> OriginateAction originateAction; >> >> originateAction = new OriginateAction(); >> originateAction.setChannel("SIP/eu"); >> originateAction.setContext("ivr"); >> originateAction.setExten("400"); >> originateAction.setPriority(new Integer(1)); >> >> managerConnection.addEventListener(this); >> managerConnection.login(); >> >> managerConnection.sendAction(originateAction, 30000); >> >> Thread.sleep(60); >> >> managerConnection.logoff(); >> } >> >> public static void main(String[] args) throws Exception { >> AsteriskLive helloLiveEvents = new AsteriskLive(); >> helloLiveEvents.run(); >> } >> >> } >> >> And the MenuEvent class >> >> public class MenuEvent extends UserEvent { >> >> public MenuEvent(Object source) { >> super(source); >> } >> >> private static final long serialVersionUID = 1L; >> >> } >> >> >> And the extensions.conf >> exten => 1,2,MP3Player(confirmed.mp3) >> exten => 1,1,UserEvent(Menu,uid:${UNIQUEID},selection:${EXTEN}) >> >> >> >> On Wed, Jan 2, 2013 at 2:27 PM, Mordechay Kaganer <mka...@gm...>wrote: >> >>> B.H. >>> >>> >>> >>> On Wed, Jan 2, 2013 at 5:49 PM, Kelly Goedert <kel...@gm...>wrote: >>> >>>> Hi, >>> >>> >>> Hello >>> >>> >>>> >>>> I need to originate a call from java, this call is made to an extension >>>> which plays menu options to the user, like, press 1 to confirm and 2 to >>>> cancel. >>>> >>>> I originate a call to the extension 400@ivr that looks like this: >>>> >>>> [ivr] >>>> exten => 400,1,MP3Player(sound1.mp3) >>>> exten => 400,2,Background(menu.mp3) >>>> exten => 400,n,WaitExten(5) >>>> >>>> exten => 1,1,MP3Player(confirmed.mp3) >>>> >>>> exten => 2,1,MP3Player(cancel.mp3) >>>> exten => 3,1,MP3Player(later.mp3) >>>> exten => 4,1,Goto(ivr,400,2) >>>> exten => i,1,MP3Player(invalid.mp3) >>>> exten => t,1,Hangup() >>>> >>>> Is it possible to know if the user selected 1,2,3 or 4? If so, how can >>>> I do that? >>>> >>>> Thanks >>>> >>>> Kelly >>>> >>>> >>> AFAIK, Asterisk 1.4 sends NewExtenEvent on every priority in the >>> dialplan but the later versions do not send this event. I would recommend >>> to use cusom UserEvent like this on every extention of the menu: >>> >>> exten => s,n,UserEvent(MENU,uid: ${UNIQUEID},selection: ${EXTEN}) >>> >>> (you need to pass the channel's UNIQUEID because for some reason it is >>> not passed automatically by asterisk for user events) >>> >>> Then you create a class MenuEvent (The class name matters!) which >>> extends org.asteriskjava.manager.event.UserEvent and register it with your >>> AMI connection: >>> >>> connection.registerUserEventClass(MenuEvent.class); >>> >>> Another solution whould be to use FastAGI, if it is applicable in your >>> case >>> >>> >>>> >>>> >>>> ------------------------------------------------------------------------------ >>>> Master Java SE, Java EE, Eclipse, Spring, Hibernate, JavaScript, jQuery >>>> and much more. Keep your Java skills current with LearnJavaNow - >>>> 200+ hours of step-by-step video tutorials by Java experts. >>>> SALE $49.99 this month only -- learn more at: >>>> http://p.sf.net/sfu/learnmore_122612 >>>> _______________________________________________ >>>> Asterisk-java-users mailing list >>>> Ast...@li... >>>> https://lists.sourceforge.net/lists/listinfo/asterisk-java-users >>>> >>>> >>> Best regards, Mordechay >>> >>> -- >>> משיח NOW! >>> Moshiach is coming very soon, prepare yourself! >>> יחי אדוננו מורינו ורבינו מלך המשיח לעולם ועד! >>> >>> >>> ------------------------------------------------------------------------------ >>> Master Java SE, Java EE, Eclipse, Spring, Hibernate, JavaScript, jQuery >>> and much more. Keep your Java skills current with LearnJavaNow - >>> 200+ hours of step-by-step video tutorials by Java experts. >>> SALE $49.99 this month only -- learn more at: >>> http://p.sf.net/sfu/learnmore_122612 >>> _______________________________________________ >>> Asterisk-java-users mailing list >>> Ast...@li... >>> https://lists.sourceforge.net/lists/listinfo/asterisk-java-users >>> >>> >> >> >> ------------------------------------------------------------------------------ >> Master Java SE, Java EE, Eclipse, Spring, Hibernate, JavaScript, jQuery >> and much more. Keep your Java skills current with LearnJavaNow - >> 200+ hours of step-by-step video tutorials by Java experts. >> SALE $49.99 this month only -- learn more at: >> http://p.sf.net/sfu/learnmore_122612 >> _______________________________________________ >> Asterisk-java-users mailing list >> Ast...@li... >> https://lists.sourceforge.net/lists/listinfo/asterisk-java-users >> >> > > > -- > משיח NOW! > Moshiach is coming very soon, prepare yourself! > יחי אדוננו מורינו ורבינו מלך המשיח לעולם ועד! > > > ------------------------------------------------------------------------------ > Master Java SE, Java EE, Eclipse, Spring, Hibernate, JavaScript, jQuery > and much more. Keep your Java skills current with LearnJavaNow - > 200+ hours of step-by-step video tutorials by Java experts. > SALE $49.99 this month only -- learn more at: > http://p.sf.net/sfu/learnmore_122612 > _______________________________________________ > Asterisk-java-users mailing list > Ast...@li... > https://lists.sourceforge.net/lists/listinfo/asterisk-java-users > > |
From: Mordechay K. <mka...@gm...> - 2013-01-03 12:34:32
|
B.H. You probably didn't set 'user' permission for your manager login in /etc/astersk/manager.conf. I have it enabled for read and for write. Of course, you can use AGI as well, it should be simpler. You can even implement the whole IVR in Java this way. In my case i have multiple asterisk hosts and multiple AMI listeners working together so UserEvent is better because it is broadcast to all logged in AMI event listeners. Every listener 'catches' what belong to him using uniqueId. On Thu, Jan 3, 2013 at 12:03 PM, Kelly Goedert <kel...@gm...>wrote: > Hi, > > I did put the properties as described on the docs, but it did not work. > There are no errors in the log of the java code also. Maybe the problem is > because I am using asterisk 1.6? > > > On Wed, Jan 2, 2013 at 4:52 PM, Mordechay Kaganer <mka...@gm...>wrote: > >> B.H. >> >> First, you need to add the custom properties 'uid' and 'selection' to >> MenuEvent class, like explained in UserEvent class's docs. Maybe the event >> reader thread cannot instantiate your class because it doesn't find the >> setters. >> >> Then check the log output of your java code if you can see any errors or >> warnings there. >> >> I'm using this technique with asterisk-java and asterisk 1.8 quite widely >> and it works without problems. >> >> >> >> On Wed, Jan 2, 2013 at 6:52 PM, Kelly Goedert <kel...@gm...>wrote: >> >>> Hi, >>> >>> I implemented the MenuEvent class as you suggested, and I can see this >>> line on the console >>> >>> Executing [1@ivr:1] UserEvent("SIP/eu-34001bd0", >>> "Menu,uid:1357145308.1,selection:1") in new stack >>> >>> But in the java code, the event is not received. My class is as follows: >>> >>> public class AsteriskLive implements ManagerEventListener { >>> >>> private ManagerConnection managerConnection; >>> >>> public AsteriskLive() { >>> >>> } >>> >>> @Override >>> public void onManagerEvent(ManagerEvent event) { >>> if(event instanceof MenuEvent){ >>> System.out.println(event); >>> } >>> } >>> >>> public void run() throws IOException, AuthenticationFailedException, >>> TimeoutException, InterruptedException { >>> ManagerConnectionFactory factory = new >>> ManagerConnectionFactory("1.1.1.2", "a", "p"); >>> ManagerConnection managerConnection = factory.createManagerConnection(); >>> managerConnection.registerUserEventClass(MenuEvent.class); >>> >>> OriginateAction originateAction; >>> >>> originateAction = new OriginateAction(); >>> originateAction.setChannel("SIP/eu"); >>> originateAction.setContext("ivr"); >>> originateAction.setExten("400"); >>> originateAction.setPriority(new Integer(1)); >>> >>> managerConnection.addEventListener(this); >>> managerConnection.login(); >>> >>> managerConnection.sendAction(originateAction, 30000); >>> >>> Thread.sleep(60); >>> >>> managerConnection.logoff(); >>> } >>> >>> public static void main(String[] args) throws Exception { >>> AsteriskLive helloLiveEvents = new AsteriskLive(); >>> helloLiveEvents.run(); >>> } >>> >>> } >>> >>> And the MenuEvent class >>> >>> public class MenuEvent extends UserEvent { >>> >>> public MenuEvent(Object source) { >>> super(source); >>> } >>> >>> private static final long serialVersionUID = 1L; >>> >>> } >>> >>> >>> And the extensions.conf >>> exten => 1,2,MP3Player(confirmed.mp3) >>> exten => 1,1,UserEvent(Menu,uid:${UNIQUEID},selection:${EXTEN}) >>> >>> >>> >>> On Wed, Jan 2, 2013 at 2:27 PM, Mordechay Kaganer <mka...@gm...>wrote: >>> >>>> B.H. >>>> >>>> >>>> >>>> On Wed, Jan 2, 2013 at 5:49 PM, Kelly Goedert <kel...@gm...>wrote: >>>> >>>>> Hi, >>>> >>>> >>>> Hello >>>> >>>> >>>>> >>>>> I need to originate a call from java, this call is made to an >>>>> extension which plays menu options to the user, like, press 1 to confirm >>>>> and 2 to cancel. >>>>> >>>>> I originate a call to the extension 400@ivr that looks like this: >>>>> >>>>> [ivr] >>>>> exten => 400,1,MP3Player(sound1.mp3) >>>>> exten => 400,2,Background(menu.mp3) >>>>> exten => 400,n,WaitExten(5) >>>>> >>>>> exten => 1,1,MP3Player(confirmed.mp3) >>>>> >>>>> exten => 2,1,MP3Player(cancel.mp3) >>>>> exten => 3,1,MP3Player(later.mp3) >>>>> exten => 4,1,Goto(ivr,400,2) >>>>> exten => i,1,MP3Player(invalid.mp3) >>>>> exten => t,1,Hangup() >>>>> >>>>> Is it possible to know if the user selected 1,2,3 or 4? If so, how can >>>>> I do that? >>>>> >>>>> Thanks >>>>> >>>>> Kelly >>>>> >>>>> >>>> AFAIK, Asterisk 1.4 sends NewExtenEvent on every priority in the >>>> dialplan but the later versions do not send this event. I would recommend >>>> to use cusom UserEvent like this on every extention of the menu: >>>> >>>> exten => s,n,UserEvent(MENU,uid: ${UNIQUEID},selection: ${EXTEN}) >>>> >>>> (you need to pass the channel's UNIQUEID because for some reason it is >>>> not passed automatically by asterisk for user events) >>>> >>>> Then you create a class MenuEvent (The class name matters!) which >>>> extends org.asteriskjava.manager.event.UserEvent and register it with your >>>> AMI connection: >>>> >>>> connection.registerUserEventClass(MenuEvent.class); >>>> >>>> Another solution whould be to use FastAGI, if it is applicable in your >>>> case >>>> >>>> >>>>> >>>>> >>>>> ------------------------------------------------------------------------------ >>>>> Master Java SE, Java EE, Eclipse, Spring, Hibernate, JavaScript, jQuery >>>>> and much more. Keep your Java skills current with LearnJavaNow - >>>>> 200+ hours of step-by-step video tutorials by Java experts. >>>>> SALE $49.99 this month only -- learn more at: >>>>> http://p.sf.net/sfu/learnmore_122612 >>>>> _______________________________________________ >>>>> Asterisk-java-users mailing list >>>>> Ast...@li... >>>>> https://lists.sourceforge.net/lists/listinfo/asterisk-java-users >>>>> >>>>> >>>> Best regards, Mordechay >>>> >>>> -- >>>> משיח NOW! >>>> Moshiach is coming very soon, prepare yourself! >>>> יחי אדוננו מורינו ורבינו מלך המשיח לעולם ועד! >>>> >>>> >>>> ------------------------------------------------------------------------------ >>>> Master Java SE, Java EE, Eclipse, Spring, Hibernate, JavaScript, jQuery >>>> and much more. Keep your Java skills current with LearnJavaNow - >>>> 200+ hours of step-by-step video tutorials by Java experts. >>>> SALE $49.99 this month only -- learn more at: >>>> http://p.sf.net/sfu/learnmore_122612 >>>> _______________________________________________ >>>> Asterisk-java-users mailing list >>>> Ast...@li... >>>> https://lists.sourceforge.net/lists/listinfo/asterisk-java-users >>>> >>>> >>> >>> >>> ------------------------------------------------------------------------------ >>> Master Java SE, Java EE, Eclipse, Spring, Hibernate, JavaScript, jQuery >>> and much more. Keep your Java skills current with LearnJavaNow - >>> 200+ hours of step-by-step video tutorials by Java experts. >>> SALE $49.99 this month only -- learn more at: >>> http://p.sf.net/sfu/learnmore_122612 >>> _______________________________________________ >>> Asterisk-java-users mailing list >>> Ast...@li... >>> https://lists.sourceforge.net/lists/listinfo/asterisk-java-users >>> >>> >> >> >> -- >> משיח NOW! >> Moshiach is coming very soon, prepare yourself! >> יחי אדוננו מורינו ורבינו מלך המשיח לעולם ועד! >> >> >> ------------------------------------------------------------------------------ >> Master Java SE, Java EE, Eclipse, Spring, Hibernate, JavaScript, jQuery >> and much more. Keep your Java skills current with LearnJavaNow - >> 200+ hours of step-by-step video tutorials by Java experts. >> SALE $49.99 this month only -- learn more at: >> http://p.sf.net/sfu/learnmore_122612 >> _______________________________________________ >> Asterisk-java-users mailing list >> Ast...@li... >> https://lists.sourceforge.net/lists/listinfo/asterisk-java-users >> >> > > > ------------------------------------------------------------------------------ > Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, > MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current > with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft > MVPs and experts. ON SALE this month only -- learn more at: > http://p.sf.net/sfu/learnmore_122712 > _______________________________________________ > Asterisk-java-users mailing list > Ast...@li... > https://lists.sourceforge.net/lists/listinfo/asterisk-java-users > > -- משיח NOW! Moshiach is coming very soon, prepare yourself! יחי אדוננו מורינו ורבינו מלך המשיח לעולם ועד! |
From: Yves A. <yv...@gm...> - 2013-01-03 10:17:48
|
Hi, I´d recommend to use a java-agi for that purpose. You can pass parameters to your agi and you have full control over the call, directly receive DTMF inputs, can use any database and and and... (i do it this way for large ivr campaigns (no matter if in- or outbound) handling hundreds of calls per hour... no problems... on outbound campaigns the call is also java-initiated) regards, yves Am 02.01.2013 16:49, schrieb Kelly Goedert: > Hi, > > I need to originate a call from java, this call is made to an > extension which plays menu options to the user, like, press 1 to > confirm and 2 to cancel. > > I originate a call to the extension 400@ivr that looks like this: > > [ivr] > exten => 400,1,MP3Player(sound1.mp3) > exten => 400,2,Background(menu.mp3) > exten => 400,n,WaitExten(5) > > exten => 1,1,MP3Player(confirmed.mp3) > > exten => 2,1,MP3Player(cancel.mp3) > exten => 3,1,MP3Player(later.mp3) > exten => 4,1,Goto(ivr,400,2) > exten => i,1,MP3Player(invalid.mp3) > exten => t,1,Hangup() > > Is it possible to know if the user selected 1,2,3 or 4? If so, how can > I do that? > > Thanks > > Kelly > > > > ------------------------------------------------------------------------------ > Master Java SE, Java EE, Eclipse, Spring, Hibernate, JavaScript, jQuery > and much more. Keep your Java skills current with LearnJavaNow - > 200+ hours of step-by-step video tutorials by Java experts. > SALE $49.99 this month only -- learn more at: > http://p.sf.net/sfu/learnmore_122612 > > > _______________________________________________ > Asterisk-java-users mailing list > Ast...@li... > https://lists.sourceforge.net/lists/listinfo/asterisk-java-users |