Re: [Asterisk-java-users] Listen for an incomming call to a sip/extension
Brought to you by:
srt
From: Jorge <gus...@gm...> - 2014-04-16 17:22:03
|
Thank you for your help, but I still didn't it work. When I get the caller Id it is empty. My structure is the next one : I have n sip extensions inside a queue. When an incomming call gets inside it goes directly to the queue waitng for an available sip extension. What I am doing is attaching a listener to each new channel created. When I get evt.getPropertyName().equals("dialingExtension") I obtain the source and the dialing extension. As it comes from the pstn it creates an channel called dadhi/incomingTlfNumber@context this channel goes inside the queue and converts into something like Local/2501@queue.... . The main problem is that this channel Local/2501@queue... is automatically created with caller id empty when I detect the changing property (tested with asterisk-java) In conclusion I am able to get the channel FROM THE QUEUE that is calling the Sip extension but it has the caller id EMPTY. I am wirting my hearth so I could have wirtten some wrong labels. Jorge ---------------------------------------------------------------------------------------------------------------------------------------------- <https://twitter.com/#%21/correderajorge> <http://www.correderajorge.es/> En función de la *Ley Orgánica 15/1999*, este mensaje de correo electrónico y sus documentos adjuntos están dirigidos *exclusivamente* a los destinatarios especificados y su información es de uso *estrictamente privado* salvo que se especifique lo contrario. La información contenida puede ser *confidencial* y/o estar *legalmente protegida*. Si usted recibe este mensaje por *error*, por favor comuníqueselo inmediatamente al remitente y *elimínelo* ya que carece de autorización de todo tipo. *Se prohíbe expresamente* la revelación, distribución, impresión o copia de toda o alguna parte de la información contenida en este mensaje 2014-04-14 17:45 GMT+02:00 Wayne Merricks <way...@th...>: > fyi messed up my else ifs they should be else if to the > evt.getPropertyName() block not the ChannelState bit. > > Wayne Merricks > The Voice Asia > > On 14/04/14 16:17, Wayne Merricks wrote: > > Hi, > > Normally you would loop through the channels until you find the extension > you're looking at with channel.getCallerId().getNumber() > > Then you can see if it is linked with another channel by > channel.getLinkedChannel() and get the caller id from that in the same way. > > If you're doing this in "real time", the way I do it is to register an > AsteriskServerListener and then for every new channel add a > PropertyChangeListener > > You then need to figure out what type of events you want to listen to and > which ones to ignore (hint you get a lot of events). > > To help you narrow it down most likely all you need are the following: > > public void propertyChange(PropertyChangeEvent evt){ > > if(evt.getPropertyName().equals("state") && evt.getSource() instanceof AsteriskChannel){ > > if(evt.getNewValue() instanceof ChannelState){ > > ChannelState state = (ChannelState)evt.getNewValue(); > //Then look at state.getStatus() for things like RING or RINGING or HUNGUP or BUSY > //You can get the channel in question by doing evt.getSource() > > }else if(evt.getPropertyName().equals("currentExtension") && evt.getOldValue() == null){ > > //The evt.getNewValue() here will have an Extension object which you can use to see what this channel is ringing > //Note you get a lot of dialplan messages here that you can skip, they're usually with a context of macro-auto-blkvm > //but this varies depending on what Asterisk system you use > > }else if(evt.getPropertyName().equals("linkedChannel") && evt.getSource() instanceof AsteriskChannel){ > > //You get these when two channels connect to each other e.g. when someone picks up a call > //You will get at least two of these for both sides of the call > > } > > } > > } > > > Hope this gets you started, > > Wayne Merricks > The Voice Asia > > On 14/04/14 14:15, Jorge wrote: > > How can I get from this event the phone that is callling this extension? > > I am looking in to asteriskServer.getChannels(); but the channel is not > created when the status changed. > > Jorge > > > ---------------------------------------------------------------------------------------------------------------------------------------------- > > > <https://twitter.com/#%21/correderajorge> > <http://www.correderajorge.es/> > > En función de la *Ley Orgánica 15/1999*, este mensaje de correo > electrónico y sus documentos adjuntos están dirigidos *exclusivamente* a > los destinatarios especificados y su información es de uso *estrictamente > privado* salvo que se especifique lo contrario. La información contenida > puede ser *confidencial* y/o estar *legalmente protegida*. Si usted > recibe este mensaje por *error*, por favor comuníqueselo inmediatamente > al remitente y *elimínelo* ya que carece de autorización de todo tipo. *Se > prohíbe expresamente* la revelación, distribución, impresión o copia de > toda o alguna parte de la información contenida en este mensaje > > > > 2014-04-13 11:03 GMT+02:00 Miguel Santiago <m.s...@gm...>: > >> I think you can Use ExtensionStatusEvent in order to know what you need >> El 10/04/2014 20:57, "Jorge" <gus...@gm...> escribió: >> >>> Hi: >>> >>> I would like to know if it is possible to implement a listener or check >>> if a sip extension is busy with a call. And in case it is answering a call >>> how to know which number is calling. >>> >>> Kind Regards >>> >>> Jorge >>> >>> >>> >>> ------------------------------------------------------------------------------ >>> Put Bad Developers to Shame >>> Dominate Development with Jenkins Continuous Integration >>> Continuously Automate Build, Test & Deployment >>> Start a new project now. Try Jenkins in the cloud. >>> http://p.sf.net/sfu/13600_Cloudbees >>> _______________________________________________ >>> Asterisk-java-users mailing list >>> Ast...@li... >>> https://lists.sourceforge.net/lists/listinfo/asterisk-java-users >>> >>> >> >> ------------------------------------------------------------------------------ >> Put Bad Developers to Shame >> Dominate Development with Jenkins Continuous Integration >> Continuously Automate Build, Test & Deployment >> Start a new project now. Try Jenkins in the cloud. >> http://p.sf.net/sfu/13600_Cloudbees >> _______________________________________________ >> Asterisk-java-users mailing list >> Ast...@li... >> https://lists.sourceforge.net/lists/listinfo/asterisk-java-users >> >> > > > ------------------------------------------------------------------------------ > Learn Graph Databases - Download FREE O'Reilly Book > "Graph Databases" is the definitive new guide to graph databases and their > applications. Written by three acclaimed leaders in the field, > this first edition is now available. Download your free book today!http://p.sf.net/sfu/NeoTech > > > > _______________________________________________ > Asterisk-java-users mailing lis...@li...https://lists.sourceforge.net/lists/listinfo/asterisk-java-users > > > > > ------------------------------------------------------------------------------ > Learn Graph Databases - Download FREE O'Reilly Book > "Graph Databases" is the definitive new guide to graph databases and their > applications. Written by three acclaimed leaders in the field, > this first edition is now available. Download your free book today!http://p.sf.net/sfu/NeoTech > > > > _______________________________________________ > Asterisk-java-users mailing lis...@li...https://lists.sourceforge.net/lists/listinfo/asterisk-java-users > > > > > ------------------------------------------------------------------------------ > Learn Graph Databases - Download FREE O'Reilly Book > "Graph Databases" is the definitive new guide to graph databases and their > applications. Written by three acclaimed leaders in the field, > this first edition is now available. Download your free book today! > http://p.sf.net/sfu/NeoTech > _______________________________________________ > Asterisk-java-users mailing list > Ast...@li... > https://lists.sourceforge.net/lists/listinfo/asterisk-java-users > > |