[asterisk-users] How to check a number online or offline

Jim Dickenson dickenson at cfmc.com
Mon Jan 10 21:09:20 CST 2011


If you do an AMI packet like this:

Action: Originate
Channel: Local/get_info at some_context
Exten: do_noop
Context: some_context
Priority: 1
ActionID: GetInfo
Async: true

and then have a couple extensions that do what you want. Here is what I do in my case:

exten => get_info,1,Answer()
exten => get_info,n,UserEvent(GetInfo,Version:ABE & DateTime:${STRFTIME(${EPOCH},,%Y%m%d%H%M%S)} & CfMC:83351)
exten => get_info,n,Hangup()

exten => do_noop,1,Answer()
exten => do_noop,n,Wait(1)
exten => do_noop,n,Hangup()

You would then do what you need to do in your extensions.



-- 
Jim Dickenson
mailto:dickenson at cfmc.com

CfMC
http://www.cfmc.com/



On Jan 10, 2011, at 6:16 PM, Phuong Hoang wrote:

> Thanks Jim,
> 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.
> Best regards,
> Phuong.
> 
> On Mon, Jan 10, 2011 at 8:50 AM, Jim Dickenson <dickenson at cfmc.com> wrote:
> 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.
> -- 
> Jim Dickenson
> mailto:dickenson at cfmc.com
> 
> CfMC
> http://www.cfmc.com/
> 
> 
> 
> On Jan 10, 2011, at 7:48 AM, Phuong Hoang wrote:
> 
>> Thanks Dhaval,
>> 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.
>> Regards!
>> Phuong
>> 
>> On Mon, Jan 10, 2011 at 3:13 AM, DHAVAL INDRODIYA <dhaval.it01034 at gmail.com> wrote:
>> 
>> Hello ,
>> 
>> You can use Dialplan function DEVICE_STATE, which will gives you perfect status of DEVICE.
>> 
>> regards
>> Dhaval
>> 
>> 
>> On Mon, Jan 10, 2011 at 4:11 PM, Steve Howes <steve-lists at geekinter.net> wrote:
>> 
>> On 10 Jan 2011, at 10:37, Phuong Hoang wrote:
>> 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?
>> 
>> 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..
>> 
>> S
>> --
>> _____________________________________________________________________
>> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>> New to Asterisk? Join us for a live introductory webinar every Thurs:
>>               http://www.asterisk.org/hello
>> 
>> asterisk-users mailing list
>> To UNSUBSCRIBE or update options visit:
>>   http://lists.digium.com/mailman/listinfo/asterisk-users
>> 
>> 
>> --
>> _____________________________________________________________________
>> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>> New to Asterisk? Join us for a live introductory webinar every Thurs:
>>               http://www.asterisk.org/hello
>> 
>> asterisk-users mailing list
>> To UNSUBSCRIBE or update options visit:
>>   http://lists.digium.com/mailman/listinfo/asterisk-users
>> 
>> --
>> _____________________________________________________________________
>> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>> New to Asterisk? Join us for a live introductory webinar every Thurs:
>>               http://www.asterisk.org/hello
>> 
>> asterisk-users mailing list
>> To UNSUBSCRIBE or update options visit:
>>   http://lists.digium.com/mailman/listinfo/asterisk-users
> 
> 
> --
> _____________________________________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
> New to Asterisk? Join us for a live introductory webinar every Thurs:
>               http://www.asterisk.org/hello
> 
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>   http://lists.digium.com/mailman/listinfo/asterisk-users
> 
> --
> _____________________________________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
> New to Asterisk? Join us for a live introductory webinar every Thurs:
>               http://www.asterisk.org/hello
> 
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>   http://lists.digium.com/mailman/listinfo/asterisk-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20110110/9a459a64/attachment.htm>


More information about the asterisk-users mailing list