Re: [Asterisk-java-users] Listen for an incomming call to a sip/extension
Brought to you by:
srt
From: Jorge <gus...@gm...> - 2014-04-11 05:05:23
|
Thank you very much I am goin to test rigth now. There is a bad copy/paste for else if parts. Also your extension could be > the calledChannel so you need to modify the code to match this case too. > > Regards, > Zoumana > Le 10 avr. 2014 23:21, "Zoumana TRAORE" <zou...@gm...> a écrit : > > Hi Jorge, >> >> Not tested but maybe you can do something like >> >> String targetExtension = "SIP/100"; >> Collection<AsteriskChannel> activeChannels = >> asteriskServer.getChannels(); >> boolean targetIsActive = false; >> String otherPartChannel = ""; >> for (AsteriskChannel activeChannel : activeChannels) { >> String callerChannel = activeChannel.getName(); >> if(callerChannel.contains(targetExtension+"-")){ //i suggest >> to add this because Asterisk always set channelName like "SIP/100-000001" >> //if you don't maybe you will match the Channel SIP/1000 >> for example if it exists >> targetIsActive = true; >> } >> String calledChannel = ""; >> >> //regarding the API getDialedChannel, getDialingChannel, >> getLinkedChannel seem to be interesting, but i can't figure out exactly THE >> ONE IS RIGHT FOR YOUR NEED >> if(activeChannel.getDialedChannel() != null){ >> calledChannel = >> activeChannel.getDialedChannel().getName(); >> if(calledChannel.contains(targetExtension+"-")){ >> otherPartChannel = calledChannel; >> } >> }else if(activeChannel.getDialingChannel() != null){ >> calledChannel = >> activeChannel.getDialedChannel().getName(); >> if(calledChannel.contains(targetExtension+"-")){ >> otherPartChannel = calledChannel; >> } >> }else if(activeChannel.getLinkedChannel() != null){ >> calledChannel = >> activeChannel.getDialedChannel().getName(); >> if(calledChannel.contains(targetExtension+"-")){ >> otherPartChannel = calledChannel; >> } >> } >> } >> >> Hope this will help. >> >> Regards, >> Zoumana >> >> >> >> *---* >> >> *Zoumana TRAORE* >> >> mob. (+33)0699783622 >> >> >> 2014-04-10 20:55 GMT+02:00 Jorge <gus...@gm...>: >> >>> 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 > > |