[Asterisk-java-users] Transfer call to another extension
Brought to you by:
srt
From: Jorge <gus...@gm...> - 2015-01-15 20:46:25
|
Hi, I am would like to use Asterisk-Java to transfer a call that is in a queue. The context is the next one. One call go to a queue so I detect the call with onNewQueueEntry and check if it goes to my queue. If it goes after doing several things I want to transfers it back to a extension. The main idea is detecting a call, doing things that can´t be done through the dialplan and give it back to the dialplan. As entry.getChannel has the channel that is in the queue I wanted to use this channel to transfer to the desired extension. I have done several attemps but nothing worked. public void onNewQueueEntry(final AsteriskQueueEntry entry) { // Si está en la cola que estamos monitorizando, procesa if(entry.getQueue().getName().equals(queueName)){ Dialplan [myCall] exten => s,1,NoOp(myCall) exten => s,n,Playback(es/digits/1) exten => s,n,Return() 1) Java-code AtxferAction action = new AtxferAction(entry.getChannel().getName(), "myCall", "s", 1); ManagerResponse response = Asterisk.getManagerConnection().sendAction(action); The answer is ok but nothing happens. org.asteriskjava.manager.response.ManagerResponse: actionId='null'; message='Atxfer successfully queued'; response='Success'; uniqueId='null'; systemHashcode=1928471006 2) OriginateAction dial = new OriginateAction(); // // Sets the name of the channel to connect to the outgoing call. dial.setChannel(entry.getChannel().getName()); // Sets the name of the context of the extension to connect to. dial.setContext("myCall"); // Sets the extension to connect to dial.setExten("s"); dial.setPriority(1); ManagerResponse response = Asterisk.getManagerConnection().sendAction(dial); It gives me org.asteriskjava.live.NoSuchChannelException:Channel is not available 3) Asterisk.getAsteriskServer().originateToApplication(entry.getChannel().getName()", "myCall", "", 1000); It gives me org.asteriskjava.live.NoSuchChannelException:Channel is not available Could you let my know what I am doing wrong? Kind regards. |