[Asterisk-Users] Able to tell if phone is registered?

2005-02-23 Thread Tim Pushor
Hi All,
I have a new asterisk setup running at home and am very happy with it. 
One thing that I am trying to do is to take various actions in the 
dialplan *if* a particular phone is registered/authenticated/connected. 
For example, if someone dials *me* and is shows that I am connected via 
my softphone, to try it instead of my deskphone (and possibly notifiy 
the user in advance that it is taking that action).

I didn't see any way to do this using the standard applications - would 
someone be able to point me in the right direction?

Thanks!
Tim
___
Asterisk-Users mailing list
Asterisk-Users@lists.digium.com
http://lists.digium.com/mailman/listinfo/asterisk-users
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [Asterisk-Users] Able to tell if phone is registered?

2005-02-23 Thread Kevin P. Fleming
Tim Pushor wrote:
I have a new asterisk setup running at home and am very happy with it. 
One thing that I am trying to do is to take various actions in the 
dialplan *if* a particular phone is registered/authenticated/connected. 
For example, if someone dials *me* and is shows that I am connected via 
my softphone, to try it instead of my deskphone (and possibly notifiy 
the user in advance that it is taking that action).
Just go ahead and try to send the call there... it will fail immediately 
if it is not registered, with a DIALSTATUS of CHANUNAVAIL.

If you are using CVS HEAD, you can use regexten to accomplish 
something similar, but I wouldn't recommend it as it's about to change :-)
___
Asterisk-Users mailing list
Asterisk-Users@lists.digium.com
http://lists.digium.com/mailman/listinfo/asterisk-users
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [Asterisk-Users] Able to tell if phone is registered?

2005-02-23 Thread Tim Pushor
Kevin,
Thanks for the reply, and thats what I am doing now, but I would really 
like to know in advance if a particular phone has been registered before 
taking a certain action.

I was wondering if I could do something with regexten, but seemed like a 
messy solution. Is there any other way? I don't mind getting my hands 
dirty with perl or C, but I wouldn't really know where to start ...

Thanks,
Tim
Kevin P. Fleming wrote:
Tim Pushor wrote:
I have a new asterisk setup running at home and am very happy with 
it. One thing that I am trying to do is to take various actions in 
the dialplan *if* a particular phone is 
registered/authenticated/connected. For example, if someone dials 
*me* and is shows that I am connected via my softphone, to try it 
instead of my deskphone (and possibly notifiy the user in advance 
that it is taking that action).

Just go ahead and try to send the call there... it will fail 
immediately if it is not registered, with a DIALSTATUS of CHANUNAVAIL.

If you are using CVS HEAD, you can use regexten to accomplish 
something similar, but I wouldn't recommend it as it's about to change 
:-)
___
Asterisk-Users mailing list
Asterisk-Users@lists.digium.com
http://lists.digium.com/mailman/listinfo/asterisk-users
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users
___
Asterisk-Users mailing list
Asterisk-Users@lists.digium.com
http://lists.digium.com/mailman/listinfo/asterisk-users
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users


RE: [Asterisk-Users] Able to tell if phone is registered?

2005-02-23 Thread Nathan C. Smith
Hi All,

I have a new asterisk setup running at home and am very happy with it. 
One thing that I am trying to do is to take various actions in the 
dialplan *if* a particular phone is registered/authenticated/connected. 
For example, if someone dials *me* and is shows that I am connected via 
my softphone, to try it instead of my deskphone (and possibly notifiy 
the user in advance that it is taking that action).

There are a couple ways, but within the dialplan you can use chanavail().
On the console you can type show application appname to get more
information about applications such as chanavail and dial.  

On the failure of a dial command the priority jumps 101, so for instance if
you softphone was dialed at priority 3 and it failed the execution would
jump to priority 104 where you could attempt to dial your deskphone.

Finally, you can use the asterisk database.  By dialing an extension to set
a database value and checking for a value in the dialplan you can use logic
to decide whether to dial an extension or not.

Most of this is documented reasonably well on www.voip-info.org once you
know what you are looking for.

-Nate
___
Asterisk-Users mailing list
Asterisk-Users@lists.digium.com
http://lists.digium.com/mailman/listinfo/asterisk-users
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [Asterisk-Users] Able to tell if phone is registered?

2005-02-23 Thread Tim Pushor
I tried using chanavail and it didn't seem to work as I expected. I 
don't really want the user to have to do anything, other than register 
their phone, for the system to know that it should take a different action.

Thanks,
Tim
Nathan C. Smith wrote:
Hi All,
I have a new asterisk setup running at home and am very happy with it. 
One thing that I am trying to do is to take various actions in the 
dialplan *if* a particular phone is registered/authenticated/connected. 
For example, if someone dials *me* and is shows that I am connected via 
my softphone, to try it instead of my deskphone (and possibly notifiy 
the user in advance that it is taking that action).

There are a couple ways, but within the dialplan you can use chanavail().
On the console you can type show application appname to get more
information about applications such as chanavail and dial.  

On the failure of a dial command the priority jumps 101, so for instance if
you softphone was dialed at priority 3 and it failed the execution would
jump to priority 104 where you could attempt to dial your deskphone.
Finally, you can use the asterisk database.  By dialing an extension to set
a database value and checking for a value in the dialplan you can use logic
to decide whether to dial an extension or not.
Most of this is documented reasonably well on www.voip-info.org once you
know what you are looking for.
-Nate
___
Asterisk-Users mailing list
Asterisk-Users@lists.digium.com
http://lists.digium.com/mailman/listinfo/asterisk-users
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users
 

___
Asterisk-Users mailing list
Asterisk-Users@lists.digium.com
http://lists.digium.com/mailman/listinfo/asterisk-users
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [Asterisk-Users] Able to tell if phone is registered?

2005-02-23 Thread Kevin P. Fleming
Tim Pushor wrote:
I was wondering if I could do something with regexten, but seemed like a 
messy solution. Is there any other way? I don't mind getting my hands 
dirty with perl or C, but I wouldn't really know where to start ...
No, there is no cleaner way, because it's too channel specific and it 
might change after you ask for the status anyway... regexten is really 
what you want.

I do have a pending patch in bug 3626 that would help; it deactivates an 
entire context if a peer is unregistered, or is registered and stops 
communicating... if you put the peers you care about each into their own 
contexts that would suffice. That patch will be expanded to include 
replacement regexten functionality as well.

What value do you see in knowing whether the peer is registered or not 
before trying to dial it?
___
Asterisk-Users mailing list
Asterisk-Users@lists.digium.com
http://lists.digium.com/mailman/listinfo/asterisk-users
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [Asterisk-Users] Able to tell if phone is registered?

2005-02-23 Thread Kevin P. Fleming
Tim Pushor wrote:
I tried using chanavail and it didn't seem to work as I expected. I 
don't really want the user to have to do anything, other than register 
their phone, for the system to know that it should take a different action.
The channel available function will not tell you whether they are 
registered, only whether the channel string is valid-looking or not.
___
Asterisk-Users mailing list
Asterisk-Users@lists.digium.com
http://lists.digium.com/mailman/listinfo/asterisk-users
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [Asterisk-Users] Able to tell if phone is registered?

2005-02-23 Thread Richard J. Sears
One method that I use is to dial all of my extensions at once (Office,
home, laptop) and then dial my cellphone. Failing any of those to answer,
it drops back into my voicemail.

exten = 
${RJSWORK},1,Macro(stdexten_cell,SIP/${RJSWORK}SIP/${RJSDESK}SIP/${RJSLAPTOP}SIP/${RJSHOME},${RJSCELL})

[macro-stdexten_cell]
exten = s,1,Dial(${ARG1},10,rtm)
exten = s,2,Goto(s-${DIALSTATUS},1)
exten = s-NOANSWER,1,Dial(IAX2/[EMAIL PROTECTED]/${ARG2},10,rtm)
exten = s-NOANSWER,2,Voicemail(u${MACRO_EXTEN})
;exten = s-NOANSWER,3,Goto(default,s,1)
exten = s-BUSY,1,Voicemail(b${MACRO_EXTEN})
;exten = s-BUSY,2,Goto(default,s,1)
exten = s-.,1,Goto(s-NOANSWER,1)
exten = a,1,VoicemailMain(${MACRO_EXTEN})


On Wed, 23 Feb 2005 12:07:03 -0600
Nathan C. Smith [EMAIL PROTECTED] wrote:

 Hi All,
 
 I have a new asterisk setup running at home and am very happy with it. 
 One thing that I am trying to do is to take various actions in the 
 dialplan *if* a particular phone is registered/authenticated/connected. 
 For example, if someone dials *me* and is shows that I am connected via 
 my softphone, to try it instead of my deskphone (and possibly notifiy 
 the user in advance that it is taking that action).
 
 There are a couple ways, but within the dialplan you can use chanavail().
 On the console you can type show application appname to get more
 information about applications such as chanavail and dial.  
 
 On the failure of a dial command the priority jumps 101, so for instance if
 you softphone was dialed at priority 3 and it failed the execution would
 jump to priority 104 where you could attempt to dial your deskphone.
 
 Finally, you can use the asterisk database.  By dialing an extension to set
 a database value and checking for a value in the dialplan you can use logic
 to decide whether to dial an extension or not.
 
 Most of this is documented reasonably well on www.voip-info.org once you
 know what you are looking for.
 
 -Nate
 ___
 Asterisk-Users mailing list
 Asterisk-Users@lists.digium.com
 http://lists.digium.com/mailman/listinfo/asterisk-users
 To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users


**
Richard J. Sears
Vice President 
American Internet Services  

[EMAIL PROTECTED]
http://www.adnc.com

858.576.4272 - Phone
858.427.2401 - Fax
INOC-DBA - 6130


I fly because it releases my mind 
from the tyranny of petty things . . 


Work like you don't need the money, love like you've
never been hurt and dance like you do when nobody's
watching.

___
Asterisk-Users mailing list
Asterisk-Users@lists.digium.com
http://lists.digium.com/mailman/listinfo/asterisk-users
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


RE: [Asterisk-Users] Able to tell if phone is registered?

2005-02-23 Thread Bill Seddon
 I was wondering if I could do something with regexten, but seemed
like a 
messy solution. Is there any other way? I don't mind getting my hands 
dirty with perl or C, but I wouldn't really know where to start ...

A suggestion is to take a look at the commands available at the CLI and
determine if the information they provide would meet your requirement.
In particular look at the command database show.  This will/should
show the phone registered and you can query the contents of the database
from the dialplan using DBGet().

If this does not meet your needs you could try some of the other command
to see if they do provide the information you are looking for.  For
example, the CLI command sip show peers.

Information such as that from the sip show peers command is not
available (so far as I'm aware) from the dialplan.  However, if one or
more CLI commands do provide the information you are looking for and you
are prepared to write a little code, you can use the Manager API to call
these commands and write the status into the registry database or into
variables.

It would be inefficient to have to run a manager command periodically.
Fortunately, Asterisk provides some event information to processes
listening on the Manager API port. The events broadcast include
register/unregister actions.  By monitoring the events your code can
respond to the events of interest and, for example, update status
variables dynamically.  For more information about the Manager API see:

http://www.voip-info.org/tiki-index.php?page=Asterisk%20manager%20API

Bill Seddon

Lyquidity Solutions Limited


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Tim Pushor
Sent: February 23, 2005 5:56 PM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [Asterisk-Users] Able to tell if phone is registered?

Kevin,

Thanks for the reply, and thats what I am doing now, but I would really 
like to know in advance if a particular phone has been registered before

taking a certain action.

I was wondering if I could do something with regexten, but seemed like a

messy solution. Is there any other way? I don't mind getting my hands 
dirty with perl or C, but I wouldn't really know where to start ...

Thanks,
Tim

Kevin P. Fleming wrote:

 Tim Pushor wrote:

 I have a new asterisk setup running at home and am very happy with 
 it. One thing that I am trying to do is to take various actions in 
 the dialplan *if* a particular phone is 
 registered/authenticated/connected. For example, if someone dials 
 *me* and is shows that I am connected via my softphone, to try it 
 instead of my deskphone (and possibly notifiy the user in advance 
 that it is taking that action).


 Just go ahead and try to send the call there... it will fail 
 immediately if it is not registered, with a DIALSTATUS of CHANUNAVAIL.

 If you are using CVS HEAD, you can use regexten to accomplish 
 something similar, but I wouldn't recommend it as it's about to change

 :-)
 ___
 Asterisk-Users mailing list
 Asterisk-Users@lists.digium.com
 http://lists.digium.com/mailman/listinfo/asterisk-users
 To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

___
Asterisk-Users mailing list
Asterisk-Users@lists.digium.com
http://lists.digium.com/mailman/listinfo/asterisk-users
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


___
Asterisk-Users mailing list
Asterisk-Users@lists.digium.com
http://lists.digium.com/mailman/listinfo/asterisk-users
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [Asterisk-Users] Able to tell if phone is registered?

2005-02-23 Thread Tim Pushor

No, there is no cleaner way, because it's too channel specific and it 
might change after you ask for the status anyway... regexten is really 
what you want.

I do have a pending patch in bug 3626 that would help; it deactivates 
an entire context if a peer is unregistered, or is registered and 
stops communicating... if you put the peers you care about each into 
their own contexts that would suffice. That patch will be expanded to 
include replacement regexten functionality as well.

What value do you see in knowing whether the peer is registered or not 
before trying to dial it?

It may sound dumb, but I would like the sytem to announce that it is 
attempting to dial my softphone before it does, as there can be a 
noticable quality/reliability drop (when sending the call out to me via 
SIP/VPN at a client site), that is acceptable as I am able to take calls 
remotely, but I would like to let the person at the other end know first ..

Thanks,
Tim
___
Asterisk-Users mailing list
Asterisk-Users@lists.digium.com
http://lists.digium.com/mailman/listinfo/asterisk-users
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users


RE: [Asterisk-Users] Able to tell if phone is registered?

2005-02-23 Thread Race Vanderdecken
Look at ast_exists_extension in pbx.c

I have tinkered a bit around them, but not directly coded to it. In the
app_voicemail.c code I think it is used to make sure the extension is
valid. There might be code in there to see if the registration is
active.

Look further I see that chan_sip.c has a sip_show_registry() function
that dumps out the registration state of things.

But the coup de gras maybe the ast_device_state_changed()

When the SIP stack expires a registered phone it calls expire_register()
which calls ast_device_state_changed() to notifiy someone of the state
change.

Race The Tyrant Vanderdecken


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Tim Pushor
Sent: Wednesday, February 23, 2005 12:56 PM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [Asterisk-Users] Able to tell if phone is registered?

Kevin,

Thanks for the reply, and thats what I am doing now, but I would really 
like to know in advance if a particular phone has been registered before

taking a certain action.

I was wondering if I could do something with regexten, but seemed like a

messy solution. Is there any other way? I don't mind getting my hands 
dirty with perl or C, but I wouldn't really know where to start ...

Thanks,
Tim

Kevin P. Fleming wrote:

 Tim Pushor wrote:

 I have a new asterisk setup running at home and am very happy with 
 it. One thing that I am trying to do is to take various actions in 
 the dialplan *if* a particular phone is 
 registered/authenticated/connected. For example, if someone dials 
 *me* and is shows that I am connected via my softphone, to try it 
 instead of my deskphone (and possibly notifiy the user in advance 
 that it is taking that action).


 Just go ahead and try to send the call there... it will fail 
 immediately if it is not registered, with a DIALSTATUS of CHANUNAVAIL.

 If you are using CVS HEAD, you can use regexten to accomplish 
 something similar, but I wouldn't recommend it as it's about to change

 :-)
 ___
 Asterisk-Users mailing list
 Asterisk-Users@lists.digium.com
 http://lists.digium.com/mailman/listinfo/asterisk-users
 To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

___
Asterisk-Users mailing list
Asterisk-Users@lists.digium.com
http://lists.digium.com/mailman/listinfo/asterisk-users
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


___
Asterisk-Users mailing list
Asterisk-Users@lists.digium.com
http://lists.digium.com/mailman/listinfo/asterisk-users
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users