System information

for 30 seconds, and then (if there is no answer or the device is busy or unavailable) play
back a prompt that says the user is currently unavailable, followed by a hangup.
We’ve just shown you how to place and receive calls via Skype. The following sections
will show you how to send and receive messages via the Skype network, and how to
place calls to your Skype buddies without assigning extension numbers to them.
Sending and receiving messages via Skype
Sending and receiving messages via Skype is similar to doing this via XMPP (Jabber),
which we described in “Sending messages with JabberSend()” on page 421 and “Re-
ceiving messages with JABBER_RECEIVE()” on page 422, so we won’t go into quite
the detail in these sections as we did there. Please review the sections about XMPP
messaging before continuing, as we’ll be using the same basic dialplans to accomplish
sending and receiving of messages via Skype, while making adjustments to use the
appropriate dialplan applications and functions.
The primary thing to remember is that messages are sent with the dialplan application
SkypeChatSend() and received with the dialplan function SKYPE_CHAT_RECEIVE(). Addi-
tionally, messages can only be received when the SKYPE_CHAT_RECEIVE() function has
been called from the dialplan, and it blocks (does not continue in the dialplan) while
waiting for a message.
Sending a message from the dialplan to a Skype buddy is relatively straightforward.
Here is a simple dialplan we can use to send a message from Asterisk to someone on
the Skype network:
[LocalSets]
exten => 104,1,Answer()
; *** This line should not have any line breaks
same => n,SkypeChatSend(pbx.shifteight.org,tfot.madsen,Incoming call from
${CALLERID(all)})
same => n,Dial(SIP/0000FFFF0002,30)
same => n,Hangup()
Our dialplan is simple. We created a test extension of 104 that answers the line, then
sends a message to Skype user tfot.madsen from the pbx.shifteight.org account
(which we configured in the chan_skype.conf file). The message sent is “Incoming call
from ${CALLERID(all)}”, where the caller ID is provided by the CALLERID() func-
tion. After sending our message, we then dial the device located at 0000FFFF0002 and
hang up if no one answers within 30 seconds.
That’s it for sending messages via Skype. Now let’s look at some of the ways we can
receive messages from Skype. Here is the simple example we explored in “Receiving
messages with JABBER_RECEIVE()” on page 422), with a few changes made to reflect
the technology. This time, we’ll be replacing JabberSend() and JABBER_RECEIVE() with
432 | Chapter 18:External Services