[Asterisk-Users] Presence
John Todd
jtodd at loligo.com
Wed Apr 7 18:29:34 MST 2004
At 8:29 PM -0400 on 4/7/04, Shad Mortazavi wrote:
>I have to agree.
>
>A large number of people are looking for this feature. I have
>written a web script that can show Agent logged into the system.
>
>I think integration/gateway between Asterisk and Jabber would be a
>amazingly wonderful product.
>
>There is always MSN.
>
>Shad Mortazavi
>---------------------------------------------------
>Nexus Technical Manager
>n|m Nexus Management Inc
>Netural Bay
>Sydney
My idea for AIM/Jabber/Yahoo integration is below.
Comments and/or programmers are welcome to have at it, and to expand
on my ideas. I have mentioned this to several programmers who
expressed an interest, but I'm sure that lack of time and funding has
kept them from starting on the project, if it indeed is worthwhile.
This is a kludge to some degree, but it uses _already existing_
presence tools to extend Asterisk's functionality, without needing to
modify any client software or hardware.
********
This is really a one-way presence idea at the moment. There are the
glimmerings of two-way presence (see the "activewhen" keyword) but
this is mostly for CTI outbound notices from an * server to humans
upon some events defined by the administrator. I would see this most
typically used either as a screenpop on an inbound or outbound call,
or perhaps as a voicemail notification tool if the administrator is
clever enough to embed a URL into the string for the instant message
text.
Phase 1: Create a set of programs for Asterisk which allows status
checking of a particular username on a particular instant messaging
system (availability, idle time) and also allows for transmission of
instant messages from Asterisk to other users on those instant
messaging systems (one-way.) The first systems that come to mind
would be AOL's AIM and Yahoo.
Phase 2: Add additional instant message systems: maybe Jabber, MSN.
Allow examination of user's header line (in AOL, at least) and pass
that through the app_imstatus return codes. This would allow me to
specify "mobile:" as the first digits of my status, thus a GotoIf
would be able to know that it should send calls to my cell phone. Or
when I get to work, and shift between my home account ("home: hello,
I'm home") to work ("work: at my desk") then the system will
automatically forward calls appropriately. This might be easy enough
to do in Phase 1, but I'm uncertain.
Future paths:
A true "presence" application for telephony in a large scale method
is lacking today. It may be the case that this could be done by
creating a custom telephony presence presentation application that is
based on an existing (or multiple existing) chat protocols. As an
example, it is possible that I might be able to make my status
message on AIM change from "avail/sip:12156667777 at 128.151.224.17" to
"busy/sip:12156667777 at 128.151.224.17" every time I pick up the phone;
that could be done programmatically by Asterisk. Then, my friends
who have the custom telephony presence application would see the
little icon beside "pinkycaruthers" go from green to flashing orange.
As soon as I went back to non-busy, they could just click on my icon,
and two things would happen: a password-protected message would get
fired off to THEIR phone system and extension from the presence
application on their desktop, which in turn would be received by an
asterisk-aware application on their Asterisk server, which in turn
would create a spool call to MY phone system from the SIP URI that I
included in my Status message. Presto! We have minimalist call
routing, presence, and click-to-dial - we're just missing the little
app to do it on <Windows, MacOS, Linux, Java, whatever>. The core
message transport protocols all exist; it's just a matter of layers
on top of them. Using standard telephony URI's, we could not just do
this with SIP, but with tel, h323, iax2, anything - it's not limited
to VoIP.
; im.conf
;
; Use of this file implies that you have an active account with one or more
; instant messaging services, and that you probably use an account that is
; dedicated to your Asterisk server so it "knows" what's going on. You may
; need to ensure that any other user id's that you expect to receive messages
; are filtered in such a way that the messages from your Asterisk-specific
; account are permitted through.
;
; username= username of the user on this particular messaging system.
; secret= password for the username
; type= type of connection this is. Each messaging system uses
it's own protocols,
; so we need to specify which one of the protocols we're
using for this particular
; "channel". Current choices are:
; aim - the AOL OSCAR protocol
; yahoo - the Yahoo protocol
; statusmessage= Sets the status message for the user on the chat
server. Visible to other users.
; activewhen= perform a login only when this channel type is valid or
logged in. This is
; reduce unnecessary heartbeat traffic for phones that
aren't logged in.
; An example of this setting would be "IAX2/12345" or
"SIP/jimmy" where those
; channel peers would be sending REGISTER messages to the server.
; Use of keyword "always" means logged in all the time. Optional.
; subscribe= users whose presence should be monitored by this peer
; port= port for protocol (defaults taken from type=)
; host= host for protocol (defaults taken from type=)
;
;
[aim-1]
username=pinkys-asterisk
secret=foofoofoo
type=aim
statusmessage="Pinky Caruthers Phone Presense Robot - no inbound, please."
subscribe=buckaroo,janedoe,turtlehead,misspiggy2001
;
; end im.conf sample
-= Info about application 'IMStatus' =-
[Synopsis]:
Get the status of a remote user's instant messaging presence
[Description]:
IMStatus(template/remoteuser,[options])
Returns several strings as result codes if successful. If an error
occurs during
transmission, the system will jump to priority n+101.
${IM-STATUS}: "online", "offline", "unknown", "idle"
${IM-IDLETIME}: number of seconds of idle time
${IM-STATUS}: if applicable, the text string of the remote user's
status bar
${IM-LASTSEEN}: how many minutes ago was this user online, at
least as far as
this running instance of Asterisk has knowledge. 0=online or never
Note that the remoteuser must be in the "subscribe" list of the IM
peer in order for
the system to return correct values. If the IM peer username is listed as the
remoteuser, the status of the IM peer will be returned in
${IM-STATUS} as either
"online" or "offline" depending on the current registered state.
The option string may contain zero or more of the following:
'g' -- goes on in context if an error occurs
'W(x)' -- Wait x milliseconds before returning regardless of
result (avoids hangs)
-= Info about application 'IMSend' =-
[Synopsis]:
Transmit an Instant Message
[Description]:
IMSend(template/remoteuser/string)
Sends a string to a remote user, using the username in the peer
definition as the sender.
Receiver can be any user on the IM network chosen. Errors are
currently handled silently.
String can be up to XXX characters long.
command-line options:
im show peers = shows a list of IM peers, and statuses of
subscription to those peers
im show subscribed [peername][|subscriber] = shows a list of users
whose status the system is monitoring, or optionally just one out of
the list for that IM peer. Also shows last time (minutes ago) the
user was seen online (0 if online or never)
im debug = debugs instant messaging items
im debug intense = more debug
foo*CLI> im show peers
Name Type Host Port User Status
aim1 AIM 64.12.24.32 5190 pinkys-asteri Registered
foo*CLI> im show subscribed aim1
Name Status Idle Lastseen
buckaroo online 140 0
janedoe online 3 0
turtlehead offline 0 0
misspiggy20 offline 0 500
typical trivial usage:
; Send calls to Buckaroo appropriately based on his
; AIM presence, and send a message before the call
; if he's on-line
;
exten => 1233,1,AGI(get-customer-data-from-callerid.agi)
exten => 1233,2,SetVar(CALLMESSAGE="${CUSTOMER-NAME} is calling from
${CUSTOMER-COMPANY}. They do ${BILLABLE-VOLUME} in sales with us -
pick up the phone!")
exten => 1233,3,IMStatus(aim1/buckaroo)
exten => 1233,4,GotoIf($[${IM-STATUS} = offline]?5:10)
exten => 1233,5,Dial(Zap/1/${BUCKAROO-CELL})
exten => 1234,6,Hangup
exten => 1234,10,GotoIf($[${IM-STATUS} = online]?11:20)
exten => 1234,11,IMSend(aim1/buckaroo/${CALLMESSAGE})
exten => 1234,12,Dial(SIP/${BUCKAROO-MAIN},20)
exten => 1234,13,Voicemail(u${BUCKAROO-MAIN})
exten => 1234,14,Hangup
exten => 1234,20,Voicemail(${BUCAROO-MAIN})
exten => 1234,21,Hangup
More information about the asterisk-users
mailing list